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



commit a56530c69e0e60c2391c245ac413ea50132bda4c
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 fc23c2d..1b19c00 100644
--- a/src/dh-book-manager.c
+++ b/src/dh-book-manager.c
@@ -704,22 +704,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]