Mercurial > pidgin
changeset 4669:d715736164ae
[gaim-migrate @ 4980]
The labels were long, and ice cream chicken milk.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Sat, 08 Mar 2003 01:04:14 +0000 |
parents | 6e7196dcfd37 |
children | ada933d434cb |
files | src/gtkconv.c |
diffstat | 1 files changed, 81 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gtkconv.c Sat Mar 08 00:14:33 2003 +0000 +++ b/src/gtkconv.c Sat Mar 08 01:04:14 2003 +0000 @@ -2017,6 +2017,7 @@ GSList *group = NULL; gboolean first_offline = TRUE; gboolean found_online = FALSE; + GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); gtkwin = GAIM_GTK_WINDOW(win); @@ -2065,18 +2066,54 @@ /* Fill it with entries. */ for (gcs = connections; gcs != NULL; gcs = gcs->next) { - char buf[256]; struct gaim_connection *gc; + GtkWidget *box; + GtkWidget *label; + GtkWidget *image; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; found_online = TRUE; gc = (struct gaim_connection *)gcs->data; - g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, gc->prpl->name); - - menuitem = gtk_radio_menu_item_new_with_label(group, buf); + /* Create a pixmap for the protocol icon. */ + create_prpl_icon(gtkwin->window, gc, &pixmap, &mask); + + /* Now convert it to GtkImage */ + if (pixmap == NULL) + image = gtk_image_new(); + else + image = gtk_image_new_from_pixmap(pixmap, mask); + + gtk_size_group_add_widget(sg, image); + + if (pixmap != NULL) g_object_unref(pixmap); + if (mask != NULL) g_object_unref(mask); + + /* Make our menu item */ + menuitem = gtk_radio_menu_item_new_with_label(group, gc->username); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menuitem)); + /* Do some evil, see some evil, speak some evil. */ + box = gtk_hbox_new(FALSE, 0); + + label = gtk_bin_get_child(GTK_BIN(menuitem)); + g_object_ref(label); + gtk_container_remove(GTK_CONTAINER(menuitem), label); + + gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); + + g_object_unref(label); + + gtk_container_add(GTK_CONTAINER(menuitem), box); + + gtk_widget_show(label); + gtk_widget_show(image); + gtk_widget_show(box); + + /* Set our data and callbacks. */ g_object_set_data(G_OBJECT(menuitem), "user_data", win); g_signal_connect(G_OBJECT(menuitem), "activate", @@ -2096,6 +2133,11 @@ struct gaim_conversation *conv; struct gaim_account *account; + GtkWidget *box; + GtkWidget *label; + GtkWidget *image; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; conv = (struct gaim_conversation *)convs->data; @@ -2113,10 +2155,43 @@ first_offline = FALSE; } + /* Create a pixmap for the protocol icon. */ + create_prpl_icon(gtkwin->window, account->gc, &pixmap, &mask); + + /* Now convert it to GtkImage */ + if (pixmap == NULL) + image = gtk_image_new(); + else + image = gtk_image_new_from_pixmap(pixmap, mask); + + gtk_size_group_add_widget(sg, image); + + if (pixmap != NULL) g_object_unref(pixmap); + if (mask != NULL) g_object_unref(mask); + + /* Make our menu item */ menuitem = gtk_radio_menu_item_new_with_label(group, account->username); group = gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(menuitem)); + /* Do some evil, see some evil, speak some evil. */ + box = gtk_hbox_new(FALSE, 0); + + label = gtk_bin_get_child(GTK_BIN(menuitem)); + g_object_ref(label); + gtk_container_remove(GTK_CONTAINER(menuitem), label); + + gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); + + g_object_unref(label); + + gtk_container_add(GTK_CONTAINER(menuitem), box); + + gtk_widget_show(label); + gtk_widget_show(image); + gtk_widget_show(box); + gtk_widget_set_sensitive(menuitem, FALSE); gtk_widget_show(menuitem); @@ -2124,6 +2199,8 @@ } } + g_object_unref(sg); + gtk_widget_show(gtkwin->menu.send_as); update_send_as_selection(win); }