changeset 12162:5e24b8e49522

[gaim-migrate @ 14463] SF Patch #1361020 from Sadrul 'Double click to (1)"Use" a saved-status (2) Load Plugin-pref Double-click to use a saved-status in the saved-status dialog, and double-click to load a plugin and open it's preference-dialog.' I ask, he writes. Wow! :) committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 19 Nov 2005 15:19:35 +0000
parents 58685e2d472b
children f6f08fd1841a
files src/gtkplugin.c src/gtksavedstatuses.c
diffstat 2 files changed, 39 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkplugin.c	Sat Nov 19 14:34:30 2005 +0000
+++ b/src/gtkplugin.c	Sat Nov 19 15:19:35 2005 +0000
@@ -334,6 +334,34 @@
 	}
 }
 
+static void
+show_plugin_prefs_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer null)
+{
+	GtkTreeSelection *sel;
+	GtkTreeIter iter;
+	GaimPlugin *plugin;
+	GtkTreeModel *model;
+
+	sel = gtk_tree_view_get_selection(view);
+
+	if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+		return;
+	
+	gtk_tree_model_get(model, &iter, 2, &plugin, -1);
+
+	/* If the plugin is not loaded, then load it first. */
+	if (!gaim_plugin_is_loaded(plugin))
+	{
+		GtkTreePath *path = gtk_tree_model_get_path(model, &iter);
+		gchar *pth = gtk_tree_path_to_string(path);
+		gtk_tree_path_free(path);
+		plugin_load(NULL, pth, model);
+		g_free(pth);
+	}
+	/* Now show the pref-dialog for the plugin */
+	plugin_dialog_response_cb(NULL, 98121, sel);
+}
+
 void gaim_gtk_plugin_dialog_show()
 {
 	GtkWidget *sw;
@@ -372,6 +400,9 @@
 
 	event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls));
 
+	g_signal_connect(G_OBJECT(event_view), "row-activated",
+				G_CALLBACK(show_plugin_prefs_cb), event_view);
+
 	rend = gtk_cell_renderer_toggle_new();
 	sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view));
 
--- a/src/gtksavedstatuses.c	Sat Nov 19 14:34:30 2005 +0000
+++ b/src/gtksavedstatuses.c	Sat Nov 19 15:19:35 2005 +0000
@@ -387,6 +387,12 @@
 	return result;
 }
 
+static void
+use_savedstatus_cb(GtkTreeView *view, GtkTreePath *path, GtkTreeViewColumn *column, StatusWindow *dialog)
+{
+	status_window_use_cb(NULL, dialog);
+}
+
 static GtkWidget *
 create_saved_status_list(StatusWindow *dialog)
 {
@@ -415,6 +421,8 @@
 	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dialog->model));
 	dialog->treeview = treeview;
 	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
+	g_signal_connect(G_OBJECT(treeview), "row-activated",
+						G_CALLBACK(use_savedstatus_cb), dialog);
 
 	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
 	gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);