summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-07-23 10:09:39 +0200
committerBerke Viktor <bviktor@hexchat.org>2012-07-23 10:09:39 +0200
commit4e2d3763907fa5d4c7156cbf02c1d334775fdc8a (patch)
tree0144e58ba45497a1e45d84a877edffae864524e3 /src
parentfdc3ed47b86b7e865885d869ff5566322895c3fe (diff)
Make HexChat remember minimum and maximum users set in channel list
Diffstat (limited to 'src')
-rw-r--r--src/common/cfgfiles.c4
-rw-r--r--src/common/xchat.h2
-rw-r--r--src/fe-gtk/chanlist.c20
3 files changed, 24 insertions, 2 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 522ab2ef..e9dc8780 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -449,6 +449,8 @@ const struct prefs vars[] = {
 	{"gui_auto_open_dialog", P_OFFINT (autodialog), TYPE_BOOL},
 	{"gui_auto_open_recv", P_OFFINT (autoopendccrecvwindow), TYPE_BOOL},
 	{"gui_auto_open_send", P_OFFINT (autoopendccsendwindow), TYPE_BOOL},
+	{"gui_chanlist_maxusers", P_OFFINT (gui_chanlist_maxusers), TYPE_INT},
+	{"gui_chanlist_minusers", P_OFFINT (gui_chanlist_minusers), TYPE_INT},
 	{"gui_dialog_height", P_OFFINT (dialog_height), TYPE_INT},
 	{"gui_dialog_left", P_OFFINT (dialog_left), TYPE_INT},
 	{"gui_dialog_top", P_OFFINT (dialog_top), TYPE_INT},
@@ -731,6 +733,8 @@ load_config (void)
 	prefs.autoopendccsendwindow = 1;
 	prefs.autoopendccchatwindow = 1;
 	prefs.userhost = 1;
+	prefs.gui_chanlist_maxusers = 9999;
+	prefs.gui_chanlist_minusers = 5;
 	prefs.gui_url_mod = 4;	/* ctrl */
 	prefs.gui_tray = 1;
 	prefs.gui_pane_left_size = 100;
diff --git a/src/common/xchat.h b/src/common/xchat.h
index 2349e23b..66f43522 100644
--- a/src/common/xchat.h
+++ b/src/common/xchat.h
@@ -161,6 +161,8 @@ struct xchatprefs
 	int gui_pane_right_size;
 	int gui_pane_right_size_min;
 
+	int gui_chanlist_maxusers;
+	int gui_chanlist_minusers;
 	int gui_ulist_pos;
 	int tab_pos;
 
diff --git a/src/fe-gtk/chanlist.c b/src/fe-gtk/chanlist.c
index f2e40248..af40e3eb 100644
--- a/src/fe-gtk/chanlist.c
+++ b/src/fe-gtk/chanlist.c
@@ -548,6 +548,7 @@ static void
 chanlist_minusers (GtkSpinButton *wid, server *serv)
 {
 	serv->gui->chanlist_minusers = gtk_spin_button_get_value_as_int (wid);
+	prefs.gui_chanlist_minusers = serv->gui->chanlist_minusers;
 
 	if (serv->gui->chanlist_minusers < serv->gui->chanlist_minusers_downloaded)
 	{
@@ -568,6 +569,7 @@ static void
 chanlist_maxusers (GtkSpinButton *wid, server *serv)
 {
 	serv->gui->chanlist_maxusers = gtk_spin_button_get_value_as_int (wid);
+	prefs.gui_chanlist_maxusers = serv->gui->chanlist_maxusers;
 }
 
 static void
@@ -736,10 +738,24 @@ chanlist_opengui (server *serv, int do_refresh)
 	serv->gui->chanlist_data_stored_rows = NULL;
 
 	if (!serv->gui->chanlist_minusers)
-		serv->gui->chanlist_minusers = 5;
+	{
+		if (prefs.gui_chanlist_minusers < 1 || prefs.gui_chanlist_minusers > 999999)
+		{
+			prefs.gui_chanlist_minusers = 5;
+		}
+
+		serv->gui->chanlist_minusers = prefs.gui_chanlist_minusers;
+	}
 
 	if (!serv->gui->chanlist_maxusers)
-		serv->gui->chanlist_maxusers = 9999;
+	{
+		if (prefs.gui_chanlist_maxusers < 1 || prefs.gui_chanlist_maxusers > 999999)
+		{
+			prefs.gui_chanlist_maxusers = 9999;
+		}
+
+		serv->gui->chanlist_maxusers = prefs.gui_chanlist_maxusers;
+	}
 
 	serv->gui->chanlist_window =
 		mg_create_generic_tab ("ChanList", tbuf, FALSE, TRUE, chanlist_closegui,