[Xfce4-commits] <xfce4-panel:master> Open plugin preferences on double-click (bug #6975).
Nick Schermer
noreply at xfce.org
Mon Dec 13 21:52:02 CET 2010
Updating branch refs/heads/master
to 26f2a2d772442a2f59d5d97b7a4a1615f4b590b6 (commit)
from d16c50765b4d14c40a9864ec0271595090bbc27f (commit)
commit 26f2a2d772442a2f59d5d97b7a4a1615f4b590b6
Author: Nick Schermer <nick at xfce.org>
Date: Mon Dec 13 20:17:50 2010 +0100
Open plugin preferences on double-click (bug #6975).
panel/panel-preferences-dialog.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index 69c57b9..72aebb5 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -80,6 +80,9 @@ static void panel_preferences_dialog_item_properties
PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_item_about (GtkWidget *button,
PanelPreferencesDialog *dialog);
+static gboolean panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview,
+ GdkEventButton *event,
+ PanelPreferencesDialog *dialog);
static void panel_preferences_dialog_item_row_changed (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
@@ -225,6 +228,8 @@ panel_preferences_dialog_init (PanelPreferencesDialog *dialog)
panel_return_if_fail (GTK_IS_WIDGET (treeview));
gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (dialog->store));
gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview), ITEM_COLUMN_TOOLTIP);
+ g_signal_connect (G_OBJECT (treeview), "button-press-event",
+ G_CALLBACK (panel_preferences_dialog_treeview_clicked), dialog);
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE);
g_signal_connect (G_OBJECT (dialog->store), "row-changed",
@@ -1103,6 +1108,34 @@ panel_preferences_dialog_item_about (GtkWidget *button,
+static gboolean
+panel_preferences_dialog_treeview_clicked (GtkTreeView *treeview,
+ GdkEventButton *event,
+ PanelPreferencesDialog *dialog)
+{
+ gint x, y;
+
+ panel_return_val_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog), FALSE);
+ panel_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), FALSE);
+
+ gtk_tree_view_convert_widget_to_bin_window_coords (treeview,
+ event->x, event->y,
+ &x, &y);
+
+ /* open preferences on double-click on a row */
+ if (event->type == GDK_2BUTTON_PRESS
+ && event->button == 1
+ && gtk_tree_view_get_path_at_pos (treeview, x, y, NULL, NULL, NULL, NULL))
+ {
+ panel_preferences_dialog_item_properties (NULL, dialog);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+
static void
panel_preferences_dialog_item_row_changed (GtkTreeModel *model,
GtkTreePath *path,
More information about the Xfce4-commits
mailing list