summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2013-09-05 10:57:40 +0200
committerMarek Kasik <mkasik@redhat.com>2013-09-05 10:57:40 +0200
commit8f631b320ed451cd1d25f5b3950564aef511d8cb (patch)
treeaf4e4019be754522f1c0b7aad1f05d95cda83b7f /plugins
parent53899eb1888518b73d07277b2b807db9789660db (diff)
downloadgnome-settings-daemon-8f631b320ed451cd1d25f5b3950564aef511d8cb.tar.gz
print-notifications: Connect to message bus asynchronously
Diffstat (limited to 'plugins')
-rw-r--r--plugins/print-notifications/gsd-print-notifications-manager.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c
index 3615c821..379d67ff 100644
--- a/plugins/print-notifications/gsd-print-notifications-manager.c
+++ b/plugins/print-notifications/gsd-print-notifications-manager.c
@@ -1058,6 +1058,33 @@ cups_connection_test (gpointer user_data)
}
}
+static void
+gsd_print_notifications_manager_got_dbus_connection (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ GsdPrintNotificationsManager *manager = (GsdPrintNotificationsManager *) user_data;
+ GError *error = NULL;
+
+ manager->priv->cups_bus_connection = g_bus_get_finish (res, &error);
+
+ if (manager->priv->cups_bus_connection != NULL) {
+ g_dbus_connection_signal_subscribe (manager->priv->cups_bus_connection,
+ NULL,
+ CUPS_DBUS_INTERFACE,
+ NULL,
+ CUPS_DBUS_PATH,
+ NULL,
+ 0,
+ on_cups_notification,
+ manager,
+ NULL);
+ } else {
+ g_warning ("Connection to message bus failed: %s", error->message);
+ g_error_free (error);
+ }
+}
+
static gboolean
gsd_print_notifications_manager_start_idle (gpointer data)
{
@@ -1069,18 +1096,10 @@ gsd_print_notifications_manager_start_idle (gpointer data)
cups_connection_test (manager);
- 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,
- CUPS_DBUS_INTERFACE,
- NULL,
- CUPS_DBUS_PATH,
- NULL,
- 0,
- on_cups_notification,
- manager,
- NULL);
+ g_bus_get (G_BUS_TYPE_SYSTEM,
+ NULL,
+ gsd_print_notifications_manager_got_dbus_connection,
+ data);
scp_handler (manager, TRUE);