diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2015-05-23 17:18:11 -0700 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2015-05-24 12:21:09 -0700 |
commit | 36c19c43e0bb5689ef72341f36d425a6e1ba1afe (patch) | |
tree | db2605848be00fc868c4f25e290fd6d2323c0335 /src | |
parent | ad60d1061c6014bb91f6e1f678bdbddfe7a1d8ab (diff) | |
download | nautilus-36c19c43e0bb5689ef72341f36d425a6e1ba1afe.tar.gz |
search-provider: initialize bookmark list lazily
NautilusBookmarkList is already a singleton; since the shell provider
object is created before the application knows whether it's the primary
instance or not, loading the list in that code path makes us do ore work
than needed when we're only running as a launcher.
Just call the singleton getter every time.
Diffstat (limited to 'src')
-rw-r--r-- | src/nautilus-shell-search-provider.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c index 91db50ac6..a870be36f 100644 --- a/src/nautilus-shell-search-provider.c +++ b/src/nautilus-shell-search-provider.c @@ -60,7 +60,6 @@ struct _NautilusShellSearchProvider { GHashTable *metas_cache; - NautilusBookmarkList *bookmarks; GVolumeMonitor *volumes; }; @@ -72,9 +71,12 @@ get_display_name (NautilusShellSearchProvider *self, { GFile *location; NautilusBookmark *bookmark; + NautilusBookmarkList *bookmarks; + + bookmarks = nautilus_application_get_bookmarks (NAUTILUS_APPLICATION (g_application_get_default ())); location = nautilus_file_get_location (file); - bookmark = nautilus_bookmark_list_item_with_location (self->bookmarks, location, NULL); + bookmark = nautilus_bookmark_list_item_with_location (bookmarks, location, NULL); g_object_unref (location); if (bookmark) @@ -89,9 +91,12 @@ get_gicon (NautilusShellSearchProvider *self, { GFile *location; NautilusBookmark *bookmark; + NautilusBookmarkList *bookmarks; + + bookmarks = nautilus_application_get_bookmarks (NAUTILUS_APPLICATION (g_application_get_default ())); location = nautilus_file_get_location (file); - bookmark = nautilus_bookmark_list_item_with_location (self->bookmarks, location, NULL); + bookmark = nautilus_bookmark_list_item_with_location (bookmarks, location, NULL); g_object_unref (location); if (bookmark) @@ -261,13 +266,15 @@ search_add_volumes_and_bookmarks (PendingSearch *search) GMount *mount; GFile *location; SearchHitCandidate *candidate; + NautilusBookmarkList *bookmarks; + bookmarks = nautilus_application_get_bookmarks (NAUTILUS_APPLICATION (g_application_get_default ())); candidates = NULL; /* first add bookmarks */ - length = nautilus_bookmark_list_length (search->self->bookmarks); + length = nautilus_bookmark_list_length (bookmarks); for (idx = 0; idx < length; idx++) { - bookmark = nautilus_bookmark_list_item_at (search->self->bookmarks, idx); + bookmark = nautilus_bookmark_list_item_at (bookmarks, idx); name = nautilus_bookmark_get_name (bookmark); if (name == NULL) @@ -682,7 +689,6 @@ nautilus_shell_search_provider_init (NautilusShellSearchProvider *self) { self->metas_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_variant_unref); - self->bookmarks = nautilus_application_get_bookmarks (NAUTILUS_APPLICATION (g_application_get_default ())); self->volumes = g_volume_monitor_get (); self->skeleton = nautilus_shell_search_provider2_skeleton_new (); |