Mercurial > pidgin.yaz
changeset 16970:a728447e4e72
disapproval of revision '620eb129d63346bbbfe03d4ab019bef4096dd3e5'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Wed, 09 May 2007 18:49:38 +0000 |
parents | 825f0fe66304 |
children | 5143cdd8ad79 84fc71d9241b |
files | pidgin/gtkutils.c |
diffstat | 1 files changed, 33 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkutils.c Wed May 09 02:45:35 2007 +0000 +++ b/pidgin/gtkutils.c Wed May 09 18:49:38 2007 +0000 @@ -442,14 +442,6 @@ item = gtk_menu_get_active(GTK_MENU(menu)); protocol = g_object_get_data(G_OBJECT(item), "protocol"); - - if (!strcmp(protocol, "prpl-fake")) - { - guint index = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(item), "real_index")); - gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), index); - return; - } - user_data = (g_object_get_data(G_OBJECT(optmenu), "user_data")); if (cb != NULL) @@ -457,53 +449,19 @@ user_data); } -static GtkWidget * -pidgin_protocol_option_menu_item(GtkWidget *menu, GtkSizeGroup *sg, GtkWidget *image, - const char *name, const char *id) -{ - GtkWidget *item; - GtkWidget *hbox; - GtkWidget *label; - - /* Create the item. */ - item = gtk_menu_item_new(); - - /* Create the hbox. */ - hbox = gtk_hbox_new(FALSE, 4); - gtk_container_add(GTK_CONTAINER(item), hbox); - gtk_widget_show(hbox); - - gtk_size_group_add_widget(sg, image); - - gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); - gtk_widget_show(image); - - /* Create the label. */ - label = gtk_label_new(name); - gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); - gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); - gtk_widget_show(label); - - g_object_set_data(G_OBJECT(item), "protocol", (gpointer)id); - - gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); - gtk_widget_show(item); - pidgin_set_accessible_label (item, label); - - return item; -} - GtkWidget * pidgin_protocol_option_menu_new(const char *id, GCallback cb, gpointer user_data) { PurplePluginProtocolInfo *prpl_info; PurplePlugin *plugin; + GtkWidget *hbox; + GtkWidget *label; GtkWidget *optmenu; GtkWidget *menu; + GtkWidget *item; + GtkWidget *image; GdkPixbuf *pixbuf; - GtkWidget *image; GList *p; GtkSizeGroup *sg; char *filename; @@ -528,6 +486,14 @@ plugin = (PurplePlugin *)p->data; prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); + /* Create the item. */ + item = gtk_menu_item_new(); + + /* Create the hbox. */ + hbox = gtk_hbox_new(FALSE, 4); + gtk_container_add(GTK_CONTAINER(item), hbox); + gtk_widget_show(hbox); + /* Load the image. */ proto_name = prpl_info->list_icon(NULL, NULL); g_snprintf(buf, sizeof(buf), "%s.png", proto_name); @@ -537,31 +503,34 @@ pixbuf = gdk_pixbuf_new_from_file(filename, NULL); g_free(filename); - if (pixbuf) + if (pixbuf) { image = gtk_image_new_from_pixbuf(pixbuf); + + g_object_unref(G_OBJECT(pixbuf)); + } else image = gtk_image_new(); - pidgin_protocol_option_menu_item(menu, sg, image, plugin->info->name, plugin->info->id); + gtk_size_group_add_widget(sg, image); + + gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); + gtk_widget_show(image); + + /* Create the label. */ + label = gtk_label_new(plugin->info->name); + gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); + gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 0); + gtk_widget_show(label); + + g_object_set_data(G_OBJECT(item), "protocol", plugin->info->id); + + gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); + gtk_widget_show(item); + pidgin_set_accessible_label (item, label); if (id != NULL && !strcmp(plugin->info->id, id)) selected_index = i; - - if (!strcmp(plugin->info->id, "prpl-jabber")) - { - GtkWidget *gtalk_item; - 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 (XMPP)"), "prpl-fake"); - g_object_set_data(G_OBJECT(gtalk_item), "real_index", GUINT_TO_POINTER(i)); - i++; - } - - if (pixbuf) - g_object_unref(G_OBJECT(pixbuf)); } gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);