[evince/wip/recent-view: 9/12] ev-recent-view: Use signal handler_id instead of disconnect_by_func



commit 10e2fce86f32b2c749df7ad9468db1cce992dce3
Author: Aakash Goenka <aakash goenka gmail com>
Date:   Wed Aug 21 14:10:26 2013 +0530

    ev-recent-view: Use signal handler_id instead of disconnect_by_func

 shell/ev-recent-view.c |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/shell/ev-recent-view.c b/shell/ev-recent-view.c
index 2d14ba9..7d58a89 100644
--- a/shell/ev-recent-view.c
+++ b/shell/ev-recent-view.c
@@ -45,6 +45,7 @@ struct _EvRecentViewPrivate {
        GtkListStore      *model;
        GtkRecentManager  *recent_manager;
        GtkTreePath       *pressed_item_tree_path;
+       guint              recent_manager_changed_handler_id;
 };
 
 enum {
@@ -73,20 +74,22 @@ G_DEFINE_TYPE (EvRecentView, ev_recent_view, GTK_TYPE_SCROLLED_WINDOW)
 static void
 ev_recent_view_dispose (GObject *obj)
 {
-       EvRecentView *ev_recent_view = EV_RECENT_VIEW (obj);
-
-       if (ev_recent_view->priv->model) {
+       EvRecentView        *ev_recent_view = EV_RECENT_VIEW (obj);
+       EvRecentViewPrivate *priv = ev_recent_view->priv;
+       
+       if (priv->model) {
                ev_recent_view_clear_model (ev_recent_view);
-               g_object_unref (ev_recent_view->priv->model);
-               ev_recent_view->priv->model = NULL;
+               g_object_unref (priv->model);
+               priv->model = NULL;
        }
 
-       if (ev_recent_view->priv->recent_manager) {
-               g_signal_handlers_disconnect_by_func (ev_recent_view->priv->recent_manager,
-                                                     ev_recent_view_refresh,
-                                                     ev_recent_view);
-               ev_recent_view->priv->recent_manager = NULL;
+       if (priv->recent_manager_changed_handler_id) {
+               g_signal_handler_disconnect (priv->recent_manager,
+                                            priv->recent_manager_changed_handler_id);
+               priv->recent_manager_changed_handler_id = 0;
        }
+       priv->recent_manager = NULL;
+
        G_OBJECT_CLASS (ev_recent_view_parent_class)->dispose (obj);
 }
 
@@ -556,10 +559,11 @@ ev_recent_view_init (EvRecentView *ev_recent_view)
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ev_recent_view),
                                        GTK_POLICY_NEVER,
                                        GTK_POLICY_AUTOMATIC);
-       g_signal_connect_swapped (ev_recent_view->priv->recent_manager,
-                                 "changed",
-                                 G_CALLBACK (ev_recent_view_refresh),
-                                 ev_recent_view);
+       ev_recent_view->priv->recent_manager_changed_handler_id =
+               g_signal_connect_swapped (ev_recent_view->priv->recent_manager,
+                                         "changed",
+                                         G_CALLBACK (ev_recent_view_refresh),
+                                         ev_recent_view);
 }
 
 static void


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