diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-10-05 13:34:28 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-10-05 13:39:37 -0400 |
commit | b858d45e3c46936dc293461237face0f653f53c8 (patch) | |
tree | e1d8d01aecad94996378da03b0b6f02bd92920dd | |
parent | fbad4f6c037d87aa4339f8ed7bf47d15ec5736eb (diff) | |
download | gtk+-b858d45e3c46936dc293461237face0f653f53c8.tar.gz |
GtkPlacesSidebar: Don't pile up duplicate bookmarks
We get multiple notifications from the bookmark manager when
something changes. Every time, we reconstruct the sidebar contents
completely, by clearing the store. The bookmarks are added with
async calls though, and the code was forgetting to cancel outstanding
async requests, leading to multiple instances of the same bookmark
getting added. Use the cancellable we already have to prevent that.
This could be made much more efficient by not recreating the entire
sidebar quite so often (3-5 times for a single bookmark rename).
https://bugzilla.gnome.org/show_bug.cgi?id=737679
-rw-r--r-- | gtk/gtkplacessidebar.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 2579fcf1e5..108d3c7c92 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -915,6 +915,11 @@ update_places (GtkPlacesSidebar *sidebar) else original_uri = NULL; + g_cancellable_cancel (sidebar->cancellable); + + g_object_unref (sidebar->cancellable); + sidebar->cancellable = g_cancellable_new (); + gtk_list_store_clear (sidebar->store); sidebar->devices_header_added = FALSE; |