changeset 18441:24ecab0d40b3

Plucked revision from im.pidgin.soc.2007.finchfeat to allow showing empty groups in the buddylist. applied changes from 6e7086902b8728961c6017b56588d7731dee2f40 through a335757d9e4e5fd0116abc7c3a6fb16674045b1f
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 06 Jul 2007 05:21:37 +0000
parents be10fc22d649
children 6d8aed4adcd6
files ChangeLog finch/gntblist.c
diffstat 2 files changed, 20 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jul 06 01:20:20 2007 +0000
+++ b/ChangeLog	Fri Jul 06 05:21:37 2007 +0000
@@ -30,6 +30,7 @@
 	* Some improvements for tab-completion, tooltip and the password entries
 	* Some bugs regarding search results fixed
 	* A new DBus-script to create a docklet for finch
+	* Support for showing empty groups in the buddy list (Eric Polino)
 
 version 2.0.2 (06/14/2007):
 	Pidgin:
--- a/finch/gntblist.c	Fri Jul 06 01:20:20 2007 +0000
+++ b/finch/gntblist.c	Fri Jul 06 05:21:37 2007 +0000
@@ -195,8 +195,8 @@
 			node_update(list, (PurpleBlistNode*)contact);
 	} else if (!PURPLE_BLIST_NODE_IS_GROUP(node)) {
 		PurpleGroup *group = (PurpleGroup*)node->parent;
-		if ((!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) ||
-				group->currentsize < 1)
+		if ((group->currentsize < 1 && !purple_prefs_get_bool(PREF_ROOT "/emptygroups")) ||
+				(!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)))
 			node_remove(list, node->parent);
 		for (node = node->child; node; node = node->next)
 			node->ui_data = NULL;
@@ -253,8 +253,9 @@
 		}
 	} else if (PURPLE_BLIST_NODE_IS_GROUP(node)) {
 		PurpleGroup *group = (PurpleGroup*)node;
-		if ((!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) ||
-				group->currentsize < 1)
+		if (!purple_prefs_get_bool(PREF_ROOT "/emptygroups") &&
+				((!purple_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) ||
+				 group->currentsize < 1))
 			node_remove(list, node);
 		else
 			add_node(node, list->ui_data);
@@ -1726,9 +1727,12 @@
 	purple_prefs_add_int(PREF_ROOT "/position/y", 0);
 	purple_prefs_add_bool(PREF_ROOT "/idletime", TRUE);
 	purple_prefs_add_bool(PREF_ROOT "/showoffline", FALSE);
+	purple_prefs_add_bool(PREF_ROOT "/emptygroups", FALSE);
 	purple_prefs_add_string(PREF_ROOT "/sort_type", "text");
 
 	purple_prefs_connect_callback(finch_blist_get_handle(),
+			PREF_ROOT "/emptygroups", redraw_blist, NULL);
+	purple_prefs_connect_callback(finch_blist_get_handle(),
 			PREF_ROOT "/showoffline", redraw_blist, NULL);
 	purple_prefs_connect_callback(finch_blist_get_handle(),
 			PREF_ROOT "/sort_type", redraw_blist, NULL);
@@ -2135,7 +2139,11 @@
 		}
 	}
 }
-
+static void show_empty_cb(GntMenuItem *item, gpointer n)
+{
+	purple_prefs_set_bool(PREF_ROOT "/emptygroups",
+		!purple_prefs_get_bool(PREF_ROOT "/emptygroups"));
+}
 static void show_offline_cb(GntMenuItem *item, gpointer n)
 {
 	purple_prefs_set_bool(PREF_ROOT "/showoffline",
@@ -2220,6 +2228,12 @@
 	gnt_menu_add_item(GNT_MENU(sub), item);
 	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), send_im_select, NULL);
 
+	item = gnt_menuitem_check_new(_("Show empty groups"));
+	gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
+				purple_prefs_get_bool(PREF_ROOT "/emptygroups"));
+	gnt_menu_add_item(GNT_MENU(sub), item);
+	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), show_empty_cb, NULL);
+	
 	item = gnt_menuitem_check_new(_("Show offline buddies"));
 	gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),
 				purple_prefs_get_bool(PREF_ROOT "/showoffline"));