summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2015-10-14 09:59:10 +0200
committerJiří Klimeš <jklimes@redhat.com>2015-10-14 09:59:10 +0200
commite6b5f32838e7e52641e329d0944934978eb4c5cf (patch)
tree028a538bee3512750c655f89b5c54dddcc44247b
parent17a70373904eebeaf0ccce37f04e288b28ef60b5 (diff)
parentde7d399de7d0b15477c22a18f1a11e384ac40199 (diff)
downloadnetwork-manager-applet-e6b5f32838e7e52641e329d0944934978eb4c5cf.tar.gz
merge: hotspot mode support for the editor (bgo #755663)
It adds the AP (hotspot) mode to the editor and changes IPv4/IPv6 methods accordingly. https://bugzilla.gnome.org/show_bug.cgi?id=755663
-rw-r--r--src/connection-editor/ce-page-wifi.ui5
-rw-r--r--src/connection-editor/ce-page.c20
-rw-r--r--src/connection-editor/ce-page.h10
-rw-r--r--src/connection-editor/nm-connection-editor.c39
-rw-r--r--src/connection-editor/nm-connection-editor.h15
-rw-r--r--src/connection-editor/page-8021x-security.c4
-rw-r--r--src/connection-editor/page-8021x-security.h3
-rw-r--r--src/connection-editor/page-bluetooth.c4
-rw-r--r--src/connection-editor/page-bluetooth.h3
-rw-r--r--src/connection-editor/page-bond.c12
-rw-r--r--src/connection-editor/page-bond.h3
-rw-r--r--src/connection-editor/page-bridge-port.c4
-rw-r--r--src/connection-editor/page-bridge-port.h3
-rw-r--r--src/connection-editor/page-bridge.c4
-rw-r--r--src/connection-editor/page-bridge.h3
-rw-r--r--src/connection-editor/page-dcb.c4
-rw-r--r--src/connection-editor/page-dcb.h3
-rw-r--r--src/connection-editor/page-dsl.c4
-rw-r--r--src/connection-editor/page-dsl.h3
-rw-r--r--src/connection-editor/page-ethernet.c4
-rw-r--r--src/connection-editor/page-ethernet.h3
-rw-r--r--src/connection-editor/page-general.c4
-rw-r--r--src/connection-editor/page-general.h13
-rw-r--r--src/connection-editor/page-infiniband.c4
-rw-r--r--src/connection-editor/page-infiniband.h3
-rw-r--r--src/connection-editor/page-ip4.c111
-rw-r--r--src/connection-editor/page-ip4.h3
-rw-r--r--src/connection-editor/page-ip6.c111
-rw-r--r--src/connection-editor/page-ip6.h3
-rw-r--r--src/connection-editor/page-mobile.c4
-rw-r--r--src/connection-editor/page-mobile.h3
-rw-r--r--src/connection-editor/page-ppp.c4
-rw-r--r--src/connection-editor/page-ppp.h3
-rw-r--r--src/connection-editor/page-team-port.c14
-rw-r--r--src/connection-editor/page-team-port.h3
-rw-r--r--src/connection-editor/page-team.c12
-rw-r--r--src/connection-editor/page-team.h3
-rw-r--r--src/connection-editor/page-vlan.c4
-rw-r--r--src/connection-editor/page-vlan.h3
-rw-r--r--src/connection-editor/page-vpn.c4
-rw-r--r--src/connection-editor/page-vpn.h3
-rw-r--r--src/connection-editor/page-wifi-security.c115
-rw-r--r--src/connection-editor/page-wifi-security.h3
-rw-r--r--src/connection-editor/page-wifi.c85
-rw-r--r--src/connection-editor/page-wifi.h3
-rw-r--r--src/connection-editor/page-wimax.c4
-rw-r--r--src/connection-editor/page-wimax.h3
-rw-r--r--src/wireless-security/wireless-security.c9
-rw-r--r--src/wireless-security/wireless-security.h3
-rw-r--r--src/wireless-security/ws-dynamic-wep.c1
-rw-r--r--src/wireless-security/ws-leap.c1
-rw-r--r--src/wireless-security/ws-wpa-eap.c1
52 files changed, 540 insertions, 153 deletions
diff --git a/src/connection-editor/ce-page-wifi.ui b/src/connection-editor/ce-page-wifi.ui
index a7b8f20b..cc58fa8c 100644
--- a/src/connection-editor/ce-page-wifi.ui
+++ b/src/connection-editor/ce-page-wifi.ui
@@ -45,7 +45,10 @@
</columns>
<data>
<row>
- <col id="0" translatable="yes">Infrastructure</col>
+ <col id="0" translatable="yes">Client</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">Hotspot</col>
</row>
<row>
<col id="0" translatable="yes">Ad-hoc</col>
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 05435587..f837a221 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -155,6 +155,24 @@ ce_page_last_update (CEPage *self, NMConnection *connection, GError **error)
return TRUE;
}
+gboolean
+ce_page_inter_page_change (CEPage *self)
+{
+ gboolean ret = FALSE;
+
+ g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
+
+ if (self->inter_page_change_running)
+ return FALSE;
+
+ self->inter_page_change_running = TRUE;
+ if (CE_PAGE_GET_CLASS (self)->inter_page_change)
+ ret = CE_PAGE_GET_CLASS (self)->inter_page_change (self);
+ self->inter_page_change_running = FALSE;
+
+ return ret;
+}
+
static int
hwaddr_binary_len (const char *asc)
{
@@ -884,6 +902,7 @@ ce_page_new_connection (const char *format,
CEPage *
ce_page_new (GType page_type,
+ NMConnectionEditor *editor,
NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
@@ -906,6 +925,7 @@ ce_page_new (GType page_type,
self->title = g_strdup (title);
self->client = client;
self->settings = settings;
+ self->editor = editor;
if (ui_file) {
if (!gtk_builder_add_from_file (self->builder, ui_file, &error)) {
diff --git a/src/connection-editor/ce-page.h b/src/connection-editor/ce-page.h
index fe5e8bdf..69955f50 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -32,6 +32,7 @@
#include <nm-connection.h>
#include <nm-client.h>
#include <nm-remote-settings.h>
+#include "nm-connection-editor.h"
#include "utils.h"
/* for ARPHRD_ETHER / ARPHRD_INFINIBAND for MAC utilies */
@@ -65,6 +66,7 @@ typedef struct {
GObject parent;
gboolean initialized;
+ gboolean inter_page_change_running;
GtkBuilder *builder;
GtkWidget *page;
char *title;
@@ -72,6 +74,7 @@ typedef struct {
DBusGProxy *proxy;
gulong secrets_done_validate;
+ NMConnectionEditor *editor;
NMConnection *connection;
GtkWindow *parent_window;
NMClient *client;
@@ -84,6 +87,7 @@ typedef struct {
/* Virtual functions */
gboolean (*ce_page_validate_v) (CEPage *self, NMConnection *connection, GError **error);
gboolean (*last_update) (CEPage *self, NMConnection *connection, GError **error);
+ gboolean (*inter_page_change) (CEPage *self);
/* Signals */
void (*changed) (CEPage *self);
@@ -91,7 +95,8 @@ typedef struct {
} CEPageClass;
-typedef CEPage* (*CEPageNewFunc)(NMConnection *connection,
+typedef CEPage* (*CEPageNewFunc)(NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
@@ -107,6 +112,7 @@ const char * ce_page_get_title (CEPage *self);
gboolean ce_page_validate (CEPage *self, NMConnection *connection, GError **error);
gboolean ce_page_last_update (CEPage *self, NMConnection *connection, GError **error);
+gboolean ce_page_inter_page_change (CEPage *self);
void ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
const GByteArray *mac, int type, char **mac_list);
@@ -154,6 +160,7 @@ NMConnection *ce_page_new_connection (const char *format,
gpointer user_data);
CEPage *ce_page_new (GType page_type,
+ NMConnectionEditor *editor,
NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
@@ -162,5 +169,6 @@ CEPage *ce_page_new (GType page_type,
const char *widget_name,
const char *title);
+
#endif /* __CE_PAGE_H__ */
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 5997ea15..580ccc5a 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -281,6 +281,12 @@ permissions_changed_cb (NMClient *client,
}
static void
+destroy_inter_page_item (gpointer data)
+{
+ return;
+}
+
+static void
nm_connection_editor_init (NMConnectionEditor *editor)
{
GtkWidget *dialog;
@@ -313,6 +319,8 @@ nm_connection_editor_init (NMConnectionEditor *editor)
editor->cancel_button = GTK_WIDGET (gtk_builder_get_object (editor->builder, "cancel_button"));
editor->export_button = GTK_WIDGET (gtk_builder_get_object (editor->builder, "export_button"));
+
+ editor->inter_page_hash = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) destroy_inter_page_item);
}
static void
@@ -386,6 +394,8 @@ dispose (GObject *object)
g_clear_pointer (&editor->last_validation_error, g_free);
+ g_hash_table_destroy (editor->inter_page_hash);
+
out:
G_OBJECT_CLASS (nm_connection_editor_parent_class)->dispose (object);
}
@@ -535,6 +545,14 @@ static void
page_changed (CEPage *page, gpointer user_data)
{
NMConnectionEditor *editor = NM_CONNECTION_EDITOR (user_data);
+ GSList *iter;
+
+ /* Do page interdependent changes */
+ for (iter = editor->pages; iter; iter = g_slist_next (iter))
+ ce_page_inter_page_change (CE_PAGE (iter->data));
+
+ if (editor_is_initialized (editor))
+ nm_connection_editor_inter_page_clear_data (editor);
connection_editor_validate (editor);
}
@@ -721,7 +739,8 @@ add_page (NMConnectionEditor *editor,
g_return_val_if_fail (func != NULL, FALSE);
g_return_val_if_fail (connection != NULL, FALSE);
- page = (*func) (connection, GTK_WINDOW (editor->window), editor->client, editor->settings,
+ page = (*func) (editor, connection, GTK_WINDOW (editor->window),
+ editor->client, editor->settings,
&secrets_setting_name, error);
if (page) {
g_object_set_data_full (G_OBJECT (page),
@@ -1140,3 +1159,21 @@ nm_connection_editor_warning (GtkWindow *parent, const char *heading, const char
va_end (args);
}
+void
+nm_connection_editor_inter_page_set_value (NMConnectionEditor *editor, InterPageChangeType type, gpointer value)
+{
+ g_hash_table_insert (editor->inter_page_hash, GUINT_TO_POINTER (type), value);
+}
+
+gboolean
+nm_connection_editor_inter_page_get_value (NMConnectionEditor *editor, InterPageChangeType type, gpointer *value)
+{
+ return g_hash_table_lookup_extended (editor->inter_page_hash, GUINT_TO_POINTER (type), NULL, value);
+}
+
+void
+nm_connection_editor_inter_page_clear_data (NMConnectionEditor *editor)
+{
+ g_hash_table_remove_all (editor->inter_page_hash);
+}
+
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index cf5671a3..498e0731 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -67,6 +67,8 @@ typedef struct {
guint validate_id;
char *last_validation_error;
+
+ GHashTable *inter_page_hash;
} NMConnectionEditor;
typedef struct {
@@ -76,6 +78,11 @@ typedef struct {
void (*done) (NMConnectionEditor *editor, gint result, GError *error);
} NMConnectionEditorClass;
+typedef enum {
+ /* Add item for inter-page changes here */
+ INTER_PAGE_CHANGE_WIFI_MODE = 1,
+} InterPageChangeType;
+
GType nm_connection_editor_get_type (void);
NMConnectionEditor *nm_connection_editor_new (GtkWindow *parent_window,
NMConnection *connection,
@@ -100,4 +107,12 @@ void nm_connection_editor_warning (GtkWindow *parent,
const char *format,
...);
+void nm_connection_editor_inter_page_set_value (NMConnectionEditor *editor,
+ InterPageChangeType type,
+ gpointer value);
+gboolean nm_connection_editor_inter_page_get_value (NMConnectionEditor *editor,
+ InterPageChangeType type,
+ gpointer *value);
+void nm_connection_editor_inter_page_clear_data (NMConnectionEditor *editor);
+
#endif
diff --git a/src/connection-editor/page-8021x-security.c b/src/connection-editor/page-8021x-security.c
index eec4216e..94ab3759 100644
--- a/src/connection-editor/page-8021x-security.c
+++ b/src/connection-editor/page-8021x-security.c
@@ -98,7 +98,8 @@ finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointe
}
CEPage *
-ce_page_8021x_security_new (NMConnection *connection,
+ce_page_8021x_security_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -110,6 +111,7 @@ ce_page_8021x_security_new (NMConnection *connection,
CEPage *parent;
self = CE_PAGE_8021X_SECURITY (ce_page_new (CE_TYPE_PAGE_8021X_SECURITY,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-8021x-security.h b/src/connection-editor/page-8021x-security.h
index fc749e3b..9bdf47e6 100644
--- a/src/connection-editor/page-8021x-security.h
+++ b/src/connection-editor/page-8021x-security.h
@@ -49,7 +49,8 @@ typedef struct {
GType ce_page_8021x_security_get_type (void);
-CEPage *ce_page_8021x_security_new (NMConnection *connection,
+CEPage *ce_page_8021x_security_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-bluetooth.c b/src/connection-editor/page-bluetooth.c
index 4c697b83..d2b3ae44 100644
--- a/src/connection-editor/page-bluetooth.c
+++ b/src/connection-editor/page-bluetooth.c
@@ -89,7 +89,8 @@ finish_setup (CEPageBluetooth *self, gpointer unused, GError *error, gpointer us
}
CEPage *
-ce_page_bluetooth_new (NMConnection *connection,
+ce_page_bluetooth_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -100,6 +101,7 @@ ce_page_bluetooth_new (NMConnection *connection,
CEPageBluetoothPrivate *priv;
self = CE_PAGE_BLUETOOTH (ce_page_new (CE_TYPE_PAGE_BLUETOOTH,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-bluetooth.h b/src/connection-editor/page-bluetooth.h
index fb98865b..01890c4a 100644
--- a/src/connection-editor/page-bluetooth.h
+++ b/src/connection-editor/page-bluetooth.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_bluetooth_get_type (void);
-CEPage *ce_page_bluetooth_new (NMConnection *connection,
+CEPage *ce_page_bluetooth_new (NMConnectionEditor *edit,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index bc66e0ae..0dffd9d3 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -430,17 +430,19 @@ finish_setup (CEPageBond *self, gpointer unused, GError *error, gpointer user_da
}
CEPage *
-ce_page_bond_new (NMConnection *connection,
- GtkWindow *parent_window,
- NMClient *client,
+ce_page_bond_new (NMConnectionEditor *editor,
+ NMConnection *connection,
+ GtkWindow *parent_window,
+ NMClient *client,
NMRemoteSettings *settings,
- const char **out_secrets_setting_name,
- GError **error)
+ const char **out_secrets_setting_name,
+ GError **error)
{
CEPageBond *self;
CEPageBondPrivate *priv;
self = CE_PAGE_BOND (ce_page_new (CE_TYPE_PAGE_BOND,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-bond.h b/src/connection-editor/page-bond.h
index dcc8e1f5..fdaa97e2 100644
--- a/src/connection-editor/page-bond.h
+++ b/src/connection-editor/page-bond.h
@@ -45,7 +45,8 @@ typedef struct {
GType ce_page_bond_get_type (void);
-CEPage *ce_page_bond_new (NMConnection *connection,
+CEPage *ce_page_bond_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-bridge-port.c b/src/connection-editor/page-bridge-port.c
index 0070689d..f9a4ea44 100644
--- a/src/connection-editor/page-bridge-port.c
+++ b/src/connection-editor/page-bridge-port.c
@@ -92,7 +92,8 @@ finish_setup (CEPageBridgePort *self, gpointer unused, GError *error, gpointer u
}
CEPage *
-ce_page_bridge_port_new (NMConnection *connection,
+ce_page_bridge_port_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -103,6 +104,7 @@ ce_page_bridge_port_new (NMConnection *connection,
CEPageBridgePortPrivate *priv;
self = CE_PAGE_BRIDGE_PORT (ce_page_new (CE_TYPE_PAGE_BRIDGE_PORT,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-bridge-port.h b/src/connection-editor/page-bridge-port.h
index 2a352409..eecda9df 100644
--- a/src/connection-editor/page-bridge-port.h
+++ b/src/connection-editor/page-bridge-port.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_bridge_port_get_type (void);
-CEPage *ce_page_bridge_port_new (NMConnection *connection,
+CEPage *ce_page_bridge_port_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index e4ce500a..a159993d 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -189,7 +189,8 @@ finish_setup (CEPageBridge *self, gpointer unused, GError *error, gpointer user_
}
CEPage *
-ce_page_bridge_new (NMConnection *connection,
+ce_page_bridge_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -200,6 +201,7 @@ ce_page_bridge_new (NMConnection *connection,
CEPageBridgePrivate *priv;
self = CE_PAGE_BRIDGE (ce_page_new (CE_TYPE_PAGE_BRIDGE,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-bridge.h b/src/connection-editor/page-bridge.h
index fa6d9271..1fe4e5fd 100644
--- a/src/connection-editor/page-bridge.h
+++ b/src/connection-editor/page-bridge.h
@@ -45,7 +45,8 @@ typedef struct {
GType ce_page_bridge_get_type (void);
-CEPage *ce_page_bridge_new (NMConnection *connection,
+CEPage *ce_page_bridge_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c
index 2306ec58..e6660473 100644
--- a/src/connection-editor/page-dcb.c
+++ b/src/connection-editor/page-dcb.c
@@ -583,7 +583,8 @@ finish_setup (CEPageDcb *self, gpointer unused, GError *error, gpointer user_dat
}
CEPage *
-ce_page_dcb_new (NMConnection *connection,
+ce_page_dcb_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -596,6 +597,7 @@ ce_page_dcb_new (NMConnection *connection,
NMSettingDcb *s_dcb;
self = CE_PAGE_DCB (ce_page_new (CE_TYPE_PAGE_DCB,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-dcb.h b/src/connection-editor/page-dcb.h
index 2420b265..2bc5dca5 100644
--- a/src/connection-editor/page-dcb.h
+++ b/src/connection-editor/page-dcb.h
@@ -49,7 +49,8 @@ typedef struct {
GType ce_page_dcb_get_type (void);
-CEPage *ce_page_dcb_new (NMConnection *connection,
+CEPage *ce_page_dcb_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index 17fbc340..c06dfff6 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -115,7 +115,8 @@ finish_setup (CEPageDsl *self, gpointer unused, GError *error, gpointer user_dat
}
CEPage *
-ce_page_dsl_new (NMConnection *connection,
+ce_page_dsl_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -126,6 +127,7 @@ ce_page_dsl_new (NMConnection *connection,
CEPageDslPrivate *priv;
self = CE_PAGE_DSL (ce_page_new (CE_TYPE_PAGE_DSL,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-dsl.h b/src/connection-editor/page-dsl.h
index 514699a2..f3b0b301 100644
--- a/src/connection-editor/page-dsl.h
+++ b/src/connection-editor/page-dsl.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_dsl_get_type (void);
-CEPage *ce_page_dsl_new (NMConnection *connection,
+CEPage *ce_page_dsl_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index c4da0e8d..92404c8d 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -218,7 +218,8 @@ finish_setup (CEPageEthernet *self, gpointer unused, GError *error, gpointer use
}
CEPage *
-ce_page_ethernet_new (NMConnection *connection,
+ce_page_ethernet_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -229,6 +230,7 @@ ce_page_ethernet_new (NMConnection *connection,
CEPageEthernetPrivate *priv;
self = CE_PAGE_ETHERNET (ce_page_new (CE_TYPE_PAGE_ETHERNET,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-ethernet.h b/src/connection-editor/page-ethernet.h
index 4dd4a5cd..edc331dd 100644
--- a/src/connection-editor/page-ethernet.h
+++ b/src/connection-editor/page-ethernet.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_ethernet_get_type (void);
-CEPage *ce_page_ethernet_new (NMConnection *connection,
+CEPage *ce_page_ethernet_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index be206b0f..23e88011 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -302,7 +302,8 @@ finish_setup (CEPageGeneral *self, gpointer unused, GError *error, gpointer user
}
CEPage *
-ce_page_general_new (NMConnection *connection,
+ce_page_general_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -313,6 +314,7 @@ ce_page_general_new (NMConnection *connection,
CEPageGeneralPrivate *priv;
self = CE_PAGE_GENERAL (ce_page_new (CE_TYPE_PAGE_GENERAL,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-general.h b/src/connection-editor/page-general.h
index d8a2a2f9..f927d9a5 100644
--- a/src/connection-editor/page-general.h
+++ b/src/connection-editor/page-general.h
@@ -45,12 +45,13 @@ typedef struct {
GType ce_page_general_get_type (void);
-CEPage *ce_page_general_new (NMConnection *connection,
- GtkWindow *parent,
- NMClient *client,
- NMRemoteSettings *settings,
- const char **out_secrets_setting_name,
- GError **error);
+CEPage *ce_page_general_new (NMConnectionEditor *editor,
+ NMConnection *connection,
+ GtkWindow *parent,
+ NMClient *client,
+ NMRemoteSettings *settings,
+ const char **out_secrets_setting_name,
+ GError **error);
#endif /* __PAGE_GENERAL_H__ */
diff --git a/src/connection-editor/page-infiniband.c b/src/connection-editor/page-infiniband.c
index bb6013e2..8e1eae65 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -138,7 +138,8 @@ finish_setup (CEPageInfiniband *self, gpointer unused, GError *error, gpointer u
}
CEPage *
-ce_page_infiniband_new (NMConnection *connection,
+ce_page_infiniband_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -149,6 +150,7 @@ ce_page_infiniband_new (NMConnection *connection,
CEPageInfinibandPrivate *priv;
self = CE_PAGE_INFINIBAND (ce_page_new (CE_TYPE_PAGE_INFINIBAND,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-infiniband.h b/src/connection-editor/page-infiniband.h
index e895a987..af6d7aab 100644
--- a/src/connection-editor/page-infiniband.h
+++ b/src/connection-editor/page-infiniband.h
@@ -45,7 +45,8 @@ typedef struct {
GType ce_page_infiniband_get_type (void);
-CEPage *ce_page_infiniband_new (NMConnection *connection,
+CEPage *ce_page_infiniband_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index bb47ee53..d61c4371 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -64,6 +64,8 @@ typedef struct {
GtkComboBox *method;
GtkListStore *method_store;
+ int normal_method_idx;
+ int hotspot_method_idx;
/* Addresses */
GtkWidget *addr_label;
@@ -104,6 +106,7 @@ typedef struct {
#define METHOD_COL_NAME 0
#define METHOD_COL_NUM 1
+#define METHOD_COL_ENABLED 2
#define IP4_METHOD_AUTO 0
#define IP4_METHOD_AUTO_ADDRESSES 1
@@ -121,6 +124,7 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
NMSettingConnection *s_con;
const char *connection_type;
char *str_auto = NULL, *str_auto_only = NULL;
+ GList *cells;
builder = CE_PAGE (self)->builder;
@@ -147,19 +151,24 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
}
priv->method = GTK_COMBO_BOX (gtk_builder_get_object (builder, "ip4_method"));
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->method));
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->method), cells->data,
+ "sensitive", METHOD_COL_ENABLED);
- priv->method_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_UINT);
+ priv->method_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_BOOLEAN);
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, str_auto,
METHOD_COL_NUM, IP4_METHOD_AUTO,
+ METHOD_COL_ENABLED, TRUE,
-1);
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, str_auto_only,
METHOD_COL_NUM, IP4_METHOD_AUTO_ADDRESSES,
+ METHOD_COL_ENABLED, TRUE,
-1);
/* Manual is pointless for Mobile Broadband */
@@ -170,6 +179,7 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Manual"),
METHOD_COL_NUM, IP4_METHOD_MANUAL,
+ METHOD_COL_ENABLED, TRUE,
-1);
}
@@ -182,12 +192,14 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Link-Local Only"),
METHOD_COL_NUM, IP4_METHOD_LINK_LOCAL,
+ METHOD_COL_ENABLED, TRUE,
-1);
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Shared to other computers"),
METHOD_COL_NUM, IP4_METHOD_SHARED,
+ METHOD_COL_ENABLED, TRUE,
-1);
}
@@ -197,6 +209,7 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Disabled"),
METHOD_COL_NUM, IP4_METHOD_DISABLED,
+ METHOD_COL_ENABLED, TRUE,
-1);
}
gtk_combo_box_set_model (priv->method, GTK_TREE_MODEL (priv->method_store));
@@ -988,7 +1001,8 @@ finish_setup (CEPageIP4 *self, gpointer unused, GError *error, gpointer user_dat
}
CEPage *
-ce_page_ip4_new (NMConnection *connection,
+ce_page_ip4_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -1000,6 +1014,7 @@ ce_page_ip4_new (NMConnection *connection,
NMSettingConnection *s_con;
self = CE_PAGE_IP4 (ce_page_new (CE_TYPE_PAGE_IP4,
+ editor,
connection,
parent_window,
client,
@@ -1228,12 +1243,103 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
}
+static gboolean
+get_iter_for_method (GtkTreeModel *model, int column, GtkTreeIter *iter)
+{
+ int col;
+
+ if (gtk_tree_model_get_iter_first (model, iter)) {
+ do {
+ gtk_tree_model_get (model, iter, METHOD_COL_NUM, &col, -1);
+ if (col == column)
+ return TRUE;
+ } while (gtk_tree_model_iter_next (model, iter));
+ }
+ return FALSE;
+}
+
+static void
+toggle_method_sensitivity (CEPage *page, int column, gboolean sensitive)
+{
+ CEPageIP4 *self = CE_PAGE_IP4 (page);
+ CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
+ GtkTreeModel *model = GTK_TREE_MODEL (priv->method_store);
+ GtkTreeIter iter;
+
+ if (get_iter_for_method (model, column, &iter))
+ gtk_list_store_set (priv->method_store, &iter, METHOD_COL_ENABLED, sensitive, -1);
+}
+
+static gboolean
+get_method_sensitivity (CEPage *page, int column)
+{
+ CEPageIP4 *self = CE_PAGE_IP4 (page);
+ CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
+ GtkTreeModel *model = GTK_TREE_MODEL (priv->method_store);
+ GtkTreeIter iter;
+ gboolean sensitive = FALSE;
+
+ if (get_iter_for_method (model, column, &iter))
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->method_store), &iter, METHOD_COL_ENABLED, &sensitive, -1);
+ return sensitive;
+}
+
+static void
+change_method_combo (CEPage *page, gboolean is_hotspot)
+{
+ CEPageIP4 *self = CE_PAGE_IP4 (page);
+ CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
+
+ /* Store previous active method */
+ if (get_method_sensitivity (page, IP4_METHOD_AUTO))
+ priv->normal_method_idx = gtk_combo_box_get_active (priv->method);
+ else
+ priv->hotspot_method_idx = gtk_combo_box_get_active (priv->method);
+
+ /* Set active method */
+ if (is_hotspot) {
+ if (priv->hotspot_method_idx == -1) {
+ int method = IP4_METHOD_SHARED;
+ if (g_strcmp0 (nm_setting_ip4_config_get_method (priv->setting),
+ NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
+ method = IP4_METHOD_DISABLED;
+ gtk_combo_box_set_active (priv->method, method);
+ } else
+ gtk_combo_box_set_active (priv->method, priv->hotspot_method_idx);
+ } else {
+ if (priv->normal_method_idx != -1)
+ gtk_combo_box_set_active (priv->method, priv->normal_method_idx);
+ }
+
+ toggle_method_sensitivity (page, IP4_METHOD_AUTO, !is_hotspot);
+ toggle_method_sensitivity (page, IP4_METHOD_AUTO_ADDRESSES, !is_hotspot);
+ toggle_method_sensitivity (page, IP4_METHOD_MANUAL, !is_hotspot);
+ toggle_method_sensitivity (page, IP4_METHOD_LINK_LOCAL, !is_hotspot);
+}
+
+static gboolean
+inter_page_change (CEPage *page)
+{
+ gpointer wifi_mode_ap;
+
+ if (nm_connection_editor_inter_page_get_value (page->editor, INTER_PAGE_CHANGE_WIFI_MODE, &wifi_mode_ap)) {
+ /* For Wi-Fi AP mode restrict IPv4 methods to shared and disabled */
+ if (GPOINTER_TO_UINT (wifi_mode_ap))
+ change_method_combo (page, TRUE);
+ else
+ change_method_combo (page, FALSE);
+ }
+ return TRUE;
+}
+
static void
ce_page_ip4_init (CEPageIP4 *self)
{
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
priv->last_column = -1;
+ priv->normal_method_idx = -1;
+ priv->hotspot_method_idx = -1;
}
static void
@@ -1264,5 +1370,6 @@ ce_page_ip4_class_init (CEPageIP4Class *ip4_class)
/* virtual methods */
parent_class->ce_page_validate_v = ce_page_validate_v;
+ parent_class->inter_page_change = inter_page_change;
object_class->dispose = dispose;
}
diff --git a/src/connection-editor/page-ip4.h b/src/connection-editor/page-ip4.h
index 4fcad4c8..dad8458f 100644
--- a/src/connection-editor/page-ip4.h
+++ b/src/connection-editor/page-ip4.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_ip4_get_type (void);
-CEPage *ce_page_ip4_new (NMConnection *connection,
+CEPage *ce_page_ip4_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 1353d250..ad2cde01 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -63,6 +63,8 @@ typedef struct {
GtkComboBox *method;
GtkListStore *method_store;
+ int normal_method_idx;
+ int hotspot_method_idx;
/* Addresses */
GtkWidget *addr_label;
@@ -151,7 +153,7 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
priv->method = GTK_COMBO_BOX (gtk_builder_get_object (builder, "ip6_method"));
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->method));
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (priv->method), cells->data,
- "sensitive", METHOD_COL_ENABLED);
+ "sensitive", METHOD_COL_ENABLED);
priv->method_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_BOOLEAN);
@@ -159,21 +161,21 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Ignore"),
METHOD_COL_NUM, IP6_METHOD_IGNORE,
- METHOD_COL_ENABLED, TRUE,
+ METHOD_COL_ENABLED, TRUE,
-1);
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, str_auto,
METHOD_COL_NUM, IP6_METHOD_AUTO,
- METHOD_COL_ENABLED, TRUE,
+ METHOD_COL_ENABLED, TRUE,
-1);
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, str_auto_only,
METHOD_COL_NUM, IP6_METHOD_AUTO_ADDRESSES,
- METHOD_COL_ENABLED, TRUE,
+ METHOD_COL_ENABLED, TRUE,
-1);
/* DHCP only used on Wi-Fi and ethernet for now */
@@ -183,7 +185,7 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Automatic, DHCP only"),
METHOD_COL_NUM, IP6_METHOD_AUTO_DHCP_ONLY,
- METHOD_COL_ENABLED, TRUE,
+ METHOD_COL_ENABLED, TRUE,
-1);
}
@@ -195,7 +197,7 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Manual"),
METHOD_COL_NUM, IP6_METHOD_MANUAL,
- METHOD_COL_ENABLED, TRUE,
+ METHOD_COL_ENABLED, TRUE,
-1);
}
@@ -208,14 +210,14 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Link-Local Only"),
METHOD_COL_NUM, IP6_METHOD_LINK_LOCAL,
- METHOD_COL_ENABLED, TRUE,
+ METHOD_COL_ENABLED, TRUE,
-1);
gtk_list_store_append (priv->method_store, &iter);
gtk_list_store_set (priv->method_store, &iter,
METHOD_COL_NAME, _("Shared to other computers"),
METHOD_COL_NUM, IP6_METHOD_SHARED,
- METHOD_COL_ENABLED, FALSE,
+ METHOD_COL_ENABLED, FALSE,
-1);
}
@@ -983,7 +985,8 @@ finish_setup (CEPageIP6 *self, gpointer unused, GError *error, gpointer user_dat
}
CEPage *
-ce_page_ip6_new (NMConnection *connection,
+ce_page_ip6_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -995,6 +998,7 @@ ce_page_ip6_new (NMConnection *connection,
NMSettingConnection *s_con;
self = CE_PAGE_IP6 (ce_page_new (CE_TYPE_PAGE_IP6,
+ editor,
connection,
parent_window,
client,
@@ -1215,12 +1219,100 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
}
+static gboolean
+get_iter_for_method (GtkTreeModel *model, int column, GtkTreeIter *iter)
+{
+ int col;
+
+ if (gtk_tree_model_get_iter_first (model, iter)) {
+ do {
+ gtk_tree_model_get (model, iter, METHOD_COL_NUM, &col, -1);
+ if (col == column)
+ return TRUE;
+ } while (gtk_tree_model_iter_next (model, iter));
+ }
+ return FALSE;
+}
+
+static void
+toggle_method_sensitivity (CEPage *page, int column, gboolean sensitive)
+{
+ CEPageIP6 *self = CE_PAGE_IP6 (page);
+ CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
+ GtkTreeModel *model = GTK_TREE_MODEL (priv->method_store);
+ GtkTreeIter iter;
+
+ if (get_iter_for_method (model, column, &iter))
+ gtk_list_store_set (priv->method_store, &iter, METHOD_COL_ENABLED, sensitive, -1);
+}
+
+static gboolean
+get_method_sensitivity (CEPage *page, int column)
+{
+ CEPageIP6 *self = CE_PAGE_IP6 (page);
+ CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
+ GtkTreeModel *model = GTK_TREE_MODEL (priv->method_store);
+ GtkTreeIter iter;
+ gboolean sensitive = FALSE;
+
+ if (get_iter_for_method (model, column, &iter))
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->method_store), &iter, METHOD_COL_ENABLED, &sensitive, -1);
+ return sensitive;
+}
+
+static void
+change_method_combo (CEPage *page, gboolean is_hotspot)
+{
+ CEPageIP6 *self = CE_PAGE_IP6 (page);
+ CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
+
+ /* Store previous active method */
+ if (get_method_sensitivity (page, IP6_METHOD_AUTO))
+ priv->normal_method_idx = gtk_combo_box_get_active (priv->method);
+ else
+ priv->hotspot_method_idx = gtk_combo_box_get_active (priv->method);
+
+ /* Set active method */
+ if (is_hotspot) {
+ if (priv->hotspot_method_idx != -1)
+ gtk_combo_box_set_active (priv->method, priv->hotspot_method_idx);
+ else
+ gtk_combo_box_set_active (priv->method, IP6_METHOD_IGNORE);
+ } else {
+ if (priv->normal_method_idx != -1)
+ gtk_combo_box_set_active (priv->method, priv->normal_method_idx);
+ }
+
+ toggle_method_sensitivity (page, IP6_METHOD_AUTO, !is_hotspot);
+ toggle_method_sensitivity (page, IP6_METHOD_AUTO_ADDRESSES, !is_hotspot);
+ toggle_method_sensitivity (page, IP6_METHOD_AUTO_DHCP_ONLY, !is_hotspot);
+ toggle_method_sensitivity (page, IP6_METHOD_MANUAL, !is_hotspot);
+ toggle_method_sensitivity (page, IP6_METHOD_LINK_LOCAL, !is_hotspot);
+}
+
+static gboolean
+inter_page_change (CEPage *page)
+{
+ gpointer wifi_mode_ap;
+
+ if (nm_connection_editor_inter_page_get_value (page->editor, INTER_PAGE_CHANGE_WIFI_MODE, &wifi_mode_ap)) {
+ /* For Wi-Fi AP mode restrict IPv6 methods to ignore */
+ if (GPOINTER_TO_UINT (wifi_mode_ap))
+ change_method_combo (page, TRUE);
+ else
+ change_method_combo (page, FALSE);
+ }
+ return TRUE;
+}
+
static void
ce_page_ip6_init (CEPageIP6 *self)
{
CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
priv->last_column = -1;
+ priv->normal_method_idx = -1;
+ priv->hotspot_method_idx = -1;
}
static void
@@ -1251,5 +1343,6 @@ ce_page_ip6_class_init (CEPageIP6Class *ip6_class)
/* virtual methods */
parent_class->ce_page_validate_v = ce_page_validate_v;
+ parent_class->inter_page_change = inter_page_change;
object_class->dispose = dispose;
}
diff --git a/src/connection-editor/page-ip6.h b/src/connection-editor/page-ip6.h
index 433fa14b..d91c4a2d 100644
--- a/src/connection-editor/page-ip6.h
+++ b/src/connection-editor/page-ip6.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_ip6_get_type (void);
-CEPage *ce_page_ip6_new (NMConnection *connection,
+CEPage *ce_page_ip6_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 0a7704f3..541a3649 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -298,7 +298,8 @@ finish_setup (CEPageMobile *self, gpointer unused, GError *error, gpointer user_
}
CEPage *
-ce_page_mobile_new (NMConnection *connection,
+ce_page_mobile_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -309,6 +310,7 @@ ce_page_mobile_new (NMConnection *connection,
CEPageMobilePrivate *priv;
self = CE_PAGE_MOBILE (ce_page_new (CE_TYPE_PAGE_MOBILE,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-mobile.h b/src/connection-editor/page-mobile.h
index ab2903cc..d370ca49 100644
--- a/src/connection-editor/page-mobile.h
+++ b/src/connection-editor/page-mobile.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_mobile_get_type (void);
-CEPage *ce_page_mobile_new (NMConnection *connection,
+CEPage *ce_page_mobile_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-ppp.c b/src/connection-editor/page-ppp.c
index fe67bca5..14f9a053 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -265,7 +265,8 @@ finish_setup (CEPagePpp *self, gpointer unused, GError *error, gpointer user_dat
}
CEPage *
-ce_page_ppp_new (NMConnection *connection,
+ce_page_ppp_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -277,6 +278,7 @@ ce_page_ppp_new (NMConnection *connection,
NMSettingConnection *s_con;
self = CE_PAGE_PPP (ce_page_new (CE_TYPE_PAGE_PPP,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-ppp.h b/src/connection-editor/page-ppp.h
index 9b53575f..604ace02 100644
--- a/src/connection-editor/page-ppp.h
+++ b/src/connection-editor/page-ppp.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_ppp_get_type (void);
-CEPage *ce_page_ppp_new (NMConnection *connection,
+CEPage *ce_page_ppp_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-team-port.c b/src/connection-editor/page-team-port.c
index 3b965de2..f6b2bf5a 100644
--- a/src/connection-editor/page-team-port.c
+++ b/src/connection-editor/page-team-port.c
@@ -134,17 +134,19 @@ finish_setup (CEPageTeamPort *self, gpointer unused, GError *error, gpointer use
}
CEPage *
-ce_page_team_port_new (NMConnection *connection,
- GtkWindow *parent_window,
- NMClient *client,
- NMRemoteSettings *settings,
- const char **out_secrets_setting_name,
- GError **error)
+ce_page_team_port_new (NMConnectionEditor *editor,
+ NMConnection *connection,
+ GtkWindow *parent_window,
+ NMClient *client,
+ NMRemoteSettings *settings,
+ const char **out_secrets_setting_name,
+ GError **error)
{
CEPageTeamPort *self;
CEPageTeamPortPrivate *priv;
self = CE_PAGE_TEAM_PORT (ce_page_new (CE_TYPE_PAGE_TEAM_PORT,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-team-port.h b/src/connection-editor/page-team-port.h
index 6eccb15e..91df0502 100644
--- a/src/connection-editor/page-team-port.h
+++ b/src/connection-editor/page-team-port.h
@@ -44,7 +44,8 @@ typedef struct {
GType ce_page_team_port_get_type (void);
-CEPage *ce_page_team_port_new (NMConnection *connection,
+CEPage *ce_page_team_port_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index edec9d0a..700f87d5 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -250,17 +250,19 @@ finish_setup (CEPageTeam *self, gpointer unused, GError *error, gpointer user_da
}
CEPage *
-ce_page_team_new (NMConnection *connection,
- GtkWindow *parent_window,
- NMClient *client,
+ce_page_team_new (NMConnectionEditor *editor,
+ NMConnection *connection,
+ GtkWindow *parent_window,
+ NMClient *client,
NMRemoteSettings *settings,
- const char **out_secrets_setting_name,
- GError **error)
+ const char **out_secrets_setting_name,
+ GError **error)
{
CEPageTeam *self;
CEPageTeamPrivate *priv;
self = CE_PAGE_TEAM (ce_page_new (CE_TYPE_PAGE_TEAM,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-team.h b/src/connection-editor/page-team.h
index d1936b32..e3cb1331 100644
--- a/src/connection-editor/page-team.h
+++ b/src/connection-editor/page-team.h
@@ -44,7 +44,8 @@ typedef struct {
GType ce_page_team_get_type (void);
-CEPage *ce_page_team_new (NMConnection *connection,
+CEPage *ce_page_team_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index 7e97525a..3f24fc78 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -481,7 +481,8 @@ finish_setup (CEPageVlan *self, gpointer unused, GError *error, gpointer user_da
}
CEPage *
-ce_page_vlan_new (NMConnection *connection,
+ce_page_vlan_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -492,6 +493,7 @@ ce_page_vlan_new (NMConnection *connection,
CEPageVlanPrivate *priv;
self = CE_PAGE_VLAN (ce_page_new (CE_TYPE_PAGE_VLAN,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-vlan.h b/src/connection-editor/page-vlan.h
index 0e66a067..80c73c03 100644
--- a/src/connection-editor/page-vlan.h
+++ b/src/connection-editor/page-vlan.h
@@ -45,7 +45,8 @@ typedef struct {
GType ce_page_vlan_get_type (void);
-CEPage *ce_page_vlan_new (NMConnection *connection,
+CEPage *ce_page_vlan_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index fac255da..6596c0ee 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -91,7 +91,8 @@ finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_dat
}
CEPage *
-ce_page_vpn_new (NMConnection *connection,
+ce_page_vpn_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -103,6 +104,7 @@ ce_page_vpn_new (NMConnection *connection,
const char *service_type;
self = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-vpn.h b/src/connection-editor/page-vpn.h
index 2339732f..7d749306 100644
--- a/src/connection-editor/page-vpn.h
+++ b/src/connection-editor/page-vpn.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_vpn_get_type (void);
-CEPage *ce_page_vpn_new (NMConnection *connection,
+CEPage *ce_page_vpn_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c
index 9e87e51b..e39da1af 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -46,12 +46,13 @@ G_DEFINE_TYPE (CEPageWifiSecurity, ce_page_wifi_security, CE_TYPE_PAGE)
typedef struct {
GtkSizeGroup *group;
GtkComboBox *security_combo;
- gboolean adhoc;
+ NM80211Mode mode;
} CEPageWifiSecurityPrivate;
#define S_NAME_COLUMN 0
#define S_SEC_COLUMN 1
#define S_ADHOC_VALID_COLUMN 2
+#define S_HOTSPOT_VALID_COLUMN 3
static gboolean
find_proto (NMSettingWirelessSecurity *sec, const char *item)
@@ -189,7 +190,8 @@ add_security_item (CEPageWifiSecurity *self,
GtkListStore *model,
GtkTreeIter *iter,
const char *text,
- gboolean adhoc_valid)
+ gboolean adhoc_valid,
+ gboolean hotspot_valid)
{
wireless_security_set_changed_notify (sec, stuff_changed_cb, self);
gtk_list_store_append (model, iter);
@@ -197,6 +199,7 @@ add_security_item (CEPageWifiSecurity *self,
S_NAME_COLUMN, text,
S_SEC_COLUMN, sec,
S_ADHOC_VALID_COLUMN, adhoc_valid,
+ S_HOTSPOT_VALID_COLUMN, hotspot_valid,
-1);
wireless_security_unref (sec);
}
@@ -208,16 +211,47 @@ set_sensitive (GtkCellLayout *cell_layout,
GtkTreeIter *iter,
gpointer data)
{
- gboolean *adhoc = data;
- gboolean sensitive = TRUE, adhoc_valid = TRUE;
+ NM80211Mode *mode = data;
+ gboolean sensitive = TRUE;
- gtk_tree_model_get (tree_model, iter, S_ADHOC_VALID_COLUMN, &adhoc_valid, -1);
- if (*adhoc && !adhoc_valid)
- sensitive = FALSE;
+ if (*mode == NM_802_11_MODE_ADHOC)
+ gtk_tree_model_get (tree_model, iter, S_ADHOC_VALID_COLUMN, &sensitive, -1);
+ else if (*mode == NM_802_11_MODE_AP)
+ gtk_tree_model_get (tree_model, iter, S_HOTSPOT_VALID_COLUMN, &sensitive, -1);
g_object_set (cell, "sensitive", sensitive, NULL);
}
+static gboolean
+security_valid (NMUtilsSecurityType sectype, NM80211Mode mode)
+{
+ guint32 dev_caps = 0;
+
+ /* Fake some device capabilities here since we don't know about the
+ * NMDevice object to get the card's real capabilities.
+ */
+ dev_caps = NM_WIFI_DEVICE_CAP_CIPHER_WEP40
+ | NM_WIFI_DEVICE_CAP_CIPHER_WEP104
+ | NM_WIFI_DEVICE_CAP_CIPHER_TKIP
+ | NM_WIFI_DEVICE_CAP_CIPHER_CCMP
+ | NM_WIFI_DEVICE_CAP_WPA
+ | NM_WIFI_DEVICE_CAP_RSN;
+
+ switch (mode) {
+ case NM_802_11_MODE_AP:
+ return nm_utils_ap_mode_security_valid (sectype, NM_WIFI_DEVICE_CAP_AP);
+ case NM_802_11_MODE_ADHOC:
+ case NM_802_11_MODE_INFRA:
+ default:
+ return nm_utils_security_valid (sectype,
+ dev_caps,
+ FALSE,
+ (mode == NM_802_11_MODE_ADHOC),
+ 0, 0, 0);
+ }
+ g_assert_not_reached ();
+}
+
static void
finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer user_data)
{
@@ -226,11 +260,9 @@ finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wireless_sec;
NMConnection *connection = parent->connection;
- gboolean is_adhoc = FALSE;
+ NM80211Mode mode = NM_802_11_MODE_INFRA;
GtkListStore *sec_model;
GtkTreeIter iter;
- const char *mode;
- guint32 dev_caps = 0;
NMUtilsSecurityType default_type = NMU_SEC_NONE;
int active = -1;
int item = 0;
@@ -243,39 +275,31 @@ finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer
s_wireless = nm_connection_get_setting_wireless (connection);
g_assert (s_wireless);
- combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "wifi_security_combo"));
-
- dev_caps = NM_WIFI_DEVICE_CAP_CIPHER_WEP40
- | NM_WIFI_DEVICE_CAP_CIPHER_WEP104
- | NM_WIFI_DEVICE_CAP_CIPHER_TKIP
- | NM_WIFI_DEVICE_CAP_CIPHER_CCMP
- | NM_WIFI_DEVICE_CAP_WPA
- | NM_WIFI_DEVICE_CAP_RSN;
-
- mode = nm_setting_wireless_get_mode (s_wireless);
- if (mode && !strcmp (mode, "adhoc"))
- is_adhoc = TRUE;
- priv->adhoc = is_adhoc;
+ if (!g_strcmp0 (nm_setting_wireless_get_mode (s_wireless), "adhoc"))
+ mode = NM_802_11_MODE_ADHOC;
+ else if (!g_strcmp0 (nm_setting_wireless_get_mode (s_wireless), "ap"))
+ mode = NM_802_11_MODE_AP;
s_wireless_sec = nm_connection_get_setting_wireless_security (connection);
if (s_wireless_sec)
default_type = get_default_type_for_security (s_wireless_sec);
- sec_model = gtk_list_store_new (3, G_TYPE_STRING, wireless_security_get_type (), G_TYPE_BOOLEAN);
+ sec_model = gtk_list_store_new (4, G_TYPE_STRING, wireless_security_get_type (), G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
- if (nm_utils_security_valid (NMU_SEC_NONE, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
+ if (security_valid (NMU_SEC_NONE, mode)) {
gtk_list_store_append (sec_model, &iter);
gtk_list_store_set (sec_model, &iter,
S_NAME_COLUMN, C_("Wi-Fi/Ethernet security", "None"),
S_ADHOC_VALID_COLUMN, TRUE,
+ S_HOTSPOT_VALID_COLUMN, TRUE,
-1);
if (default_type == NMU_SEC_NONE)
active = item;
item++;
}
- if (nm_utils_security_valid (NMU_SEC_STATIC_WEP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
+ if (security_valid (NMU_SEC_STATIC_WEP, mode)) {
WirelessSecurityWEPKey *ws_wep;
NMWepKeyType wep_type = NM_WEP_KEY_TYPE_KEY;
@@ -293,7 +317,7 @@ finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer
if (ws_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit Key (Hex or ASCII)"),
- TRUE);
+ TRUE, TRUE);
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP) && (wep_type == NM_WEP_KEY_TYPE_KEY))
active = item;
item++;
@@ -302,74 +326,73 @@ finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer
ws_wep = ws_wep_key_new (connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
if (ws_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
- &iter, _("WEP 128-bit Passphrase"), TRUE);
+ &iter, _("WEP 128-bit Passphrase"), TRUE, TRUE);
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP) && (wep_type == NM_WEP_KEY_TYPE_PASSPHRASE))
active = item;
item++;
}
}
- if (nm_utils_security_valid (NMU_SEC_LEAP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
+ if (security_valid (NMU_SEC_LEAP, mode)) {
WirelessSecurityLEAP *ws_leap;
ws_leap = ws_leap_new (connection, FALSE);
if (ws_leap) {
add_security_item (self, WIRELESS_SECURITY (ws_leap), sec_model,
- &iter, _("LEAP"), FALSE);
+ &iter, _("LEAP"), FALSE, FALSE);
if ((active < 0) && (default_type == NMU_SEC_LEAP))
active = item;
item++;
}
}
- if (nm_utils_security_valid (NMU_SEC_DYNAMIC_WEP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
+ if (security_valid (NMU_SEC_DYNAMIC_WEP, mode)) {
WirelessSecurityDynamicWEP *ws_dynamic_wep;
ws_dynamic_wep = ws_dynamic_wep_new (connection, TRUE, FALSE);
if (ws_dynamic_wep) {
add_security_item (self, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
- &iter, _("Dynamic WEP (802.1x)"), FALSE);
+ &iter, _("Dynamic WEP (802.1x)"), FALSE, FALSE);
if ((active < 0) && (default_type == NMU_SEC_DYNAMIC_WEP))
active = item;
item++;
}
}
- if ( nm_utils_security_valid (NMU_SEC_WPA_PSK, dev_caps, FALSE, is_adhoc, 0, 0, 0)
- || nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
+ if (security_valid (NMU_SEC_WPA_PSK, mode) || security_valid (NMU_SEC_WPA2_PSK, mode)) {
WirelessSecurityWPAPSK *ws_wpa_psk;
ws_wpa_psk = ws_wpa_psk_new (connection, FALSE);
if (ws_wpa_psk) {
add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
- &iter, _("WPA & WPA2 Personal"), FALSE);
+ &iter, _("WPA & WPA2 Personal"), FALSE, TRUE);
if ((active < 0) && ((default_type == NMU_SEC_WPA_PSK) || (default_type == NMU_SEC_WPA2_PSK)))
active = item;
item++;
}
}
- if ( nm_utils_security_valid (NMU_SEC_WPA_ENTERPRISE, dev_caps, FALSE, is_adhoc, 0, 0, 0)
- || nm_utils_security_valid (NMU_SEC_WPA2_ENTERPRISE, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
+ if (security_valid (NMU_SEC_WPA_ENTERPRISE, mode) || security_valid (NMU_SEC_WPA2_ENTERPRISE, mode)) {
WirelessSecurityWPAEAP *ws_wpa_eap;
ws_wpa_eap = ws_wpa_eap_new (connection, TRUE, FALSE);
if (ws_wpa_eap) {
add_security_item (self, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
- &iter, _("WPA & WPA2 Enterprise"), FALSE);
+ &iter, _("WPA & WPA2 Enterprise"), FALSE, FALSE);
if ((active < 0) && ((default_type == NMU_SEC_WPA_ENTERPRISE) || (default_type == NMU_SEC_WPA2_ENTERPRISE)))
active = item;
item++;
}
}
+ combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "wifi_security_combo"));
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (sec_model));
gtk_cell_layout_clear (GTK_CELL_LAYOUT (combo));
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", S_NAME_COLUMN, NULL);
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), renderer, set_sensitive, &priv->adhoc, NULL);
+ gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), renderer, set_sensitive, &priv->mode, NULL);
gtk_combo_box_set_active (combo, active < 0 ? 0 : (guint32) active);
g_object_unref (G_OBJECT (sec_model));
@@ -383,7 +406,8 @@ finish_setup (CEPageWifiSecurity *self, gpointer unused, GError *error, gpointer
}
CEPage *
-ce_page_wifi_security_new (NMConnection *connection,
+ce_page_wifi_security_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -402,6 +426,7 @@ ce_page_wifi_security_new (NMConnection *connection,
}
self = CE_PAGE_WIFI_SECURITY (ce_page_new (CE_TYPE_PAGE_WIFI_SECURITY,
+ editor,
connection,
parent_window,
client,
@@ -470,14 +495,16 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
g_assert (s_wireless);
/* Kernel Ad-Hoc WPA support is busted; it creates open networks. Disable
- * WPA when Ad-Hoc is selected. set_sensitive() will pick up priv->adhoc
+ * WPA when Ad-Hoc is selected. set_sensitive() will pick up priv->mode
* and do the right thing.
*/
mode = nm_setting_wireless_get_mode (s_wireless);
if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0)
- priv->adhoc = TRUE;
+ priv->mode = NM_802_11_MODE_ADHOC;
+ else if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_AP) == 0)
+ priv->mode = NM_802_11_MODE_AP;
else
- priv->adhoc = FALSE;
+ priv->mode = NM_802_11_MODE_INFRA;
sec = wireless_security_combo_get_active (self);
if (sec) {
@@ -492,7 +519,7 @@ ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
valid = FALSE;
}
- if (priv->adhoc) {
+ if (priv->mode == NM_802_11_MODE_ADHOC) {
if (!wireless_security_adhoc_compatible (sec)) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Security not compatible with Ad-Hoc mode"));
valid = FALSE;
diff --git a/src/connection-editor/page-wifi-security.h b/src/connection-editor/page-wifi-security.h
index db358369..ba0ddde1 100644
--- a/src/connection-editor/page-wifi-security.h
+++ b/src/connection-editor/page-wifi-security.h
@@ -50,7 +50,8 @@ typedef struct {
GType ce_page_wifi_security_get_type (void);
-CEPage *ce_page_wifi_security_new (NMConnection *connection,
+CEPage *ce_page_wifi_security_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index 6266186c..92494537 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -33,6 +33,7 @@
#include <nm-device-wifi.h>
#include <nm-utils.h>
+#include "nm-connection-editor.h"
#include "page-wifi.h"
G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
@@ -245,51 +246,46 @@ mode_combo_changed_cb (GtkComboBox *combo,
CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self);
CEPage *parent = CE_PAGE (self);
GtkWidget *widget_band_label, *widget_chan_label, *widget_bssid_label;
- gboolean adhoc;
+ gboolean show_freq = FALSE;
+ gboolean show_bssid = TRUE;
+ gboolean hotspot = FALSE;
switch (gtk_combo_box_get_active (GTK_COMBO_BOX (combo))) {
- case 1: /* adhoc */
- adhoc = TRUE;
+ case 1: /* hotspot */
+ hotspot = TRUE;
+ case 2: /* adhoc */
+ /* BSSID is random and is created by kernel for Ad-Hoc networks
+ * http://lxr.linux.no/linux+v3.7.6/net/mac80211/ibss.c#L685
+ * For AP-mode, the BSSID is the MAC address of the device.
+ */
+ show_bssid = FALSE;
+ show_freq = TRUE;
break;
default: /* infrastructure */
- adhoc = FALSE;
+ show_freq = FALSE;
break;
}
+ nm_connection_editor_inter_page_set_value (parent->editor,
+ INTER_PAGE_CHANGE_WIFI_MODE,
+ GUINT_TO_POINTER (hotspot));
widget_band_label = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_band_label"));
widget_chan_label = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_channel_label"));
widget_bssid_label = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wifi_bssid_label"));
- if (adhoc) {
- /* For Ad-Hoc show Band and Channel */
- gtk_widget_show (widget_band_label);
- gtk_widget_show (GTK_WIDGET (priv->band));
- gtk_widget_show (widget_chan_label);
- gtk_widget_show (GTK_WIDGET (priv->channel));
+ gtk_widget_set_visible (widget_band_label, show_freq);
+ gtk_widget_set_sensitive (widget_band_label, show_freq);
+ gtk_widget_set_visible (GTK_WIDGET (priv->band), show_freq);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->band), show_freq);
+ gtk_widget_set_visible (widget_chan_label, show_freq);
+ gtk_widget_set_sensitive (widget_chan_label, show_freq);
+ gtk_widget_set_visible (GTK_WIDGET (priv->channel), show_freq);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->channel), show_freq);
- /* and hide BSSID
- * BSSID is random and is created by kernel for Ad-Hoc networks
- * http://lxr.linux.no/linux+v3.7.6/net/mac80211/ibss.c#L685
- */
- gtk_widget_hide (widget_bssid_label);
- gtk_widget_hide (GTK_WIDGET (priv->bssid));
- } else {
- /* Do opposite for Infrastructure mode */
- gtk_widget_hide (widget_band_label);
- gtk_widget_hide (GTK_WIDGET (priv->band));
- gtk_widget_hide (widget_chan_label);
- gtk_widget_hide (GTK_WIDGET (priv->channel));
-
- gtk_widget_show (widget_bssid_label);
- gtk_widget_show (GTK_WIDGET (priv->bssid));
- }
-
- gtk_widget_set_sensitive (widget_band_label, adhoc);
- gtk_widget_set_sensitive (GTK_WIDGET (priv->band), adhoc);
- gtk_widget_set_sensitive (widget_chan_label, adhoc);
- gtk_widget_set_sensitive (GTK_WIDGET (priv->channel), adhoc);
- gtk_widget_set_sensitive (widget_bssid_label, !adhoc);
- gtk_widget_set_sensitive (GTK_WIDGET (priv->bssid), !adhoc);
+ gtk_widget_set_visible (widget_bssid_label, show_bssid);
+ gtk_widget_set_sensitive (widget_bssid_label, show_bssid);
+ gtk_widget_set_visible (GTK_WIDGET (priv->bssid), show_bssid);
+ gtk_widget_set_sensitive (GTK_WIDGET (priv->bssid), show_bssid);
ce_page_changed (CE_PAGE (self));
}
@@ -349,8 +345,10 @@ populate_ui (CEPageWifi *self)
/* Default to Infrastructure */
gtk_combo_box_set_active (priv->mode, 0);
- if (mode && !strcmp (mode, "adhoc"))
+ if (!g_strcmp0 (mode, "ap"))
gtk_combo_box_set_active (priv->mode, 1);
+ if (!g_strcmp0 (mode, "adhoc"))
+ gtk_combo_box_set_active (priv->mode, 2);
mode_combo_changed_cb (priv->mode, self);
g_signal_connect (priv->mode, "changed", G_CALLBACK (mode_combo_changed_cb), self);
g_free (mode);
@@ -438,7 +436,8 @@ finish_setup (CEPageWifi *self, gpointer unused, GError *error, gpointer user_da
}
CEPage *
-ce_page_wifi_new (NMConnection *connection,
+ce_page_wifi_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -451,6 +450,7 @@ ce_page_wifi_new (NMConnection *connection,
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
self = CE_PAGE_WIFI (ce_page_new (CE_TYPE_PAGE_WIFI,
+ editor,
connection,
parent_window,
client,
@@ -516,10 +516,17 @@ ui_to_setting (CEPageWifi *self)
ssid = ce_page_wifi_get_ssid (self);
- if (gtk_combo_box_get_active (priv->mode) == 1)
+ switch (gtk_combo_box_get_active (priv->mode)) {
+ case 1:
+ mode = "ap";
+ break;
+ case 2:
mode = "adhoc";
- else
+ break;
+ default:
mode = "infrastructure";
+ break;
+ }
switch (gtk_combo_box_get_active (priv->band)) {
case 1:
@@ -535,8 +542,8 @@ ui_to_setting (CEPageWifi *self)
}
entry = gtk_bin_get_child (GTK_BIN (priv->bssid));
- /* BSSID is only valid for infrastructure not for adhoc */
- if (entry && mode && strcmp (mode, "adhoc") != 0)
+ /* BSSID is only valid for infrastructure */
+ if (entry && mode && strcmp (mode, "infrastructure") == 0)
bssid = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, NULL);
entry = gtk_bin_get_child (GTK_BIN (priv->device_combo));
if (entry)
diff --git a/src/connection-editor/page-wifi.h b/src/connection-editor/page-wifi.h
index c039b00a..eee167c5 100644
--- a/src/connection-editor/page-wifi.h
+++ b/src/connection-editor/page-wifi.h
@@ -47,7 +47,8 @@ typedef struct {
GType ce_page_wifi_get_type (void);
-CEPage *ce_page_wifi_new (NMConnection *connection,
+CEPage *ce_page_wifi_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/connection-editor/page-wimax.c b/src/connection-editor/page-wimax.c
index 77245e67..e7a470e6 100644
--- a/src/connection-editor/page-wimax.c
+++ b/src/connection-editor/page-wimax.c
@@ -99,7 +99,8 @@ finish_setup (CEPageWimax *self, gpointer unused, GError *error, gpointer user_d
}
CEPage *
-ce_page_wimax_new (NMConnection *connection,
+ce_page_wimax_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
NMRemoteSettings *settings,
@@ -112,6 +113,7 @@ ce_page_wimax_new (NMConnection *connection,
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
self = CE_PAGE_WIMAX (ce_page_new (CE_TYPE_PAGE_WIMAX,
+ editor,
connection,
parent_window,
client,
diff --git a/src/connection-editor/page-wimax.h b/src/connection-editor/page-wimax.h
index 69382848..4a40048d 100644
--- a/src/connection-editor/page-wimax.h
+++ b/src/connection-editor/page-wimax.h
@@ -45,7 +45,8 @@ typedef struct {
GType ce_page_wimax_get_type (void);
-CEPage *ce_page_wimax_new (NMConnection *connection,
+CEPage *ce_page_wimax_new (NMConnectionEditor *editor,
+ NMConnection *connection,
GtkWindow *parent,
NMClient *client,
NMRemoteSettings *settings,
diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c
index eafbee39..6d954b92 100644
--- a/src/wireless-security/wireless-security.c
+++ b/src/wireless-security/wireless-security.c
@@ -199,6 +199,7 @@ wireless_security_init (gsize obj_size,
sec->destroy = destroy;
sec->adhoc_compatible = TRUE;
+ sec->hotspot_compatible = TRUE;
return sec;
}
@@ -211,6 +212,14 @@ wireless_security_adhoc_compatible (WirelessSecurity *sec)
return sec->adhoc_compatible;
}
+gboolean
+wireless_security_hotspot_compatible (WirelessSecurity *sec)
+{
+ g_return_val_if_fail (sec != NULL, FALSE);
+
+ return sec->hotspot_compatible;
+}
+
void
wireless_security_set_userpass (WirelessSecurity *sec,
const char *user,
diff --git a/src/wireless-security/wireless-security.h b/src/wireless-security/wireless-security.h
index d5c83619..3368fc57 100644
--- a/src/wireless-security/wireless-security.h
+++ b/src/wireless-security/wireless-security.h
@@ -48,6 +48,7 @@ struct _WirelessSecurity {
gpointer changed_notify_data;
const char *default_field;
gboolean adhoc_compatible;
+ gboolean hotspot_compatible;
char *username, *password;
gboolean always_ask, show_password;
@@ -81,6 +82,8 @@ void wireless_security_update_secrets (WirelessSecurity *sec,
gboolean wireless_security_adhoc_compatible (WirelessSecurity *sec);
+gboolean wireless_security_hotspot_compatible (WirelessSecurity *sec);
+
void wireless_security_set_userpass (WirelessSecurity *sec,
const char *user,
const char *password,
diff --git a/src/wireless-security/ws-dynamic-wep.c b/src/wireless-security/ws-dynamic-wep.c
index e2dd4e18..34cf2d86 100644
--- a/src/wireless-security/ws-dynamic-wep.c
+++ b/src/wireless-security/ws-dynamic-wep.c
@@ -116,6 +116,7 @@ ws_dynamic_wep_new (NMConnection *connection,
return NULL;
parent->adhoc_compatible = FALSE;
+ parent->hotspot_compatible = FALSE;
widget = ws_802_1x_auth_combo_init (parent,
"dynamic_wep_auth_combo",
diff --git a/src/wireless-security/ws-leap.c b/src/wireless-security/ws-leap.c
index af4baaf4..0ca97b20 100644
--- a/src/wireless-security/ws-leap.c
+++ b/src/wireless-security/ws-leap.c
@@ -167,6 +167,7 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
}
parent->adhoc_compatible = FALSE;
+ parent->hotspot_compatible = FALSE;
sec = (WirelessSecurityLEAP *) parent;
sec->editing_connection = secrets_only ? FALSE : TRUE;
sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD;
diff --git a/src/wireless-security/ws-wpa-eap.c b/src/wireless-security/ws-wpa-eap.c
index 63e69570..1f469b6a 100644
--- a/src/wireless-security/ws-wpa-eap.c
+++ b/src/wireless-security/ws-wpa-eap.c
@@ -117,6 +117,7 @@ ws_wpa_eap_new (NMConnection *connection,
return NULL;
parent->adhoc_compatible = FALSE;
+ parent->hotspot_compatible = FALSE;
widget = ws_802_1x_auth_combo_init (parent,
"wpa_eap_auth_combo",