diff finch/gntplugin.c @ 17322:253155592cd5

merge of 'e39985139f646da2edf8d287dd521e2fce8c3cb2' and 'ff39939277122047daad77a5941cd085ca559d59'
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Thu, 31 May 2007 03:06:46 +0000
parents a924c94ce5da
children 7be04c20bf22
line wrap: on
line diff
--- a/finch/gntplugin.c	Thu May 31 03:06:38 2007 +0000
+++ b/finch/gntplugin.c	Thu May 31 03:06:46 2007 +0000
@@ -67,11 +67,10 @@
 static void
 plugin_toggled_cb(GntWidget *tree, PurplePlugin *plugin, gpointer null)
 {
-	/* TODO: Mark these strings for translation after the freeze */
 	if (gnt_tree_get_choice(GNT_TREE(tree), plugin))
 	{
 		if (!purple_plugin_load(plugin)) {
-			purple_notify_error(NULL, "ERROR", "loading plugin failed", NULL);
+			purple_notify_error(NULL, _("ERROR"), _("loading plugin failed"), NULL);
 			gnt_tree_set_choice(GNT_TREE(tree), plugin, FALSE);
 		}
 	}
@@ -80,7 +79,7 @@
 		GntWidget *win;
 
 		if (!purple_plugin_unload(plugin)) {
-			purple_notify_error(NULL, "ERROR", "unloading plugin failed", NULL);
+			purple_notify_error(NULL, _("ERROR"), _("unloading plugin failed"), NULL);
 			gnt_tree_set_choice(GNT_TREE(tree), plugin, TRUE);
 		}
 
@@ -105,6 +104,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 +134,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 +232,8 @@
 {
 	GntWidget *window, *tree, *box, *aboot, *button;
 	GList *iter;
+	GList *seen;
+
 	if (plugins.window)
 		return;
 
@@ -244,6 +264,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 +277,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);