[Goodies-commits] r4636 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Sun Apr 20 01:35:38 CEST 2008


Author: stephan
Date: 2008-04-19 23:35:38 +0000 (Sat, 19 Apr 2008)
New Revision: 4636

Modified:
   ristretto/trunk/src/main_window.c
Log:
Improve set-wallpaper behaviour for ristretto

(it now uses the correct xfconf properties and sets the wallpaper on the monitor and screen that the ristretto-window is running on)


Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c	2008-04-19 03:27:54 UTC (rev 4635)
+++ ristretto/trunk/src/main_window.c	2008-04-19 23:35:38 UTC (rev 4636)
@@ -19,6 +19,7 @@
 #include <config.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <gdk/gdkx.h>
 #include <string.h>
 #include <thunar-vfs/thunar-vfs.h>
 #include <libxfcegui4/libxfcegui4.h>
@@ -1096,11 +1097,29 @@
 #ifdef HAVE_XFCONF
         case RSTTO_DESKTOP_XFCE:
             {
+
                 XfconfChannel *xfdesktop_channel = xfconf_channel_new("xfdesktop");
-                if(xfconf_channel_set_string(xfdesktop_channel, "/image_path_0_0", path) == FALSE)
+
+                /*
+                 * Retrieve the screen and monitor number where the main ristretto window is running,
+                 * set the wallpaper there.
+                 */
+                GdkScreen *gdk_screen = gdk_screen_get_default();
+                gint screen = gdk_screen_get_number(gdk_screen);
+                gint monitor = gdk_screen_get_monitor_at_window(gdk_screen, GTK_WIDGET(window)->window);
+
+                gchar *image_path_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-path", screen, monitor);
+                gchar *image_show_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-show", screen, monitor);
+                if(xfconf_channel_set_string(xfdesktop_channel, image_path_prop, path) == TRUE)
                 {
+                    xfconf_channel_set_bool(xfdesktop_channel, image_show_prop, TRUE);
+                }
+                else
+                {
                     /** FAILED */
                 }
+                g_free(image_path_prop);
+                g_free(image_show_prop);
                 g_object_unref(xfdesktop_channel);
             }
             break;




More information about the Goodies-commits mailing list