[devhelp/wip/swilmet/misc-improvements: 3/16] book-manager: connect to DhBook signals with g_signal_connect_object()



commit 90160ac75d7694eb21a75d6497eb5e361da658c2
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun May 24 15:14:48 2015 +0200

    book-manager: connect to DhBook signals with g_signal_connect_object()
    
    It's safer, if a DhBook lives longer than the DhBookManager (it
    shouldn't happen, but g_signal_connect_object() is a nice safety net,
    just in case).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749797

 src/dh-book-manager.c |   36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/src/dh-book-manager.c b/src/dh-book-manager.c
index d3cd129..1f5ebb5 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -707,22 +707,26 @@ book_manager_add_from_filepath (DhBookManager *book_manager,
         }
 
         /* Get notifications of book being deleted or updated */
-        g_signal_connect (book,
-                          "deleted",
-                          G_CALLBACK (book_manager_book_deleted_cb),
-                          book_manager);
-        g_signal_connect (book,
-                          "updated",
-                          G_CALLBACK (book_manager_book_updated_cb),
-                          book_manager);
-        g_signal_connect (book,
-                          "enabled",
-                          G_CALLBACK (book_manager_book_enabled_cb),
-                          book_manager);
-        g_signal_connect (book,
-                          "disabled",
-                          G_CALLBACK (book_manager_book_disabled_cb),
-                          book_manager);
+        g_signal_connect_object (book,
+                                 "deleted",
+                                 G_CALLBACK (book_manager_book_deleted_cb),
+                                 book_manager,
+                                 0);
+        g_signal_connect_object (book,
+                                 "updated",
+                                 G_CALLBACK (book_manager_book_updated_cb),
+                                 book_manager,
+                                 0);
+        g_signal_connect_object (book,
+                                 "enabled",
+                                 G_CALLBACK (book_manager_book_enabled_cb),
+                                 book_manager,
+                                 0);
+        g_signal_connect_object (book,
+                                 "disabled",
+                                 G_CALLBACK (book_manager_book_disabled_cb),
+                                 book_manager,
+                                 0);
 
         /* Emit signal to notify others */
         g_signal_emit (book_manager,


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