summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2015-07-22 11:52:46 +0200
committerCarlos Soriano <csoriano@gnome.org>2015-07-22 13:02:04 +0200
commit5c82a12c7b521dc39d703da345980a71262c8bde (patch)
tree3cc8b681aa63bc7ad0e8e31bba8e8419b7cc9493
parent762a8b789fb641fe76369baa1376633c58d00f94 (diff)
downloadnautilus-5c82a12c7b521dc39d703da345980a71262c8bde.tar.gz
search-directory: give a better name to search_loaded
It actually means that there is some data from search engine, and that is valid and that is ready to be read. Also add an explanation about why we need this property and how it works.
-rw-r--r--libnautilus-private/nautilus-search-directory.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/libnautilus-private/nautilus-search-directory.c b/libnautilus-private/nautilus-search-directory.c
index b3c263707..bdd5b1caf 100644
--- a/libnautilus-private/nautilus-search-directory.c
+++ b/libnautilus-private/nautilus-search-directory.c
@@ -43,7 +43,21 @@ struct NautilusSearchDirectoryDetails {
NautilusSearchEngine *engine;
gboolean search_running;
- gboolean search_loaded;
+ /* When the search directory is stopped or cancelled, we migth wait
+ * until all data and signals from previous search are stopped and removed
+ * from the search engine. While this situation happens we don't want to connect
+ * clients to our signals, and we will wait until the search data and signals
+ * are valid and ready.
+ * The worst thing that can happens if we don't do this is that new clients
+ * migth get the information of old searchs if they are waiting_for_file_list.
+ * But that shouldn't be a big deal since old clients have the old information.
+ * But anyway it's currently unused for this case since the only client is
+ * nautilus-view and is not waiting_for_file_list :) .
+ *
+ * The other use case is for letting clients know if information of the directory
+ * is outdated or not valid. This might happens for automatic
+ * scheduled timeouts. */
+ gboolean search_ready_and_valid;
GList *files;
GHashTable *files_hash;
@@ -159,7 +173,7 @@ start_search (NautilusSearchDirectory *search)
/* We need to start the search engine */
search->details->search_running = TRUE;
- search->details->search_loaded = FALSE;
+ search->details->search_ready_and_valid = FALSE;
set_hidden_files (search);
nautilus_search_provider_set_query (NAUTILUS_SEARCH_PROVIDER (search->details->engine),
@@ -438,7 +452,7 @@ search_call_when_ready (NautilusDirectory *directory,
search_callback->wait_for_attributes = file_attributes;
search_callback->wait_for_file_list = wait_for_file_list;
- if (wait_for_file_list && !search->details->search_loaded) {
+ if (wait_for_file_list && !search->details->search_ready_and_valid) {
/* Add it to the pending callback list, which will be
* processed when the directory has valid data from the new
* search and all data and signals from previous searchs is removed. */
@@ -522,7 +536,7 @@ static void
on_search_directory_search_ready_and_valid (NautilusSearchDirectory *search)
{
search_directory_add_pending_files_callbacks (search);
- search->details->search_loaded = TRUE;
+ search->details->search_ready_and_valid = TRUE;
}
static void
@@ -622,7 +636,7 @@ search_force_reload (NautilusDirectory *directory)
return;
}
- search->details->search_loaded = FALSE;
+ search->details->search_ready_and_valid = FALSE;
/* Remove file monitors */
reset_file_list (search);
@@ -637,7 +651,7 @@ search_are_all_files_seen (NautilusDirectory *directory)
search = NAUTILUS_SEARCH_DIRECTORY (directory);
return (!search->details->query ||
- search->details->search_loaded);
+ search->details->search_ready_and_valid);
}
static gboolean