[devhelp/wip/swilmet/misc-improvements] sidebar: use g_signal_connect_object()



commit fd35e3571a5c908b45c7c8e7f6f0d6246d2fb238
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon May 25 18:16:01 2015 +0200

    sidebar: use g_signal_connect_object()
    
    It is possible for the BookManager to live longer than the sidebar. For
    example when a new main window is created, and the old one is closed.

 src/dh-sidebar.c |   39 +++++++++++++++++++++++----------------
 1 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/src/dh-sidebar.c b/src/dh-sidebar.c
index e08d822..c3476aa 100644
--- a/src/dh-sidebar.c
+++ b/src/dh-sidebar.c
@@ -608,22 +608,29 @@ dh_sidebar_constructed (GObject *object)
         DhSidebarPrivate *priv = dh_sidebar_get_instance_private (sidebar);
 
         /* Setup book manager */
-        g_signal_connect (priv->book_manager,
-                          "book-created",
-                          G_CALLBACK (sidebar_book_created_or_enabled_cb),
-                          sidebar);
-        g_signal_connect (priv->book_manager,
-                          "book-deleted",
-                          G_CALLBACK (sidebar_book_deleted_or_disabled_cb),
-                          sidebar);
-        g_signal_connect (priv->book_manager,
-                          "book-enabled",
-                          G_CALLBACK (sidebar_book_created_or_enabled_cb),
-                          sidebar);
-        g_signal_connect (priv->book_manager,
-                          "book-disabled",
-                          G_CALLBACK (sidebar_book_deleted_or_disabled_cb),
-                          sidebar);
+        g_signal_connect_object (priv->book_manager,
+                                 "book-created",
+                                 G_CALLBACK (sidebar_book_created_or_enabled_cb),
+                                 sidebar,
+                                 0);
+
+        g_signal_connect_object (priv->book_manager,
+                                 "book-deleted",
+                                 G_CALLBACK (sidebar_book_deleted_or_disabled_cb),
+                                 sidebar,
+                                 0);
+
+        g_signal_connect_object (priv->book_manager,
+                                 "book-enabled",
+                                 G_CALLBACK (sidebar_book_created_or_enabled_cb),
+                                 sidebar,
+                                 0);
+
+        g_signal_connect_object (priv->book_manager,
+                                 "book-disabled",
+                                 G_CALLBACK (sidebar_book_deleted_or_disabled_cb),
+                                 sidebar,
+                                 0);
 
         priv->book_tree = dh_book_tree_new (priv->book_manager);
         gtk_widget_show (priv->book_tree);


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