changeset 12137:44104dfce57b

[gaim-migrate @ 14437] Double-clicking on pounces in the pounce manager is now supported. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Fri, 18 Nov 2005 17:57:34 +0000
parents 370f9d7868f9
children 4e729e3d8f0b
files src/gtkpounce.c
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkpounce.c	Fri Nov 18 16:37:51 2005 +0000
+++ b/src/gtkpounce.c	Fri Nov 18 17:57:34 2005 +0000
@@ -1034,6 +1034,31 @@
 	gtk_widget_set_sensitive(dialog->delete_button, (num_selected > 0));
 }
 
+static gboolean
+pounce_double_click_cb(GtkTreeView *treeview, GdkEventButton *event, gpointer user_data)
+{
+	PouncesManager *dialog = user_data;
+	GtkTreePath *path;
+	GtkTreeIter iter;
+	GaimPounce *pounce;
+
+	/* Figure out which node was clicked */
+	if (!gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(dialog->treeview), event->x, event->y, &path, NULL, NULL, NULL))
+		return FALSE;
+	gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->model), &iter, path);
+	gtk_tree_path_free(path);
+	gtk_tree_model_get(GTK_TREE_MODEL(dialog->model), &iter, POUNCES_MANAGER_COLUMN_POUNCE, &pounce, -1);
+
+	if ((pounce != NULL) && (event->button == 1) &&
+		(event->type == GDK_2BUTTON_PRESS))
+	{
+		gaim_gtk_pounce_editor_show(NULL, NULL, pounce);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
 static void
 pounces_manager_persists_cb(GtkCellRendererToggle *renderer, gchar *path_str,
 							gpointer user_data)
@@ -1107,6 +1132,11 @@
 	g_signal_connect(G_OBJECT(sel), "changed",
 					 G_CALLBACK(pounce_selected_cb), dialog);
 
+	/* Handle double-clicking */
+	g_signal_connect(G_OBJECT(treeview), "button_press_event",
+					 G_CALLBACK(pounce_double_click_cb), dialog);
+
+
 	gtk_container_add(GTK_CONTAINER(sw), treeview);
 	gtk_widget_show(treeview);