[gnome-control-center] Remove the subscription renewal timeout when the panel goes away



commit 8a3368be657753c654d68128bc0be84b6641272f
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Apr 29 12:07:13 2011 -0400

    Remove the subscription renewal timeout when the panel goes away
    
    Otherwise, bad things (ie crashes) happen after 500 seconds...

 panels/printers/cc-printers-panel.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index c7e0e67..ab6bf3e 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -88,6 +88,7 @@ struct _CcPrintersPanelPrivate
   GDBusProxy      *cups_proxy;
   GDBusConnection *cups_bus_connection;
   gint             subscription_id;
+  guint            subscription_renewal_id;
 
   gpointer dummy;
 };
@@ -336,7 +337,8 @@ attach_to_cups_notifier (gpointer data)
   priv = PRINTERS_PANEL_PRIVATE (self);
 
   renew_subscription (self);
-  g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription, self);
+  priv->subscription_renewal_id =
+    g_timeout_add_seconds (RENEW_INTERVAL, renew_subscription, self);
 
   error = NULL;
   priv->cups_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
@@ -379,6 +381,11 @@ detach_from_cups_notifier (gpointer data)
   cancel_cups_subscription (priv->subscription_id);
   priv->subscription_id = -1;
 
+  if (priv->subscription_renewal_id != 0) {
+    g_source_remove (priv->subscription_renewal_id);
+    priv->subscription_renewal_id = 0;
+  }
+
   if (priv->cups_proxy != NULL) {
     g_object_unref (priv->cups_proxy);
     priv->cups_proxy = NULL;



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