changeset 11877:f1f7c83d7b6c

[gaim-migrate @ 14168] Automatically scrolls the plugin list if so the Details pane doesn't come up and cover the newly selected plugin. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Fri, 28 Oct 2005 21:41:20 +0000
parents 664e2fee9923
children f672349cfc1c
files src/gtkplugin.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkplugin.c	Fri Oct 28 18:52:50 2005 +0000
+++ b/src/gtkplugin.c	Fri Oct 28 21:41:20 2005 +0000
@@ -214,6 +214,21 @@
 	gaim_gtk_plugins_save();
 }
 
+static gboolean ensure_plugin_visible(void *data)
+{
+	GtkTreeSelection *sel = GTK_TREE_SELECTION(data);
+      	GtkTreeView *tv = gtk_tree_selection_get_tree_view(sel);
+	GtkTreeModel *model = gtk_tree_view_get_model(tv);
+	GtkTreePath *path;
+	GtkTreeIter iter;
+	if (!gtk_tree_selection_get_selected (sel, &model, &iter))
+		return FALSE;
+	path = gtk_tree_model_get_path(model, &iter);
+	gtk_tree_view_scroll_to_cell(gtk_tree_selection_get_tree_view(sel), path, NULL, FALSE, 0, 0);
+	gtk_tree_path_free(path);
+	return FALSE;
+}
+
 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model)
 {
 	gchar *buf, *pname, *pdesc, *pauth, *pweb;
@@ -255,6 +270,11 @@
 			&& plug->info->prefs_info->get_plugin_pref_frame)));
 
 	gtk_label_set_markup(GTK_LABEL(plugin_details), buf);
+
+	/* Make sure the selected plugin is still visible */
+	g_idle_add(ensure_plugin_visible, sel);
+
+
 	g_value_unset(&val);
 	g_free(buf);
 	g_free(pname);