nautilus vs. gnome-settings-daemon "race"
- From: jacob berkman <jacob ximian com>
- To: desktop-devel-list <desktop-devel-list gnome org>
- Subject: nautilus vs. gnome-settings-daemon "race"
- Date: 12 Jul 2002 13:54:25 -0400
gnome-settings-daemon currently checks to see if nautilus is running,
and if so won't draw the background image.
gnome-session starts gnome-settings-daemon before nautilus, so nautilus
isn't running when gnome-settings-daemon goes to draw the background.
this causes the background to get drawn twice, which slows down login a
bit.
this patch makes gnome-session set a property on the root window if it
is going to run nautilus, and gnome-settings-daemon checks this and
nautilus' gconf key at startup. if they're both on, it won't draw the
background.
i plan on committing this monday/tuesday, but comments/flames/criticisms
are welcome.
- jacob
? .DS_Store
? gsm.diff
? manager.annotate
? manager.c.diff
? prop.c2
? save-session
? session-properties
? sound-hacks.c
? sound-hacks.h
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/Makefile.am,v
retrieving revision 1.88
diff -u -r1.88 Makefile.am
--- Makefile.am 12 Jul 2002 09:02:06 -0000 1.88
+++ Makefile.am 12 Jul 2002 17:24:35 -0000
@@ -76,6 +76,8 @@
splash.h \
gsm-gsd.c \
gsm-gsd.h \
+ gsm-nautilus.c \
+ gsm-nautilus.h \
gsm-protocol.c \
gsm-protocol.h \
gsm-sound.c \
Index: gsm-nautilus.c
===================================================================
RCS file: gsm-nautilus.c
diff -N gsm-nautilus.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gsm-nautilus.c 12 Jul 2002 17:24:35 -0000
@@ -0,0 +1,57 @@
+#include <config.h>
+
+#include "gsm-nautilus.h"
+#include "prop.h"
+
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+
+#include <X11/Xatom.h>
+
+#include <string.h>
+
+static void
+make_nautilus_atom (void)
+{
+ Atom XA_GNOME_SESSION_STARTING_NAUTILUS;
+
+ XA_GNOME_SESSION_STARTING_NAUTILUS = XInternAtom (GDK_DISPLAY (), "GNOME_SESSION_STARTING_NAUTILUS", False);
+
+ gdk_error_trap_push ();
+
+ XChangeProperty (GDK_DISPLAY (),
+ DefaultRootWindow (GDK_DISPLAY ()),
+ XA_GNOME_SESSION_STARTING_NAUTILUS,
+ XA_STRING, 8, PropModeAppend, "GNOME", strlen ("GNOME"));
+
+ gdk_flush ();
+ gdk_error_trap_pop ();
+}
+
+void
+check_for_nautilus (Session *session)
+{
+ GSList *li;
+ SmProp *prop;
+ char *program;
+
+ g_return_if_fail (session != NULL);
+
+ for (li = session->client_list; li; li = li->next)
+ {
+ prop = find_property_by_name ((Client *)li->data, SmRestartCommand);
+ if (!prop)
+ continue;
+
+ program = strrchr (prop->vals[0].value, G_DIR_SEPARATOR);
+ program = program ? program+1 : prop->vals[0].value;
+
+ g_message ("checking whether %s is nautilus...", program);
+
+ if (strcmp (program, "nautilus"))
+ continue;
+
+ make_nautilus_atom ();
+ break;
+ }
+}
Index: gsm-nautilus.h
===================================================================
RCS file: gsm-nautilus.h
diff -N gsm-nautilus.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gsm-nautilus.h 12 Jul 2002 17:24:35 -0000
@@ -0,0 +1,8 @@
+#ifndef GSM_NAUTILUS_H
+#define GSM_NAUTILUS_H
+
+#include "headers.h"
+
+void check_for_nautilus (Session *session);
+
+#endif /* GSM_NAUTILUS_H */
Index: main.c
===================================================================
RCS file: /cvs/gnome/gnome-session/gnome-session/main.c,v
retrieving revision 1.46
diff -u -r1.46 main.c
--- main.c 11 Jul 2002 10:49:41 -0000 1.46
+++ main.c 12 Jul 2002 17:24:35 -0000
@@ -43,6 +43,7 @@
#include "util.h"
#include "gsm-sound.h"
#include "gsm-gsd.h"
+#include "gsm-nautilus.h"
/* Flag indicating autosave - user won't be prompted on logout to
* save the session */
@@ -346,6 +347,8 @@
session_name_env = g_strconcat ("GNOME_DESKTOP_SESSION_ID=", session_name, NULL);
putenv (session_name_env);
the_session = read_session (session_name);
+
+ check_for_nautilus (the_session);
gsm_sound_login ();
? gsd.patch
Index: gnome-settings-background.c
===================================================================
RCS file: /cvs/gnome/gnome-control-center/gnome-settings-daemon/gnome-settings-background.c,v
retrieving revision 1.5
diff -u -r1.5 gnome-settings-background.c
--- gnome-settings-background.c 14 Jan 2002 16:46:48 -0000 1.5
+++ gnome-settings-background.c 12 Jul 2002 17:25:48 -0000
@@ -29,6 +29,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gconf/gconf.h>
+#include <X11/Xatom.h>
#include "gnome-settings-keyboard.h"
#include "gnome-settings-daemon.h"
@@ -57,8 +58,38 @@
gnome_settings_daemon_register_callback ("/desktop/gnome/background", background_callback);
}
+static gboolean
+nautilus_will_draw_the_desktop (GConfClient *client)
+{
+ Atom XA_GNOME_SESSION_STARTING_NAUTILUS, type;
+ int format;
+ gulong nitems, bytes_after;
+ guchar *bytes;
+
+ if (!gconf_client_get_bool (client, "/apps/nautilus/preferences/show_desktop", NULL))
+ return FALSE;
+
+
+ XA_GNOME_SESSION_STARTING_NAUTILUS = XInternAtom (GDK_DISPLAY (),
+ "GNOME_SESSION_STARTING_NAUTILUS", True);
+
+ if (XA_GNOME_SESSION_STARTING_NAUTILUS != None) {
+ if (XGetWindowProperty (GDK_DISPLAY (),
+ DefaultRootWindow (GDK_DISPLAY ()),
+ XA_GNOME_SESSION_STARTING_NAUTILUS,
+ 0, 128, True, XA_STRING, &type, &format, &nitems,
+ &bytes_after, &bytes) == Success) {
+ XFree (bytes);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
void
gnome_settings_background_load (GConfClient *client)
{
- bg_applier_apply_prefs (bg_applier, prefs);
+ if (!nautilus_will_draw_the_desktop (client))
+ bg_applier_apply_prefs (bg_applier, prefs);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]