[Xfce4-commits] [panel-plugins/xfce4-clipman-plugin] 28/37: Paste first item in treeview on hitting just Enter
noreply at xfce.org
noreply at xfce.org
Mon Mar 23 23:30:23 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 f6bf8ad04e2eb2425d06c0a746fd3dae5159ab88
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Sun Mar 22 00:42:36 2020 +0100
Paste first item in treeview on hitting just Enter
---
panel-plugin/plugin.h | 1 +
panel-plugin/xfce4-clipman-history.c | 23 ++++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/panel-plugin/plugin.h b/panel-plugin/plugin.h
index 9ee6cd9..e66a4ab 100644
--- a/panel-plugin/plugin.h
+++ b/panel-plugin/plugin.h
@@ -56,6 +56,7 @@ struct _MyPlugin
gulong popup_menu_id;
GtkApplication *app;
GtkWidget *dialog;
+ GtkWidget *treeview;
};
/*
diff --git a/panel-plugin/xfce4-clipman-history.c b/panel-plugin/xfce4-clipman-history.c
index 1f36f6b..85262e3 100644
--- a/panel-plugin/xfce4-clipman-history.c
+++ b/panel-plugin/xfce4-clipman-history.c
@@ -87,6 +87,26 @@ clipman_history_row_activated (GtkTreeView *treeview,
gtk_dialog_response (GTK_DIALOG (window), GTK_RESPONSE_CLOSE);
}
+static void
+clipman_history_search_entry_activate (GtkEntry *entry,
+ MyPlugin *plugin)
+{
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ GtkTreeViewColumn *column;
+ GtkTreePath *path;
+
+ /* Make sure something is selected in the treeview */
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (plugin->treeview));
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ path = gtk_tree_model_get_path (model, &iter);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW (plugin->treeview), COLUMN_PREVIEW);
+ clipman_history_row_activated (GTK_TREE_VIEW (plugin->treeview), path, column, plugin);
+}
+
static gboolean
clipman_history_visible_func (GtkTreeModel *model,
GtkTreeIter *iter,
@@ -174,9 +194,10 @@ clipman_history_treeview_init (MyPlugin *plugin)
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 (G_OBJECT (entry), "activate", G_CALLBACK (clipman_history_search_entry_activate), plugin);
/* create the treeview */
- treeview = gtk_tree_view_new_with_model (filter);
+ plugin->treeview = treeview = gtk_tree_view_new_with_model (filter);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
g_signal_connect_swapped (G_OBJECT (treeview), "start-interactive-search", G_CALLBACK (gtk_widget_grab_focus), entry);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list