[Goodies-commits] r6155 - in ristretto/trunk: . src

Stephan Arts stephan at xfce.org
Sat Nov 22 13:04:15 CET 2008


Author: stephan
Date: 2008-11-22 12:04:15 +0000 (Sat, 22 Nov 2008)
New Revision: 6155

Modified:
   ristretto/trunk/configure.in.in
   ristretto/trunk/src/Makefile.am
   ristretto/trunk/src/main.c
   ristretto/trunk/src/main_window.c
   ristretto/trunk/src/main_window.h
   ristretto/trunk/src/save_dialog.c
Log:
Remove xfconf dependency
Replace -v with -V
Remove YES_NO buttons



Modified: ristretto/trunk/configure.in.in
===================================================================
--- ristretto/trunk/configure.in.in	2008-11-21 19:52:08 UTC (rev 6154)
+++ ristretto/trunk/configure.in.in	2008-11-22 12:04:15 UTC (rev 6155)
@@ -65,15 +65,13 @@
               [build_xfce_desktop=$enableval],
               [build_xfce_desktop=yes])
 if test "x$build_xfce_desktop" = "xyes"; then
-    echo "--------------------------------------"
-    echo "BUILDING WITH XFDESKTOP SUPPORT"
-    echo "XFDESKTOP 4.5 or higher required"
-    echo ""
-    echo "Use --disable-xfce-desktop if you are "
-    echo "running xfce older then verion 4.5"
-    echo "--------------------------------------"
-    XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [0])
-    AC_DEFINE([HAVE_XFCONF], [1], [Define if XFConf is present])
+	AC_CHECK_PROG([xfconf_query_found], [xfconf-query], [yes], [no])
+	if test x"$xfconf_query_found" = x"no"; then
+		echo "***"
+		echo "*** xfconf-query was not found on your system."
+		echo "*** The wallpaper won't work without it installed."
+		echo "***"
+	fi
     AC_DEFINE([WITH_DESKTOP_WALLPAPER], [1], [Define With Desktop wallpaper])
 fi
 

Modified: ristretto/trunk/src/Makefile.am
===================================================================
--- ristretto/trunk/src/Makefile.am	2008-11-21 19:52:08 UTC (rev 6154)
+++ ristretto/trunk/src/Makefile.am	2008-11-22 12:04:15 UTC (rev 6155)
@@ -17,7 +17,6 @@
 	$(LIBXFCE4UTIL_CFLAGS) \
 	$(LIBXFCEGUI4_CFLAGS) \
 	$(THUNAR_VFS_CFLAGS) \
-	$(XFCONF_CFLAGS) \
 	-DDATADIR=\"$(datadir)\" \
 	-DSRCDIR=\"$(top_srcdir)\" \
 	-DLOCALEDIR=\"$(localedir)\"
@@ -29,7 +28,6 @@
 	$(LIBEXIF_LIBS) \
 	$(LIBXFCE4UTIL_LIBS) \
 	$(LIBXFCEGUI4_LIBS) \
-	$(XFCONF_LIBS) \
 	$(THUNAR_VFS_LIBS)
 
 INCLUDES = \

Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c	2008-11-21 19:52:08 UTC (rev 6154)
+++ ristretto/trunk/src/main.c	2008-11-22 12:04:15 UTC (rev 6155)
@@ -57,7 +57,7 @@
 
 static GOptionEntry entries[] =
 {
-    {    "version", 'v', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
+    {    "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
         N_("Version information"),
         NULL
     },
@@ -221,6 +221,7 @@
     GdkColor *bg_color = NULL;
     GError *cli_error = NULL;
     gint n;
+    gchar *program = NULL;
 
     #ifdef ENABLE_NLS
     bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
@@ -253,7 +254,21 @@
 
     mime_dbase = thunar_vfs_mime_database_get_default();
 
+    program = g_find_program_in_path ("xfconf-query");
+    if (G_LIKELY (program != NULL))
+    {
+        rstto_has_xfconf_query = TRUE;
+        g_free (program);
+    }
 
+    program = g_find_program_in_path ("gconftool");
+    if (G_LIKELY (program != NULL))
+    {
+        rstto_has_gconftool = TRUE;
+        g_free (program);
+    }
+
+
     gtk_window_set_default_icon_name("ristretto");
     xfce_rc = xfce_rc_config_open(XFCE_RESOURCE_CONFIG, "ristretto/ristrettorc", FALSE);
 

Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c	2008-11-21 19:52:08 UTC (rev 6154)
+++ ristretto/trunk/src/main_window.c	2008-11-22 12:04:15 UTC (rev 6155)
@@ -27,10 +27,6 @@
 #include <libexif/exif-data.h>
 #include <dbus/dbus-glib.h>
 
-#ifdef HAVE_XFCONF
-#include <xfconf/xfconf.h>
-#endif
-
 #include "navigator.h"
 #include "thumbnail_bar.h"
 #include "picture_viewer.h"
@@ -425,8 +421,6 @@
     window->priv->menus.view.menu_item_set_wallpaper = gtk_image_menu_item_new_with_mnemonic(_("_Set as wallpaper"));
     gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(window->priv->menus.view.menu_item_set_wallpaper), wallpaper_image);
 
-    /** FIXME: HACK */
-#ifdef HAVE_XFCONF 
 #ifdef WITH_DESKTOP_WALLPAPER
     /** Set xfce-desktop as default when support has been compiled in */
     /* Check if xfdesktop is running */
@@ -441,7 +435,8 @@
         Atom xfce_selection_atom = XInternAtom (gdk_display, selection_name, False);
         if((XGetSelectionOwner(GDK_DISPLAY(), xfce_selection_atom)))
         {
-            window->priv->settings.desktop = RSTTO_DESKTOP_XFCE;
+            if (rstto_has_xfconf_query)
+                window->priv->settings.desktop = RSTTO_DESKTOP_XFCE;
         }
         else
         {
@@ -449,9 +444,7 @@
         }
     }
 #endif
-#endif
 
-
     gtk_widget_add_accelerator(window->priv->menus.view.menu_item_fullscreen, "activate", accel_group, GDK_F11, 0,GTK_ACCEL_VISIBLE);
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(window->priv->menus.view.menu_item_show_toolbar), TRUE);
 
@@ -903,8 +896,8 @@
 
         if (modified_files)
         {
-            GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, _("One or more images have been modified, do you want to save the changes?")); 
-            if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_YES)
+            GtkWidget *dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, _("One or more images have been modified, do you want to save the changes?")); 
+            if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
             {
                 gtk_widget_hide(dialog);
                 GtkWidget *save_dialog = rstto_save_dialog_new (GTK_WINDOW(window), modified_files);
@@ -1183,47 +1176,54 @@
     ThunarVfsInfo *info = rstto_navigator_entry_get_info(entry);
     gchar *path = thunar_vfs_path_dup_string(info->path);
 
+    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 = NULL;
+    gchar *image_show_prop = NULL;
+    gchar *image_style_prop = NULL;
+    gchar *command = NULL;
+
     switch (window->priv->settings.desktop)
     {
-#ifdef HAVE_XFCONF
         case RSTTO_DESKTOP_XFCE:
             {
 
-                XfconfChannel *xfdesktop_channel = xfconf_channel_new("xfce4-desktop");
-
                 /*
                  * 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);
+                image_path_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-path", screen, monitor);
+                image_show_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-show", screen, monitor);
+                image_style_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-style", screen, monitor);
 
-                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);
-                gchar *image_style_prop = g_strdup_printf("/backdrop/screen%d/monitor%d/image-style", screen, monitor);
-                if(xfconf_channel_set_string(xfdesktop_channel, image_path_prop, path) == TRUE)
-                {
-                    xfconf_channel_set_bool(xfdesktop_channel, image_show_prop, TRUE);
-                    xfconf_channel_set_int(xfdesktop_channel, image_style_prop, 4);
-                }
-                else
-                {
-                    /** FAILED */
-                }
-                g_free(image_path_prop);
-                g_free(image_show_prop);
-                g_free(image_style_prop);
-                g_object_unref(xfdesktop_channel);
+                command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t string -s %s", image_path_prop, path);
+                g_spawn_command_line_async (command, NULL);
+                g_free (command);
+
+                command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t bool -s true", image_show_prop);
+                g_spawn_command_line_async (command, NULL);
+                g_free (command);
+
+                command = g_strdup_printf ("xfconf-query -c xfce4-desktop -p %s --create -t int -s 4", image_style_prop);
+                g_spawn_command_line_async (command, NULL);
+                g_free (command);
+
             }
             break;
-#endif
         default:
             g_debug("not supported");
             break;
     }
-    g_free(path);
+    if (image_path_prop)
+        g_free(image_path_prop);
+    if (image_show_prop)
+        g_free(image_show_prop);
+    if (image_style_prop)
+        g_free(image_style_prop);
+    if (path)
+        g_free(path);
 }
 #endif
 

Modified: ristretto/trunk/src/main_window.h
===================================================================
--- ristretto/trunk/src/main_window.h	2008-11-21 19:52:08 UTC (rev 6154)
+++ ristretto/trunk/src/main_window.h	2008-11-22 12:04:15 UTC (rev 6155)
@@ -63,7 +63,10 @@
     RSTTO_DESKTOP_XFCE
 } RsttoDesktop;
 
+static gboolean rstto_has_xfconf_query = FALSE;
+static gboolean rstto_has_gconftool = FALSE;
 
+
 GType      rstto_main_window_get_type();
 
 GtkWidget *rstto_main_window_new();

Modified: ristretto/trunk/src/save_dialog.c
===================================================================
--- ristretto/trunk/src/save_dialog.c	2008-11-21 19:52:08 UTC (rev 6154)
+++ ristretto/trunk/src/save_dialog.c	2008-11-22 12:04:15 UTC (rev 6155)
@@ -44,7 +44,7 @@
                                 GTK_DIALOG_DESTROY_WITH_PARENT,
                                 GTK_STOCK_CANCEL,
                                 GTK_RESPONSE_CANCEL,
-                                GTK_STOCK_OK,
+                                GTK_STOCK_SAVE,
                                 GTK_RESPONSE_OK,
                                 NULL);
 




More information about the Goodies-commits mailing list