summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-search-provider.h
diff options
context:
space:
mode:
Diffstat (limited to 'libnautilus-private/nautilus-search-provider.h')
-rw-r--r--libnautilus-private/nautilus-search-provider.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/libnautilus-private/nautilus-search-provider.h b/libnautilus-private/nautilus-search-provider.h
index 38ee68751..b3be651b4 100644
--- a/libnautilus-private/nautilus-search-provider.h
+++ b/libnautilus-private/nautilus-search-provider.h
@@ -24,6 +24,11 @@
G_BEGIN_DECLS
+typedef enum {
+ NAUTILUS_SEARCH_PROVIDER_STATUS_NORMAL,
+ NAUTILUS_SEARCH_PROVIDER_STATUS_RESTARTING
+} NautilusSearchProviderStatus;
+
#define NAUTILUS_TYPE_SEARCH_PROVIDER (nautilus_search_provider_get_type ())
#define NAUTILUS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_SEARCH_PROVIDER, NautilusSearchProvider))
#define NAUTILUS_IS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_SEARCH_PROVIDER))
@@ -42,7 +47,33 @@ struct _NautilusSearchProviderIface {
/* Signals */
void (*hits_added) (NautilusSearchProvider *provider, GList *hits);
- void (*finished) (NautilusSearchProvider *provider);
+ /* This signal has a status parameter because it's necesary to discern
+ * when the search engine finished normally or wheter it finished in a
+ * different situation that will cause the engine to do some action after
+ * finishing.
+ *
+ * For example, the search engine restarts itself if the client starts a
+ * new search before all the search providers finished its current ongoing search.
+ *
+ * A real use case of this is when the user change quickly the query of the search,
+ * the search engine stops all the search providers, but given that each search
+ * provider has its own thread it will be actually stopped in a unknown time.
+ * To fix that, the search engine marks itself for restarting if the client
+ * starts a new search and not all providers finished. Then it will emit
+ * its finished signal and restart all providers with the new search.
+ *
+ * That can cause that when the search engine emits its finished signal,
+ * it actually relates to old searchs that it stopped and not the one
+ * the client started lately.
+ * The client doesn't have a way to know wheter the finished signal
+ * relates to its current search or with an old search.
+ *
+ * To fix this situation, provide with the signal a status parameter, that
+ * provides a hint of how the search engine stopped or if it is going to realize
+ * some action afterwards, like restarting.
+ */
+ void (*finished) (NautilusSearchProvider *provider,
+ NautilusSearchProviderStatus status);
void (*error) (NautilusSearchProvider *provider, const char *error_message);
};
@@ -56,7 +87,8 @@ void nautilus_search_provider_stop (NautilusSearchProvider
void nautilus_search_provider_hits_added (NautilusSearchProvider *provider,
GList *hits);
-void nautilus_search_provider_finished (NautilusSearchProvider *provider);
+void nautilus_search_provider_finished (NautilusSearchProvider *provider,
+ NautilusSearchProviderStatus status);
void nautilus_search_provider_error (NautilusSearchProvider *provider,
const char *error_message);