summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Karsay <gabor.karsay@gmx.at>2019-10-24 18:58:26 +0200
committerBastien Nocera <hadess@hadess.net>2020-04-01 14:07:25 +0200
commit4fd7a94a43a2879c71d72b44010e2840e7cdb7f8 (patch)
treeae3663a2f3a94052e72674d1d94d2d7ebb8b491c
parent67f7abdeea78cacf1ce471b73950ad7e1b97f326 (diff)
downloadtotem-4fd7a94a43a2879c71d72b44010e2840e7cdb7f8.tar.gz
grilo: Keep focus on search entry after validation
Don't make the search entry insensitive while the search is ongoing, instead cancel the ongoing operation if a new search is started. Closes: #188 Helps: #113
-rw-r--r--meson.build2
-rw-r--r--src/totem-grilo.c23
2 files changed, 15 insertions, 10 deletions
diff --git a/meson.build b/meson.build
index 6aa31bc98..af8aa7953 100644
--- a/meson.build
+++ b/meson.build
@@ -123,7 +123,7 @@ endif
add_project_arguments(common_flags, language: 'c')
-glib_req_version = '>= 2.35.0'
+glib_req_version = '>= 2.56.0'
gtk_req_version = '>= 3.22.0'
gst_req_version = '>= 1.6.0'
grilo_req_version = '>= 0.3.0'
diff --git a/src/totem-grilo.c b/src/totem-grilo.c
index 0f9396c19..a41a69f17 100644
--- a/src/totem-grilo.c
+++ b/src/totem-grilo.c
@@ -813,12 +813,18 @@ search_cb (GrlSource *source,
self = TOTEM_GRILO (user_data);
- if (error != NULL &&
- g_error_matches (error,
- GRL_CORE_ERROR,
- GRL_CORE_ERROR_OPERATION_CANCELLED) == FALSE) {
- window = totem_object_get_main_window (self->priv->totem);
- totem_interface_error (_("Search Error"), error->message, window);
+ if (error != NULL) {
+ if (g_error_matches (error,
+ GRL_CORE_ERROR,
+ GRL_CORE_ERROR_OPERATION_CANCELLED)) {
+ g_application_unmark_busy (g_application_get_default ());
+ /* Don't zero out self->priv->search_id to avoid a race
+ * condition with next search. Don't update thumbnails. */
+ return;
+ } else {
+ window = totem_object_get_main_window (self->priv->totem);
+ totem_interface_error (_("Search Error"), error->message, window);
+ }
}
if (media != NULL) {
@@ -840,7 +846,6 @@ search_cb (GrlSource *source,
if (remaining == 0) {
g_application_unmark_busy (g_application_get_default ());
self->priv->search_id = 0;
- gtk_widget_set_sensitive (self->priv->search_entry, TRUE);
update_search_thumbnails (self);
}
}
@@ -877,7 +882,6 @@ search_more (TotemGrilo *self)
search_options = get_search_options (self);
- gtk_widget_set_sensitive (self->priv->search_entry, FALSE);
self->priv->search_page++;
self->priv->search_remaining = PAGE_SIZE;
@@ -911,9 +915,10 @@ search (TotemGrilo *self,
GrlSource *source,
const gchar *text)
{
+ g_clear_handle_id (&self->priv->search_id, grl_operation_cancel);
+
gtk_tree_store_clear (GTK_TREE_STORE (self->priv->search_results_model));
// g_hash_table_remove_all (self->priv->cache_thumbnails);
- gtk_widget_set_sensitive (self->priv->search_entry, FALSE);
self->priv->search_source = source;
g_free (self->priv->search_text);
self->priv->search_text = g_strdup (text);