changeset 1070:b288f17c2fb2

[gaim-migrate @ 1080] numbers in groups. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 05 Nov 2000 13:22:01 +0000
parents 5d4926907b21
children ce12622502c5
files FIXME src/buddy.c src/gaim.h src/prefs.c
diffstat 4 files changed, 58 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/FIXME	Sun Nov 05 12:17:32 2000 +0000
+++ b/FIXME	Sun Nov 05 13:22:01 2000 +0000
@@ -1,8 +1,7 @@
 GAIM: Items to be fixed
 ------------------------
-Need to make it so that when the buddy list is edited the main window properly reflects that.
-Need to set number of buddies in group (as an option)
-Need to not hide empty groups (as an option)
-Need to do Buddy Pounces on a per-connection basis
-Need to get the permit/deny stuff put back
-Need to have per-connection protocol options (e.g. which server to connect to for IRC)
+make moving buddy list work again (adding/removing works)
+not hide empty groups (as an option)
+do Buddy Pounces on a per-connection basis
+get the permit/deny stuff put back
+have per-connection protocol options (e.g. which server to connect to for IRC)
--- a/src/buddy.c	Sun Nov 05 12:17:32 2000 +0000
+++ b/src/buddy.c	Sun Nov 05 13:22:01 2000 +0000
@@ -92,7 +92,6 @@
 struct group_show {
 	GtkWidget *item;
 	GtkWidget *label;
-	GtkWidget *count;
 	GtkWidget *tree;
 	GSList *members;
 	char *name;
@@ -143,6 +142,49 @@
 }
 
 
+static void update_num_group(struct group_show *gs) {
+	GSList *c = connections;
+	struct gaim_connection *gc;
+	struct group *g;
+	struct buddy_show *b;
+	int total = 0, on = 0;
+	char buf[256];
+
+	while (c) {
+		gc = (struct gaim_connection *)c->data;
+		g = find_group(gc, gs->name);
+		if (g) {
+			total += g_slist_length(g->members);
+		}
+		c = g_slist_next(c);
+	}
+
+	c = gs->members;
+	while (c) {
+		b = (struct buddy_show *)c->data;
+		on += g_slist_length(b->connlist);
+		c = g_slist_next(c);
+	}
+
+	if (display_options & OPT_DISP_SHOW_GRPNUM)
+		g_snprintf(buf, sizeof buf, "%s (%d/%d)", gs->name, on, total);
+	else
+		g_snprintf(buf, sizeof buf, "%s", gs->name);
+
+	gtk_label_set_text(GTK_LABEL(gs->label), buf);
+}
+
+void update_num_groups() {
+	GSList *s = shows;
+	struct group_show *g;
+
+	while (s) {
+		g = (struct group_show *)s->data;
+		update_num_group(g);
+		s = g_slist_next(s);
+	}
+}
+
 void update_button_pix()
 {
 
@@ -407,6 +449,7 @@
 		if (bs) {
 			if (g_slist_find(bs->connlist, gc)) {
 				bs->connlist = g_slist_remove(bs->connlist, gc);
+				update_num_group(gs);
 				if (!g_slist_length(bs->connlist)) {
 					gs->members = g_slist_remove(gs->members, bs);
 					if (bs->log_timer > 0)
@@ -677,6 +720,7 @@
 	do_export( (GtkWidget *) NULL, 0 );
 
 	redo_buddy_list();
+	update_num_groups();
 }
 
 
@@ -1401,6 +1445,7 @@
 	gtk_widget_show(b->idle);
 
 	gs->members = g_slist_insert(gs->members, b, pos);
+	update_num_group(gs);
 	return b;
 }
 
@@ -1624,6 +1669,7 @@
 				gtk_timeout_remove(bs->log_timer);
 			if (!g_slist_find(bs->connlist, gc))
 				bs->connlist = g_slist_append(bs->connlist, gc);
+			update_num_group(gs);
 			bs->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, bs);
 			if (display_options & OPT_DISP_SHOW_LOGON) {
 				struct conversation *c = find_conversation(b->name);
@@ -1657,6 +1703,7 @@
 		if (!bs) return;
 		play_sound(BUDDY_LEAVE);
 		bs->connlist = g_slist_remove(bs->connlist, gc);
+		update_num_group(gs);
 		if (bs->log_timer > 0)
 			gtk_timeout_remove(bs->log_timer);
 		bs->log_timer = gtk_timeout_add(10000, (GtkFunction)log_timeout, bs);
--- a/src/gaim.h	Sun Nov 05 12:17:32 2000 +0000
+++ b/src/gaim.h	Sun Nov 05 13:22:01 2000 +0000
@@ -726,6 +726,7 @@
 extern void destroy_buddy();
 extern void update_button_pix();
 extern void update_all_buddies();
+extern void update_num_groups();
 extern void show_buddy_list();
 extern void refresh_buddy_window();
 extern void toc_build_config(struct gaim_connection *, char *, int len, gboolean);
--- a/src/prefs.c	Sun Nov 05 12:17:32 2000 +0000
+++ b/src/prefs.c	Sun Nov 05 13:22:01 2000 +0000
@@ -1683,23 +1683,6 @@
        	if ((int)option == OPT_GEN_LOG_ALL)
        		update_log_convs();
 
-	/*
-	if (prefrem)
-		gtk_signal_handler_block_by_data(GTK_OBJECT(prefrem), (int *)OPT_GEN_REMEMBER_PASS);
-	if (remember)
-		gtk_signal_handler_block_by_data(GTK_OBJECT(remember), (int *)OPT_GEN_REMEMBER_PASS);
-	if (prefrem)
-		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(prefrem),
-			(general_options & OPT_GEN_REMEMBER_PASS));
-	if (remember)
-		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(remember),
-			(general_options & OPT_GEN_REMEMBER_PASS));
-	if (prefrem)
-		gtk_signal_handler_unblock_by_data(GTK_OBJECT(prefrem), (int *)OPT_GEN_REMEMBER_PASS);
-	if (remember)
-		gtk_signal_handler_unblock_by_data(GTK_OBJECT(remember), (int *)OPT_GEN_REMEMBER_PASS);
-	*/
-
 	save_prefs();
 }
 
@@ -1707,9 +1690,11 @@
 {
         display_options = display_options ^ (int)option;
 
-	if (blist) build_imchat_box(!(display_options & OPT_DISP_NO_BUTTONS));
+	if (blist && ((int)option == OPT_DISP_NO_BUTTONS))
+		build_imchat_box(!(display_options & OPT_DISP_NO_BUTTONS));
 
-	if (blist) update_button_pix();
+	if (blist && ((int)option == OPT_DISP_SHOW_GRPNUM))
+		update_num_groups();
 
 #ifdef USE_APPLET
 	update_pixmaps();