summaryrefslogtreecommitdiff
path: root/gnome-settings-daemon/main.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-10-22 10:16:42 +0200
committerBastien Nocera <hadess@hadess.net>2012-10-22 10:16:42 +0200
commitdcb54d8a1c4ecacf6fbe17bdffefdca3b1e6d2d5 (patch)
tree803da54948a5f21ad5e7efe840dbb4ce39c9f70c /gnome-settings-daemon/main.c
parente18eb3a05f5d1c3b42c25a04f285f84f960f88ee (diff)
downloadgnome-settings-daemon-dcb54d8a1c4ecacf6fbe17bdffefdca3b1e6d2d5.tar.gz
main: Ensure session registration happens before other idles
We're deferring some slower operations to idles, in plugins, to have it happen after session registration and not slow down login - but I've observed that the ordering is unreliable. Sometimes we end up doing the RegisterClient call after the initial set of idles. Ensure that the session registration happens before other idles by making the idle higher priority than the plugins. https://bugzilla.gnome.org/show_bug.cgi?id=686579
Diffstat (limited to 'gnome-settings-daemon/main.c')
-rw-r--r--gnome-settings-daemon/main.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c
index fdcb497b..efd29a7c 100644
--- a/gnome-settings-daemon/main.c
+++ b/gnome-settings-daemon/main.c
@@ -352,6 +352,48 @@ name_lost_handler (GDBusConnection *connection,
gtk_main_quit ();
}
+static gboolean
+do_register_client (GDBusProxy *proxy)
+{
+ const char *startup_id;
+
+ g_assert (proxy != NULL);
+
+ startup_id = g_getenv ("DESKTOP_AUTOSTART_ID");
+ g_dbus_proxy_call (proxy,
+ "RegisterClient",
+ g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ (GAsyncReadyCallback) on_client_registered,
+ manager);
+
+ return FALSE;
+}
+
+static void
+queue_register_client (void)
+{
+ GDBusConnection *bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
+ GDBusProxy *proxy;
+
+ if (!bus)
+ return;
+
+ proxy = gnome_settings_session_get_session_proxy ();
+ if (proxy == NULL) {
+ g_debug ("Could not connect to the Session manager");
+ return;
+ }
+
+ /* Register the daemon with gnome-session */
+ g_signal_connect (G_OBJECT (proxy), "g-signal",
+ G_CALLBACK (on_session_over), NULL);
+
+ g_idle_add_full (G_PRIORITY_DEFAULT, (GSourceFunc) do_register_client, proxy, NULL);
+}
+
static void
bus_register (void)
{
@@ -445,6 +487,8 @@ main (int argc, char *argv[])
notify_init ("gnome-settings-daemon");
+ queue_register_client ();
+
bus_register ();
gnome_settings_profile_start ("gnome_settings_manager_new");