changeset 16941:beb960114f7d

I liked Etan's suggestion in devel. Now, Finch will bold unseen plugins in the plugin dialog. A plugin is considered 'seen' only after the details of the plugin is viewed by the user.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 08 May 2007 03:23:38 +0000
parents efbe682933f7
children 2d2c2913548b
files finch/gntplugin.c finch/gntprefs.c
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntplugin.c	Tue May 08 03:18:55 2007 +0000
+++ b/finch/gntplugin.c	Tue May 08 03:23:38 2007 +0000
@@ -105,6 +105,20 @@
 {
 	PurplePlugin *plugin = current;
 	char *text;
+	GList *list = NULL, *iter = NULL;
+
+	/* If the selected plugin was unseen before, mark it as seen. But save the list
+	 * only when the plugin list is closed. So if the user enables a plugin, and it
+	 * crashes, it won't get marked as seen so the user can fix the bug and still
+	 * quickly find the plugin in the list.
+	 * I probably mean 'plugin developers' by 'users' here. */
+	list = g_object_get_data(G_OBJECT(widget), "seen-list");
+	if (list)
+		iter = g_list_find_custom(list, plugin->path, (GCompareFunc)strcmp);
+	if (!iter) {
+		list = g_list_prepend(list, g_strdup(plugin->path));
+		g_object_set_data(G_OBJECT(widget), "seen-list", list);
+	}
 
 	/* XXX: Use formatting and stuff */
 	gnt_text_view_clear(GNT_TEXT_VIEW(plugins.aboot));
@@ -121,6 +135,11 @@
 static void
 reset_plugin_window(GntWidget *window, gpointer null)
 {
+	GList *list = g_object_get_data(G_OBJECT(plugins.tree), "seen-list");
+	purple_prefs_set_path_list("/finch/plugins/seen", list);
+	g_list_foreach(list, (GFunc)g_free, NULL);
+	g_list_free(list);
+
 	plugins.window = NULL;
 	plugins.tree = NULL;
 	plugins.aboot = NULL;
@@ -214,6 +233,8 @@
 {
 	GntWidget *window, *tree, *box, *aboot, *button;
 	GList *iter;
+	GList *seen;
+
 	if (plugins.window)
 		return;
 
@@ -244,6 +265,7 @@
 	gnt_widget_set_size(aboot, 40, 20);
 	gnt_box_add_widget(GNT_BOX(box), aboot);
 
+	seen = purple_prefs_get_path_list("/finch/plugins/seen");
 	for (iter = purple_plugins_get_all(); iter; iter = iter->next)
 	{
 		PurplePlugin *plug = iter->data;
@@ -256,10 +278,13 @@
 		gnt_tree_add_choice(GNT_TREE(tree), plug,
 				gnt_tree_create_row(GNT_TREE(tree), plug->info->name), NULL, NULL);
 		gnt_tree_set_choice(GNT_TREE(tree), plug, purple_plugin_is_loaded(plug));
+		if (!g_list_find_custom(seen, plug->path, (GCompareFunc)strcmp))
+			gnt_tree_set_row_flags(GNT_TREE(tree), plug, GNT_TEXT_FLAG_BOLD);
 	}
 	gnt_tree_set_col_width(GNT_TREE(tree), 0, 30);
 	g_signal_connect(G_OBJECT(tree), "toggled", G_CALLBACK(plugin_toggled_cb), NULL);
 	g_signal_connect(G_OBJECT(tree), "selection_changed", G_CALLBACK(selection_changed), NULL);
+	g_object_set_data(G_OBJECT(tree), "seen-list", seen);
 
 	box = gnt_hbox_new(FALSE);
 	gnt_box_add_widget(GNT_BOX(window), box);
--- a/finch/gntprefs.c	Tue May 08 03:18:55 2007 +0000
+++ b/finch/gntprefs.c	Tue May 08 03:23:38 2007 +0000
@@ -39,6 +39,7 @@
 
 	purple_prefs_add_none("/finch/plugins");
 	purple_prefs_add_path_list("/finch/plugins/loaded", NULL);
+	purple_prefs_add_path_list("/finch/plugins/seen", NULL);
 
 	purple_prefs_add_none("/finch/conversations");
 	purple_prefs_add_bool("/finch/conversations/timestamps", TRUE);