[Xfce4-commits] r29692 - in xfdesktop/trunk: . src

Brian Tarricone kelnos at xfce.org
Thu Apr 2 08:23:41 CEST 2009


Author: kelnos
Date: 2009-04-02 06:23:41 +0000 (Thu, 02 Apr 2009)
New Revision: 29692

Modified:
   xfdesktop/trunk/NEWS
   xfdesktop/trunk/src/main.c
   xfdesktop/trunk/src/xfce-desktop.c
   xfdesktop/trunk/src/xfce-desktop.h
Log:
reload image and icon view when 'xfdesktop --reload' is run (bug 5156)

Modified: xfdesktop/trunk/NEWS
===================================================================
--- xfdesktop/trunk/NEWS	2009-04-02 05:43:16 UTC (rev 29691)
+++ xfdesktop/trunk/NEWS	2009-04-02 06:23:41 UTC (rev 29692)
@@ -2,7 +2,10 @@
 ----------
 
   * Fix desktop menu failing to load on FreeBSD (bug 3370).
-  * Ensure root window properties get deleted when xfdesktop quits (bug 5154).
+  * Ensure root window properties get deleted when xfdesktop
+    quits (bug 5154).
+  * Reload the backdrop and icon view when 'xfdesktop --reload'
+    is run (bug 5156).
 
 
 Xfce 4.6.0

Modified: xfdesktop/trunk/src/main.c
===================================================================
--- xfdesktop/trunk/src/main.c	2009-04-02 05:43:16 UTC (rev 29691)
+++ xfdesktop/trunk/src/main.c	2009-04-02 06:23:41 UTC (rev 29692)
@@ -152,8 +152,17 @@
 static gboolean 
 reload_idle_cb(gpointer data)
 {
-    //settings_reload_all();  /* FIXME */
+    XfceDesktop **desktops = data;
+    gint i, nscreens;
+
+    nscreens = gdk_display_get_n_screens(gdk_display_get_default());
+    for(i = 0; i < nscreens; ++i) {
+        if(desktops[i])
+            xfce_desktop_refresh(desktops[i]);
+    }
+
     menu_reload();
+
     return FALSE;
 }
 
@@ -162,7 +171,7 @@
 {
     if(evt->data_format == 8) {
         if(!strcmp(RELOAD_MESSAGE, evt->data.b)) {
-            g_idle_add ((GSourceFunc)reload_idle_cb, NULL);
+            g_idle_add((GSourceFunc)reload_idle_cb, user_data);
             return TRUE;
         } else if(!strcmp(MENU_MESSAGE, evt->data.b)) {
             xfce_desktop_popup_root_menu(XFCE_DESKTOP(w), 0,
@@ -331,7 +340,7 @@
         channel = xfconf_channel_new(XFDESKTOP_CHANNEL);
 
     nscreens = gdk_display_get_n_screens(gdpy);
-    desktops = g_new(GtkWidget *, nscreens);
+    desktops = g_new0(GtkWidget *, nscreens);
     for(i = 0; i < nscreens; i++) {
         g_snprintf(buf, sizeof(buf), "/backdrop/screen%d/", i);
         desktops[i] = xfce_desktop_new(gdk_display_get_screen(gdpy, i),
@@ -341,7 +350,7 @@
         g_signal_connect(G_OBJECT(desktops[i]), "scroll-event",
                          G_CALLBACK(scroll_cb), NULL);
         g_signal_connect(G_OBJECT(desktops[i]), "client-event",
-                         G_CALLBACK(client_message_received), NULL);
+                         G_CALLBACK(client_message_received), desktops);
         menu_attach(XFCE_DESKTOP(desktops[i]));
         windowlist_attach(XFCE_DESKTOP(desktops[i]));
         gtk_widget_show(desktops[i]);

Modified: xfdesktop/trunk/src/xfce-desktop.c
===================================================================
--- xfdesktop/trunk/src/xfce-desktop.c	2009-04-02 05:43:16 UTC (rev 29691)
+++ xfdesktop/trunk/src/xfce-desktop.c	2009-04-02 06:23:41 UTC (rev 29692)
@@ -1377,3 +1377,43 @@
     xfce_desktop_do_menu_popup(desktop, button, activate_time,
                                signals[SIG_POPULATE_SECONDARY_ROOT_MENU]);
 }
+
+void
+xfce_desktop_refresh(XfceDesktop *desktop)
+{
+    gchar buf[256];
+    guint i, max;
+
+    g_return_if_fail(XFCE_IS_DESKTOP(desktop));
+
+    if(!GTK_WIDGET_REALIZED(desktop))
+        return;
+
+    /* reload image */
+    if(desktop->priv->xinerama_stretch)
+        max = 1;
+    else
+        max = desktop->priv->nbackdrops;
+    for(i = 0; i < max; ++i) {
+        GValue val = { 0, };
+
+        g_snprintf(buf, sizeof(buf), "%smonitor%d/image-path",
+                   desktop->priv->property_prefix, i);
+        xfconf_channel_get_property(desktop->priv->channel, buf, &val);
+
+        xfce_desktop_image_filename_changed(desktop->priv->channel, buf,
+                                            &val, desktop);
+
+        if(G_VALUE_TYPE(&val))
+            g_value_unset(&val);
+    }
+
+#ifdef ENABLE_DESKTOP_ICONS
+    /* reload icon view */
+    if(desktop->priv->icon_view) {
+        gtk_widget_destroy(desktop->priv->icon_view);
+        desktop->priv->icon_view = NULL;
+    }
+    xfce_desktop_setup_icon_view(desktop);
+#endif
+}

Modified: xfdesktop/trunk/src/xfce-desktop.h
===================================================================
--- xfdesktop/trunk/src/xfce-desktop.h	2009-04-02 05:43:16 UTC (rev 29691)
+++ xfdesktop/trunk/src/xfce-desktop.h	2009-04-02 06:23:41 UTC (rev 29692)
@@ -114,6 +114,8 @@
                                             guint button,
                                             guint activate_time);
 
+void xfce_desktop_refresh(XfceDesktop *desktop);
+
 G_END_DECLS
 
 #endif




More information about the Xfce4-commits mailing list