changeset 18442:6d8aed4adcd6

Minor changes to remove a couple of lines of duplication.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 06 Jul 2007 05:25:39 +0000
parents 24ecab0d40b3
children 92f845cd977c
files finch/gntblist.c
diffstat 1 files changed, 5 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Fri Jul 06 05:21:37 2007 +0000
+++ b/finch/gntblist.c	Fri Jul 06 05:25:39 2007 +0000
@@ -2139,15 +2139,10 @@
 		}
 	}
 }
-static void show_empty_cb(GntMenuItem *item, gpointer n)
+
+static void toggle_pref_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",
-		!purple_prefs_get_bool(PREF_ROOT "/showoffline"));
+	purple_prefs_set_bool(n, !purple_prefs_get_bool(n));
 }
 
 static void sort_blist_change_cb(GntMenuItem *item, gpointer n)
@@ -2232,13 +2227,13 @@
 	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);
+	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/emptygroups");
 	
 	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"));
 	gnt_menu_add_item(GNT_MENU(sub), item);
-	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), show_offline_cb, NULL);
+	gnt_menuitem_set_callback(GNT_MENU_ITEM(item), toggle_pref_cb, PREF_ROOT "/showoffline");
 
 	item = gnt_menuitem_new(_("Sort by status"));
 	gnt_menu_add_item(GNT_MENU(sub), item);