# HG changeset patch # User Nathan Walp # Date 1049381523 0 # Node ID 06baf1e9094cf4ca362d37596ced0fd3857070fc # Parent 26ba09fa7dee272bfe4ce3f23dd804382f562c19 [gaim-migrate @ 5315] group numbers, done the _RIGHT_ way, and optional once again. Also fixed a memory leak in the new tooltips, and cleaned up a few things. committer: Tailor Script diff -r 26ba09fa7dee -r 06baf1e9094c src/buddy.c --- a/src/buddy.c Thu Apr 03 14:06:51 2003 +0000 +++ b/src/buddy.c Thu Apr 03 14:52:03 2003 +0000 @@ -737,7 +737,7 @@ b->evil ? _("\nWarned:") : "", b->evil ? warning : "", !b->present ? _("\nStatus: Offline") : "", statustext ? "\n" : "", statustext ? statustext : "", - !g_strcasecmp(b->name, "robflynn") ? "\nDescription: Spooky" : ""); + !g_ascii_strcasecmp(b->name, "robflynn") ? "\nDescription: Spooky" : ""); if(warning) g_free(warning); @@ -1289,6 +1289,9 @@ gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips), button, _("Set an away message"), NULL); gtk_widget_show(button); + /* we're done setting tooltips */ + gtk_object_sink(GTK_OBJECT(tooltips)); + /* this will show the right image/label widgets for us */ gaim_gtk_blist_update_toolbar(); @@ -1445,29 +1448,22 @@ 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 (%d/%d)", esc, num_online, num_total); + struct group *group = (struct group *)node; + char *esc = g_markup_escape_text(group->name, -1); + char *mark; + + if(blist_options & OPT_BLIST_SHOW_GRPNUM) + mark = g_strdup_printf("%s (%d/%d)", esc, gaim_blist_get_group_online_count(group), gaim_blist_get_group_size(group, FALSE)); + else + mark = g_strdup_printf("%s", esc); + g_free(esc); + sibling = node->prev; while (sibling && !get_iter_from_node(sibling, &siblingiter)) { sibling = sibling->prev; @@ -1535,10 +1531,15 @@ (!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 (%d/%d)", esc, num_online, num_total); + struct group *group = (struct group *)node; + char *esc = g_markup_escape_text(group->name, -1); + char *mark; + + if(blist_options & OPT_BLIST_SHOW_GRPNUM) + mark = g_strdup_printf("%s (%d/%d)", esc, gaim_blist_get_group_online_count(group), gaim_blist_get_group_size(group, FALSE)); + else + mark = g_strdup_printf("%s", esc); + g_free(esc); gtk_tree_store_set(gtkblist->treemodel, &iter, NAME_COLUMN, mark, @@ -1618,40 +1619,17 @@ gaim_gtk_blist_remove(list, node); if (blist_options & OPT_BLIST_POPUP) gtk_window_present(GTK_WINDOW(gtkblist->window)); - } else if (GAIM_BLIST_NODE_IS_GROUP(node)) { - GaimBlistNode *afsad = node->child; - while (afsad) { - gaim_gtk_blist_update(list, afsad); - afsad = afsad->next; - } - - gtk_tree_view_columns_autosize(GTK_TREE_VIEW(gtkblist->treeview)); } + 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); } + + if(GAIM_BLIST_NODE_IS_BUDDY(node)) + gaim_gtk_blist_update(list, node->parent); } static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list) diff -r 26ba09fa7dee -r 06baf1e9094c src/prefs.c --- a/src/prefs.c Thu Apr 03 14:06:51 2003 +0000 +++ b/src/prefs.c Thu Apr 03 14:52:03 2003 +0000 @@ -551,9 +551,9 @@ gaim_button(_("_Save window size/position"), &blist_options, OPT_BLIST_SAVED_WINDOWS, vbox); gaim_button(_("_Raise window on events"), &blist_options, OPT_BLIST_POPUP, vbox); - /* vbox = make_frame (ret, _("Group Display")); */ + vbox = make_frame (ret, _("Group Display")); /* gaim_button(_("Hide _groups with no online buddies"), &blist_options, OPT_BLIST_NO_MT_GRP, vbox); */ - /* gaim_button(_("Show _numbers in groups"), &blist_options, OPT_BLIST_SHOW_GRPNUM, vbox); */ + gaim_button(_("Show _numbers in groups"), &blist_options, OPT_BLIST_SHOW_GRPNUM, vbox); vbox = make_frame (ret, _("Buddy Display")); gaim_button(_("Show buddy _icons"), &blist_options, OPT_BLIST_SHOW_ICONS, vbox);