/soc/2013/ankitkv/gobjectification: 2e95872a71c3: Update the aut...

Ankit Vani a at nevitus.org
Fri Sep 20 15:45:37 EDT 2013


Changeset: 2e95872a71c34f593a0a37de3779178e3fea6147
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-09-21 01:15 +0530
Branch:	 soc.2013.gobjectification.plugins
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/2e95872a71c3

Description:

Update the automatically loaded plugins via dependencies/dependent plugins on plugin load/unload in pidgin

diffstat:

 pidgin/gtkplugin.c |  27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diffs (44 lines):

diff --git a/pidgin/gtkplugin.c b/pidgin/gtkplugin.c
--- a/pidgin/gtkplugin.c
+++ b/pidgin/gtkplugin.c
@@ -283,6 +283,23 @@ update_plugin_list(void *data)
 	g_list_free(plugins);
 }
 
+static gboolean
+check_if_loaded(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+{
+	PurplePlugin *plugin;
+	gtk_tree_model_get(model, iter, 2, &plugin, -1);
+	gtk_list_store_set(GTK_LIST_STORE(model), iter,
+					           0, purple_plugin_is_loaded(plugin),
+					           -1);
+	return FALSE;
+}
+
+static void
+update_loaded_plugins(GtkTreeModel *model)
+{
+	gtk_tree_model_foreach(model, check_if_loaded, NULL);
+}
+
 static void plugin_loading_common(PurplePlugin *plugin, GtkTreeView *view, gboolean loaded)
 {
 	GtkTreeIter iter;
@@ -475,9 +492,13 @@ static void plugin_toggled_stage_two(Pur
 		g_error_free(error);
 	}
 
-	gtk_list_store_set(GTK_LIST_STORE (model), iter,
-	                   0, purple_plugin_is_loaded(plug),
-	                   -1);
+	if ((unload && purple_plugin_get_dependent_plugins(plug)) ||
+	   (!unload && purple_plugin_info_get_dependencies(info)))
+		update_loaded_plugins(model);
+	else
+		gtk_list_store_set(GTK_LIST_STORE (model), iter,
+			               0, purple_plugin_is_loaded(plug),
+			               -1);
 	g_free(iter);
 
 	pidgin_plugins_save();



More information about the Commits mailing list