Mercurial > pidgin.yaz
comparison src/gtkutils.c @ 5646:48c63ee49961
[gaim-migrate @ 6060]
The protocol drop-down menu now has protocol icons.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Mon, 02 Jun 2003 03:52:43 +0000 |
parents | 213e999fa5cc |
children | 6e551616d051 |
comparison
equal
deleted
inserted
replaced
5645:a9cd11fd0d6f | 5646:48c63ee49961 |
---|---|
530 GaimPluginProtocolInfo *prpl_info; | 530 GaimPluginProtocolInfo *prpl_info; |
531 GaimPlugin *plugin; | 531 GaimPlugin *plugin; |
532 GtkWidget *optmenu; | 532 GtkWidget *optmenu; |
533 GtkWidget *menu; | 533 GtkWidget *menu; |
534 GtkWidget *item; | 534 GtkWidget *item; |
535 GtkWidget *image; | |
536 GdkPixbuf *pixbuf; | |
537 GdkPixbuf *scale; | |
535 GList *p; | 538 GList *p; |
536 int i; | 539 char *filename; |
537 int selected_index = -1; | 540 const char *proto_name; |
541 char buf[256]; | |
542 int i, selected_index = -1; | |
538 | 543 |
539 optmenu = gtk_option_menu_new(); | 544 optmenu = gtk_option_menu_new(); |
540 gtk_widget_show(optmenu); | 545 gtk_widget_show(optmenu); |
541 | 546 |
542 menu = gtk_menu_new(); | 547 menu = gtk_menu_new(); |
547 p = p->next, i++) { | 552 p = p->next, i++) { |
548 | 553 |
549 plugin = (GaimPlugin *)p->data; | 554 plugin = (GaimPlugin *)p->data; |
550 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); | 555 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plugin); |
551 | 556 |
552 item = gtk_menu_item_new_with_label(plugin->info->name); | 557 /* Create the item. */ |
558 item = gtk_image_menu_item_new_with_label(plugin->info->name); | |
559 | |
560 /* Load the image. */ | |
561 proto_name = prpl_info->list_icon(NULL, NULL); | |
562 g_snprintf(buf, sizeof(buf), "%s.png", proto_name); | |
563 | |
564 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", | |
565 "default", buf, NULL); | |
566 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | |
567 g_free(filename); | |
568 | |
569 if (pixbuf != NULL) { | |
570 /* Scale and insert the image */ | |
571 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, | |
572 GDK_INTERP_BILINEAR); | |
573 image = gtk_image_new_from_pixbuf(scale); | |
574 g_object_unref(G_OBJECT(pixbuf)); | |
575 g_object_unref(G_OBJECT(scale)); | |
576 gtk_widget_show(image); | |
577 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(item), image); | |
578 } | |
553 | 579 |
554 g_object_set_data(G_OBJECT(item), "user_data", user_data); | 580 g_object_set_data(G_OBJECT(item), "user_data", user_data); |
555 | 581 |
556 g_signal_connect(G_OBJECT(item), "activate", | 582 g_signal_connect(G_OBJECT(item), "activate", |
557 cb, GINT_TO_POINTER(prpl_info->protocol)); | 583 cb, GINT_TO_POINTER(prpl_info->protocol)); |