diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-12 18:28:21 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2012-10-15 10:47:32 -0400 |
commit | 7666f837777b73903ce2f6000503a3ed8183106f (patch) | |
tree | 2644fb07b9a6abd0e16426fa254021a3831c72cc | |
parent | 18bf5a4e09137f65d10cfe5448f19e4f183e1ad7 (diff) | |
download | nautilus-7666f837777b73903ce2f6000503a3ed8183106f.tar.gz |
search: remove unused hits-subtracted signal
Since this is never emitted, keeping the code around just makes it more
complicated.
-rw-r--r-- | libnautilus-private/nautilus-search-directory.c | 46 | ||||
-rw-r--r-- | libnautilus-private/nautilus-search-engine.c | 32 | ||||
-rw-r--r-- | libnautilus-private/nautilus-search-provider.c | 17 | ||||
-rw-r--r-- | libnautilus-private/nautilus-search-provider.h | 3 | ||||
-rw-r--r-- | src/nautilus-shell-search-provider.c | 24 | ||||
-rw-r--r-- | test/test-nautilus-search-engine.c | 12 |
6 files changed, 0 insertions, 134 deletions
diff --git a/libnautilus-private/nautilus-search-directory.c b/libnautilus-private/nautilus-search-directory.c index f1747d47e..5da6f7a94 100644 --- a/libnautilus-private/nautilus-search-directory.c +++ b/libnautilus-private/nautilus-search-directory.c @@ -90,7 +90,6 @@ G_DEFINE_TYPE (NautilusSearchDirectory, nautilus_search_directory, static GParamSpec *properties[NUM_PROPERTIES] = { NULL, }; static void search_engine_hits_added (NautilusSearchEngine *engine, GList *hits, NautilusSearchDirectory *search); -static void search_engine_hits_subtracted (NautilusSearchEngine *engine, GList *hits, NautilusSearchDirectory *search); static void search_engine_finished (NautilusSearchEngine *engine, NautilusSearchDirectory *search); static void search_engine_error (NautilusSearchEngine *engine, const char *error, NautilusSearchDirectory *search); static void search_callback_file_ready_callback (NautilusFile *file, gpointer data); @@ -546,48 +545,6 @@ search_engine_hits_added (NautilusSearchEngine *engine, GList *hits, } static void -search_engine_hits_subtracted (NautilusSearchEngine *engine, GList *hits, - NautilusSearchDirectory *search) -{ - GList *hit_list; - GList *monitor_list; - SearchMonitor *monitor; - GList *file_list; - NautilusFile *file; - - file_list = NULL; - - for (hit_list = hits; hit_list != NULL; hit_list = hit_list->next) { - NautilusSearchHit *hit = hit_list->data; - const char *uri; - - uri = nautilus_search_hit_get_uri (hit); - file = nautilus_file_get_by_uri (uri); - - for (monitor_list = search->details->monitor_list; monitor_list; - monitor_list = monitor_list->next) { - monitor = monitor_list->data; - /* Remove monitors */ - nautilus_file_monitor_remove (file, monitor); - } - - g_signal_handlers_disconnect_by_func (file, file_changed, search); - - search->details->files = g_list_remove (search->details->files, file); - - file_list = g_list_prepend (file_list, file); - } - - nautilus_directory_emit_files_changed (NAUTILUS_DIRECTORY (search), file_list); - - nautilus_file_list_free (file_list); - - file = nautilus_directory_get_corresponding_file (NAUTILUS_DIRECTORY (search)); - nautilus_file_emit_changed (file); - nautilus_file_unref (file); -} - -static void search_callback_add_pending_file_callbacks (SearchCallback *callback) { callback->file_list = nautilus_file_list_copy (callback->search_directory->details->files); @@ -803,9 +760,6 @@ nautilus_search_directory_init (NautilusSearchDirectory *search) g_signal_connect (search->details->engine, "hits-added", G_CALLBACK (search_engine_hits_added), search); - g_signal_connect (search->details->engine, "hits-subtracted", - G_CALLBACK (search_engine_hits_subtracted), - search); g_signal_connect (search->details->engine, "finished", G_CALLBACK (search_engine_finished), search); diff --git a/libnautilus-private/nautilus-search-engine.c b/libnautilus-private/nautilus-search-engine.c index 461a80e18..6d91d1fd5 100644 --- a/libnautilus-private/nautilus-search-engine.c +++ b/libnautilus-private/nautilus-search-engine.c @@ -174,35 +174,6 @@ search_provider_hits_added (NautilusSearchProvider *provider, } static void -search_provider_hits_subtracted (NautilusSearchProvider *provider, - GList *hits, - NautilusSearchEngine *engine) -{ - GList *removed = NULL; - GList *l; - - for (l = hits; l != NULL; l = l->next) { - NautilusSearchHit *hit = l->data; - int count; - const char *uri; - - uri = nautilus_search_hit_get_uri (hit); - count = GPOINTER_TO_INT (g_hash_table_lookup (engine->details->uris, uri)); - g_assert (count > 0); - if (count == 1) { - removed = g_list_prepend (removed, hit); - g_hash_table_remove (engine->details->uris, uri); - } else { - g_hash_table_replace (engine->details->uris, g_strdup (uri), GINT_TO_POINTER (--count)); - } - } - if (removed != NULL) { - nautilus_search_provider_hits_subtracted (NAUTILUS_SEARCH_PROVIDER (engine), g_list_reverse (removed)); - g_list_free (removed); - } -} - -static void check_providers_status (NautilusSearchEngine *engine) { gint num_finished = engine->details->providers_error + engine->details->providers_finished; @@ -262,9 +233,6 @@ connect_provider_signals (NautilusSearchEngine *engine, g_signal_connect (provider, "hits-added", G_CALLBACK (search_provider_hits_added), engine); - g_signal_connect (provider, "hits-subtracted", - G_CALLBACK (search_provider_hits_subtracted), - engine); g_signal_connect (provider, "finished", G_CALLBACK (search_provider_finished), engine); diff --git a/libnautilus-private/nautilus-search-provider.c b/libnautilus-private/nautilus-search-provider.c index 6d21906b0..753fe8ce4 100644 --- a/libnautilus-private/nautilus-search-provider.c +++ b/libnautilus-private/nautilus-search-provider.c @@ -25,7 +25,6 @@ enum { HITS_ADDED, - HITS_SUBTRACTED, FINISHED, ERROR, LAST_SIGNAL @@ -81,14 +80,6 @@ nautilus_search_provider_base_init (gpointer g_iface) g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - signals[HITS_SUBTRACTED] = g_signal_new ("hits-subtracted", - NAUTILUS_TYPE_SEARCH_PROVIDER, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NautilusSearchProviderIface, hits_subtracted), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, - G_TYPE_POINTER); signals[FINISHED] = g_signal_new ("finished", NAUTILUS_TYPE_SEARCH_PROVIDER, @@ -147,14 +138,6 @@ nautilus_search_provider_hits_added (NautilusSearchProvider *provider, GList *hi } void -nautilus_search_provider_hits_subtracted (NautilusSearchProvider *provider, GList *hits) -{ - g_return_if_fail (NAUTILUS_IS_SEARCH_PROVIDER (provider)); - - g_signal_emit (provider, signals[HITS_SUBTRACTED], 0, hits); -} - -void nautilus_search_provider_finished (NautilusSearchProvider *provider) { g_return_if_fail (NAUTILUS_IS_SEARCH_PROVIDER (provider)); diff --git a/libnautilus-private/nautilus-search-provider.h b/libnautilus-private/nautilus-search-provider.h index abd37a959..3ec41350c 100644 --- a/libnautilus-private/nautilus-search-provider.h +++ b/libnautilus-private/nautilus-search-provider.h @@ -43,7 +43,6 @@ struct _NautilusSearchProviderIface { /* Signals */ void (*hits_added) (NautilusSearchProvider *provider, GList *hits); - void (*hits_subtracted) (NautilusSearchProvider *provider, GList *hits); void (*finished) (NautilusSearchProvider *provider); void (*error) (NautilusSearchProvider *provider, const char *error_message); }; @@ -58,8 +57,6 @@ void nautilus_search_provider_stop (NautilusSearchProvider void nautilus_search_provider_hits_added (NautilusSearchProvider *provider, GList *hits); -void nautilus_search_provider_hits_subtracted (NautilusSearchProvider *provider, - GList *hits); void nautilus_search_provider_finished (NautilusSearchProvider *provider); void nautilus_search_provider_error (NautilusSearchProvider *provider, const char *error_message); diff --git a/src/nautilus-shell-search-provider.c b/src/nautilus-shell-search-provider.c index fc0c6551d..c8f02636d 100644 --- a/src/nautilus-shell-search-provider.c +++ b/src/nautilus-shell-search-provider.c @@ -192,28 +192,6 @@ search_hits_added_cb (NautilusSearchEngine *engine, } } -static void -search_hits_subtracted_cb (NautilusSearchEngine *engine, - GList *hits, - gpointer user_data) -{ - NautilusShellSearchProviderApp *self = user_data; - PendingSearch *search = self->current_search; - GList *l; - NautilusSearchHit *hit; - const gchar *hit_uri; - - g_debug ("*** Search engine hits subtracted"); - - for (l = hits; l != NULL; l = l->next) { - hit = l->data; - hit_uri = nautilus_search_hit_get_uri (hit); - g_debug (" %s", hit_uri); - - g_hash_table_remove (search->hits, hit_uri); - } -} - static gint search_hit_compare_relevance (gconstpointer a, gconstpointer b) @@ -473,8 +451,6 @@ execute_search (NautilusShellSearchProviderApp *self, g_signal_connect (pending_search->engine, "hits-added", G_CALLBACK (search_hits_added_cb), self); - g_signal_connect (pending_search->engine, "hits-subtracted", - G_CALLBACK (search_hits_subtracted_cb), self); g_signal_connect (pending_search->engine, "finished", G_CALLBACK (search_finished_cb), self); g_signal_connect (pending_search->engine, "error", diff --git a/test/test-nautilus-search-engine.c b/test/test-nautilus-search-engine.c index 096076bd1..d0d4f976c 100644 --- a/test/test-nautilus-search-engine.c +++ b/test/test-nautilus-search-engine.c @@ -13,16 +13,6 @@ hits_added_cb (NautilusSearchEngine *engine, GSList *hits) } static void -hits_subtracted_cb (NautilusSearchEngine *engine, GSList *hits) -{ - g_print ("hits subtracted\n"); - while (hits) { - g_print (" - %s\n", (char *)hits->data); - hits = hits->next; - } -} - -static void finished_cb (NautilusSearchEngine *engine) { g_print ("finished!\n"); @@ -40,8 +30,6 @@ main (int argc, char* argv[]) engine = nautilus_search_engine_new (); g_signal_connect (engine, "hits-added", G_CALLBACK (hits_added_cb), NULL); - g_signal_connect (engine, "hits-subtracted", - G_CALLBACK (hits_subtracted_cb), NULL); g_signal_connect (engine, "finished", G_CALLBACK (finished_cb), NULL); |