changeset 17057:bc16e00f1f7d

Sort Google Talk appropriately.
author Richard Laager <rlaager@wiktel.com>
date Sat, 12 May 2007 02:40:59 +0000
parents 413c957e7c44
children ce02eb521787
files pidgin/gtkutils.c
diffstat 1 files changed, 30 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkutils.c	Fri May 11 20:10:43 2007 +0000
+++ b/pidgin/gtkutils.c	Sat May 12 02:40:59 2007 +0000
@@ -510,6 +510,7 @@
 	const char *proto_name;
 	char buf[256];
 	int i, selected_index = -1;
+	char *gtalk_name = g_strdup(_("Google Talk"));
 
 	optmenu = gtk_option_menu_new();
 	gtk_widget_show(optmenu);
@@ -528,6 +529,29 @@
 		plugin = (PurplePlugin *)p->data;
 		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin);
 
+		if (gtalk_name && strcmp(gtalk_name, plugin->info->name) < 0)
+		{
+			GtkWidget *gtalk_item;
+
+			filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols",
+			                            "16", "google-talk.png", NULL);
+			pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+			g_free(filename);
+
+
+			if (pixbuf)
+				image = gtk_image_new_from_pixbuf(pixbuf);
+			else
+				image = gtk_image_new();
+
+			gtalk_item = pidgin_protocol_option_menu_item(menu, sg, image, gtalk_name, "prpl-fake");
+			g_object_set_data(G_OBJECT(gtalk_item), "real_protocol", plugin->info->id);
+			i++;
+
+			g_free(gtalk_name);
+			gtalk_name = NULL;
+		}
+
 		/* Load the image. */
 		proto_name = prpl_info->list_icon(NULL, NULL);
 		g_snprintf(buf, sizeof(buf), "%s.png", proto_name);
@@ -555,30 +579,16 @@
 			g_object_set_data(G_OBJECT(optmenu), "last_protocol", plugin->info->id);
 		}
 
-		if (!strcmp(plugin->info->id, "prpl-jabber"))
-		{
-			GtkWidget *gtalk_item;
-
-			filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols",
-			                            "16", "google-talk.png", NULL);
-			pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
-			g_free(filename);
-
-
-			if (pixbuf)
-				image = gtk_image_new_from_pixbuf(pixbuf);
-			else
-				image = gtk_image_new();
-
-			gtalk_item = pidgin_protocol_option_menu_item(menu, sg, image, _("Google Talk"), "prpl-fake");
-			g_object_set_data(G_OBJECT(gtalk_item), "real_protocol", plugin->info->id);
-			i++;
-		}
-
 		if (pixbuf)
 			g_object_unref(G_OBJECT(pixbuf));
 	}
 
+	/* This is only needed if Pidgin has zero prpls compiled in, but
+	 * I'm doing it because it's proper and might make a difference
+	 * for automated source checkers. */
+	g_free(gtalk_name);
+
+
 	gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
 
 	if (selected_index != -1)