| 354 { |
354 { |
| 355 GtkStyle *style; |
355 GtkStyle *style; |
| 356 GdkPixbuf *pixbuf = gaim_gtk_blist_get_status_icon(b, GAIM_STATUS_ICON_LARGE); |
356 GdkPixbuf *pixbuf = gaim_gtk_blist_get_status_icon(b, GAIM_STATUS_ICON_LARGE); |
| 357 PangoLayout *layout; |
357 PangoLayout *layout; |
| 358 char *tooltiptext = gaim_get_tooltip_text(b); |
358 char *tooltiptext = gaim_get_tooltip_text(b); |
| 359 int width; |
|
| 360 |
359 |
| 361 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL); |
360 layout = gtk_widget_create_pango_layout (gtkblist->tipwindow, NULL); |
| 362 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext)); |
361 pango_layout_set_markup(layout, tooltiptext, strlen(tooltiptext)); |
| 363 pango_layout_set_wrap(layout, PANGO_WRAP_WORD); |
362 pango_layout_set_wrap(layout, PANGO_WRAP_WORD); |
| 364 pango_layout_set_width(layout, 300000); |
363 pango_layout_set_width(layout, 300000); |
| 571 b->alias && b->alias[0] ? "\n" : "", b->alias && b->alias[0] ? _("<b>Alias:</b> ") : "", b->alias ? b->alias : "", |
570 b->alias && b->alias[0] ? "\n" : "", b->alias && b->alias[0] ? _("<b>Alias:</b> ") : "", b->alias ? b->alias : "", |
| 572 b->server_alias ? "\n" : "", b->server_alias ? _("<b>Nickname:</b> ") : "", b->server_alias ? b->server_alias : "", |
571 b->server_alias ? "\n" : "", b->server_alias ? _("<b>Nickname:</b> ") : "", b->server_alias ? b->server_alias : "", |
| 573 b->idle ? "\n" : "", b->idle ? idletime : "", |
572 b->idle ? "\n" : "", b->idle ? idletime : "", |
| 574 b->evil ? "\n" : "", b->evil ? warning : "", |
573 b->evil ? "\n" : "", b->evil ? warning : "", |
| 575 statustext ? "\n" : "", statustext ? statustext : ""); |
574 statustext ? "\n" : "", statustext ? statustext : ""); |
| |
575 if(warning) |
| |
576 g_free(warning); |
| |
577 if(idletime) |
| |
578 g_free(idletime); |
| |
579 if(statustext) |
| |
580 g_free(statustext); |
| |
581 |
| 576 return text; |
582 return text; |
| 577 |
583 |
| 578 } |
584 } |
| 579 |
585 |
| 580 static GdkPixbuf *gaim_gtk_blist_get_status_icon(struct buddy *b, GaimStatusIconSize size) |
586 static GdkPixbuf *gaim_gtk_blist_get_status_icon(struct buddy *b, GaimStatusIconSize size) |
| 581 { |
587 { |
| 582 GdkPixbuf *status = NULL; |
588 GdkPixbuf *status = NULL; |
| 583 GdkPixbuf *scale = NULL; |
589 GdkPixbuf *scale = NULL; |
| 584 GdkPixbuf *emblem = NULL; |
590 GdkPixbuf *emblem = NULL; |
| 585 gchar *filename = NULL; |
591 gchar *filename = NULL; |
| 586 const char *protoname = NULL; |
592 const char *protoname = NULL; |
| 587 |
593 |
| 588 char *se = NULL, *sw = NULL ,*nw = NULL ,*ne = NULL; |
594 char *se = NULL, *sw = NULL ,*nw = NULL ,*ne = NULL; |
| 589 |
595 |
| 590 int scalesize = 30; |
596 int scalesize = 30; |
| 591 |
597 |
| 592 struct prpl* prpl = find_prpl(b->account->protocol); |
598 struct prpl* prpl = find_prpl(b->account->protocol); |
| 593 if (prpl->list_icon) |
599 if (prpl->list_icon) |
| 594 protoname = prpl->list_icon(b->account, b); |
600 protoname = prpl->list_icon(b->account, b); |
| 595 if (prpl->list_emblems) |
601 if (prpl->list_emblems) |
| 596 prpl->list_emblems(b, &se, &sw, &nw, &ne); |
602 prpl->list_emblems(b, &se, &sw, &nw, &ne); |
| 597 |
603 |
| 598 if (size == GAIM_STATUS_ICON_SMALL) { |
604 if (size == GAIM_STATUS_ICON_SMALL) { |
| 599 scalesize = 15; |
605 scalesize = 15; |
| 600 sw = nw = ne = NULL; /* So that only the se icon will composite */ |
606 sw = nw = ne = NULL; /* So that only the se icon will composite */ |
| 601 } |
607 } |
| 602 |
608 |
| 610 g_free(filename); |
616 g_free(filename); |
| 611 |
617 |
| 612 gtknode = GAIM_GTK_BLIST_NODE((GaimBlistNode*)b); |
618 gtknode = GAIM_GTK_BLIST_NODE((GaimBlistNode*)b); |
| 613 gtknode->timer = g_timeout_add(10000, (GSourceFunc)gaim_reset_present_icon, b); |
619 gtknode->timer = g_timeout_add(10000, (GSourceFunc)gaim_reset_present_icon, b); |
| 614 |
620 |
| 615 /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and |
621 /* "Hey, what's all this crap?" you ask. Status icons will be themeable too, and |
| 616 then it will look up protoname from the theme */ |
622 then it will look up protoname from the theme */ |
| 617 } else { |
623 } else { |
| 618 char *image = g_strdup_printf("%s.png", protoname); |
624 char *image = g_strdup_printf("%s.png", protoname); |
| 619 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
625 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
| 620 status = gdk_pixbuf_new_from_file(filename,NULL); |
626 status = gdk_pixbuf_new_from_file(filename,NULL); |
| 621 g_free(image); |
627 g_free(image); |
| 622 g_free(filename); |
628 g_free(filename); |
| 623 |
629 |
| 624 } |
630 } |
| 625 |
631 |
| 626 if (!status) |
632 if (!status) |
| 627 return NULL; |
633 return NULL; |
| 628 |
634 |
| 629 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize, GDK_INTERP_BILINEAR); |
635 scale = gdk_pixbuf_scale_simple(status, scalesize, scalesize, GDK_INTERP_BILINEAR); |
| 630 |
636 |
| |
637 g_object_unref(G_OBJECT(status)); |
| |
638 |
| 631 /* Emblems */ |
639 /* Emblems */ |
| 632 |
640 |
| 633 /* Each protocol can specify up to four "emblems" to composite over the base icon. "away", "busy", "mobile user" |
641 /* Each protocol can specify up to four "emblems" to composite over the base icon. "away", "busy", "mobile user" |
| 634 * are all examples of states represented by emblems. I'm not even really sure I like this yet. */ |
642 * are all examples of states represented by emblems. I'm not even really sure I like this yet. */ |
| 635 |
643 |
| 636 /* XXX Clean this crap up, yo. */ |
644 /* XXX Clean this crap up, yo. */ |
| 637 if (se) { |
645 if (se) { |
| 638 char *image = g_strdup_printf("%s.png", se); |
646 char *image = g_strdup_printf("%s.png", se); |
| 639 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
647 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
| 640 g_free(image); |
648 g_free(image); |
| 655 15, 15, |
663 15, 15, |
| 656 0, 0, |
664 0, 0, |
| 657 1, 1, |
665 1, 1, |
| 658 GDK_INTERP_BILINEAR, |
666 GDK_INTERP_BILINEAR, |
| 659 255); |
667 255); |
| |
668 g_object_unref(G_OBJECT(emblem)); |
| 660 } |
669 } |
| 661 } |
670 } |
| 662 if (sw) { |
671 if (sw) { |
| 663 char *image = g_strdup_printf("%s.png", sw); |
672 char *image = g_strdup_printf("%s.png", sw); |
| 664 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
673 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
| 665 g_free(image); |
674 g_free(image); |
| 666 emblem = gdk_pixbuf_new_from_file(filename,NULL); |
675 emblem = gdk_pixbuf_new_from_file(filename,NULL); |
| 667 g_free(filename); |
676 g_free(filename); |
| 668 if (emblem) { |
677 if (emblem) { |
| 669 gdk_pixbuf_composite (emblem, |
678 gdk_pixbuf_composite (emblem, |
| 670 scale, 0, 15, |
679 scale, 0, 15, |
| 671 15, 15, |
680 15, 15, |
| 672 0, 15, |
681 0, 15, |
| 673 1, 1, |
682 1, 1, |
| 674 GDK_INTERP_BILINEAR, |
683 GDK_INTERP_BILINEAR, |
| 675 255); |
684 255); |
| |
685 g_object_unref(G_OBJECT(emblem)); |
| 676 } |
686 } |
| 677 } |
687 } |
| 678 if (nw) { |
688 if (nw) { |
| 679 char *image = g_strdup_printf("%s.png", nw); |
689 char *image = g_strdup_printf("%s.png", nw); |
| 680 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
690 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", image, NULL); |
| 704 15, 0, |
715 15, 0, |
| 705 1, 1, |
716 1, 1, |
| 706 GDK_INTERP_BILINEAR, |
717 GDK_INTERP_BILINEAR, |
| 707 255); |
718 255); |
| 708 } |
719 } |
| 709 } |
720 } |
| 710 |
721 |
| 711 |
722 |
| 712 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */ |
723 /* Idle grey buddies affects the whole row. This converts the status icon to greyscale. */ |
| 713 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) |
724 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) |
| 714 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0, FALSE); |
725 gdk_pixbuf_saturate_and_pixelate(scale, scale, 0, FALSE); |
| 715 return scale; |
726 return scale; |
| 716 } |
727 } |
| 717 |
728 |
| 718 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(struct buddy *b) |
729 static GdkPixbuf *gaim_gtk_blist_get_buddy_icon(struct buddy *b) |
| 719 { |
730 { |
| 720 /* This just opens a file from ~/.gaim/icons/screenname. This needs to change to be more gooder. */ |
731 /* This just opens a file from ~/.gaim/icons/screenname. This needs to change to be more gooder. */ |
| 721 char *file = g_build_filename(gaim_user_dir(), "icons", normalize(b->name), NULL); |
732 char *file; |
| 722 GdkPixbuf *buf = gdk_pixbuf_new_from_file(file, NULL); |
733 GdkPixbuf *buf, *ret; |
| 723 |
734 |
| 724 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) |
735 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) |
| 725 return NULL; |
736 return NULL; |
| 726 |
737 |
| |
738 file = g_build_filename(gaim_user_dir(), "icons", normalize(b->name), NULL); |
| |
739 buf = gdk_pixbuf_new_from_file(file, NULL); |
| |
740 g_free(file); |
| |
741 |
| |
742 |
| 727 if (buf) { |
743 if (buf) { |
| 728 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) { |
744 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) { |
| 729 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0, FALSE); |
745 gdk_pixbuf_saturate_and_pixelate(buf, buf, 0, FALSE); |
| 730 } |
746 } |
| 731 return gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR); |
747 ret = gdk_pixbuf_scale_simple(buf,30,30, GDK_INTERP_BILINEAR); |
| |
748 g_object_unref(G_OBJECT(buf)); |
| |
749 return ret; |
| 732 } |
750 } |
| 733 return NULL; |
751 return NULL; |
| 734 } |
752 } |
| 735 |
753 |
| 736 static gchar *gaim_gtk_blist_get_name_markup(struct buddy *b) |
754 static gchar *gaim_gtk_blist_get_name_markup(struct buddy *b) |
| 1089 STATUS_ICON_COLUMN, gtk_widget_render_icon |
1109 STATUS_ICON_COLUMN, gtk_widget_render_icon |
| 1090 (gtkblist->treeview,GTK_STOCK_OPEN,GTK_ICON_SIZE_SMALL_TOOLBAR,NULL), |
1110 (gtkblist->treeview,GTK_STOCK_OPEN,GTK_ICON_SIZE_SMALL_TOOLBAR,NULL), |
| 1091 NAME_COLUMN, mark, |
1111 NAME_COLUMN, mark, |
| 1092 NODE_COLUMN, node->parent, |
1112 NODE_COLUMN, node->parent, |
| 1093 -1); |
1113 -1); |
| |
1114 |
| |
1115 g_free(mark); |
| 1094 |
1116 |
| 1095 expand = TRUE; |
1117 expand = TRUE; |
| 1096 } |
1118 } |
| 1097 |
1119 |
| 1098 oldersibling = node->prev; |
1120 oldersibling = node->prev; |