[Xfce4-commits] <xfdesktop:master> Refresh desktop on style changes

Eric Koegel noreply at xfce.org
Sun Jan 26 05:28:01 CET 2014


Updating branch refs/heads/master
         to 1516cb96c6ec9b20b63f05e7bcc4af8594d43129 (commit)
       from 9628995ae4ae767591de3a31fb98ef233852617e (commit)

commit 1516cb96c6ec9b20b63f05e7bcc4af8594d43129
Author: Eric Koegel <eric.koegel at gmail.com>
Date:   Sat Jan 25 18:33:19 2014 +0300

    Refresh desktop on style changes
    
    Xfdestkop's icon view doesn't update the icon labels when xfsettingsd
    starts up. To work around that, refresh the desktop on a style change
    event. Additionally gtk likes to send up to 10 style change events at
    once, so this also adds a 1 second delay to ensure it's the last change
    event that we respond to.

 src/xfce-desktop.c |   38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/xfce-desktop.c b/src/xfce-desktop.c
index 7ae3e0c..b87bdf9 100644
--- a/src/xfce-desktop.c
+++ b/src/xfce-desktop.c
@@ -114,6 +114,7 @@ struct _XfceDesktopPriv
     gboolean icons_font_size_set;
     guint icons_font_size;
     guint icons_size;
+    gint  style_refresh_timer;
     GtkWidget *icon_view;
     gdouble system_font_size;
 #endif
@@ -889,6 +890,9 @@ xfce_desktop_finalize(GObject *object)
     g_object_unref(G_OBJECT(desktop->priv->channel));
     g_free(desktop->priv->property_prefix);
 
+    if(desktop->priv->style_refresh_timer != 0)
+        g_source_remove(desktop->priv->style_refresh_timer);
+
     G_OBJECT_CLASS(xfce_desktop_parent_class)->finalize(object);
 }
 
@@ -1248,28 +1252,26 @@ xfce_desktop_delete_event(GtkWidget *w,
     return TRUE;
 }
 
+static gboolean
+style_refresh_cb(gpointer *w)
+{
+    XfceDesktop *desktop = XFCE_DESKTOP(w);
+
+    xfce_desktop_refresh(desktop);
+    desktop->priv->style_refresh_timer = 0;
+
+    return FALSE;
+}
+
 static void
-xfce_desktop_style_set(GtkWidget *w,
-                       GtkStyle *old_style)
+xfce_desktop_style_set(GtkWidget *w, GtkStyle *old_style)
 {
     XfceDesktop *desktop = XFCE_DESKTOP(w);
-#ifdef ENABLE_DESKTOP_ICONS
-    gdouble old_font_size;
-#endif
-    
-    if(GDK_IS_WINDOW(desktop->priv->bg_pixmap))
-        gdk_window_set_back_pixmap(gtk_widget_get_window(w), desktop->priv->bg_pixmap, FALSE);
-    gtk_widget_queue_draw(w);
 
-#ifdef ENABLE_DESKTOP_ICONS
-    old_font_size = desktop->priv->system_font_size;
-    if(xfce_desktop_ensure_system_font_size(desktop) != old_font_size
-       && desktop->priv->icon_view && !desktop->priv->icons_font_size_set)
-    {
-        xfdesktop_icon_view_set_font_size(XFDESKTOP_ICON_VIEW(desktop->priv->icon_view),
-                                          desktop->priv->system_font_size);
-    }
-#endif
+    if(desktop->priv->style_refresh_timer != 0)
+        g_source_remove(desktop->priv->style_refresh_timer);
+
+    desktop->priv->style_refresh_timer = g_timeout_add_seconds(1, (GSourceFunc)style_refresh_cb, w);
 }
 
 static void


More information about the Xfce4-commits mailing list