]> git.0d.be Git - empathy.git/blobdiff - src/empathy-new-chatroom-dialog.c
factor out update_join_button_sensitivy
[empathy.git] / src / empathy-new-chatroom-dialog.c
index fcbfc6a4a8ec202546aae4b261e970ca9a0df5d1..663bd026a44e98462b5dd8f61b1aa6b39824f09b 100644 (file)
@@ -356,12 +356,20 @@ new_chatroom_dialog_model_add_columns (EmpathyNewChatroomDialog *dialog)
        gtk_tree_view_append_column (view, column);
 }
 
+static void
+update_join_button_sensitivy (EmpathyNewChatroomDialog *dialog)
+{
+       const gchar           *room;
+
+       room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room));
+       gtk_widget_set_sensitive (dialog->button_join, !EMP_STR_EMPTY (room));
+}
+
 static void
 new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
 {
        EmpathyAccountChooser *account_chooser;
        const gchar           *protocol;
-       const gchar           *room;
 
        account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
 
@@ -386,8 +394,7 @@ new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
                gtk_widget_set_sensitive (dialog->entry_server, TRUE);
        }
 
-       room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room));
-       gtk_widget_set_sensitive (dialog->button_join, !EMP_STR_EMPTY (room));
+       update_join_button_sensitivy (dialog);
 
        /* Final set up of the dialog */
        gtk_widget_grab_focus (dialog->entry_room);
@@ -632,10 +639,8 @@ new_chatroom_dialog_entry_changed_cb (GtkWidget                *entry,
                                      EmpathyNewChatroomDialog *dialog)
 {
        if (entry == dialog->entry_room) {
-               const gchar *room;
+               update_join_button_sensitivy (dialog);
 
-               room = gtk_entry_get_text (GTK_ENTRY (dialog->entry_room));
-               gtk_widget_set_sensitive (dialog->button_join, !EMP_STR_EMPTY (room));
                /* FIXME: Select the room in the list */
        }
 }