diff src/gtkplugin.c @ 12695:0bc110c7ab91

[gaim-migrate @ 15038] Let's display outdated plugins in the plugins dialog, but grey them out. This way, the user can find out which plugins need to be updated. They will also be able to view the website address so they know where to get a new version. Inspired by SF Feature Request #1395058 from Daniel Beardsmore (uilleann). committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 03 Jan 2006 12:03:02 +0000
parents e856f985a0b9
children ba7834d6e2c9
line wrap: on
line diff
--- a/src/gtkplugin.c	Tue Jan 03 11:42:51 2006 +0000
+++ b/src/gtkplugin.c	Tue Jan 03 12:03:02 2006 +0000
@@ -130,7 +130,9 @@
 		gtk_list_store_set(ls, &iter,
 				   0, gaim_plugin_is_loaded(plug),
 				   1, desc,
-				   2, plug, -1);
+				   2, plug,
+				   3, gaim_plugin_is_unloadable(plug),
+				   -1);
 		g_free(desc);
 	}
 }
@@ -159,14 +161,19 @@
 	gchar buf[1024];
 	gchar *name = NULL, *description = NULL;
 	GtkWidget *dialog = NULL;
-
-	GdkCursor *wait = gdk_cursor_new (GDK_WATCH);
-	gdk_window_set_cursor(plugin_dialog->window, wait);
-	gdk_cursor_unref(wait);
+	GdkCursor *wait;
 
 	gtk_tree_model_get_iter (model, &iter, path);
 	gtk_tree_model_get (model, &iter, 2, &plug, -1);
 
+	/* Apparently, GTK+ won't honor the sensitive flag on cell renderers for booleans. */
+	if (gaim_plugin_is_unloadable(plug))
+		return;
+
+	wait = gdk_cursor_new (GDK_WATCH);
+	gdk_window_set_cursor(plugin_dialog->window, wait);
+	gdk_cursor_unref(wait);
+
 	if (!gaim_plugin_is_loaded(plug))
 		gaim_plugin_load(plug);
 	else {
@@ -273,6 +280,16 @@
 		   pdesc ? pdesc : "", pdesc ? "\n\n" : "",
 		   pauth ? pauth : "", pweb ? pweb : "", plug->path);
 
+	if (plug->error != NULL)
+	{
+		char *tmp = g_strdup_printf(
+			_("%s\n"
+			  "<span foreground=\"#ff0000\" weight=\"bold\">Error: %s</span>"),
+			buf, plug->error);
+		g_free(buf);
+		buf = tmp;
+	}
+
 	gtk_widget_set_sensitive(pref_button,
 		gaim_plugin_is_loaded(plug)
 		&& ((GAIM_IS_GTK_PLUGIN(plug) && plug->info->ui_info
@@ -399,7 +416,7 @@
 
 	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(plugin_dialog)->vbox), sw, TRUE, TRUE, 0);
 
-	ls = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
+	ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
 	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls),
 					     1, GTK_SORT_ASCENDING);
 
@@ -423,9 +440,13 @@
 			  G_CALLBACK(plugin_load), ls);
 
 	rendt = gtk_cell_renderer_text_new();
+	g_object_set(rendt,
+		     "foreground", "#c0c0c0",
+		     NULL);
 	col = gtk_tree_view_column_new_with_attributes (_("Name"),
 							rendt,
 							"markup", 1,
+							"foreground-set", 3,
 							NULL);
 #if GTK_CHECK_VERSION(2,6,0)
 	gtk_tree_view_column_set_expand (col, TRUE);