[gnome-settings-daemon/gnome-3-4] printers: Move expensive initialization to an idle
- From: Marek KaÅÃk <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-4] printers: Move expensive initialization to an idle
- Date: Tue, 8 Jan 2013 12:05:11 +0000 (UTC)
commit 1d0d5d8295b56871116ecd94a8cea49a0d9fdbc1
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Apr 23 17:14:28 2012 +0200
printers: Move expensive initialization to an idle
The start() function is running before gsd finishes its
session registration, so everything we do here is in the
critical path for session startup. Both cupsGetDests and
the subscription registration are potentially expensive,
and can very well be done later.
https://bugzilla.gnome.org/show_bug.cgi?id=674551
.../gsd-print-notifications-manager.c | 41 ++++++++++++++------
1 files changed, 29 insertions(+), 12 deletions(-)
---
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c
index 7ee2042..a09bee6 100644
--- a/plugins/print-notifications/gsd-print-notifications-manager.c
+++ b/plugins/print-notifications/gsd-print-notifications-manager.c
@@ -919,25 +919,17 @@ renew_subscription (gpointer data)
return TRUE;
}
-gboolean
-gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager,
- GError **error)
+static gboolean
+gsd_print_notifications_manager_start_idle (gpointer data)
{
- g_debug ("Starting print-notifications manager");
+ GsdPrintNotificationsManager *manager = data;
gnome_settings_profile_start (NULL);
- manager->priv->subscription_id = -1;
- manager->priv->dests = NULL;
- manager->priv->num_dests = 0;
- manager->priv->scp_handler_spawned = FALSE;
- manager->priv->timeouts = NULL;
manager->priv->printing_printers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
- manager->priv->active_notifications = NULL;
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");
@@ -959,6 +951,30 @@ gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager,
gnome_settings_profile_end (NULL);
+ return G_SOURCE_REMOVE;
+}
+
+gboolean
+gsd_print_notifications_manager_start (GsdPrintNotificationsManager *manager,
+ GError **error)
+{
+ g_debug ("Starting print-notifications manager");
+
+ gnome_settings_profile_start (NULL);
+
+ manager->priv->subscription_id = -1;
+ manager->priv->dests = NULL;
+ manager->priv->num_dests = 0;
+ manager->priv->scp_handler_spawned = FALSE;
+ manager->priv->timeouts = NULL;
+ manager->priv->printing_printers = NULL;
+ manager->priv->active_notifications = NULL;
+ manager->priv->cups_bus_connection = NULL;
+
+ g_idle_add (gsd_print_notifications_manager_start_idle, manager);
+
+ gnome_settings_profile_end (NULL);
+
return TRUE;
}
@@ -978,7 +994,8 @@ gsd_print_notifications_manager_stop (GsdPrintNotificationsManager *manager)
if (manager->priv->subscription_id >= 0)
cancel_subscription (manager->priv->subscription_id);
- g_hash_table_destroy (manager->priv->printing_printers);
+ if (manager->priv->printing_printers)
+ g_hash_table_destroy (manager->priv->printing_printers);
g_clear_object (&manager->priv->cups_bus_connection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]