# HG changeset patch # User Luke Schierer # Date 1049376768 0 # Node ID 0581a59c949219ed6ea883d5f08bc51a11bf62df # Parent a9b49d0e89704b384bf82fdfc3b4843c3258a81f [gaim-migrate @ 5309] Brian (bjt23) also brought back the much-missed group counts for the blist. committer: Tailor Script diff -r a9b49d0e8970 -r 0581a59c9492 src/buddy.c --- 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("%s", esc); + char *mark = g_strdup_printf("%s (%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("%s", esc); + char *mark = g_strdup_printf("%s (%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("%s (%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);