~ubuntu-branches/ubuntu/oneiric/network-manager-applet/oneiric

« back to all changes in this revision

Viewing changes to src/wireless-dialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2011-07-08 01:07:05 UTC
  • mfrom: (1.2.22 upstream)
  • Revision ID: james.westby@ubuntu.com-20110708010705-d60t3h78jol3kq12
Tags: 0.8.9997+git.20110707t152406.340f695-0ubuntu1
* upstream snapshot 2011-07-07 15:24:06 (GMT)
  + 340f69597ea787cebf690b73de2d4c8c78f7b16c
  - editor: update secret flags when updating visibility
  - applet: don't show irrelevant security options during secrets requests
  - added translations
* debian/control: drop gksu from network-manager-gnome Depends.
* debian/patches/nm-applet-use-indicator.patch:
  - refreshed.
  - rework menu update code to trigger on dbusmenu about-to-show signal
    (LP: #791770, #764451)

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
        gboolean nag_ignored;
74
74
        gboolean network_name_focus;
75
75
 
76
 
        gboolean auth_only;
 
76
        gboolean secrets_only;
77
77
 
78
78
        guint revalidate_id;
79
79
 
93
93
#define C_SEP_COLUMN            2
94
94
#define C_NEW_COLUMN            3
95
95
 
96
 
static gboolean security_combo_init (NMAWirelessDialog *self, gboolean auth_only);
 
96
static gboolean security_combo_init (NMAWirelessDialog *self, gboolean secrets_only);
97
97
static void ssid_entry_changed (GtkWidget *entry, gpointer user_data);
98
98
 
99
99
void
366
366
                            C_CON_COLUMN, &priv->connection,
367
367
                            C_NEW_COLUMN, &is_new, -1);
368
368
 
369
 
        if (!security_combo_init (self, priv->auth_only)) {
 
369
        if (!security_combo_init (self, priv->secrets_only)) {
370
370
                g_warning ("Couldn't change wireless security combo box.");
371
371
                return;
372
372
        }
585
585
                return;
586
586
        }
587
587
 
588
 
        if (!security_combo_init (self, priv->auth_only)) {
 
588
        if (!security_combo_init (self, priv->secrets_only)) {
589
589
                g_warning ("Couldn't change wireless security combo box.");
590
590
                return;
591
591
        }
833
833
}
834
834
 
835
835
static gboolean
836
 
security_combo_init (NMAWirelessDialog *self, gboolean auth_only)
 
836
security_combo_init (NMAWirelessDialog *self, gboolean secrets_only)
837
837
{
838
838
        NMAWirelessDialogPrivate *priv;
839
839
        GtkListStore *sec_model;
918
918
            && ((!ap_wpa && !ap_rsn) || !(dev_caps & (NM_WIFI_DEVICE_CAP_WPA | NM_WIFI_DEVICE_CAP_RSN)))) {
919
919
                WirelessSecurityWEPKey *ws_wep;
920
920
 
921
 
                ws_wep = ws_wep_key_new (priv->connection, NM_WEP_KEY_TYPE_KEY, priv->adhoc_create, auth_only);
 
921
                ws_wep = ws_wep_key_new (priv->connection, NM_WEP_KEY_TYPE_KEY, priv->adhoc_create, secrets_only);
922
922
                if (ws_wep) {
923
923
                        add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
924
924
                                           &iter, _("WEP 40/128-bit Key (Hex or ASCII)"));
927
927
                        item++;
928
928
                }
929
929
 
930
 
                ws_wep = ws_wep_key_new (priv->connection, NM_WEP_KEY_TYPE_PASSPHRASE, priv->adhoc_create, auth_only);
 
930
                ws_wep = ws_wep_key_new (priv->connection, NM_WEP_KEY_TYPE_PASSPHRASE, priv->adhoc_create, secrets_only);
931
931
                if (ws_wep) {
932
932
                        add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
933
933
                                           &iter, _("WEP 128-bit Passphrase"));
944
944
            && ((!ap_wpa && !ap_rsn) || !(dev_caps & (NM_WIFI_DEVICE_CAP_WPA | NM_WIFI_DEVICE_CAP_RSN)))) {
945
945
                WirelessSecurityLEAP *ws_leap;
946
946
 
947
 
                ws_leap = ws_leap_new (priv->connection);
 
947
                ws_leap = ws_leap_new (priv->connection, secrets_only);
948
948
                if (ws_leap) {
949
949
                        add_security_item (self, WIRELESS_SECURITY (ws_leap), sec_model,
950
950
                                           &iter, _("LEAP"));
957
957
        if (nm_utils_security_valid (NMU_SEC_DYNAMIC_WEP, dev_caps, !!priv->ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)) {
958
958
                WirelessSecurityDynamicWEP *ws_dynamic_wep;
959
959
 
960
 
                ws_dynamic_wep = ws_dynamic_wep_new (priv->connection, FALSE);
 
960
                ws_dynamic_wep = ws_dynamic_wep_new (priv->connection, FALSE, secrets_only);
961
961
                if (ws_dynamic_wep) {
962
962
                        add_security_item (self, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
963
963
                                           &iter, _("Dynamic WEP (802.1x)"));
971
971
            || nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, !!priv->ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)) {
972
972
                WirelessSecurityWPAPSK *ws_wpa_psk;
973
973
 
974
 
                ws_wpa_psk = ws_wpa_psk_new (priv->connection);
 
974
                ws_wpa_psk = ws_wpa_psk_new (priv->connection, secrets_only);
975
975
                if (ws_wpa_psk) {
976
976
                        add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
977
977
                                           &iter, _("WPA & WPA2 Personal"));
985
985
            || nm_utils_security_valid (NMU_SEC_WPA2_ENTERPRISE, dev_caps, !!priv->ap, is_adhoc, ap_flags, ap_wpa, ap_rsn)) {
986
986
                WirelessSecurityWPAEAP *ws_wpa_eap;
987
987
 
988
 
                ws_wpa_eap = ws_wpa_eap_new (priv->connection, FALSE);
 
988
                ws_wpa_eap = ws_wpa_eap_new (priv->connection, FALSE, secrets_only);
989
989
                if (ws_wpa_eap) {
990
990
                        add_security_item (self, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
991
991
                                           &iter, _("WPA & WPA2 Enterprise"));
1042
1042
internal_init (NMAWirelessDialog *self,
1043
1043
               NMConnection *specific_connection,
1044
1044
               NMDevice *specific_device,
1045
 
               gboolean auth_only,
 
1045
               gboolean secrets_only,
1046
1046
               gboolean create)
1047
1047
{
1048
1048
        NMAWirelessDialogPrivate *priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self);
1055
1055
        gtk_window_set_default_size (GTK_WINDOW (self), 488, -1);
1056
1056
        gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
1057
1057
 
1058
 
        priv->auth_only = auth_only;
1059
 
        if (auth_only)
 
1058
        priv->secrets_only = secrets_only;
 
1059
        if (secrets_only)
1060
1060
                icon_name = "dialog-password";
1061
1061
        else
1062
1062
                icon_name = "network-wireless";
1126
1126
                return FALSE;
1127
1127
        }
1128
1128
 
1129
 
        if (!security_combo_init (self, priv->auth_only)) {
 
1129
        if (!security_combo_init (self, priv->secrets_only)) {
1130
1130
                g_warning ("Couldn't set up wireless security combo box.");
1131
1131
                return FALSE;
1132
1132
        }
1135
1135
        g_signal_connect (G_OBJECT (priv->sec_combo), "changed",
1136
1136
                          G_CALLBACK (security_combo_changed_manually), self);
1137
1137
 
 
1138
        if (secrets_only) {
 
1139
                gtk_widget_hide (priv->sec_combo);
 
1140
                widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "security_combo_label"));
 
1141
                gtk_widget_hide (widget);
 
1142
        }
 
1143
 
1138
1144
        if (security_combo_focus)
1139
1145
                gtk_widget_grab_focus (priv->sec_combo);
1140
1146
        else if (priv->network_name_focus) {
1267
1273
nma_wireless_dialog_new (NMApplet *applet,
1268
1274
                         NMConnection *connection,
1269
1275
                         NMDevice *device,
1270
 
                         NMAccessPoint *ap)
 
1276
                         NMAccessPoint *ap,
 
1277
                         gboolean secrets_only)
1271
1278
{
1272
1279
        GObject *obj;
1273
1280
        NMAWirelessDialogPrivate *priv;
1294
1301
                priv->sec_combo = GTK_WIDGET (gtk_builder_get_object (priv->builder, "security_combo"));
1295
1302
                priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
1296
1303
 
1297
 
                if (!internal_init (NMA_WIRELESS_DIALOG (obj), connection, device, TRUE, FALSE)) {
 
1304
                if (!internal_init (NMA_WIRELESS_DIALOG (obj), connection, device, secrets_only, FALSE)) {
1298
1305
                        g_warning ("Couldn't create wireless security dialog.");
1299
1306
                        g_object_unref (obj);
1300
1307
                        obj = NULL;