[ekiga] Made the status menu code manage its conf notifiers more carefully



commit d9db70a53e4c214ade9ad4bdfaee6210bb62f20e
Author: Julien Puydt <jpuydt free fr>
Date:   Mon Jan 21 10:52:41 2013 +0100

    Made the status menu code manage its conf notifiers more carefully

 lib/engine/gui/gtk-frontend/statusmenu.cpp |   34 +++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/statusmenu.cpp b/lib/engine/gui/gtk-frontend/statusmenu.cpp
index ccd4b07..55092bc 100644
--- a/lib/engine/gui/gtk-frontend/statusmenu.cpp
+++ b/lib/engine/gui/gtk-frontend/statusmenu.cpp
@@ -49,13 +49,28 @@
 
 struct _StatusMenuPrivate
 {
+  ~_StatusMenuPrivate ();
+
   boost::shared_ptr<Ekiga::PersonalDetails> personal_details;
   std::vector<boost::signals::connection> connections;
+  std::list<gpointer> notifiers;
 
   GtkListStore *list_store; // List store storing the menu
   GtkWindow    *parent;     // Parent window
 };
 
+_StatusMenuPrivate::~_StatusMenuPrivate()
+{
+  for (std::list<gpointer>::iterator iter = notifiers.begin ();
+       iter != notifiers.end ();
+       ++iter)
+    gm_conf_notifier_remove (*iter);
+  for (std::vector<boost::signals::connection>::iterator iter = connections.begin ();
+       iter != connections.end ();
+       ++iter)
+    iter->disconnect ();
+}
+
 enum Columns
 {
   COL_ICON,          // The status icon
@@ -796,6 +811,7 @@ status_menu_new (Ekiga::ServiceCore & core)
   StatusMenu *self = NULL;
 
   boost::signals::connection conn;
+  gpointer notifier;
   GtkCellRenderer *renderer = NULL;
   GSList *custom_status_array [NUM_STATUS_TYPES];
 
@@ -847,12 +863,18 @@ status_menu_new (Ekiga::ServiceCore & core)
   g_signal_connect (self, "changed",
                     G_CALLBACK (status_menu_option_changed), self);
 
-  gm_conf_notifier_add (PERSONAL_DATA_KEY "available_custom_status",
-                        status_menu_custom_messages_changed, self);
-  gm_conf_notifier_add (PERSONAL_DATA_KEY "away_custom_status",
-                        status_menu_custom_messages_changed, self);
-  gm_conf_notifier_add (PERSONAL_DATA_KEY "busy_custom_status",
-                        status_menu_custom_messages_changed, self);
+  notifier =
+    gm_conf_notifier_add (PERSONAL_DATA_KEY "available_custom_status",
+			  status_menu_custom_messages_changed, self);
+  self->priv->notifiers.push_front (notifier);
+  notifier =
+    gm_conf_notifier_add (PERSONAL_DATA_KEY "away_custom_status",
+			  status_menu_custom_messages_changed, self);
+  self->priv->notifiers.push_front (notifier);
+  notifier =
+    gm_conf_notifier_add (PERSONAL_DATA_KEY "busy_custom_status",
+			  status_menu_custom_messages_changed, self);
+  self->priv->notifiers.push_front (notifier);
 
   conn = self->priv->personal_details->updated.connect (boost::bind (&on_details_updated, self));
   self->priv->connections.push_back (conn);



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