Re: [Rhythmbox-devel] gtk 2.6



Le mercredi 26 janvier 2005 à 18:16 +0100, Christophe Fergeau a écrit :
> > Does anyone know why it doesn't work in the library view?
> 
> I tried to look at why it didn't work the other day, and it's not
> immediatly obvious how to get it to work properly... (there's a function
> call which disables typeahead find in the library view, but when
> removing it, it doesn't behave as expected).

Ok, so getting it to work wasn't as straightforward as the
artist/album/genre lists, but with this patch it works for me.

Christophe
* looking for teuf gnome org--2004/rhythmbox--playbin--0.9--patch-17 to compare with
* comparing to teuf gnome org--2004/rhythmbox--playbin--0.9--patch-17
M  widgets/rb-entry-view.c

* modified files

--- orig/widgets/rb-entry-view.c
+++ mod/widgets/rb-entry-view.c
@@ -207,6 +207,23 @@
 
 static guint rb_entry_view_signals[LAST_SIGNAL] = { 0 };
 
+static gboolean
+type_ahead_search_func (GtkTreeModel *model, gint column,
+			const gchar *key, GtkTreeIter *iter,
+			gpointer search_data)
+{
+	RhythmDBEntry *entry;
+	gchar *folded;
+	gboolean res;
+
+	gtk_tree_model_get (model, iter, 0, &entry, -1);
+	folded = g_utf8_casefold (key, -1);
+	res = (strstr (rb_refstring_get_folded (entry->title), folded) == NULL);
+	g_free (folded);
+	return res;
+}
+
+
 GType
 rb_entry_view_get_type (void)
 {
@@ -885,7 +902,7 @@
 
 static void
 rb_entry_view_play_count_cell_data_func (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
-					 GtkTreeModel *tree_model, GtkTreeIter *iter,
+					 GtkTreeModel *tree_model, GtkTreeIter * iter,
 					 struct RBEntryViewCellDataFuncData *data)
 {
 	RhythmDBEntry *entry;
@@ -1319,6 +1336,12 @@
 
 	view->priv->treeview = GTK_WIDGET (rb_tree_view_new ());
 
+	gtk_tree_view_set_search_equal_func (GTK_TREE_VIEW (view->priv->treeview),
+					     type_ahead_search_func, 
+					     NULL, NULL);
+	gtk_tree_view_set_enable_search (GTK_TREE_VIEW (view->priv->treeview), 
+					 TRUE);
+
 	g_signal_connect_object (G_OBJECT (view->priv->treeview),
 			         "button_press_event",
 			         G_CALLBACK (rb_entry_view_button_press_cb),
@@ -2031,4 +2054,3 @@
 
 	return rhythmdb_query_model_poll (view->priv->model, &timeout);
 }
-





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