Remove some redundancy

This commit is contained in:
Berke Viktor 2013-05-11 03:13:50 +02:00
parent 0e1da0d33d
commit 2e1425451d

View File

@ -1037,6 +1037,22 @@ servlist_autojoinedit (ircnet *net, char *channel, gboolean add)
gtk_widget_show (win); 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 static void
servlist_autojoinedit_cb (GtkWidget *button, ircnet *net) 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 ((1 << num) == FLAG_USE_GLOBAL)
{ {
if (GTK_TOGGLE_BUTTON (but)->active) servlist_toggle_global_user (!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);
}
} }
} }
@ -1700,17 +1688,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
if (net->flags & FLAG_USE_GLOBAL) if (net->flags & FLAG_USE_GLOBAL)
{ {
gtk_widget_set_sensitive (edit_entry_nick, FALSE); servlist_toggle_global_user (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);
} }
gtk_widget_grab_focus (button10); gtk_widget_grab_focus (button10);