[network-manager-openconnect/nm-0-9-8] Automatically start connecting if there's only one host anyway (cherry picked from commit 527cd5fc0a



commit 3255272fb9e628f4393a0150f3c9c5d6059ff69e
Author: David Woodhouse <David Woodhouse intel com>
Date:   Fri May 31 16:25:48 2013 +0100

    Automatically start connecting if there's only one host anyway
    (cherry picked from commit 527cd5fc0a5aa635405e91712551de98344b2a98)

 auth-dialog/main.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/auth-dialog/main.c b/auth-dialog/main.c
index 1b4fca6..fd8c59d 100644
--- a/auth-dialog/main.c
+++ b/auth-dialog/main.c
@@ -1528,14 +1528,14 @@ static void build_main_dialog(auth_ui_data *ui_data)
        g_signal_connect_swapped(ui_data->connect_button, "clicked",
                                 G_CALLBACK(queue_connect_host), ui_data);
        gtk_widget_show(ui_data->connect_button);
-
-       autocon = gtk_check_button_new_with_label(_("Automatically start connecting next time"));
-       gtk_box_pack_start(GTK_BOX(vbox), autocon, FALSE, FALSE, 0);
-       if (get_autoconnect (ui_data->secrets))
-               gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autocon), 1);
-       g_signal_connect(autocon, "toggled", G_CALLBACK(autocon_toggled), NULL);
-       gtk_widget_show(autocon);
-
+       if (vpnhosts->next) {
+               autocon = gtk_check_button_new_with_label(_("Automatically start connecting next time"));
+               gtk_box_pack_start(GTK_BOX(vbox), autocon, FALSE, FALSE, 0);
+               if (get_autoconnect (ui_data->secrets))
+                       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autocon), 1);
+               g_signal_connect(autocon, "toggled", G_CALLBACK(autocon_toggled), NULL);
+               gtk_widget_show(autocon);
+       }
        frame = gtk_frame_new(NULL);
        gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
        gtk_widget_set_size_request(frame, -1, -1);
@@ -1794,7 +1794,8 @@ int main (int argc, char **argv)
 #endif
        openconnect_init_ssl();
 
-       if (get_autoconnect (secrets))
+       /* Start connecting now if there's only one host. Or if configured to */
+       if (!vpnhosts->next || get_autoconnect (secrets))
                queue_connect_host(_ui_data);
 
        gtk_window_present(GTK_WINDOW(_ui_data->dialog));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]