[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 34/37: Keep first element selected when searching
noreply at xfce.org
noreply at xfce.org
Mon Mar 23 23:30:29 CET 2020
This is an automated email from the git hooks/post-receive script.
o c h o s i p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-clipman-plugin.
commit 4e9b8af6b1669b0dbc9516d6f9d4b94604c68511
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sun Mar 22 22:48:27 2020 +0100
Keep first element selected when searching
---
panel-plugin/xfce4-clipman-history.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/panel-plugin/xfce4-clipman-history.c b/panel-plugin/xfce4-clipman-history.c
index ab703db..82a2d01 100644
--- a/panel-plugin/xfce4-clipman-history.c
+++ b/panel-plugin/xfce4-clipman-history.c
@@ -149,6 +149,26 @@ clipman_history_visible_func (GtkTreeModel *model,
return visible;
}
+static void
+clipman_history_treeview_filter_and_select (MyPlugin *plugin)
+{
+ GtkTreePath *path;
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (plugin->treeview));
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
+
+ path = gtk_tree_path_new_from_indices (0, -1);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (plugin->treeview));
+ gtk_tree_selection_select_path (selection, path);
+
+ if (gtk_tree_selection_path_is_selected (selection, path))
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (plugin->treeview), path, NULL, FALSE, 0.0, 0.0);
+
+ gtk_tree_path_free (path);
+}
+
GtkWidget *
clipman_history_treeview_init (MyPlugin *plugin)
{
@@ -190,7 +210,7 @@ clipman_history_treeview_init (MyPlugin *plugin)
/* create treemodel with filter */
filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (liststore), NULL);
gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (filter), clipman_history_visible_func, entry, NULL);
- g_signal_connect_swapped (G_OBJECT (entry), "changed", G_CALLBACK (gtk_tree_model_filter_refilter), filter);
+ g_signal_connect_swapped (G_OBJECT (entry), "changed", G_CALLBACK (clipman_history_treeview_filter_and_select), plugin);
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (clipman_history_search_entry_activate), plugin);
/* create the treeview */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list