Update to version 2.3.1
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
This commit is contained in:
parent
8592cfe384
commit
ae33d71c17
@ -1,163 +0,0 @@
|
||||
From 9796c3d4224e7c5b15edca3ca0b158451809b973 Mon Sep 17 00:00:00 2001
|
||||
From: kylinsecos_admin <gitee@kylinos.com.cn>
|
||||
Date: Thu, 3 Mar 2022 14:46:14 +0800
|
||||
Subject: [PATCH] feature(dbus): Add dbus method Setenv
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 添加dbus函数Setenv
|
||||
|
||||
Signed-off-by: kylinsecos_admin <gitee@kylinos.com.cn>
|
||||
---
|
||||
src/org.gnome.SessionManager.xml | 10 ++++++++++
|
||||
src/session-manager.cpp | 12 ++++++++++++
|
||||
src/session-manager.h | 3 +++
|
||||
src/utils.cpp | 18 +++++++++---------
|
||||
src/utils.h | 6 +++---
|
||||
5 files changed, 37 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/src/org.gnome.SessionManager.xml b/src/org.gnome.SessionManager.xml
|
||||
index 60827ce..9b4cec5 100644
|
||||
--- a/src/org.gnome.SessionManager.xml
|
||||
+++ b/src/org.gnome.SessionManager.xml
|
||||
@@ -116,6 +116,16 @@
|
||||
<description>Whether the user can reboot.</description>
|
||||
</method>
|
||||
|
||||
+ <method name="Setenv">
|
||||
+ <arg name="name" type="s" direction="in">
|
||||
+ <summary>The environment variable name</summary>
|
||||
+ </arg>
|
||||
+ <arg name="value" type="s" direction="in">
|
||||
+ <summary>The environment variable value</summary>
|
||||
+ </arg>
|
||||
+ <description>Adds the variable name to the application launch environment with the specified value. May only be used during the Session Manager initialization phase.</description>
|
||||
+ </method>
|
||||
+
|
||||
<signal name="InhibitorAdded">
|
||||
<arg name="cookie" type="u">
|
||||
<summary>The inhibitor cookie.</summary>
|
||||
diff --git a/src/session-manager.cpp b/src/session-manager.cpp
|
||||
index 5047c59..7f57255 100644
|
||||
--- a/src/session-manager.cpp
|
||||
+++ b/src/session-manager.cpp
|
||||
@@ -279,6 +279,18 @@ void SessionManager::CanReboot(MethodInvocation &invocation)
|
||||
invocation.ret(this->power_.can_power_action(PowerAction::POWER_ACTION_REBOOT));
|
||||
}
|
||||
|
||||
+void SessionManager::Setenv(const Glib::ustring &name, const Glib::ustring &value, MethodInvocation &invocation)
|
||||
+{
|
||||
+ KLOG_PROFILE("name: %s, value: %s.", name.c_str(), value.c_str());
|
||||
+
|
||||
+ if (this->current_phase_ > KSMPhase::KSM_PHASE_INITIALIZATION)
|
||||
+ {
|
||||
+ DBUS_ERROR_REPLY_AND_RET(KSMErrorCode::ERROR_MANAGER_PHASE_INVALID);
|
||||
+ }
|
||||
+ Utils::setenv(name, value);
|
||||
+ invocation.ret();
|
||||
+}
|
||||
+
|
||||
void SessionManager::init()
|
||||
{
|
||||
KLOG_PROFILE("");
|
||||
diff --git a/src/session-manager.h b/src/session-manager.h
|
||||
index c8cf075..9d26c57 100644
|
||||
--- a/src/session-manager.h
|
||||
+++ b/src/session-manager.h
|
||||
@@ -88,6 +88,9 @@ protected:
|
||||
virtual void RequestReboot(MethodInvocation &invocation);
|
||||
virtual void CanReboot(MethodInvocation &invocation);
|
||||
|
||||
+ // 添加会话程序的环境变量
|
||||
+ virtual void Setenv(const Glib::ustring &name, const Glib::ustring &value, MethodInvocation &invocation);
|
||||
+
|
||||
private:
|
||||
void init();
|
||||
|
||||
diff --git a/src/utils.cpp b/src/utils.cpp
|
||||
index e70cc98..0cbe117 100644
|
||||
--- a/src/utils.cpp
|
||||
+++ b/src/utils.cpp
|
||||
@@ -87,13 +87,13 @@ std::vector<std::string> Utils::get_autostart_dirs()
|
||||
return dirs;
|
||||
}
|
||||
|
||||
-void Utils::setenv(const std::string &key, const std::string &value)
|
||||
+void Utils::setenv(const std::string &name, const std::string &value)
|
||||
{
|
||||
- KLOG_DEBUG("key: %s, value: %s.", key.c_str(), value.c_str());
|
||||
+ KLOG_DEBUG("name: %s, value: %s.", name.c_str(), value.c_str());
|
||||
|
||||
- Glib::setenv(key, value);
|
||||
- Utils::setenv_to_dbus(key, value);
|
||||
- Utils::setenv_to_systemd(key, value);
|
||||
+ Glib::setenv(name, value);
|
||||
+ Utils::setenv_to_dbus(name, value);
|
||||
+ Utils::setenv_to_systemd(name, value);
|
||||
}
|
||||
|
||||
void Utils::setenvs(const std::map<Glib::ustring, Glib::ustring> &envs)
|
||||
@@ -196,7 +196,7 @@ std::string Utils::phase_enum2str(KSMPhase phase)
|
||||
return std::string();
|
||||
}
|
||||
|
||||
-void Utils::setenv_to_dbus(const std::string &key, const std::string &value)
|
||||
+void Utils::setenv_to_dbus(const std::string &name, const std::string &value)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -206,7 +206,7 @@ void Utils::setenv_to_dbus(const std::string &key, const std::string &value)
|
||||
DAEMON_DBUS_INTERFACE_NAME);
|
||||
using param_type = std::tuple<std::map<Glib::ustring, Glib::ustring>>;
|
||||
|
||||
- std::map<Glib::ustring, Glib::ustring> envs{{key, value}};
|
||||
+ std::map<Glib::ustring, Glib::ustring> envs{{name, value}};
|
||||
auto parameter = Glib::Variant<param_type>::create(std::make_tuple(envs));
|
||||
daemon_proxy->call_sync("UpdateActivationEnvironment", parameter);
|
||||
}
|
||||
@@ -217,7 +217,7 @@ void Utils::setenv_to_dbus(const std::string &key, const std::string &value)
|
||||
}
|
||||
}
|
||||
|
||||
-void Utils::setenv_to_systemd(const std::string &key, const std::string &value)
|
||||
+void Utils::setenv_to_systemd(const std::string &name, const std::string &value)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -226,7 +226,7 @@ void Utils::setenv_to_systemd(const std::string &key, const std::string &value)
|
||||
SYSTEMD_DBUS_OBJECT_PATH,
|
||||
SYSTEMD_DBUS_INTERFACE_NAME);
|
||||
using param_type = std::tuple<std::vector<Glib::ustring>>;
|
||||
- auto env = fmt::format("{0}={1}", key, value);
|
||||
+ auto env = fmt::format("{0}={1}", name, value);
|
||||
auto parameter = Glib::Variant<param_type>::create(std::make_tuple(std::vector<Glib::ustring>{env}));
|
||||
systemd_proxy->call_sync("SetEnvironment", parameter);
|
||||
}
|
||||
diff --git a/src/utils.h b/src/utils.h
|
||||
index 2501734..d51de5b 100644
|
||||
--- a/src/utils.h
|
||||
+++ b/src/utils.h
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
// 获取自动启动程序的目录列表
|
||||
static std::vector<std::string> get_autostart_dirs();
|
||||
// 设置环境变量
|
||||
- static void setenv(const std::string &key, const std::string &value);
|
||||
+ static void setenv(const std::string &name, const std::string &value);
|
||||
static void setenvs(const std::map<Glib::ustring, Glib::ustring> &envs);
|
||||
// 生成cookie
|
||||
static uint32_t generate_cookie();
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
static std::string phase_enum2str(KSMPhase phase);
|
||||
|
||||
private:
|
||||
- static void setenv_to_dbus(const std::string &key, const std::string &value);
|
||||
- static void setenv_to_systemd(const std::string &key, const std::string &value);
|
||||
+ static void setenv_to_dbus(const std::string &name, const std::string &value);
|
||||
+ static void setenv_to_systemd(const std::string &name, const std::string &value);
|
||||
|
||||
private:
|
||||
static Glib::Rand rand_;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
Binary file not shown.
BIN
kiran-session-manager-2.3.1.tar.gz
Normal file
BIN
kiran-session-manager-2.3.1.tar.gz
Normal file
Binary file not shown.
@ -1,13 +1,11 @@
|
||||
Name: kiran-session-manager
|
||||
Version: 2.3.0
|
||||
Version: 2.3.1
|
||||
Release: 1
|
||||
Summary: Session manager for KIRAN desktop environment
|
||||
|
||||
License: Mulan PSL v2
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
|
||||
Patch1000: 0000-feature-dbus-Add-dbus-method-Setenv-9796c3d4.patch
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
BuildRequires: pkgconfig(giomm-2.4)
|
||||
BuildRequires: pkgconfig(gtkmm-3.0)
|
||||
@ -59,6 +57,12 @@ make %{?_smp_mflags}
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Aug 02 2022 tangjie02 <tangjie02@kylinsec.com.cn> - 2.3.1-1
|
||||
- KYOS-F: Add nm-applet.desktop to blacklist autostart apps.
|
||||
- KYOS-F: Modify the screensaver dbus to kiran-screensaver.
|
||||
- KYOS-B: Fix the problem that exists orphan progress when session has exited.(#53714)
|
||||
- KYOS-F: Add SetIdleHint function.
|
||||
|
||||
* Sat Jul 09 2022 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.3.0-1
|
||||
- KYOS-F: remove SUPPORT_CAJA marco,release 2.3
|
||||
|
||||
|
||||
4
kiran-session-manager.yaml
Normal file
4
kiran-session-manager.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
version_control: gitee
|
||||
src_repo: https://gitee.com/openeuler/kiran-session-manager.git
|
||||
tag_prefix: "v"
|
||||
seperator: "."
|
||||
Loading…
x
Reference in New Issue
Block a user