[gtk+/places-sidebar] Sync from Nautilus commit 480b1daf8814063f348d0f75082353a2f6a3eab3



commit eea192adaa7e6ad535ae53a18a04685513eff673
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Jan 21 16:38:23 2013 -0500

    Sync from Nautilus commit 480b1daf8814063f348d0f75082353a2f6a3eab3
    
    cancel the hostnamed proxy creation on dispose

 gtk/gtkplacessidebar.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index f944fb7..40ab3e0 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -152,6 +152,7 @@ struct _GtkPlacesSidebar {
 	GSList *shortcuts;
 
 	GDBusProxy *hostnamed_proxy;
+	GCancellable *hostnamed_cancellable;
 	char *hostname;
 
 	GtkPlacesOpenFlags open_flags;
@@ -3226,6 +3227,8 @@ hostname_proxy_new_cb (GObject      *source_object,
 	GError *error = NULL;
 
 	sidebar->hostnamed_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+	g_clear_object (&sidebar->hostnamed_cancellable);
+
 	if (error != NULL) {
 		g_debug ("Failed to create D-Bus proxy: %s", error->message);
 		g_error_free (error);
@@ -3504,13 +3507,14 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
 	tree_view_set_activate_on_single_click (sidebar->tree_view);
 
 	sidebar->hostname = g_strdup (_("Computer"));
+	sidebar->hostnamed_cancellable = g_cancellable_new ();
 	g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
 				  G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES,
 				  NULL,
 				  "org.freedesktop.hostname1",
 				  "/org/freedesktop/hostname1",
 				  "org.freedesktop.hostname1",
-				  NULL,
+				  sidebar->hostnamed_cancellable,
 				  hostname_proxy_new_cb,
  				  sidebar);
 }
@@ -3570,6 +3574,11 @@ gtk_places_sidebar_dispose (GObject *object)
 		g_clear_object (&sidebar->volume_monitor);
 	}
 
+	if (sidebar->hostnamed_cancellable != NULL) {
+		g_cancellable_cancel (sidebar->hostnamed_cancellable);
+		g_clear_object (&sidebar->hostnamed_cancellable);
+	}
+
 	g_clear_object (&sidebar->hostnamed_proxy);
 	g_free (sidebar->hostname);
 	sidebar->hostname = NULL;



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