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




commit 7854c9895bfcf4d045444fb3d4862b583032c439
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 | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index de37d4fde..e9e77851f 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,14 @@ 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,
-                              "notify::loading",
-                              G_CALLBACK (loading_cb),
-                              self);
+    g_signal_connect_object (priv->places_view, "notify::loading",
+                             G_CALLBACK (loading_cb), self, G_CONNECT_SWAPPED);
 
-    g_signal_connect_swapped (priv->places_view,
-                              "open-location",
-                              G_CALLBACK (open_location_cb),
-                              self);
+    g_signal_connect_object (priv->places_view, "open-location",
+                             G_CALLBACK (open_location_cb), self, G_CONNECT_SWAPPED);
 
-    g_signal_connect_swapped (priv->places_view,
-                              "show-error-message",
-                              G_CALLBACK (show_error_message_cb),
-                              self);
+    g_signal_connect_object (priv->places_view, "show-error-message",
+                             G_CALLBACK (show_error_message_cb), self, G_CONNECT_SWAPPED);
 }
 
 NautilusPlacesView *


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