[nautilus/wip/corey/places-view-signals] places-view: Make sure signals are really disconnected




commit 4c6d9a4c5e4eca666c5116a7b92b77f7fffd10e1
Author: Corey Berla <corey berla me>
Date:   Tue Aug 23 13:49:56 2022 -0700

    places-view: Make sure signals are really disconnected
    
    I screwed up in 8c296a91c8a3e410edcb6471fa713eeaa3133d25 by flipping
    the instance and data when disconnecting the signal.  Let's just use
    g_signal_connect_object to make this automatic.

 src/nautilus-places-view.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index de37d4fde..9e2f5964a 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -142,10 +142,6 @@ nautilus_places_view_finalize (GObject *object)
     NautilusPlacesView *self = (NautilusPlacesView *) object;
     NautilusPlacesViewPrivate *priv = nautilus_places_view_get_instance_private (self);
 
-    g_signal_handlers_disconnect_by_func (self, loading_cb, priv->places_view);
-    g_signal_handlers_disconnect_by_func (self, open_location_cb, priv->places_view);
-    g_signal_handlers_disconnect_by_func (self, show_error_message_cb, priv->places_view);
-
     g_clear_object (&priv->location);
     g_clear_object (&priv->search_query);
 
@@ -392,20 +388,20 @@ nautilus_places_view_init (NautilusPlacesView *self)
     gtk_widget_show (priv->places_view);
     gtk_box_append (GTK_BOX (self), priv->places_view);
 
-    g_signal_connect_swapped (priv->places_view,
+    g_signal_connect_object (priv->places_view,
                               "notify::loading",
                               G_CALLBACK (loading_cb),
-                              self);
+                              self, G_CONNECT_SWAPPED);
 
-    g_signal_connect_swapped (priv->places_view,
+    g_signal_connect_object (priv->places_view,
                               "open-location",
                               G_CALLBACK (open_location_cb),
-                              self);
+                              self, G_CONNECT_SWAPPED);
 
-    g_signal_connect_swapped (priv->places_view,
+    g_signal_connect_object (priv->places_view,
                               "show-error-message",
                               G_CALLBACK (show_error_message_cb),
-                              self);
+                              self, G_CONNECT_SWAPPED);
 }
 
 NautilusPlacesView *


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