[gnome-settings-daemon] print-notifications: Don't create an unused proxy object



commit 4dd2bc1f5ba76663710285d4d9c17172682af56e
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Apr 21 19:26:05 2012 -0400

    print-notifications: Don't create an unused proxy object
    
    The proxy object was not used for anything, and it was creating
    synchronously.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674550

 .../gsd-print-notifications-manager.c              |   33 ++-----------------
 1 files changed, 4 insertions(+), 29 deletions(-)
---
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c
index bb9c7b9..44fbbbe 100644
--- a/plugins/print-notifications/gsd-print-notifications-manager.c
+++ b/plugins/print-notifications/gsd-print-notifications-manager.c
@@ -54,7 +54,6 @@
 
 struct GsdPrintNotificationsManagerPrivate
 {
-        GDBusProxy                   *cups_proxy;
         GDBusConnection              *cups_bus_connection;
         gint                          subscription_id;
         cups_dest_t                  *dests;
@@ -909,8 +908,6 @@ gboolean
 gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager,
                                        GError                      **error)
 {
-        GError     *lerror;
-
         g_debug ("Starting print-notifications manager");
 
         gnome_settings_profile_start (NULL);
@@ -925,25 +922,12 @@ gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager,
 
         renew_subscription (manager);
         g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription, manager);
+        gnome_settings_profile_msg ("renewed subscriptions");
 
         manager->priv->num_dests = cupsGetDests (&manager->priv->dests);
+        gnome_settings_profile_msg ("got dests");
 
-        lerror = NULL;
-        manager->priv->cups_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
-                                                                   0,
-                                                                   NULL,
-                                                                   CUPS_DBUS_NAME,
-                                                                   CUPS_DBUS_PATH,
-                                                                   CUPS_DBUS_INTERFACE,
-                                                                   NULL,
-                                                                   &lerror);
-
-        if (lerror != NULL) {
-                g_propagate_error (error, lerror);
-                return FALSE;
-        }
-
-        manager->priv->cups_bus_connection = g_dbus_proxy_get_connection (manager->priv->cups_proxy);
+        manager->priv->cups_bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
 
         g_dbus_connection_signal_subscribe (manager->priv->cups_bus_connection,
                                             NULL,
@@ -981,12 +965,7 @@ gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager)
 
         g_hash_table_destroy (manager->priv->printing_printers);
 
-        manager->priv->cups_bus_connection = NULL;
-
-        if (manager->priv->cups_proxy != NULL) {
-                g_object_unref (manager->priv->cups_proxy);
-                manager->priv->cups_proxy = NULL;
-        }
+        g_clear_object (&manager->priv->cups_bus_connection);
 
         for (tmp = manager->priv->timeouts; tmp; tmp = g_list_next (tmp)) {
                 data = (TimeoutData *) tmp->data;
@@ -1058,10 +1037,6 @@ gsd_print_notifications_manager_finalize (GObject *object)
 
         g_return_if_fail (manager->priv != NULL);
 
-        if (manager->priv->cups_proxy != NULL) {
-                g_object_unref (manager->priv->cups_proxy);
-        }
-
         G_OBJECT_CLASS (gsd_print_notifications_manager_parent_class)->finalize (object);
 }
 



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