summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-05-11 03:13:50 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-05-11 03:13:50 +0200
commit2e1425451dcd2515950c5ab3705b274101f14b33 (patch)
tree70cabe73ddcf86c46c2e9871a75bc1f660aadf8a /src/fe-gtk
parent0e1da0d33d14e2a1b107493cbc65cb321cefadcf (diff)
Remove some redundancy
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/servlistgui.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c
index 4ebf8c19..53903f84 100644
--- a/src/fe-gtk/servlistgui.c
+++ b/src/fe-gtk/servlistgui.c
@@ -1038,6 +1038,22 @@ servlist_autojoinedit (ircnet *net, char *channel, gboolean add)
 }
 
 static void
+servlist_toggle_global_user (gboolean sensitive)
+{
+	gtk_widget_set_sensitive (edit_entry_nick, sensitive);
+	gtk_widget_set_sensitive (edit_label_nick, sensitive);
+
+	gtk_widget_set_sensitive (edit_entry_nick2, sensitive);
+	gtk_widget_set_sensitive (edit_label_nick2, sensitive);
+
+	gtk_widget_set_sensitive (edit_entry_user, sensitive);
+	gtk_widget_set_sensitive (edit_label_user, sensitive);
+
+	gtk_widget_set_sensitive (edit_entry_real, sensitive);
+	gtk_widget_set_sensitive (edit_label_real, sensitive);
+}
+
+static void
 servlist_autojoinedit_cb (GtkWidget *button, ircnet *net)
 {
 	servlist_autojoinedit (net, NULL, FALSE);
@@ -1164,35 +1180,7 @@ servlist_check_cb (GtkWidget *but, gpointer num_p)
 
 	if ((1 << num) == FLAG_USE_GLOBAL)
 	{
-		if (GTK_TOGGLE_BUTTON (but)->active)
-		{
-			gtk_widget_set_sensitive (edit_entry_nick, FALSE);
-			gtk_widget_set_sensitive (edit_label_nick, FALSE);
-
-			gtk_widget_set_sensitive (edit_entry_nick2, FALSE);
-			gtk_widget_set_sensitive (edit_label_nick2, FALSE);
-
-			gtk_widget_set_sensitive (edit_entry_user, FALSE);
-			gtk_widget_set_sensitive (edit_label_user, FALSE);
-
-			gtk_widget_set_sensitive (edit_entry_real, FALSE);
-			gtk_widget_set_sensitive (edit_label_real, FALSE);
-			
-		}
-		else
-		{
-			gtk_widget_set_sensitive (edit_entry_nick, TRUE);
-			gtk_widget_set_sensitive (edit_label_nick, TRUE);
-
-			gtk_widget_set_sensitive (edit_entry_nick2, TRUE);
-			gtk_widget_set_sensitive (edit_label_nick2, TRUE);
-
-			gtk_widget_set_sensitive (edit_entry_user, TRUE);
-			gtk_widget_set_sensitive (edit_label_user, TRUE);
-
-			gtk_widget_set_sensitive (edit_entry_real, TRUE);
-			gtk_widget_set_sensitive (edit_label_real, TRUE);
-		}
+		servlist_toggle_global_user (!GTK_TOGGLE_BUTTON (but)->active);
 	}
 }
 
@@ -1700,17 +1688,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
 
 	if (net->flags & FLAG_USE_GLOBAL)
 	{
-		gtk_widget_set_sensitive (edit_entry_nick, FALSE);
-		gtk_widget_set_sensitive (edit_label_nick, FALSE);
-
-		gtk_widget_set_sensitive (edit_entry_nick2, FALSE);
-		gtk_widget_set_sensitive (edit_label_nick2, FALSE);
-
-		gtk_widget_set_sensitive (edit_entry_user, FALSE);
-		gtk_widget_set_sensitive (edit_label_user, FALSE);
-
-		gtk_widget_set_sensitive (edit_entry_real, FALSE);
-		gtk_widget_set_sensitive (edit_label_real, FALSE);
+		servlist_toggle_global_user (FALSE);
 	}
 
 	gtk_widget_grab_focus (button10);