summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2013-01-21 16:38:23 -0500
committerCosimo Cecchi <cosimoc@gnome.org>2013-01-21 16:38:23 -0500
commiteea192adaa7e6ad535ae53a18a04685513eff673 (patch)
tree21ccf234f1fcfb97eec426ca0b5f545a2fd8eb4e
parent26a5391caa4add24b774115e46ad2f2836fb8b05 (diff)
downloadgtk+-eea192adaa7e6ad535ae53a18a04685513eff673.tar.gz
Sync from Nautilus commit 480b1daf8814063f348d0f75082353a2f6a3eab3
cancel the hostnamed proxy creation on dispose
-rw-r--r--gtk/gtkplacessidebar.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index f944fb7e16..40ab3e0cbc 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;