[gnome-settings-daemon] updates: Use new SessionManager singleton



commit db2312a3975cd2878ef7c6c7ab4a1651dfbfcdcb
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 22 10:00:11 2012 +0200

    updates: Use new SessionManager singleton
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686556

 plugins/updates/gsd-updates-manager.c |   10 ++--------
 plugins/updates/gsd-updates-refresh.c |   18 ++++--------------
 2 files changed, 6 insertions(+), 22 deletions(-)
---
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
index 95ee1c4..d6face2 100644
--- a/plugins/updates/gsd-updates-manager.c
+++ b/plugins/updates/gsd-updates-manager.c
@@ -35,6 +35,7 @@
 #include "gsd-updates-refresh.h"
 #include "gsd-updates-common.h"
 #include "gnome-settings-profile.h"
+#include "gnome-settings-session.h"
 
 #define GSD_UPDATES_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerPrivate))
 
@@ -1382,14 +1383,7 @@ gsd_updates_manager_start (GsdUpdatesManager *manager,
 
         /* use gnome-session for the idle detection */
         manager->priv->proxy_session =
-                g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
-                                               G_DBUS_PROXY_FLAGS_NONE,
-                                               NULL, /* GDBusInterfaceInfo */
-                                               "org.gnome.SessionManager",
-                                               "/org/gnome/SessionManager",
-                                               "org.gnome.SessionManager",
-                                               manager->priv->cancellable,
-                                               error);
+                gnome_settings_session_get_session_proxy ();
         if (manager->priv->proxy_session == NULL)
                 goto out;
 
diff --git a/plugins/updates/gsd-updates-refresh.c b/plugins/updates/gsd-updates-refresh.c
index 54e4b3f..a21f79c 100644
--- a/plugins/updates/gsd-updates-refresh.c
+++ b/plugins/updates/gsd-updates-refresh.c
@@ -25,6 +25,8 @@
 #include <packagekit-glib2/packagekit.h>
 #include <libupower-glib/upower.h>
 
+#include "gnome-settings-session.h"
+
 #include "gsd-updates-common.h"
 #include "gsd-updates-refresh.h"
 
@@ -467,7 +469,6 @@ session_presence_signal_cb (GDBusProxy *proxy,
 static void
 gsd_updates_refresh_init (GsdUpdatesRefresh *refresh)
 {
-        GError *error = NULL;
         GVariant *status;
         guint status_code;
 
@@ -505,19 +506,8 @@ gsd_updates_refresh_init (GsdUpdatesRefresh *refresh)
 
         /* use gnome-session for the idle detection */
         refresh->priv->proxy_session =
-                g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
-                                               G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
-                                               NULL, /* GDBusInterfaceInfo */
-                                               "org.gnome.SessionManager",
-                                               "/org/gnome/SessionManager/Presence",
-                                               "org.gnome.SessionManager.Presence",
-                                               NULL, /* GCancellable */
-                                               &error);
-        if (refresh->priv->proxy_session == NULL) {
-                g_warning ("Error creating proxy: %s",
-                           error->message);
-                g_error_free (error);
-        } else {
+                gnome_settings_session_get_session_proxy ();
+        if (refresh->priv->proxy_session != NULL) {
                 g_signal_connect (refresh->priv->proxy_session,
                                   "g-signal",
                                   G_CALLBACK (session_presence_signal_cb),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]