From 2e1425451dcd2515950c5ab3705b274101f14b33 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sat, 11 May 2013 03:13:50 +0200 Subject: Remove some redundancy --- src/fe-gtk/servlistgui.c | 58 +++++++++++++++--------------------------------- 1 file 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 @@ -1037,6 +1037,22 @@ servlist_autojoinedit (ircnet *net, char *channel, gboolean add) gtk_widget_show (win); } +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) { @@ -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); -- cgit 1.4.1