changeset 10640:43ab987a0222

[gaim-migrate @ 12145] sf patch #1151314, from Ephraim Double click to modify account in Accounts window committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 26 Feb 2005 18:59:43 +0000
parents 84fb7beabb5c
children 5564a3066387
files src/gtkaccount.c
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkaccount.c	Sat Feb 26 18:27:52 2005 +0000
+++ b/src/gtkaccount.c	Sat Feb 26 18:59:43 2005 +0000
@@ -2168,6 +2168,32 @@
 	gtk_widget_set_sensitive(dialog->delete_button, selected);
 }
 
+static gboolean
+account_treeview_double_click_cb(GtkTreeView *treeview, GdkEventButton *event, gpointer user_data)
+{
+	AccountsWindow *dialog;
+	GtkTreePath *path;
+	GtkTreeIter iter;
+	GaimAccount *account;
+
+	dialog = (AccountsWindow *)user_data;
+
+	/* 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_model_get(GTK_TREE_MODEL(dialog->model), &iter, COLUMN_DATA, &account, -1);
+
+	if ((account != NULL) && (event->button == 1) &&
+		(event->type == GDK_2BUTTON_PRESS))
+	{
+		gaim_gtk_account_dialog_show(GAIM_GTK_MODIFY_ACCOUNT_DIALOG, account);
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
 static GtkWidget *
 create_accounts_list(AccountsWindow *dialog)
 {
@@ -2201,6 +2227,10 @@
 	g_signal_connect(G_OBJECT(sel), "changed",
 					 G_CALLBACK(account_selected_cb), dialog);
 
+	/* Handle double-clicking */
+	g_signal_connect(G_OBJECT(treeview), "button_press_event",
+					 G_CALLBACK(account_treeview_double_click_cb), dialog);
+
 	gtk_container_add(GTK_CONTAINER(sw), treeview);
 	gtk_widget_show(treeview);