comparison src/gtkblist.c @ 5237:757d680f923d

[gaim-migrate @ 5607] I guess I shouldn't force the aliases on everyone...now they're optional. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Sat, 26 Apr 2003 21:44:00 +0000
parents 890b29f00b68
children a3bb756635be
comparison
equal deleted inserted replaced
5236:0d4b8ca97c17 5237:757d680f923d
761 * Private Utility functions * 761 * Private Utility functions *
762 *********************************************************/ 762 *********************************************************/
763 763
764 static char *gaim_get_tooltip_text(GaimBlistNode *node) 764 static char *gaim_get_tooltip_text(GaimBlistNode *node)
765 { 765 {
766 GaimPlugin *prpl;
767 GaimPluginProtocolInfo *prpl_info = NULL;
766 char *text = NULL; 768 char *text = NULL;
767 769
768 if(GAIM_BLIST_NODE_IS_CHAT(node)) { 770 if(GAIM_BLIST_NODE_IS_CHAT(node)) {
769 struct chat *chat = (struct chat *)node; 771 struct chat *chat = (struct chat *)node;
772 char *name = NULL;
773
774 if(chat->alias) {
775 name = g_markup_escape_text(chat->alias, -1);
776 } else {
777 struct proto_chat_entry *pce;
778 GList *parts;
779 prpl = gaim_find_prpl(chat->account->protocol);
780 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);
781
782 parts = prpl_info->chat_info(chat->account->gc);
783 pce = parts->data;
784 name = g_markup_escape_text(g_hash_table_lookup(chat->components,
785 pce->identifier), -1);
786 g_list_free(parts);
787 }
788
770 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", 789 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>",
771 chat->alias); 790 name);
791 g_free(name);
772 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) { 792 } else if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
773 GaimPlugin *prpl;
774 GaimPluginProtocolInfo *prpl_info = NULL;
775 struct buddy *b = (struct buddy *)node; 793 struct buddy *b = (struct buddy *)node;
776 char *statustext = NULL; 794 char *statustext = NULL;
777 char *aliastext = NULL, *nicktext = NULL; 795 char *aliastext = NULL, *nicktext = NULL;
778 char *warning = NULL, *idletime = NULL; 796 char *warning = NULL, *idletime = NULL;
779 797
1684 } 1702 }
1685 } 1703 }
1686 1704
1687 if (GAIM_BLIST_NODE_IS_CHAT(node) && ((struct chat*)node)->account->gc) { 1705 if (GAIM_BLIST_NODE_IS_CHAT(node) && ((struct chat*)node)->account->gc) {
1688 GdkPixbuf *status; 1706 GdkPixbuf *status;
1689 char *mark; 1707 struct chat *chat = (struct chat *)node;
1708 char *name;
1690 1709
1691 status = gaim_gtk_blist_get_status_icon(node, 1710 status = gaim_gtk_blist_get_status_icon(node,
1692 blist_options & OPT_BLIST_SHOW_ICONS ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL); 1711 blist_options & OPT_BLIST_SHOW_ICONS ? GAIM_STATUS_ICON_LARGE : GAIM_STATUS_ICON_SMALL);
1693 mark = g_markup_escape_text(((struct chat*)node)->alias, -1); 1712 if(chat->alias) {
1713 name = g_markup_escape_text(chat->alias, -1);
1714 } else {
1715 struct proto_chat_entry *pce;
1716 GList *parts;
1717
1718 parts = GAIM_PLUGIN_PROTOCOL_INFO(chat->account->gc->prpl)->chat_info(chat->account->gc);
1719 pce = parts->data;
1720 name = g_markup_escape_text(g_hash_table_lookup(chat->components,
1721 pce->identifier), -1);
1722 g_list_free(parts);
1723 }
1724
1694 1725
1695 gtk_tree_store_set(gtkblist->treemodel, &iter, 1726 gtk_tree_store_set(gtkblist->treemodel, &iter,
1696 STATUS_ICON_COLUMN, status, 1727 STATUS_ICON_COLUMN, status,
1697 STATUS_ICON_VISIBLE_COLUMN, TRUE, 1728 STATUS_ICON_VISIBLE_COLUMN, TRUE,
1698 NAME_COLUMN, mark, 1729 NAME_COLUMN, name,
1699 NODE_COLUMN, node, 1730 NODE_COLUMN, node,
1700 -1); 1731 -1);
1701 1732
1702 g_free(mark); 1733 g_free(name);
1703 if (status != NULL) 1734 if (status != NULL)
1704 g_object_unref(status); 1735 g_object_unref(status);
1705 } else if(GAIM_BLIST_NODE_IS_CHAT(node) && !((struct chat *)node)->account->gc) { 1736 } else if(GAIM_BLIST_NODE_IS_CHAT(node) && !((struct chat *)node)->account->gc) {
1706 gaim_gtk_blist_remove(list, node); 1737 gaim_gtk_blist_remove(list, node);
1707 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && (((struct buddy*)node)->present != GAIM_BUDDY_OFFLINE || ((blist_options & OPT_BLIST_SHOW_OFFLINE) && ((struct buddy*)node)->account->gc))) { 1738 } else if (GAIM_BLIST_NODE_IS_BUDDY(node) && (((struct buddy*)node)->present != GAIM_BUDDY_OFFLINE || ((blist_options & OPT_BLIST_SHOW_OFFLINE) && ((struct buddy*)node)->account->gc))) {