183
183
wireless_security_unref (sec);
186
CEPageWirelessSecurity *
187
ce_page_wireless_security_new (NMConnection *connection)
187
finish_setup (CEPageWirelessSecurity *self, gpointer unused, GError *error, gpointer user_data)
189
CEPageWirelessSecurity *self;
189
CEPage *parent = CE_PAGE (self);
191
190
NMSettingWireless *s_wireless;
192
191
NMSettingWirelessSecurity *s_wireless_sec;
192
NMConnection *connection = parent->connection;
193
193
gboolean is_adhoc = FALSE;
194
194
GtkListStore *sec_model;
195
195
GtkTreeIter iter;
202
202
const char *glade_file = GLADEDIR "/applet.glade";
203
203
GtkComboBox *combo;
205
self = CE_PAGE_WIRELESS_SECURITY (g_object_new (CE_TYPE_PAGE_WIRELESS_SECURITY, NULL));
206
parent = CE_PAGE (self);
208
208
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
210
g_warning ("%s: Connection didn't have a wireless setting!", __func__);
211
g_object_unref (self);
215
parent->xml = glade_xml_new (GLADEDIR "/ce-page-wireless-security.glade", "WirelessSecurityPage", NULL);
217
g_warning ("%s: Couldn't load wireless security page glade file.", __func__);
218
g_object_unref (self);
222
parent->page = glade_xml_get_widget (parent->xml, "WirelessSecurityPage");
224
g_warning ("%s: Couldn't load wireless security page from glade file.", __func__);
225
g_object_unref (self);
228
g_object_ref_sink (parent->page);
230
parent->title = g_strdup (_("Wireless Security"));
232
self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
209
g_assert (s_wireless);
234
211
combo = GTK_COMBO_BOX (glade_xml_get_widget (parent->xml, "wireless_security_combo"));
355
332
g_signal_connect (combo, "changed",
356
333
G_CALLBACK (wireless_security_combo_changed),
338
ce_page_wireless_security_new (NMConnection *connection, GtkWindow *parent_window, GError **error)
340
CEPageWirelessSecurity *self;
342
NMSettingWireless *s_wireless;
343
NMSettingWirelessSecurity *s_wsec = NULL;
344
const char *setting_name = NULL;
345
NMUtilsSecurityType default_type = NMU_SEC_NONE;
346
const char *security;
348
self = CE_PAGE_WIRELESS_SECURITY (g_object_new (CE_TYPE_PAGE_WIRELESS_SECURITY,
349
CE_PAGE_CONNECTION, connection,
350
CE_PAGE_PARENT_WINDOW, parent_window,
352
parent = CE_PAGE (self);
354
s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
356
g_set_error (error, 0, 0, "%s", _("Could not load WiFi security user interface; missing WiFi setting."));
357
g_object_unref (self);
361
parent->xml = glade_xml_new (GLADEDIR "/ce-page-wireless-security.glade", "WirelessSecurityPage", NULL);
363
g_set_error (error, 0, 0, "%s", _("Could not load WiFi security user interface."));
364
g_object_unref (self);
368
parent->page = glade_xml_get_widget (parent->xml, "WirelessSecurityPage");
370
g_set_error (error, 0, 0, "%s", _("Could not load WiFi security user interface."));
371
g_object_unref (self);
374
g_object_ref_sink (parent->page);
376
parent->title = g_strdup (_("Wireless Security"));
378
self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
380
g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
382
s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection,
383
NM_TYPE_SETTING_WIRELESS_SECURITY));
385
security = nm_setting_wireless_get_security (s_wireless);
386
if (!security || strcmp (security, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME))
389
default_type = get_default_type_for_security (s_wsec);
391
/* Get secrets if the connection is not 802.1x enabled */
392
if ( default_type == NMU_SEC_STATIC_WEP
393
|| default_type == NMU_SEC_LEAP
394
|| default_type == NMU_SEC_WPA_PSK
395
|| default_type == NMU_SEC_WPA2_PSK) {
396
setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
399
/* Or if it is 802.1x enabled */
400
if ( default_type == NMU_SEC_DYNAMIC_WEP
401
|| default_type == NMU_SEC_WPA_ENTERPRISE
402
|| default_type == NMU_SEC_WPA2_ENTERPRISE) {
403
setting_name = NM_SETTING_802_1X_SETTING_NAME;
406
if (!ce_page_initialize (parent, setting_name, error)) {
407
g_object_unref (self);
411
return CE_PAGE (self);