fix(tray):Put all tray icons in the panel and fix crash issues

- 将所有托盘图标都放到面板中,暂时不再放入托盘容器中
  修复托盘图标从托盘区域移除时,发生的崩溃问题

Related #12490,#14004
This commit is contained in:
luoqing 2023-09-01 16:08:11 +08:00
parent e857aacc61
commit 97a79e16b8
3 changed files with 127 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 2724de097ff51a06e28579066a5085d5318a7b0e Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Thu, 24 Aug 2023 14:37:03 +0800
Subject: [PATCH] fix(tray):Place all tray icons in the panel and no longer in
the tray container for the time being
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 将所有托盘图标都放到面板中,暂时不再放入托盘容器中
Related #12490
---
src/tray/kiran-tray.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/tray/kiran-tray.c b/src/tray/kiran-tray.c
index 9b40d96..2d5d418 100644
--- a/src/tray/kiran-tray.c
+++ b/src/tray/kiran-tray.c
@@ -1123,7 +1123,7 @@ kiran_tray_notify_icon_added(KiranTrayManager *manager,
priv = tray->priv;
id = kiran_notify_icon_get_id(icon);
- type = kiran_tray_get_icon_type(priv->settings, id);
+ // type = kiran_tray_get_icon_type(priv->settings, id);
/* 系统已知的通知图标如声音,网络,电池等不需要记录 */
if (kiran_notify_icon_get_category(icon) != KIRAN_NOTIFY_ICON_CATEGORY_HARDWARE)
@@ -1136,6 +1136,10 @@ kiran_tray_notify_icon_added(KiranTrayManager *manager,
gtk_widget_set_name(GTK_WIDGET(icon), "iconWinButton");
+ gtk_box_pack_start(GTK_BOX(tray), GTK_WIDGET(icon), FALSE, TRUE, 0);
+ kiran_tray_icons_refresh(tray);
+
+ /*
if (type == ICON_SHOW_IN_PANEL)
{
gtk_box_pack_start(GTK_BOX(tray), GTK_WIDGET(icon), FALSE, TRUE, 0);
@@ -1149,6 +1153,7 @@ kiran_tray_notify_icon_added(KiranTrayManager *manager,
gtk_widget_show(priv->icons_win_button);
position_notify_icon_window(tray, FALSE);
}
+ */
g_signal_connect(icon,
"size-allocate",
--
2.33.0

View File

@ -0,0 +1,69 @@
From 4428d8c315ac13d8bacc533a9b6cc64bf335d30b Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Wed, 30 Aug 2023 17:04:12 +0800
Subject: [PATCH] fix(tray):Fixed a crash issue that occurred when the tray
icon was removed from the tray area
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复托盘图标从托盘区域移除时,发生的崩溃问题
Related #14004
---
src/tray/kiran-tray.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/tray/kiran-tray.c b/src/tray/kiran-tray.c
index 2d5d418..4093571 100644
--- a/src/tray/kiran-tray.c
+++ b/src/tray/kiran-tray.c
@@ -1123,7 +1123,7 @@ kiran_tray_notify_icon_added(KiranTrayManager *manager,
priv = tray->priv;
id = kiran_notify_icon_get_id(icon);
- // type = kiran_tray_get_icon_type(priv->settings, id);
+ type = kiran_tray_get_icon_type(priv->settings, id);
/* 系统已知的通知图标如声音,网络,电池等不需要记录 */
if (kiran_notify_icon_get_category(icon) != KIRAN_NOTIFY_ICON_CATEGORY_HARDWARE)
@@ -1136,9 +1136,12 @@ kiran_tray_notify_icon_added(KiranTrayManager *manager,
gtk_widget_set_name(GTK_WIDGET(icon), "iconWinButton");
- gtk_box_pack_start(GTK_BOX(tray), GTK_WIDGET(icon), FALSE, TRUE, 0);
- kiran_tray_icons_refresh(tray);
-
+ if (type != ICON_NOT_SHOW)
+ {
+ gtk_box_pack_start(GTK_BOX(tray), GTK_WIDGET(icon), FALSE, TRUE, 0);
+ kiran_tray_icons_refresh(tray);
+ }
+
/*
if (type == ICON_SHOW_IN_PANEL)
{
@@ -1186,6 +1189,12 @@ kiran_tray_notify_icon_removed(KiranTrayManager *manager,
id = kiran_notify_icon_get_id(icon);
type = kiran_tray_get_icon_type(priv->settings, id);
+ if(type != ICON_NOT_SHOW)
+ {
+ gtk_container_remove(GTK_CONTAINER(tray), GTK_WIDGET(icon));
+ }
+
+ /*
if (type == ICON_SHOW_IN_PANEL)
{
gtk_container_remove(GTK_CONTAINER(tray), GTK_WIDGET(icon));
@@ -1203,6 +1212,7 @@ kiran_tray_notify_icon_removed(KiranTrayManager *manager,
position_notify_icon_window(tray, FALSE);
}
+ */
priv->icons = g_slist_remove(priv->icons, icon);
}
--
2.33.0

View File

@ -1,12 +1,14 @@
Name: kiran-menu
Version: 2.5.1
Release: 2
Release: 3
Summary: Applets for mate panel from Kiran Desktop
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-coredump-Fix-crash-when-clicking-on-the-power-op.patch
Patch0002: 0002-fix-tray-Place-all-tray-icons-in-the-panel-and-no-lo.patch
Patch0003: 0003-fix-tray-Fixed-a-crash-issue-that-occurred-when-the-.patch
BuildRequires: cmake > 3.0
BuildRequires: gcc-c++
@ -98,6 +100,10 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/
%changelog
* Fri Sep 01 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.1-3
- KYOS-F: Place all tray icons in the panel and no longer in the tray container for the time being (#12490)
- KYOS-F: Fixed a crash issue that occurred when the tray icon was removed from the tray area (#14004)
* Fri Jun 30 2023 huangjiawen <huangjiawen@kylinsec.com.cn> - 2.5.1-2
- KYOS-F: Fix crash when clicking on the power option button in vnc.