kiran-menu/0003-fix-tray-Fixed-a-crash-issue-that-occurred-when-the-.patch
luoqing 735e1fdc2a fix(tray):Put all tray icons in the panel and fix crash issues
- 将所有托盘图标都放到面板中,暂时不再放入托盘容器中
  修复托盘图标从托盘区域移除时,发生的崩溃问题

Related #12490,#14004
2023-09-01 16:08:11 +08:00

70 lines
2.2 KiB
Diff

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