comparison src/buddy.c @ 4757:c4ebe1a8484b

[gaim-migrate @ 5074] this fixes a bunch of little things, as well as a few big things, plugs a few leaks, and makes the new buddy icon cache stuff much cooler. enjoy! committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 14 Mar 2003 01:14:24 +0000
parents 54fbd9769677
children 2202f056a1c9
comparison
equal deleted inserted replaced
4756:85637881b342 4757:c4ebe1a8484b
733 GdkPixbuf *buf, *ret; 733 GdkPixbuf *buf, *ret;
734 734
735 if (!(blist_options & OPT_BLIST_SHOW_ICONS)) 735 if (!(blist_options & OPT_BLIST_SHOW_ICONS))
736 return NULL; 736 return NULL;
737 737
738 file = g_build_filename(gaim_user_dir(), "icons", normalize(b->name), NULL); 738 if ((file = gaim_buddy_get_setting(b, "buddy_icon")) == NULL)
739 return NULL;
740
739 buf = gdk_pixbuf_new_from_file(file, NULL); 741 buf = gdk_pixbuf_new_from_file(file, NULL);
740 g_free(file); 742 g_free(file);
741 743
742 744
743 if (buf) { 745 if (buf) {
781 if (prpl->status_text) { 783 if (prpl->status_text) {
782 char *tmp = prpl->status_text(b); 784 char *tmp = prpl->status_text(b);
783 785
784 if(tmp) { 786 if(tmp) {
785 if(strlen(tmp) > 20) 787 if(strlen(tmp) > 20)
786 statustext = g_strdup_printf("%.16s...", tmp); 788 statustext = g_strdup_printf("%.20s... ", tmp);
787 else 789 else
788 statustext = g_strdup(tmp); 790 statustext = g_strdup_printf("%s ", tmp);
789 g_free(tmp); 791 g_free(tmp);
790 } 792 }
791 } 793 }
792 794
793 if (b->idle) { 795 if (b->idle) {
794 if (ihrs) 796 if (ihrs)
795 idletime = g_strdup_printf(_("Idle (%dh%02dm)"), ihrs, imin); 797 idletime = g_strdup_printf(_("Idle (%dh%02dm) "), ihrs, imin);
796 else 798 else
797 idletime = g_strdup_printf(_("Idle (%dm)"), imin); 799 idletime = g_strdup_printf(_("Idle (%dm) "), imin);
798 } 800 }
799 801
800 if (b->evil > 0) 802 if (b->evil > 0)
801 warning = g_strdup_printf(_("Warned (%d%%)"), b->evil); 803 warning = g_strdup_printf(_("Warned (%d%%) "), b->evil);
802 804
803 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS) 805 if (b->idle && blist_options & OPT_BLIST_GREY_IDLERS)
804 text = g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s %s %s</span>", 806 text = g_strdup_printf("<span color='dim grey'>%s</span>\n<span color='dim grey' size='smaller'>%s%s%s</span>",
805 esc, 807 esc,
806 statustext != NULL ? statustext : "", 808 statustext != NULL ? statustext : "",
807 idletime != NULL ? idletime : "", 809 idletime != NULL ? idletime : "",
808 warning != NULL ? warning : ""); 810 warning != NULL ? warning : "");
809 else 811 else
810 text = g_strdup_printf("%s\n<span color='dim grey' size='smaller'>%s %s %s</span>", esc, 812 text = g_strdup_printf("%s\n<span color='dim grey' size='smaller'>%s%s%s</span>", esc,
811 statustext != NULL ? statustext : "", 813 statustext != NULL ? statustext : "",
812 idletime != NULL ? idletime : "", 814 idletime != NULL ? idletime : "",
813 warning != NULL ? warning : ""); 815 warning != NULL ? warning : "");
814 if (idletime) 816 if (idletime)
815 g_free(idletime); 817 g_free(idletime);
1094 GaimBlistNode *oldersibling; 1096 GaimBlistNode *oldersibling;
1095 GtkTreeIter oldersiblingiter; 1097 GtkTreeIter oldersiblingiter;
1096 1098
1097 if(node->parent && !get_iter_from_node(node->parent, &groupiter)) { 1099 if(node->parent && !get_iter_from_node(node->parent, &groupiter)) {
1098 /* This buddy's group has not yet been added. We do that here */ 1100 /* This buddy's group has not yet been added. We do that here */
1101 GdkPixbuf *groupicon = gtk_widget_render_icon(gtkblist->treeview,
1102 GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL);
1099 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", ((struct group*)node->parent)->name); 1103 char *mark = g_strdup_printf("<span weight='bold'>%s</span>", ((struct group*)node->parent)->name);
1100 oldersibling = node->parent->prev; 1104 oldersibling = node->parent->prev;
1101 1105
1102 /* We traverse backwards through the buddy list to find the node in the tree to insert it after */ 1106 /* We traverse backwards through the buddy list to find the node in the tree to insert it after */
1103 while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter)) 1107 while (oldersibling && !get_iter_from_node(oldersibling, &oldersiblingiter))
1104 oldersibling = oldersibling->prev; 1108 oldersibling = oldersibling->prev;
1105 1109
1106 /* This is where we create the node and add it. */ 1110 /* This is where we create the node and add it. */
1107 gtk_tree_store_insert_after(gtkblist->treemodel, &groupiter, NULL, oldersibling ? &oldersiblingiter : NULL); 1111 gtk_tree_store_insert_after(gtkblist->treemodel, &groupiter, NULL, oldersibling ? &oldersiblingiter : NULL);
1108 gtk_tree_store_set(gtkblist->treemodel, &groupiter, 1112 gtk_tree_store_set(gtkblist->treemodel, &groupiter,
1109 STATUS_ICON_COLUMN, gtk_widget_render_icon 1113 STATUS_ICON_COLUMN, groupicon,
1110 (gtkblist->treeview,GTK_STOCK_OPEN,GTK_ICON_SIZE_SMALL_TOOLBAR,NULL),
1111 NAME_COLUMN, mark, 1114 NAME_COLUMN, mark,
1112 NODE_COLUMN, node->parent, 1115 NODE_COLUMN, node->parent,
1113 -1); 1116 -1);
1114 1117
1115 g_free(mark); 1118 g_free(mark);
1119 g_object_unref(G_OBJECT(groupicon));
1116 1120
1117 expand = TRUE; 1121 expand = TRUE;
1118 } 1122 }
1119 1123
1120 oldersibling = node->prev; 1124 oldersibling = node->prev;