[Xfce4-commits] <libxfce4ui:new-sm-client> don't set the default window icon if it's already set

Brian J. Tarricone noreply at xfce.org
Mon Oct 5 22:40:02 CEST 2009


Updating branch refs/heads/kelnos/new-sm-client
         to a6767cb98b36c5544623effdd29ecfb080148566 (commit)
       from b2598aef0fb1dbe516a6746ec2da4b919543589b (commit)

commit a6767cb98b36c5544623effdd29ecfb080148566
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Mon Oct 5 13:07:37 2009 -0700

    don't set the default window icon if it's already set

 libxfce4ui/xfce-sm-client.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index bca246d..dc85962 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -1777,6 +1777,8 @@ xfce_sm_client_set_desktop_file(XfceSMClient *sm_client,
 {
     XfceRc *rcfile = NULL;
     gchar *real_desktop_file = NULL;
+    gboolean has_default_icon = FALSE;
+    GList *icon_list;
     const gchar *name, *icon, *exec;
 
     g_return_if_fail(XFCE_IS_SM_CLIENT(sm_client));
@@ -1821,12 +1823,25 @@ xfce_sm_client_set_desktop_file(XfceSMClient *sm_client,
             g_set_application_name(name);
     }
 
-    icon = xfce_rc_read_entry(rcfile, "Icon", NULL);
-    if(icon) {
-        if(g_path_is_absolute(icon))
-            gtk_window_set_default_icon_from_file(icon, NULL);
-        else
-            gtk_window_set_default_icon_name(icon);
+#if GTK_CHECK_VERSION(2, 16, 0)
+    if(gtk_window_get_default_icon_name())
+        has_default_icon = TRUE;
+#endif
+
+    icon_list = gtk_window_get_default_icon_list();
+    if(icon_list) {
+        has_default_icon = TRUE;
+        g_list_free(icon_list);
+    }
+
+    if(!has_default_icon) {
+        icon = xfce_rc_read_entry(rcfile, "Icon", NULL);
+        if(icon) {
+            if(g_path_is_absolute(icon))
+                gtk_window_set_default_icon_from_file(icon, NULL);
+            else
+                gtk_window_set_default_icon_name(icon);
+        }
     }
 
     exec = xfce_rc_read_entry(rcfile, "Exec", NULL);



More information about the Xfce4-commits mailing list