| 476 |
475 |
| 477 /* Load the image. */ |
476 /* Load the image. */ |
| 478 proto_name = prpl_info->list_icon(NULL, NULL); |
477 proto_name = prpl_info->list_icon(NULL, NULL); |
| 479 g_snprintf(buf, sizeof(buf), "%s.png", proto_name); |
478 g_snprintf(buf, sizeof(buf), "%s.png", proto_name); |
| 480 |
479 |
| 481 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", |
480 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
| 482 "default", buf, NULL); |
481 "16", buf, NULL); |
| 483 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
482 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
| 484 g_free(filename); |
483 g_free(filename); |
| 485 |
484 |
| 486 if (pixbuf != NULL) { |
485 if (pixbuf) { |
| 487 /* Scale and insert the image */ |
486 image = gtk_image_new_from_pixbuf(pixbuf); |
| 488 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
|
| 489 GDK_INTERP_BILINEAR); |
|
| 490 image = gtk_image_new_from_pixbuf(scale); |
|
| 491 |
487 |
| 492 g_object_unref(G_OBJECT(pixbuf)); |
488 g_object_unref(G_OBJECT(pixbuf)); |
| 493 g_object_unref(G_OBJECT(scale)); |
|
| 494 } |
489 } |
| 495 else |
490 else |
| 496 image = gtk_image_new(); |
491 image = gtk_image_new(); |
| 497 |
492 |
| 498 gtk_size_group_add_widget(sg, image); |
493 gtk_size_group_add_widget(sg, image); |
| 620 /* Load the image. */ |
614 /* Load the image. */ |
| 621 if (prpl_info != NULL) { |
615 if (prpl_info != NULL) { |
| 622 proto_name = prpl_info->list_icon(account, NULL); |
616 proto_name = prpl_info->list_icon(account, NULL); |
| 623 g_snprintf(buf, sizeof(buf), "%s.png", proto_name); |
617 g_snprintf(buf, sizeof(buf), "%s.png", proto_name); |
| 624 |
618 |
| 625 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", |
619 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
| 626 "default", buf, NULL); |
620 "16", buf, NULL); |
| 627 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
621 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
| 628 g_free(filename); |
622 g_free(filename); |
| 629 |
623 |
| 630 if (pixbuf != NULL) { |
624 if (pixbuf != NULL) { |
| 631 /* Scale and insert the image */ |
|
| 632 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, |
|
| 633 GDK_INTERP_BILINEAR); |
|
| 634 |
|
| 635 if (gaim_account_is_disconnected(account) && show_all && |
625 if (gaim_account_is_disconnected(account) && show_all && |
| 636 gaim_connections_get_all()) |
626 gaim_connections_get_all()) |
| 637 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0.0, FALSE); |
627 gdk_pixbuf_saturate_and_pixelate(pixbuf, pixbuf, 0.0, FALSE); |
| 638 |
628 |
| 639 image = gtk_image_new_from_pixbuf(scale); |
629 image = gtk_image_new_from_pixbuf(pixbuf); |
| 640 |
630 |
| 641 g_object_unref(G_OBJECT(pixbuf)); |
631 g_object_unref(G_OBJECT(pixbuf)); |
| 642 g_object_unref(G_OBJECT(scale)); |
|
| 643 } |
632 } |
| 644 else |
633 else |
| 645 image = gtk_image_new(); |
634 image = gtk_image_new(); |
| 646 } |
635 } |
| 647 else |
636 else |
| 1541 if(*height > 100) |
1530 if(*height > 100) |
| 1542 *height = 100; |
1531 *height = 100; |
| 1543 } |
1532 } |
| 1544 |
1533 |
| 1545 GdkPixbuf * |
1534 GdkPixbuf * |
| 1546 gaim_gtk_create_prpl_icon(GaimAccount *account, double scale_factor) |
1535 gaim_gtk_create_prpl_icon(GaimAccount *account, PidginPrplIconSize size) |
| 1547 { |
1536 { |
| 1548 GaimPlugin *prpl; |
1537 GaimPlugin *prpl; |
| 1549 GaimPluginProtocolInfo *prpl_info; |
1538 GaimPluginProtocolInfo *prpl_info; |
| 1550 const char *protoname = NULL; |
1539 const char *protoname = NULL; |
| 1551 char buf[256]; /* TODO: We should use a define for max file length */ |
1540 char buf[256]; /* TODO: We should use a define for max file length */ |
| 1552 char *filename = NULL; |
1541 char *filename = NULL; |
| 1553 GdkPixbuf *pixbuf, *scaled; |
1542 GdkPixbuf *pixbuf; |
| 1554 |
1543 |
| 1555 g_return_val_if_fail(account != NULL, NULL); |
1544 g_return_val_if_fail(account != NULL, NULL); |
| 1556 |
1545 |
| 1557 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
1546 prpl = gaim_find_prpl(gaim_account_get_protocol_id(account)); |
| 1558 if (prpl == NULL) |
1547 if (prpl == NULL) |
| 1570 * Status icons will be themeable too, and then it will look up |
1559 * Status icons will be themeable too, and then it will look up |
| 1571 * protoname from the theme |
1560 * protoname from the theme |
| 1572 */ |
1561 */ |
| 1573 g_snprintf(buf, sizeof(buf), "%s.png", protoname); |
1562 g_snprintf(buf, sizeof(buf), "%s.png", protoname); |
| 1574 |
1563 |
| 1575 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", |
1564 filename = g_build_filename(DATADIR, "pixmaps", "pidgin", "protocols", |
| 1576 "default", buf, NULL); |
1565 size == PIDGIN_PRPL_ICON_SMALL ? "16" : |
| |
1566 size == PIDGIN_PRPL_ICON_MEDIUM ? "22" : "48", |
| |
1567 buf, NULL); |
| 1577 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
1568 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
| 1578 g_free(filename); |
1569 g_free(filename); |
| 1579 |
1570 |
| 1580 scaled = gdk_pixbuf_scale_simple(pixbuf, 32*scale_factor, |
1571 return pixbuf; |
| 1581 32*scale_factor, GDK_INTERP_BILINEAR); |
|
| 1582 g_object_unref(pixbuf); |
|
| 1583 |
|
| 1584 return scaled; |
|
| 1585 } |
1572 } |
| 1586 |
1573 |
| 1587 static GdkPixbuf * |
1574 static GdkPixbuf * |
| 1588 overlay_status_onto_icon(GdkPixbuf *pixbuf, GaimStatusPrimitive primitive) |
1575 overlay_status_onto_icon(GdkPixbuf *pixbuf, GaimStatusPrimitive primitive) |
| 1589 { |
1576 { |
| 2948 GCallback callback; |
2935 GCallback callback; |
| 2949 char *primary_esc, *secondary_esc; |
2936 char *primary_esc, *secondary_esc; |
| 2950 va_list args; |
2937 va_list args; |
| 2951 static gboolean first_call = TRUE; |
2938 static gboolean first_call = TRUE; |
| 2952 |
2939 |
| 2953 img = gtk_image_new_from_stock(icon_name, GTK_ICON_SIZE_BUTTON); |
2940 img = gtk_image_new_from_stock(icon_name, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL)); |
| 2954 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
2941 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
| 2955 |
2942 |
| 2956 vbox = gtk_vbox_new(FALSE,0); |
2943 vbox = gtk_vbox_new(FALSE,0); |
| 2957 gtk_container_set_border_width(GTK_CONTAINER(vbox), GAIM_HIG_BOX_SPACE); |
2944 gtk_container_set_border_width(GTK_CONTAINER(vbox), GAIM_HIG_BOX_SPACE); |
| 2958 |
2945 |