kiran-panel/0002-fix-Fixed-issue-with-empty-taskbar-due-to-empty-obje.patch
SkyzcYou be513edb66 fix(*): Fixed issue with empty taskbar due to empty object id list.
- 修复了由于 object-id-list 为空导致的任务栏为空问题。

Close #14053 #11856
2023-09-05 14:18:52 +08:00

83 lines
2.7 KiB
Diff

From 72c29b2a51c9f22a9832066e710f9d9523b6ff64 Mon Sep 17 00:00:00 2001
From: youzhengcai <youzhengcai@kylinsec.com.cn>
Date: Mon, 4 Sep 2023 17:25:15 +0800
Subject: [PATCH] fix(*): Fixed issue with empty taskbar due to empty object id
list.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复了由于 object-id-list 为空导致的任务栏为空问题。
Close #14053 #11856
---
mate-panel/panel-profile.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c
index 13a04ab..7e1a039 100644
--- a/mate-panel/panel-profile.c
+++ b/mate-panel/panel-profile.c
@@ -86,6 +86,7 @@ static GQuark commit_timeout_quark = 0;
static void panel_profile_object_id_list_update (gchar **objects);
static void panel_profile_ensure_toplevel_per_screen (void);
+static GSList* panel_profile_object_id_list(GSettings *panel_settings);
static void
panel_profile_set_toplevel_id (PanelToplevel *toplevel,
@@ -1554,6 +1555,13 @@ panel_profile_object_id_list_notify (GSettings *settings,
gchar **objects;
objects = g_settings_get_strv (settings, key);
panel_profile_object_id_list_update (objects);
+
+ GSList *object_ids = panel_profile_object_id_list(settings);
+ if (g_slist_length(object_ids) == 0){
+ g_settings_set_strv (settings, PANEL_TOPLEVEL_ID_LIST_KEY, NULL);
+ }
+ g_slist_free (object_ids);
+
g_strfreev (objects);
}
@@ -1583,6 +1591,19 @@ panel_profile_load_list (GSettings *settings,
g_strfreev (list);
}
+static GSList*
+panel_profile_object_id_list(GSettings *panel_settings) {
+ gchar **objects = g_settings_get_strv(panel_settings, PANEL_OBJECT_ID_LIST_KEY);
+
+ GSList *object_ids;
+ object_ids = mate_gsettings_strv_to_gslist ((const gchar **) objects);
+ object_ids = panel_g_slist_make_unique (object_ids,
+ (GCompareFunc) g_strcmp0,
+ FALSE);
+ g_strfreev(objects);
+ return object_ids;
+}
+
static void
panel_profile_ensure_toplevel_per_screen ()
{
@@ -1608,7 +1629,15 @@ panel_profile_ensure_toplevel_per_screen ()
for (l = empty_screens; l; l = l->next)
panel_layout_apply_default_from_gkeyfile (l->data);
- g_slist_free (empty_screens);
+ GSettings *panel_settings = g_settings_new (PANEL_SCHEMA);
+ GSList *object_ids = panel_profile_object_id_list(panel_settings);
+ if (g_slist_length(object_ids) == 0){
+ g_settings_set_strv (panel_settings, PANEL_TOPLEVEL_ID_LIST_KEY, NULL);
+ }
+ g_slist_free (object_ids);
+ g_object_unref(panel_settings);
+
+ g_slist_free (empty_screens);
}
void
--
2.27.0