[totem] grilo: Cancel searches when switching source



commit 287d76402b0be6fe7d704a4b333b2b6d13334767
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jul 1 10:30:38 2011 +0100

    grilo: Cancel searches when switching source
    
    And clear the results view in the process.

 src/plugins/grilo/totem-grilo.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/grilo/totem-grilo.c b/src/plugins/grilo/totem-grilo.c
index 62b1ab1..86979ab 100644
--- a/src/plugins/grilo/totem-grilo.c
+++ b/src/plugins/grilo/totem-grilo.c
@@ -769,6 +769,18 @@ browser_activated_cb (GtkTreeView *tree_view,
 }
 
 static void
+search_source_changed_cb (GtkComboBox *combo,
+			  TotemGriloPlugin *self)
+{
+	if (self->priv->search_id > 0) {
+		grl_metadata_source_cancel (GRL_METADATA_SOURCE (self->priv->search_source),
+					    self->priv->search_id);
+		self->priv->search_id = 0;
+	}
+	gtk_list_store_clear (GTK_LIST_STORE (self->priv->search_results_model));
+}
+
+static void
 search_activated_cb (GtkIconView *icon_view,
                      GtkTreePath *path,
                      gpointer user_data)
@@ -1225,6 +1237,10 @@ setup_sidebar_search (TotemGriloPlugin *self,
 
 	gtk_widget_set_sensitive (self->priv->search_entry, FALSE);
 
+	g_signal_connect (self->priv->search_sources_list,
+			  "changed",
+			  G_CALLBACK (search_source_changed_cb), self);
+
 	g_signal_connect (self->priv->search_results_view,
 	                  "item-activated",
 	                  G_CALLBACK (search_activated_cb),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]