[Xfce4-commits] <thunar:nick/1.8> In daemon mode let Thunar decide to manage the desktop.
Nick Schermer
noreply at xfce.org
Fri Aug 9 21:22:01 CEST 2013
Updating branch refs/heads/nick/1.8
to befaaf94ea00c5f2f14286776d99d01322e3fa9a (commit)
from 278a691844aa09b75fc39389bab86d4ff0d499c5 (commit)
commit befaaf94ea00c5f2f14286776d99d01322e3fa9a
Author: Nick Schermer <nick at xfce.org>
Date: Fri Aug 9 20:23:34 2013 +0200
In daemon mode let Thunar decide to manage the desktop.
thunar/main.c | 31 +++++++++++++++++++------------
thunar/thunar-desktop-background.c | 5 ++++-
thunar/thunar-desktop-window.c | 11 +++++++++++
thunar/thunar-preferences.c | 14 ++++++++++++++
4 files changed, 48 insertions(+), 13 deletions(-)
diff --git a/thunar/main.c b/thunar/main.c
index 4bdb296..21d90cb 100644
--- a/thunar/main.c
+++ b/thunar/main.c
@@ -50,7 +50,6 @@
/* --- globals --- */
static gboolean opt_bulk_rename = FALSE;
-static gboolean opt_desktop = FALSE;
static gboolean opt_daemon = FALSE;
static gchar *opt_sm_client_id = NULL;
static gboolean opt_quit = FALSE;
@@ -62,7 +61,6 @@ static gboolean opt_version = FALSE;
static GOptionEntry option_entries[] =
{
{ "bulk-rename", 'B', 0, G_OPTION_ARG_NONE, &opt_bulk_rename, N_ ("Open the bulk rename dialog"), NULL, },
- { "desktop", 0, 0, G_OPTION_ARG_NONE, &opt_desktop, N_ ("Let Thunar manage the desktop"), NULL, },
#ifdef HAVE_DBUS
{ "daemon", 0, 0, G_OPTION_ARG_NONE, &opt_daemon, N_ ("Run in daemon mode"), NULL, },
#else
@@ -224,7 +222,7 @@ main (int argc, char **argv)
filenames = g_new (gchar *, 1);
filenames[0] = NULL;
}
- else if (!opt_daemon && !opt_desktop)
+ else if (!opt_daemon)
{
/* use the current working directory */
filenames = g_new (gchar *, 2);
@@ -236,8 +234,6 @@ main (int argc, char **argv)
/* check if we can reuse an existing instance */
if (opt_bulk_rename)
result = thunar_dbus_client_bulk_rename (working_directory, filenames, TRUE, NULL, startup_id, NULL);
- else if (opt_desktop)
- result = thunar_dbus_client_manage_desktop (NULL);
else if (filenames != NULL)
result = thunar_dbus_client_launch_files (working_directory, filenames, NULL, startup_id, NULL);
else
@@ -260,7 +256,7 @@ main (int argc, char **argv)
#ifdef HAVE_DBUS
/* setup daemon mode if requested and supported */
- thunar_application_set_daemon (application, opt_daemon || opt_desktop);
+ thunar_application_set_daemon (application, opt_daemon);
#endif
/* use the Thunar icon as default for new windows */
@@ -273,11 +269,6 @@ main (int argc, char **argv)
if (!thunar_application_bulk_rename (application, working_directory, filenames, TRUE, NULL, startup_id, &error))
goto error0;
}
- else if (G_UNLIKELY (opt_desktop))
- {
- /* show desktop windows */
- thunar_desktop_window_show_all ();
- }
else if (filenames != NULL && !thunar_application_process_filenames (application, working_directory, filenames, NULL, startup_id, &error))
{
/* we failed to process the filenames or the bulk rename failed */
@@ -304,7 +295,23 @@ error0:
/* check if the name was requested successfully */
if (!thunar_dbus_service_has_connection (dbus_service))
- thunar_application_set_daemon (application, FALSE);
+ {
+ thunar_application_set_daemon (application, FALSE);
+
+ /* ask the running instance to manage the desktop */
+ if (!thunar_dbus_client_manage_desktop (&error))
+ {
+ g_printerr ("Thunar: %s\n", error->message);
+ g_clear_error (&error);
+ }
+ }
+ else
+ {
+ /* yeey, this instance is the active daemon, start the
+ * desktop (if enabled and not already taken by another
+ * application) */
+ thunar_desktop_window_show_all ();
+ }
#endif
}
else
diff --git a/thunar/thunar-desktop-background.c b/thunar/thunar-desktop-background.c
index 0e19823..cab42b1 100644
--- a/thunar/thunar-desktop-background.c
+++ b/thunar/thunar-desktop-background.c
@@ -232,6 +232,7 @@ thunar_desktop_background_finalize (GObject *object)
gdk_error_trap_push ();
gdk_property_delete (root_window, gdk_atom_intern_static_string ("_XROOTPMAP_ID"));
gdk_property_delete (root_window, gdk_atom_intern_static_string ("ESETROOT_PMAP_ID"));
+ gdk_flush ();
gdk_error_trap_pop ();
#endif
@@ -452,6 +453,8 @@ thunar_desktop_background_expose (ThunarDesktopBackground *background,
gdk_atom_intern_static_string ("_XROOTPMAP_ID"),
atom_pixmap, 32,
GDK_PROP_MODE_REPLACE, (guchar *) &pixmap_xid, 1);
+
+ gdk_flush ();
#endif
gdk_error_trap_pop ();
@@ -681,7 +684,7 @@ thunar_desktop_background_paint_finished (GObject *source_object,
thunar_desktop_background_expose (background, TRUE);
}
}
- else if (fade_animation)
+ else if (!fade_animation)
{
/* animations are disabled, clear the window now */
thunar_desktop_background_expose (background, TRUE);
diff --git a/thunar/thunar-desktop-window.c b/thunar/thunar-desktop-window.c
index c0a6c76..129a6f8 100644
--- a/thunar/thunar-desktop-window.c
+++ b/thunar/thunar-desktop-window.c
@@ -26,6 +26,7 @@
#include <thunar/thunar-private.h>
#include <thunar/thunar-desktop-window.h>
#include <thunar/thunar-desktop-background.h>
+#include <thunar/thunar-preferences.h>
#include <thunar/thunar-application.h>
#ifdef GDK_WINDOWING_X11
@@ -320,6 +321,16 @@ thunar_desktop_window_show_all (void)
GtkWidget *desktop;
ThunarApplication *application;
gboolean managing_desktop;
+ gboolean should_manage;
+ ThunarPreferences *preferences;
+
+ /* check if Thunar should manage the desktop */
+ preferences = thunar_preferences_get ();
+ g_object_get (preferences, "misc-manage-desktop", &should_manage, NULL);
+ g_object_unref (preferences);
+
+ if (!should_manage)
+ return;
/* check if there are already desktop windows */
application = thunar_application_get ();
diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c
index f4cc5f6..e2a11a3 100644
--- a/thunar/thunar-preferences.c
+++ b/thunar/thunar-preferences.c
@@ -79,6 +79,7 @@ enum
PROP_MISC_FULL_PATH_IN_TITLE,
PROP_MISC_HORIZONTAL_WHEEL_NAVIGATES,
PROP_MISC_IMAGE_SIZE_IN_STATUSBAR,
+ PROP_MISC_MANAGE_DESKTOP,
PROP_MISC_MIDDLE_CLICK_IN_TAB,
PROP_MISC_RECURSIVE_PERMISSIONS,
PROP_MISC_REMEMBER_GEOMETRY,
@@ -543,6 +544,19 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass)
EXO_PARAM_READWRITE);
/**
+ * ThunarPreferences:misc-manage-desktop:
+ *
+ * If Thunar should try to take control over the desktop to
+ * manage the backgrounds and icons.
+ **/
+ property_pspecs[PROP_MISC_MANAGE_DESKTOP] =
+ g_param_spec_boolean ("misc-manage-desktop",
+ "MiscManageDesktop",
+ NULL,
+ FALSE,
+ EXO_PARAM_READWRITE);
+
+ /**
* ThunarPreferences:misc-middle-click-in-tab:
*
* If middle click opens a folder in a new window (FALSE) or in a new window (TRUE);
More information about the Xfce4-commits
mailing list