Mercurial > pidgin
diff src/buddy.c @ 4974:0581a59c9492
[gaim-migrate @ 5309]
Brian (bjt23) also brought back the much-missed group counts for the
blist.
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 03 Apr 2003 13:32:48 +0000 |
parents | a9b49d0e8970 |
children | 307c16c4b57e |
line wrap: on
line diff
--- a/src/buddy.c Thu Apr 03 13:31:48 2003 +0000 +++ b/src/buddy.c Thu Apr 03 13:32:48 2003 +0000 @@ -1445,13 +1445,28 @@ g_timeout_add(0, (GSourceFunc)do_selection_changed, new_selection); } +static int gaim_blist_node_count_children(GaimBlistNode *node) +{ + int count = 0; + GaimBlistNode *n = node->child; + + while(n) { + count++; + n = n->next; + } + + return count; +} + static void make_a_group(GaimBlistNode *node, GtkTreeIter *iter) { GaimBlistNode *sibling; GtkTreeIter siblingiter; GdkPixbuf *groupicon = gtk_widget_render_icon(gtkblist->treeview, GTK_STOCK_OPEN, GTK_ICON_SIZE_SMALL_TOOLBAR, NULL); + int num_online = gaim_blist_get_group_online_count((struct group *)node); + int num_total = gaim_blist_node_count_children(node); char *esc = g_markup_escape_text(((struct group*)node)->name, -1); - char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc); + char *mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)", esc, num_online, num_total); g_free(esc); sibling = node->prev; while (sibling && !get_iter_from_node(sibling, &siblingiter)) { @@ -1520,8 +1535,10 @@ (!gtk_tree_model_iter_has_child(GTK_TREE_MODEL(gtkblist->treemodel), &iter) && !(blist_options & OPT_BLIST_SHOW_OFFLINE))) { gtk_tree_store_remove(gtkblist->treemodel, &iter); } else { + int num_online = gaim_blist_get_group_online_count((struct group *)node); + int num_total = gaim_blist_node_count_children(node); char *esc = g_markup_escape_text(((struct group*)node)->name, -1); - char *mark = g_strdup_printf("<span weight='bold'>%s</span>", esc); + char *mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)", esc, num_online, num_total); g_free(esc); gtk_tree_store_set(gtkblist->treemodel, &iter, NAME_COLUMN, mark, @@ -1611,6 +1628,26 @@ gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); } + /* let the containing group know we are here (or not here, for that matter) */ + if(GAIM_BLIST_NODE_IS_BUDDY(node) && GAIM_BLIST_NODE_IS_GROUP(node->parent)) { + /* i would just call gaim_gtk_blist_update() on the parent, + * but that would unfortunately cause it to recursively call + * itself ad infinitum since below we have group nodes call + * this function on all its children */ + GtkTreeIter iter1; + if(get_iter_from_node(node->parent, &iter1)) { + int num_online = gaim_blist_get_group_online_count((struct group *)node->parent); + int num_total = gaim_blist_node_count_children(node->parent); + char *esc = g_markup_escape_text(((struct group*)node->parent)->name, -1); + char *mark = g_strdup_printf("<span weight='bold'>%s</span> (%d/%d)", esc, num_online, num_total); + g_free(esc); + gtk_tree_store_set(gtkblist->treemodel, &iter1, + NAME_COLUMN, mark, + -1); + g_free(mark); + } + } + if(expand) { gtk_tree_view_expand_row(GTK_TREE_VIEW(gtkblist->treeview), expand, TRUE); gtk_tree_path_free(expand);