[network-manager-applet/danw/wip/libnm] wip
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/danw/wip/libnm] wip
- Date: Sat, 22 Nov 2014 15:47:42 +0000 (UTC)
commit c33004bc9d6593fcc1bc02deeb5e46e1e4ce1ae2
Author: Dan Winship <danw redhat com>
Date: Sat Nov 22 10:47:11 2014 -0500
wip
configure.ac | 1 -
src/applet-agent.c | 59 +++++-----
src/applet-agent.h | 5 +-
src/applet-device-wifi.c | 4 +-
src/applet.c | 127 +++++++--------------
src/applet.h | 3 +-
src/connection-editor/ce-page.c | 17 +--
src/connection-editor/ce-page.h | 9 +-
src/connection-editor/connection-helpers.c | 30 +++---
src/connection-editor/connection-helpers.h | 6 +-
src/connection-editor/ip4-routes-dialog.c | 97 ++++++++--------
src/connection-editor/ip4-routes-dialog.h | 4 +-
src/connection-editor/ip6-routes-dialog.c | 90 +++++++--------
src/connection-editor/ip6-routes-dialog.h | 4 +-
src/connection-editor/nm-connection-editor.c | 27 ++---
src/connection-editor/nm-connection-editor.h | 4 +-
src/connection-editor/nm-connection-list.c | 121 +++++---------------
src/connection-editor/nm-connection-list.h | 3 +-
src/connection-editor/page-8021x-security.c | 2 -
src/connection-editor/page-8021x-security.h | 1 -
src/connection-editor/page-bond.c | 21 ++--
src/connection-editor/page-bond.h | 3 +-
src/connection-editor/page-bridge-port.c | 2 -
src/connection-editor/page-bridge-port.h | 1 -
src/connection-editor/page-bridge.c | 25 ++---
src/connection-editor/page-bridge.h | 3 +-
src/connection-editor/page-dcb.c | 2 -
src/connection-editor/page-dcb.h | 1 -
src/connection-editor/page-dsl.c | 15 +--
src/connection-editor/page-dsl.h | 3 +-
src/connection-editor/page-ethernet.c | 6 +-
src/connection-editor/page-ethernet.h | 3 +-
src/connection-editor/page-general.c | 25 ++---
src/connection-editor/page-general.h | 9 +-
src/connection-editor/page-infiniband.c | 6 +-
src/connection-editor/page-infiniband.h | 3 +-
src/connection-editor/page-ip4.c | 133 +++++++++++-----------
src/connection-editor/page-ip4.h | 1 -
src/connection-editor/page-ip6.c | 157 +++++++++++++-------------
src/connection-editor/page-ip6.h | 1 -
src/connection-editor/page-master.c | 25 ++--
src/connection-editor/page-mobile.c | 12 +-
src/connection-editor/page-mobile.h | 3 +-
src/connection-editor/page-ppp.c | 2 -
src/connection-editor/page-ppp.h | 1 -
src/connection-editor/page-team-port.c | 10 +-
src/connection-editor/page-team-port.h | 1 -
src/connection-editor/page-team.c | 21 ++--
src/connection-editor/page-team.h | 3 +-
src/connection-editor/page-vlan.c | 19 ++--
src/connection-editor/page-vlan.h | 3 +-
src/connection-editor/page-vpn.c | 44 ++++----
src/connection-editor/page-vpn.h | 5 +-
src/connection-editor/page-wifi-security.c | 2 -
src/connection-editor/page-wifi-security.h | 1 -
src/connection-editor/page-wifi.c | 6 +-
src/connection-editor/page-wifi.h | 3 +-
src/connection-editor/page-wimax.c | 6 +-
src/connection-editor/page-wimax.h | 3 +-
src/connection-editor/vpn-helpers.c | 32 +++---
src/connection-editor/vpn-helpers.h | 2 +-
src/gnome-bluetooth/bt-widget.c | 8 +-
src/gnome-bluetooth/nma-bt-device.c | 20 ++--
src/libnm-gtk/nm-wifi-dialog.c | 47 ++++-----
src/libnm-gtk/nm-wifi-dialog.h | 10 +-
src/libnm-gtk/nm-wireless-dialog.c | 11 +-
src/libnm-gtk/nm-wireless-dialog.h | 7 +-
src/migration-tool.c | 10 +-
68 files changed, 564 insertions(+), 787 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9bc05c6..a3f2c18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,7 +74,6 @@ PKG_CHECK_MODULES(GOBJECT, gobject-2.0)
PKG_CHECK_MODULES(NMA,
[dbus-glib-1 >= 0.74
gio-2.0 >= 2.32
- NetworkManager >= 0.9.9.95
libnm >= 0.9.9.95
gmodule-export-2.0])
diff --git a/src/applet-agent.c b/src/applet-agent.c
index 3fd6b62..bf5b4ed 100644
--- a/src/applet-agent.c
+++ b/src/applet-agent.c
@@ -49,7 +49,7 @@ static const SecretSchema network_manager_secret_schema = {
}
};
-G_DEFINE_TYPE (AppletAgent, applet_agent, NM_TYPE_SECRET_AGENT);
+G_DEFINE_TYPE (AppletAgent, applet_agent, NM_TYPE_SECRET_AGENT_OLD);
#define APPLET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APPLET_TYPE_AGENT,
AppletAgentPrivate))
@@ -75,15 +75,15 @@ static guint signals[LAST_SIGNAL] = { 0 };
typedef struct {
guint id;
- NMSecretAgent *agent;
+ NMSecretAgentOld *agent;
NMConnection *connection;
char *path;
char *setting_name;
char **hints;
guint32 flags;
- NMSecretAgentGetSecretsFunc get_callback;
- NMSecretAgentSaveSecretsFunc save_callback;
- NMSecretAgentDeleteSecretsFunc delete_callback;
+ NMSecretAgentOldGetSecretsFunc get_callback;
+ NMSecretAgentOldSaveSecretsFunc save_callback;
+ NMSecretAgentOldDeleteSecretsFunc delete_callback;
gpointer callback_data;
GCancellable *cancellable;
@@ -91,15 +91,15 @@ typedef struct {
} Request;
static Request *
-request_new (NMSecretAgent *agent,
+request_new (NMSecretAgentOld *agent,
NMConnection *connection,
const char *connection_path,
const char *setting_name,
const char **hints,
guint32 flags,
- NMSecretAgentGetSecretsFunc get_callback,
- NMSecretAgentSaveSecretsFunc save_callback,
- NMSecretAgentDeleteSecretsFunc delete_callback,
+ NMSecretAgentOldGetSecretsFunc get_callback,
+ NMSecretAgentOldSaveSecretsFunc save_callback,
+ NMSecretAgentOldDeleteSecretsFunc delete_callback,
gpointer callback_data)
{
static guint32 counter = 1;
@@ -143,7 +143,7 @@ request_free (Request *r)
/*******************************************************/
static void
-get_save_cb (NMSecretAgent *agent,
+get_save_cb (NMSecretAgentOld *agent,
NMConnection *connection,
GError *error,
gpointer user_data)
@@ -182,11 +182,11 @@ get_secrets_cb (AppletAgent *self,
nm_connection_update_secrets (dupl, setting_name, secrets, NULL);
/* And save updated secrets to the keyring */
- nm_secret_agent_save_secrets (NM_SECRET_AGENT (self), dupl, get_save_cb, NULL);
+ nm_secret_agent_old_save_secrets (NM_SECRET_AGENT_OLD (self), dupl, get_save_cb,
NULL);
g_object_unref (dupl);
}
- r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, secrets, error, r->callback_data);
+ r->get_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, secrets, error,
r->callback_data);
}
request_free (r);
}
@@ -402,7 +402,7 @@ done:
ask_for_secrets (r);
} else {
/* Otherwise send the secrets back to NetworkManager */
- r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, error ? NULL : settings, error,
r->callback_data);
+ r->get_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, error ? NULL : settings,
error, r->callback_data);
request_free (r);
}
@@ -412,13 +412,13 @@ done:
}
static void
-get_secrets (NMSecretAgent *agent,
+get_secrets (NMSecretAgentOld *agent,
NMConnection *connection,
const char *connection_path,
const char *setting_name,
const char **hints,
guint32 flags,
- NMSecretAgentGetSecretsFunc callback,
+ NMSecretAgentOldGetSecretsFunc callback,
gpointer callback_data)
{
AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (agent);
@@ -495,7 +495,7 @@ get_secrets (NMSecretAgent *agent,
/*******************************************************/
static void
-cancel_get_secrets (NMSecretAgent *agent,
+cancel_get_secrets (NMSecretAgentOld *agent,
const char *connection_path,
const char *setting_name)
{
@@ -520,7 +520,7 @@ cancel_get_secrets (NMSecretAgent *agent,
/* cancel outstanding keyring operations */
g_cancellable_cancel (r->cancellable);
- r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, NULL, error,
r->callback_data);
+ r->get_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, NULL, error,
r->callback_data);
g_hash_table_remove (priv->requests, GUINT_TO_POINTER (r->id));
g_signal_emit (r->agent, signals[CANCEL_SECRETS], 0, GUINT_TO_POINTER (r->id));
}
@@ -539,7 +539,7 @@ save_request_try_complete (Request *r)
*/
if (r->keyring_calls == 0) {
if (!g_cancellable_is_cancelled (r->cancellable))
- r->save_callback (NM_SECRET_AGENT (r->agent), r->connection, NULL, r->callback_data);
+ r->save_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, NULL,
r->callback_data);
request_free (r);
}
}
@@ -678,7 +678,7 @@ write_one_secret_to_keyring (NMSetting *setting,
}
static void
-save_delete_cb (NMSecretAgent *agent,
+save_delete_cb (NMSecretAgentOld *agent,
NMConnection *connection,
GError *error,
gpointer user_data)
@@ -696,10 +696,10 @@ save_delete_cb (NMSecretAgent *agent,
}
static void
-save_secrets (NMSecretAgent *agent,
+save_secrets (NMSecretAgentOld *agent,
NMConnection *connection,
const char *connection_path,
- NMSecretAgentSaveSecretsFunc callback,
+ NMSecretAgentOldSaveSecretsFunc callback,
gpointer callback_data)
{
AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (agent);
@@ -709,7 +709,7 @@ save_secrets (NMSecretAgent *agent,
g_hash_table_insert (priv->requests, GUINT_TO_POINTER (r->id), r);
/* First delete any existing items in the keyring */
- nm_secret_agent_delete_secrets (agent, connection, save_delete_cb, r);
+ nm_secret_agent_old_delete_secrets (agent, connection, save_delete_cb, r);
}
/*******************************************************/
@@ -744,10 +744,10 @@ delete_find_items_cb (GObject *source,
}
static void
-delete_secrets (NMSecretAgent *agent,
+delete_secrets (NMSecretAgentOld *agent,
NMConnection *connection,
const char *connection_path,
- NMSecretAgentDeleteSecretsFunc callback,
+ NMSecretAgentOldDeleteSecretsFunc callback,
gpointer callback_data)
{
AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (agent);
@@ -786,15 +786,15 @@ applet_agent_new (void)
{
//return g_initable_new (APPLET_TYPE_AGENT, NULL, NULL,
return g_object_new (APPLET_TYPE_AGENT,
- NM_SECRET_AGENT_IDENTIFIER, "org.freedesktop.nm-applet",
- NM_SECRET_AGENT_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS,
+ NM_SECRET_AGENT_OLD_IDENTIFIER, "org.freedesktop.nm-applet",
+ NM_SECRET_AGENT_OLD_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS,
NULL);
}
#if 0
FIXME
static void
-agent_registration_result_cb (NMSecretAgent *agent, GError *error, gpointer user_data)
+agent_registration_result_cb (NMSecretAgentOld *agent, GError *error, gpointer user_data)
{
if (error)
g_warning ("Failed to register as an agent: (%d) %s", error->code, error->message);
@@ -807,9 +807,6 @@ applet_agent_init (AppletAgent *self)
AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (self);
priv->requests = g_hash_table_new (g_direct_hash, g_direct_equal);
-
-//// g_signal_connect (self, NM_SECRET_AGENT_REGISTRATION_RESULT,
-//// G_CALLBACK (agent_registration_result_cb), NULL);
}
static void
@@ -838,7 +835,7 @@ static void
applet_agent_class_init (AppletAgentClass *agent_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (agent_class);
- NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (agent_class);
+ NMSecretAgentOldClass *parent_class = NM_SECRET_AGENT_OLD_CLASS (agent_class);
g_type_class_add_private (agent_class, sizeof (AppletAgentPrivate));
diff --git a/src/applet-agent.h b/src/applet-agent.h
index f82de43..e9cc5f2 100644
--- a/src/applet-agent.h
+++ b/src/applet-agent.h
@@ -23,6 +23,7 @@
#define _APPLET_AGENT_H_
#include <NetworkManager.h>
+#include <nm-secret-agent-old.h>
#define APPLET_TYPE_AGENT (applet_agent_get_type ())
#define APPLET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLET_TYPE_AGENT, AppletAgent))
@@ -35,7 +36,7 @@
#define APPLET_AGENT_CANCEL_SECRETS "cancel-secrets"
typedef struct {
- NMSecretAgent parent;
+ NMSecretAgentOld parent;
} AppletAgent;
typedef void (*AppletAgentSecretsCallback) (AppletAgent *self,
@@ -44,7 +45,7 @@ typedef void (*AppletAgentSecretsCallback) (AppletAgent *self,
gpointer user_data);
typedef struct {
- NMSecretAgentClass parent_class;
+ NMSecretAgentOldClass parent_class;
void (*get_secrets) (AppletAgent *self,
void *request_id,
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 88cba2a..7d151eb 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1102,7 +1102,7 @@ access_point_removed_cb (NMDeviceWifi *device,
}
static void
-on_new_connection (NMRemoteSettings *settings,
+on_new_connection (NMClient *settings,
NMRemoteConnection *connection,
gpointer datap)
{
@@ -1114,7 +1114,7 @@ static void
free_ap_notification_data (gpointer user_data)
{
struct ap_notification_data *data = user_data;
- NMRemoteSettings *settings = applet_get_settings (data->applet);
+ NMClient *settings = applet_get_settings (data->applet);
if (data->id)
g_source_remove (data->id);
diff --git a/src/applet.c b/src/applet.c
index 332a844..638675e 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -89,7 +89,7 @@ impl_dbus_connect_to_hidden_network (NMApplet *applet, GError **error)
if (!applet_wifi_connect_to_hidden_network (applet)) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"Failed to create Wi-Fi dialog");
return FALSE;
}
@@ -103,7 +103,7 @@ impl_dbus_create_wifi_network (NMApplet *applet, GError **error)
if (!applet_wifi_can_create_wifi_network (applet)) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED,
+ NM_SECRET_AGENT_ERROR_PERMISSION_DENIED,
"Creation of Wi-Fi networks has been disabled by system policy.");
return FALSE;
}
@@ -111,7 +111,7 @@ impl_dbus_create_wifi_network (NMApplet *applet, GError **error)
if (!applet_wifi_create_wifi_network (applet)) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"Failed to create Wi-Fi dialog");
return FALSE;
}
@@ -132,7 +132,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
if (!device || NM_IS_DEVICE_WIFI (device) == FALSE) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"The device could not be found.");
return FALSE;
}
@@ -141,7 +141,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
if (!ap) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"The access point could not be found.");
return FALSE;
}
@@ -151,7 +151,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
&& !(nm_access_point_get_rsn_flags (ap) & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"The access point had no 802.1x capabilities");
return FALSE;
}
@@ -159,7 +159,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
if (!applet_wifi_connect_to_8021x_network (applet, device, ap)) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"Failed to create Wi-Fi dialog");
return FALSE;
}
@@ -179,7 +179,7 @@ impl_dbus_connect_to_3g_network (NMApplet *applet,
if (!device || NM_IS_DEVICE_MODEM (device) == FALSE) {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"The device could not be found.");
return FALSE;
}
@@ -193,7 +193,7 @@ impl_dbus_connect_to_3g_network (NMApplet *applet,
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"ModemManager was not found");
return FALSE;
}
@@ -207,7 +207,7 @@ impl_dbus_connect_to_3g_network (NMApplet *applet,
} else {
g_set_error_literal (error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"The device had no GSM or CDMA capabilities.");
return FALSE;
}
@@ -424,58 +424,29 @@ applet_get_default_active_connection (NMApplet *applet, NMDevice **device)
return default_ac;
}
-NMRemoteSettings *
-applet_get_settings (NMApplet *applet)
-{
- return applet->settings;
-}
-
GSList *
applet_get_all_connections (NMApplet *applet)
{
- GSList *connections, *iter, *next;
+ const GPtrArray *all_connections;
+ GSList *connections = NULL;
+ int i;
NMConnection *connection;
NMSettingConnection *s_con;
- connections = nm_remote_settings_list_connections (applet->settings);
+ all_connections = nm_client_get_connections (applet->nm_client);
/* Ignore slave connections */
- for (iter = connections; iter; iter = next) {
- connection = iter->data;
- next = iter->next;
+ for (i = 0; i < all_connections->len; i++) {
+ connection = all_connections->pdata[i];
s_con = nm_connection_get_setting_connection (connection);
if (s_con && nm_setting_connection_get_master (s_con))
- connections = g_slist_delete_link (connections, iter);
+ connections = g_slist_prepend (connections, connection);
}
return connections;
}
-static NMConnection *
-applet_get_connection_for_active (NMApplet *applet, NMActiveConnection *active)
-{
- GSList *list, *iter;
- NMConnection *connection = NULL;
- const char *path;
-
- path = nm_active_connection_get_connection (active);
- g_return_val_if_fail (path != NULL, NULL);
-
- list = applet_get_all_connections (applet);
- for (iter = list; iter; iter = g_slist_next (iter)) {
- NMConnection *candidate = NM_CONNECTION (iter->data);
-
- if (!strcmp (nm_connection_get_path (candidate), path)) {
- connection = candidate;
- break;
- }
- }
- g_slist_free (list);
-
- return connection;
-}
-
static NMActiveConnection *
applet_get_active_for_connection (NMApplet *applet, NMConnection *connection)
{
@@ -489,7 +460,8 @@ applet_get_active_for_connection (NMApplet *applet, NMConnection *connection)
active_list = nm_client_get_active_connections (applet->nm_client);
for (i = 0; active_list && (i < active_list->len); i++) {
NMActiveConnection *active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_list, i));
- const char *active_cpath = nm_active_connection_get_connection (active);
+ NMRemoteConnection *conn = nm_active_connection_get_connection (active);
+ const char *active_cpath = nm_connection_get_path (NM_CONNECTION (conn));
if (active_cpath && !strcmp (active_cpath, cpath))
return active;
@@ -1033,7 +1005,7 @@ make_vpn_failure_message (NMVpnConnection *vpn,
g_return_val_if_fail (vpn != NULL, NULL);
- connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
+ connection = (NMConnection *) nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (vpn));
s_con = nm_connection_get_setting_connection (connection);
switch (reason) {
@@ -1079,7 +1051,7 @@ make_vpn_disconnection_message (NMVpnConnection *vpn,
g_return_val_if_fail (vpn != NULL, NULL);
- connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
+ connection = (NMConnection *) nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (vpn));
s_con = nm_connection_get_setting_connection (connection);
switch (reason) {
@@ -1297,7 +1269,7 @@ applet_get_first_active_vpn_connection (NMApplet *applet,
candidate = g_ptr_array_index (active_list, i);
- connection = applet_get_connection_for_active (applet, candidate);
+ connection = (NMConnection *) nm_active_connection_get_connection (candidate);
if (!connection)
continue;
@@ -1402,7 +1374,6 @@ applet_find_active_connection_for_device (NMDevice *device,
NMActiveConnection **out_active)
{
const GPtrArray *active_connections;
- NMConnection *connection = NULL;
int i;
g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
@@ -1411,32 +1382,27 @@ applet_find_active_connection_for_device (NMDevice *device,
g_return_val_if_fail (*out_active == NULL, NULL);
active_connections = nm_client_get_active_connections (applet->nm_client);
- for (i = 0; active_connections && (i < active_connections->len); i++) {
- NMRemoteConnection *tmp;
+ for (i = 0; i < active_connections->len; i++) {
+ NMRemoteConnection *conn;
NMActiveConnection *active;
- const char *connection_path;
const GPtrArray *devices;
active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_connections, i));
devices = nm_active_connection_get_devices (active);
- connection_path = nm_active_connection_get_connection (active);
+ conn = nm_active_connection_get_connection (active);
- if (!devices || !connection_path)
+ if (!devices || !conn)
continue;
if (!nm_g_ptr_array_contains (devices, device))
continue;
- tmp = nm_remote_settings_get_connection_by_path (applet->settings, connection_path);
- if (tmp) {
- connection = NM_CONNECTION (tmp);
- if (out_active)
- *out_active = active;
- break;
- }
+ if (out_active)
+ *out_active = active;
+ return NM_CONNECTION (conn);
}
- return connection;
+ return NULL;
}
static NMConnection *
@@ -1445,7 +1411,6 @@ applet_find_active_connection_for_virtual_device (const char *iface,
NMActiveConnection **out_active)
{
const GPtrArray *active_connections;
- NMConnection *connection = NULL;
int i;
g_return_val_if_fail (iface != NULL, NULL);
@@ -1454,30 +1419,24 @@ applet_find_active_connection_for_virtual_device (const char *iface,
g_return_val_if_fail (*out_active == NULL, NULL);
active_connections = nm_client_get_active_connections (applet->nm_client);
- for (i = 0; active_connections && (i < active_connections->len); i++) {
- NMRemoteConnection *tmp;
+ for (i = 0; i < active_connections->len; i++) {
+ NMRemoteConnection *conn;
NMActiveConnection *active;
- const char *connection_path;
active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_connections, i));
- connection_path = nm_active_connection_get_connection (active);
+ conn = nm_active_connection_get_connection (active);
- if (!connection_path)
+ if (!conn)
continue;
- tmp = nm_remote_settings_get_connection_by_path (applet->settings, connection_path);
- if (!tmp)
- continue;
-
- if (!g_strcmp0 (nm_connection_get_interface_name (NM_CONNECTION (tmp)), iface)) {
- connection = NM_CONNECTION (tmp);
+ if (!g_strcmp0 (nm_connection_get_interface_name (NM_CONNECTION (conn)), iface)) {
if (out_active)
*out_active = active;
- break;
+ return NM_CONNECTION (conn);
}
}
- return connection;
+ return NULL;
}
gboolean
@@ -2450,7 +2409,7 @@ applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet)
if (!nm_g_ptr_array_contains (devices, device))
continue;
- connection = nm_remote_settings_get_connection_by_path (applet->settings, connection_path);
+ connection = nm_client_get_connection_by_path (applet->client, connection_path);
if (connection)
return connection;
}
@@ -3088,14 +3047,14 @@ applet_secrets_request_complete_setting (SecretsRequest *req,
if (!secrets_dict) {
g_set_error (&error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"%s.%d (%s): failed to hash setting '%s'.",
__FILE__, __LINE__, __func__, setting_name);
}
} else {
g_set_error (&error,
NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"%s.%d (%s): unhandled setting '%s'",
__FILE__, __LINE__, __func__, setting_name);
}
@@ -3189,7 +3148,7 @@ applet_agent_get_secrets_cb (AppletAgent *agent,
dclass = get_device_class_from_connection (connection, applet);
if (!dclass) {
error = g_error_new (NM_SECRET_AGENT_ERROR,
- NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+ NM_SECRET_AGENT_ERROR_FAILED,
"%s.%d (%s): device type unknown",
__FILE__, __LINE__, __func__);
goto error;
@@ -3647,7 +3606,6 @@ initable_init (GInitable *initable, GCancellable *cancellable, GError **error)
g_prefix_error (error, "Failed to initialize D-Bus: ");
return FALSE;
}
- applet->settings = nm_remote_settings_new (NULL, NULL);
#ifdef BUILD_MIGRATION_TOOL
{
@@ -3791,9 +3749,6 @@ static void finalize (GObject *object)
if (applet->agent)
g_object_unref (applet->agent);
- if (applet->settings)
- g_object_unref (applet->settings);
-
if (applet->session_bus)
dbus_g_connection_unref (applet->session_bus);
diff --git a/src/applet.h b/src/applet.h
index fbd96c7..c89041a 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -86,7 +86,6 @@ typedef struct
guint agent_start_id;
NMClient *nm_client;
- NMRemoteSettings *settings;
AppletAgent *agent;
GSettings *gsettings;
@@ -267,7 +266,7 @@ NMApplet *nm_applet_new (void);
void applet_schedule_update_icon (NMApplet *applet);
-NMRemoteSettings *applet_get_settings (NMApplet *applet);
+NMClient *applet_get_settings (NMApplet *applet);
GSList *applet_get_all_connections (NMApplet *applet);
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 20c25ad..a645246 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -237,22 +237,22 @@ ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid)
}
char *
-ce_page_get_next_available_name (GSList *connections, const char *format)
+ce_page_get_next_available_name (const GPtrArray *connections, const char *format)
{
GSList *names = NULL, *iter;
char *cname = NULL;
int i = 0;
- for (iter = connections; iter; iter = g_slist_next (iter)) {
+ for (i = 0; i < connections->len; i++) {
const char *id;
- id = nm_connection_get_id (NM_CONNECTION (iter->data));
+ id = nm_connection_get_id (connections->pdata[i]);
g_assert (id);
names = g_slist_append (names, (gpointer) id);
}
/* Find the next available unique connection name */
- while (!cname && (i++ < 10000)) {
+ for (i = 1; !cname && i < 10000; i++) {
char *temp;
gboolean found = FALSE;
@@ -514,13 +514,13 @@ NMConnection *
ce_page_new_connection (const char *format,
const char *ctype,
gboolean autoconnect,
- NMRemoteSettings *settings,
+ NMClient *client,
gpointer user_data)
{
NMConnection *connection;
NMSettingConnection *s_con;
char *uuid, *id;
- GSList *connections;
+ const GPtrArray *connections;
connection = nm_simple_connection_new ();
@@ -529,9 +529,8 @@ ce_page_new_connection (const char *format,
uuid = nm_utils_uuid_generate ();
- connections = nm_remote_settings_list_connections (settings);
+ connections = nm_client_get_connections (client);
id = ce_page_get_next_available_name (connections, format);
- g_slist_free (connections);
g_object_set (s_con,
NM_SETTING_CONNECTION_UUID, uuid,
@@ -551,7 +550,6 @@ ce_page_new (GType page_type,
NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char *ui_file,
const char *widget_name,
const char *title)
@@ -569,7 +567,6 @@ ce_page_new (GType page_type,
NULL));
self->title = g_strdup (title);
self->client = client;
- self->settings = settings;
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 6c1f537..deb5840 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -45,7 +45,7 @@ typedef GSList * (*PageGetConnectionsFunc) (gpointer user_data);
typedef void (*PageNewConnectionFunc) (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
@@ -74,7 +74,6 @@ typedef struct {
NMConnection *connection;
GtkWindow *parent_window;
NMClient *client;
- NMRemoteSettings *settings;
gboolean disposed;
} CEPage;
@@ -94,7 +93,6 @@ typedef struct {
typedef CEPage* (*CEPageNewFunc)(NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
@@ -128,20 +126,19 @@ void ce_page_complete_init (CEPage *self,
gboolean ce_page_get_initialized (CEPage *self);
-char *ce_page_get_next_available_name (GSList *connections, const char *format);
+char *ce_page_get_next_available_name (const GPtrArray *connections, const char *format);
/* Only for subclasses */
NMConnection *ce_page_new_connection (const char *format,
const char *ctype,
gboolean autoconnect,
- NMRemoteSettings *settings,
+ NMClient *client,
gpointer user_data);
CEPage *ce_page_new (GType page_type,
NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char *ui_file,
const char *widget_name,
const char *title);
diff --git a/src/connection-editor/connection-helpers.c b/src/connection-editor/connection-helpers.c
index 29446e2..a5a0a9a 100644
--- a/src/connection-editor/connection-helpers.c
+++ b/src/connection-editor/connection-helpers.c
@@ -48,13 +48,13 @@ static GSList *vpn_plugins;
static gint
sort_vpn_plugins (gconstpointer a, gconstpointer b)
{
- NMVpnPluginUiInterface *aa = NM_VPN_PLUGIN_UI_INTERFACE (a);
- NMVpnPluginUiInterface *bb = NM_VPN_PLUGIN_UI_INTERFACE (b);
+ NMVpnEditorPlugin *aa = NM_VPN_EDITOR_PLUGIN (a);
+ NMVpnEditorPlugin *bb = NM_VPN_EDITOR_PLUGIN (b);
char *aa_desc = NULL, *bb_desc = NULL;
int ret;
- g_object_get (aa, NM_VPN_PLUGIN_UI_INTERFACE_NAME, &aa_desc, NULL);
- g_object_get (bb, NM_VPN_PLUGIN_UI_INTERFACE_NAME, &bb_desc, NULL);
+ g_object_get (aa, NM_VPN_EDITOR_PLUGIN_NAME, &aa_desc, NULL);
+ g_object_get (bb, NM_VPN_EDITOR_PLUGIN_NAME, &bb_desc, NULL);
ret = g_strcmp0 (aa_desc, bb_desc);
@@ -207,7 +207,7 @@ combo_changed_cb (GtkComboBox *combo, gpointer user_data)
GtkLabel *label = GTK_LABEL (user_data);
GtkTreeModel *model;
GtkTreeIter iter;
- NMVpnPluginUiInterface *plugin = NULL;
+ NMVpnEditorPlugin *plugin = NULL;
char *description, *markup;
if (!gtk_combo_box_get_active_iter (combo, &iter))
@@ -221,7 +221,7 @@ combo_changed_cb (GtkComboBox *combo, gpointer user_data)
if (!plugin)
goto error;
- g_object_get (G_OBJECT (plugin), NM_VPN_PLUGIN_UI_INTERFACE_DESC, &description, NULL);
+ g_object_get (G_OBJECT (plugin), NM_VPN_EDITOR_PLUGIN_DESCRIPTION, &description, NULL);
g_object_unref (plugin);
if (!description)
goto error;
@@ -316,10 +316,10 @@ set_up_connection_type_combo (GtkComboBox *combo,
}
for (p = vpn_plugins; p; p = p->next) {
- NMVpnPluginUiInterface *plugin = NM_VPN_PLUGIN_UI_INTERFACE (p->data);
+ NMVpnEditorPlugin *plugin = NM_VPN_EDITOR_PLUGIN (p->data);
char *desc;
- g_object_get (plugin, NM_VPN_PLUGIN_UI_INTERFACE_NAME, &desc, NULL);
+ g_object_get (plugin, NM_VPN_EDITOR_PLUGIN_NAME, &desc, NULL);
if (show_headers)
markup = g_markup_printf_escaped (" %s", desc);
@@ -335,7 +335,7 @@ set_up_connection_type_combo (GtkComboBox *combo,
g_free (markup);
g_free (desc);
- if (nm_vpn_plugin_ui_interface_get_capabilities (plugin) & NM_VPN_PLUGIN_UI_CAPABILITY_IMPORT)
+ if (nm_vpn_editor_plugin_get_capabilities (plugin) & NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT)
import_supported = TRUE;
}
@@ -361,7 +361,7 @@ set_up_connection_type_combo (GtkComboBox *combo,
typedef struct {
GtkWindow *parent_window;
- NMRemoteSettings *settings;
+ NMClient *settings;
NewConnectionResultFunc result_func;
gpointer user_data;
} NewConnectionData;
@@ -395,7 +395,7 @@ new_connection_result (NMConnection *connection,
void
new_connection_of_type (GtkWindow *parent_window,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *settings,
PageNewConnectionFunc new_func,
NewConnectionResultFunc result_func,
gpointer user_data)
@@ -417,7 +417,7 @@ new_connection_of_type (GtkWindow *parent_window,
void
new_connection_dialog (GtkWindow *parent_window,
- NMRemoteSettings *settings,
+ NMClient *settings,
NewConnectionTypeFilterFunc type_filter_func,
NewConnectionResultFunc result_func,
gpointer user_data)
@@ -431,7 +431,7 @@ new_connection_dialog (GtkWindow *parent_window,
void
new_connection_dialog_full (GtkWindow *parent_window,
- NMRemoteSettings *settings,
+ NMClient *settings,
const char *primary_label,
const char *secondary_label,
NewConnectionTypeFilterFunc type_filter_func,
@@ -446,7 +446,7 @@ new_connection_dialog_full (GtkWindow *parent_window,
GtkTreeIter iter;
int response;
PageNewConnectionFunc new_func = NULL;
- NMVpnPluginUiInterface *plugin = NULL;
+ NMVpnEditorPlugin *plugin = NULL;
char *vpn_type = NULL;
GError *error = NULL;
@@ -486,7 +486,7 @@ new_connection_dialog_full (GtkWindow *parent_window,
-1);
if (plugin) {
- g_object_get (G_OBJECT (plugin), NM_VPN_PLUGIN_UI_INTERFACE_SERVICE, &vpn_type, NULL);
+ g_object_get (G_OBJECT (plugin), NM_VPN_EDITOR_PLUGIN_SERVICE, &vpn_type, NULL);
g_object_unref (plugin);
}
}
diff --git a/src/connection-editor/connection-helpers.h b/src/connection-editor/connection-helpers.h
index f50f93f..f704c7d 100644
--- a/src/connection-editor/connection-helpers.h
+++ b/src/connection-editor/connection-helpers.h
@@ -40,12 +40,12 @@ typedef void (*NewConnectionResultFunc) (NMConnection *connection,
gpointer user_data);
void new_connection_dialog (GtkWindow *parent_window,
- NMRemoteSettings *settings,
+ NMClient *client,
NewConnectionTypeFilterFunc type_filter_func,
NewConnectionResultFunc result_func,
gpointer user_data);
void new_connection_dialog_full (GtkWindow *parent_window,
- NMRemoteSettings *settings,
+ NMClient *client,
const char *primary_label,
const char *secondary_label,
NewConnectionTypeFilterFunc type_filter_func,
@@ -54,7 +54,7 @@ void new_connection_dialog_full (GtkWindow *parent_window,
void new_connection_of_type (GtkWindow *parent_window,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionFunc new_func,
NewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/ip4-routes-dialog.c b/src/connection-editor/ip4-routes-dialog.c
index 36df32f..e798587 100644
--- a/src/connection-editor/ip4-routes-dialog.c
+++ b/src/connection-editor/ip4-routes-dialog.c
@@ -125,11 +125,10 @@ get_one_addr (GtkTreeModel *model,
GtkTreeIter *iter,
int column,
gboolean fail_if_missing,
- guint32 *out)
+ char **out)
{
char *item = NULL;
struct in_addr tmp_addr = { 0 };
- gboolean success = FALSE;
gtk_tree_model_get (model, iter, column, &item, -1);
if (!item || !strlen (item)) {
@@ -137,13 +136,16 @@ get_one_addr (GtkTreeModel *model,
return fail_if_missing ? FALSE : TRUE;
}
- if (inet_pton (AF_INET, item, &tmp_addr) > 0) {
- *out = tmp_addr.s_addr;
- success = TRUE;
+ if (inet_pton (AF_INET, item, &tmp_addr) == 0)
+ return FALSE;
+
+ if (tmp_addr.s_addr == 0) {
+ g_free (item);
+ return fail_if_missing ? FALSE : TRUE;
}
- g_free (item);
- return success;
+ *out = item;
+ return TRUE;
}
static void
@@ -166,14 +168,13 @@ validate (GtkWidget *dialog)
iter_valid = gtk_tree_model_get_iter_first (model, &tree_iter);
while (iter_valid) {
- guint32 addr = 0, prefix = 0, next_hop = 0, metric = 0;
+ char *addr = NULL, *next_hop = NULL;
+ guint32 prefix = 0, metric = 0;
/* Address */
if (!get_one_addr (model, &tree_iter, COL_ADDRESS, TRUE, &addr))
goto done;
- /* Don't allow inserting 0.0.0.0 for now - that's not supported in libnm-util */
- if (addr == 0)
- goto done;
+ g_free (addr);
/* Prefix */
if (!get_one_prefix (model, &tree_iter, COL_PREFIX, TRUE, &prefix))
@@ -185,6 +186,7 @@ validate (GtkWidget *dialog)
/* Next hop (optional) */
if (!get_one_addr (model, &tree_iter, COL_NEXT_HOP, FALSE, &next_hop))
goto done;
+ g_free (next_hop);
/* Metric (optional) */
if (!get_one_int (model, &tree_iter, COL_METRIC, G_MAXUINT32, FALSE, &metric))
@@ -627,7 +629,7 @@ tree_view_button_pressed_cb (GtkWidget *widget,
}
GtkWidget *
-ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic)
+ip4_routes_dialog_new (NMSettingIPConfig *s_ip4, gboolean automatic)
{
GtkBuilder *builder;
GtkWidget *dialog, *widget, *ok_button;
@@ -673,36 +675,31 @@ ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic)
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
/* Add existing routes */
- for (i = 0; i < nm_setting_ip4_config_get_num_routes (s_ip4); i++) {
- NMIP4Route *route = nm_setting_ip4_config_get_route (s_ip4, i);
+ for (i = 0; i < nm_setting_ip_config_get_num_routes (s_ip4); i++) {
+ NMIPRoute *route = nm_setting_ip_config_get_route (s_ip4, i);
struct in_addr tmp_addr;
- char ip_string[INET_ADDRSTRLEN];
- char *tmp;
+ char netmask[INET_ADDRSTRLEN], metric[32];
if (!route) {
g_warning ("%s: empty IP4 route structure!", __func__);
continue;
}
- gtk_list_store_append (store, &model_iter);
-
- tmp_addr.s_addr = nm_ip4_route_get_dest (route);;
- if (inet_ntop (AF_INET, &tmp_addr, &ip_string[0], sizeof (ip_string)))
- gtk_list_store_set (store, &model_iter, COL_ADDRESS, ip_string, -1);
-
- tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip4_route_get_prefix (route));
- if (inet_ntop (AF_INET, &tmp_addr, &ip_string[0], sizeof (ip_string)))
- gtk_list_store_set (store, &model_iter, COL_PREFIX, ip_string, -1);
+ tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip_route_get_prefix (route));
+ if (!inet_ntop (AF_INET, &tmp_addr, netmask, sizeof (netmask)))
+ *netmask = '\0';
- tmp_addr.s_addr = nm_ip4_route_get_next_hop (route);
- if (tmp_addr.s_addr && inet_ntop (AF_INET, &tmp_addr, &ip_string[0], sizeof (ip_string)))
- gtk_list_store_set (store, &model_iter, COL_NEXT_HOP, ip_string, -1);
+ /* FIXME */
+ g_snprintf (metric, sizeof (metric), "%u",
+ (guint32) MIN (0, nm_ip_route_get_metric (route)));
- if (nm_ip4_route_get_metric (route)) {
- tmp = g_strdup_printf ("%d", nm_ip4_route_get_metric (route));
- gtk_list_store_set (store, &model_iter, COL_METRIC, tmp, -1);
- g_free (tmp);
- }
+ gtk_list_store_append (store, &model_iter);
+ gtk_list_store_set (store, &model_iter,
+ COL_ADDRESS, nm_ip_route_get_dest (route),
+ COL_PREFIX, netmask,
+ COL_NEXT_HOP, nm_ip_route_get_next_hop (route),
+ COL_METRIC, metric,
+ -1);
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_routes"));
@@ -795,12 +792,12 @@ ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_ignore_auto_routes"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
- nm_setting_ip4_config_get_ignore_auto_routes (s_ip4));
+ nm_setting_ip_config_get_ignore_auto_routes (s_ip4));
gtk_widget_set_sensitive (widget, automatic);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_never_default"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
- nm_setting_ip4_config_get_never_default (s_ip4));
+ nm_setting_ip_config_get_never_default (s_ip4));
/* Update initial validity */
validate (dialog);
@@ -809,7 +806,7 @@ ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic)
}
void
-ip4_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP4Config *s_ip4)
+ip4_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIPConfig *s_ip4)
{
GtkBuilder *builder;
GtkWidget *widget;
@@ -828,11 +825,12 @@ ip4_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP4Config *s_ip4)
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
iter_valid = gtk_tree_model_get_iter_first (model, &tree_iter);
- nm_setting_ip4_config_clear_routes (s_ip4);
+ nm_setting_ip_config_clear_routes (s_ip4);
while (iter_valid) {
- guint32 addr = 0, prefix = 0, next_hop = 0, metric = 0;
- NMIP4Route *route;
+ char *addr = NULL, *next_hop = NULL;
+ guint32 prefix = 0, metric = 0;
+ NMIPRoute *route;
/* Address */
if (!get_one_addr (model, &tree_iter, COL_ADDRESS, TRUE, &addr)) {
@@ -843,40 +841,43 @@ ip4_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP4Config *s_ip4)
/* Prefix */
if (!get_one_prefix (model, &tree_iter, COL_PREFIX, TRUE, &prefix)) {
g_warning ("%s: IPv4 prefix/netmask missing or invalid!", __func__);
+ g_free (addr);
goto next;
}
/* Next hop (optional) */
if (!get_one_addr (model, &tree_iter, COL_NEXT_HOP, FALSE, &next_hop)) {
g_warning ("%s: IPv4 next hop invalid!", __func__);
+ g_free (addr);
goto next;
}
/* Metric (optional) */
if (!get_one_int (model, &tree_iter, COL_METRIC, G_MAXUINT32, FALSE, &metric)) {
g_warning ("%s: IPv4 metric invalid!", __func__);
+ g_free (addr);
+ g_free (next_hop);
goto next;
}
- route = nm_ip4_route_new ();
- nm_ip4_route_set_dest (route, addr);
- nm_ip4_route_set_prefix (route, prefix);
- nm_ip4_route_set_next_hop (route, next_hop);
- nm_ip4_route_set_metric (route, metric);
- nm_setting_ip4_config_add_route (s_ip4, route);
- nm_ip4_route_unref (route);
+ route = nm_ip_route_new (AF_INET, addr, prefix, next_hop, metric, NULL);
+ nm_setting_ip_config_add_route (s_ip4, route);
+ nm_ip_route_unref (route);
+
+ g_free (addr);
+ g_free (next_hop);
next:
iter_valid = gtk_tree_model_iter_next (model, &tree_iter);
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_ignore_auto_routes"));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES,
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
NULL);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip4_never_default"));
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT,
+ g_object_set (s_ip4, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
NULL);
}
diff --git a/src/connection-editor/ip4-routes-dialog.h b/src/connection-editor/ip4-routes-dialog.h
index 1f6c665..b7e38b2 100644
--- a/src/connection-editor/ip4-routes-dialog.h
+++ b/src/connection-editor/ip4-routes-dialog.h
@@ -30,8 +30,8 @@
#include "nm-setting-ip4-config.h"
-GtkWidget *ip4_routes_dialog_new (NMSettingIP4Config *s_ip4, gboolean automatic);
+GtkWidget *ip4_routes_dialog_new (NMSettingIPConfig *s_ip4, gboolean automatic);
-void ip4_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP4Config *s_ip4);
+void ip4_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIPConfig *s_ip4);
#endif /* IP4_ROUTES_DIALOG_H */
diff --git a/src/connection-editor/ip6-routes-dialog.c b/src/connection-editor/ip6-routes-dialog.c
index d524318..c967b8a 100644
--- a/src/connection-editor/ip6-routes-dialog.c
+++ b/src/connection-editor/ip6-routes-dialog.c
@@ -86,10 +86,10 @@ get_one_addr (GtkTreeModel *model,
GtkTreeIter *iter,
int column,
gboolean fail_if_missing,
- struct in6_addr *out)
+ char **out)
{
char *item = NULL;
- gboolean success = FALSE;
+ struct in6_addr tmp_addr;
gtk_tree_model_get (model, iter, column, &item, -1);
if (!item || !strlen (item)) {
@@ -97,11 +97,16 @@ get_one_addr (GtkTreeModel *model,
return fail_if_missing ? FALSE : TRUE;
}
- if (inet_pton (AF_INET6, item, out) > 0)
- success = TRUE;
+ if (inet_pton (AF_INET6, item, &tmp_addr) == 0)
+ return FALSE;
- g_free (item);
- return success;
+ if (IN6_IS_ADDR_UNSPECIFIED (&tmp_addr)) {
+ g_free (item);
+ return fail_if_missing ? FALSE : TRUE;
+ }
+
+ *out = item;
+ return TRUE;
}
static void
@@ -124,12 +129,13 @@ validate (GtkWidget *dialog)
iter_valid = gtk_tree_model_get_iter_first (model, &tree_iter);
while (iter_valid) {
- struct in6_addr dest, next_hop;
+ char *dest = NULL, *next_hop = NULL;
guint prefix = 0, metric = 0;
/* Address */
if (!get_one_addr (model, &tree_iter, COL_ADDRESS, TRUE, &dest))
goto done;
+ g_free (dest);
/* Prefix */
if (!get_one_int (model, &tree_iter, COL_PREFIX, 128, TRUE, &prefix))
@@ -138,6 +144,7 @@ validate (GtkWidget *dialog)
/* Next hop (optional) */
if (!get_one_addr (model, &tree_iter, COL_NEXT_HOP, FALSE, &next_hop))
goto done;
+ g_free (next_hop);
/* Metric (optional) */
if (!get_one_int (model, &tree_iter, COL_METRIC, G_MAXUINT32, FALSE, &metric))
@@ -570,7 +577,7 @@ tree_view_button_pressed_cb (GtkWidget *widget,
}
GtkWidget *
-ip6_routes_dialog_new (NMSettingIP6Config *s_ip6, gboolean automatic)
+ip6_routes_dialog_new (NMSettingIPConfig *s_ip6, gboolean automatic)
{
GtkBuilder *builder;
GtkWidget *dialog, *widget, *ok_button;
@@ -616,37 +623,28 @@ ip6_routes_dialog_new (NMSettingIP6Config *s_ip6, gboolean automatic)
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
/* Add existing routes */
- for (i = 0; i < nm_setting_ip6_config_get_num_routes (s_ip6); i++) {
- NMIP6Route *route = nm_setting_ip6_config_get_route (s_ip6, i);
- const struct in6_addr *tmp_addr;
- char ip_string[INET6_ADDRSTRLEN];
- char *tmp;
+ for (i = 0; i < nm_setting_ip_config_get_num_routes (s_ip6); i++) {
+ NMIPRoute *route = nm_setting_ip_config_get_route (s_ip6, i);
+ char prefix[32], metric[32];
if (!route) {
g_warning ("%s: empty IP6 route structure!", __func__);
continue;
}
- gtk_list_store_append (store, &model_iter);
-
- tmp_addr = nm_ip6_route_get_dest (route);
- if (inet_ntop (AF_INET6, tmp_addr, ip_string, sizeof (ip_string)))
- gtk_list_store_set (store, &model_iter, COL_ADDRESS, ip_string, -1);
+ g_snprintf (prefix, sizeof (prefix), "%u", nm_ip_route_get_prefix (route));
- tmp = g_strdup_printf ("%u", nm_ip6_route_get_prefix (route));
- gtk_list_store_set (store, &model_iter, COL_PREFIX, tmp, -1);
- g_free (tmp);
+ /* FIXME */
+ g_snprintf (metric, sizeof (metric), "%u",
+ (guint32) MIN (0, nm_ip_route_get_metric (route)));
- tmp_addr = nm_ip6_route_get_next_hop (route);
- if (tmp_addr && !IN6_IS_ADDR_UNSPECIFIED (tmp_addr) &&
- inet_ntop (AF_INET6, tmp_addr, ip_string, sizeof (ip_string)))
- gtk_list_store_set (store, &model_iter, COL_NEXT_HOP, ip_string, -1);
-
- if (nm_ip6_route_get_metric (route)) {
- tmp = g_strdup_printf ("%u", nm_ip6_route_get_metric (route));
- gtk_list_store_set (store, &model_iter, COL_METRIC, tmp, -1);
- g_free (tmp);
- }
+ gtk_list_store_append (store, &model_iter);
+ gtk_list_store_set (store, &model_iter,
+ COL_ADDRESS, nm_ip_route_get_dest (route),
+ COL_PREFIX, prefix,
+ COL_NEXT_HOP, nm_ip_route_get_next_hop (route),
+ COL_METRIC, metric,
+ -1);
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_routes"));
@@ -739,12 +737,12 @@ ip6_routes_dialog_new (NMSettingIP6Config *s_ip6, gboolean automatic)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_ignore_auto_routes"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
- nm_setting_ip6_config_get_ignore_auto_routes (s_ip6));
+ nm_setting_ip_config_get_ignore_auto_routes (s_ip6));
gtk_widget_set_sensitive (widget, automatic);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_never_default"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
- nm_setting_ip6_config_get_never_default (s_ip6));
+ nm_setting_ip_config_get_never_default (s_ip6));
/* Update initial validity */
validate (dialog);
@@ -753,7 +751,7 @@ ip6_routes_dialog_new (NMSettingIP6Config *s_ip6, gboolean automatic)
}
void
-ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP6Config *s_ip6)
+ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIPConfig *s_ip6)
{
GtkBuilder *builder;
GtkWidget *widget;
@@ -772,12 +770,12 @@ ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP6Config *s_ip6)
model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
iter_valid = gtk_tree_model_get_iter_first (model, &tree_iter);
- nm_setting_ip6_config_clear_routes (s_ip6);
+ nm_setting_ip_config_clear_routes (s_ip6);
while (iter_valid) {
- struct in6_addr dest, next_hop;
+ char *dest = NULL, *next_hop = NULL;
guint prefix = 0, metric = 0;
- NMIP6Route *route;
+ NMIPRoute *route;
/* Address */
if (!get_one_addr (model, &tree_iter, COL_ADDRESS, TRUE, &dest)) {
@@ -788,6 +786,7 @@ ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP6Config *s_ip6)
/* Prefix */
if (!get_one_int (model, &tree_iter, COL_PREFIX, 128, TRUE, &prefix)) {
g_warning ("%s: IPv6 prefix missing or invalid!", __func__);
+ g_free (dest);
goto next;
}
@@ -795,34 +794,33 @@ ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP6Config *s_ip6)
memset (&next_hop, 0, sizeof (struct in6_addr));
if (!get_one_addr (model, &tree_iter, COL_NEXT_HOP, FALSE, &next_hop)) {
g_warning ("%s: IPv6 next hop invalid!", __func__);
+ g_free (dest);
goto next;
}
/* Metric (optional) */
if (!get_one_int (model, &tree_iter, COL_METRIC, G_MAXUINT32, FALSE, &metric)) {
g_warning ("%s: IPv6 metric invalid!", __func__);
+ g_free (dest);
+ g_free (next_hop);
goto next;
}
- route = nm_ip6_route_new ();
- nm_ip6_route_set_dest (route, &dest);
- nm_ip6_route_set_prefix (route, prefix);
- nm_ip6_route_set_next_hop (route, &next_hop);
- nm_ip6_route_set_metric (route, metric);
- nm_setting_ip6_config_add_route (s_ip6, route);
- nm_ip6_route_unref (route);
+ route = nm_ip_route_new (AF_INET6, dest, prefix, next_hop, metric, NULL);
+ nm_setting_ip_config_add_route (s_ip6, route);
+ nm_ip_route_unref (route);
next:
iter_valid = gtk_tree_model_iter_next (model, &tree_iter);
}
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_ignore_auto_routes"));
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES,
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
NULL);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "ip6_never_default"));
- g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT,
+ g_object_set (s_ip6, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
NULL);
}
diff --git a/src/connection-editor/ip6-routes-dialog.h b/src/connection-editor/ip6-routes-dialog.h
index 2312c49..746eab1 100644
--- a/src/connection-editor/ip6-routes-dialog.h
+++ b/src/connection-editor/ip6-routes-dialog.h
@@ -30,8 +30,8 @@
#include "nm-setting-ip6-config.h"
-GtkWidget *ip6_routes_dialog_new (NMSettingIP6Config *s_ip6, gboolean automatic);
+GtkWidget *ip6_routes_dialog_new (NMSettingIPConfig *s_ip6, gboolean automatic);
-void ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIP6Config *s_ip6);
+void ip6_routes_dialog_update_setting (GtkWidget *dialog, NMSettingIPConfig *s_ip6);
#endif /* IP6_ROUTES_DIALOG_H */
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 6359c6a..cad9b4d 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -342,8 +342,6 @@ dispose (GObject *object)
g_signal_handler_disconnect (editor->client, editor->permission_id);
g_object_unref (editor->client);
- g_object_unref (editor->settings);
-
out:
G_OBJECT_CLASS (nm_connection_editor_parent_class)->dispose (object);
}
@@ -370,8 +368,7 @@ nm_connection_editor_class_init (NMConnectionEditorClass *klass)
NMConnectionEditor *
nm_connection_editor_new (GtkWindow *parent_window,
NMConnection *connection,
- NMClient *client,
- NMRemoteSettings *settings)
+ NMClient *client)
{
NMConnectionEditor *editor;
GtkWidget *hbox;
@@ -380,12 +377,11 @@ nm_connection_editor_new (GtkWindow *parent_window,
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
- is_new = !nm_remote_settings_get_connection_by_uuid (settings, nm_connection_get_uuid (connection));
+ is_new = !nm_client_get_connection_by_uuid (client, nm_connection_get_uuid (connection));
editor = g_object_new (NM_TYPE_CONNECTION_EDITOR, NULL);
editor->parent_window = parent_window ? g_object_ref (parent_window) : NULL;
editor->client = g_object_ref (client);
- editor->settings = g_object_ref (settings);
editor->is_new_connection = is_new;
editor->can_modify = nm_client_get_permission_result (client,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
@@ -681,7 +677,7 @@ 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) (connection, GTK_WINDOW (editor->window), editor->client,
&secrets_setting_name, error);
if (page) {
g_object_set_data_full (G_OBJECT (page),
@@ -866,7 +862,7 @@ editor_closed_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
}
static void
-added_connection_cb (GObject *settings,
+added_connection_cb (GObject *client,
GAsyncResult *result,
gpointer user_data)
{
@@ -876,8 +872,7 @@ added_connection_cb (GObject *settings,
nm_connection_editor_set_busy (self, FALSE);
- connection = nm_remote_settings_add_connection_finish (NM_REMOTE_SETTINGS (settings),
- result, &error);
+ connection = nm_client_add_connection_finish (NM_CLIENT (client), result, &error);
if (error) {
nm_connection_editor_error (self->parent_window, _("Connection add failed"),
"%s", error->message);
@@ -929,12 +924,12 @@ ok_button_clicked_save_connection (NMConnectionEditor *self)
eap_method_ca_cert_ignore_save (self->connection);
if (self->is_new_connection) {
- nm_remote_settings_add_connection_async (self->settings,
- self->orig_connection,
- TRUE,
- NULL,
- added_connection_cb,
- self);
+ nm_client_add_connection_async (self->client,
+ self->orig_connection,
+ TRUE,
+ NULL,
+ added_connection_cb,
+ self);
} else {
nm_remote_connection_commit_changes_async (NM_REMOTE_CONNECTION (self->orig_connection),
TRUE, NULL, updated_connection_cb, self);
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index b815a19..7c953b8 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -41,7 +41,6 @@ typedef struct {
GtkWindow *parent_window;
NMClient *client;
guint permission_id;
- NMRemoteSettings *settings;
/* private data */
NMConnection *connection;
@@ -77,8 +76,7 @@ typedef struct {
GType nm_connection_editor_get_type (void);
NMConnectionEditor *nm_connection_editor_new (GtkWindow *parent_window,
NMConnection *connection,
- NMClient *client,
- NMRemoteSettings *settings);
+ NMClient *client);
NMConnectionEditor *nm_connection_editor_get (NMConnection *connection);
NMConnectionEditor *nm_connection_editor_get_master (NMConnection *slave);
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 850db4a..5640f3e 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -276,8 +276,7 @@ really_add_connection (NMConnection *connection,
return;
}
- editor = nm_connection_editor_new (GTK_WINDOW (list->dialog), connection,
- list->nm_client, list->settings);
+ editor = nm_connection_editor_new (GTK_WINDOW (list->dialog), connection, list->client);
if (!editor) {
g_object_unref (connection);
g_signal_emit (list, list_signals[EDITING_DONE], 0, 0);
@@ -294,7 +293,7 @@ add_clicked (GtkButton *button, gpointer user_data)
NMConnectionList *list = user_data;
new_connection_dialog (GTK_WINDOW (list->dialog),
- list->settings,
+ list->client,
NULL,
really_add_connection,
list);
@@ -333,8 +332,7 @@ edit_connection (NMConnectionList *list, NMConnection *connection)
editor = nm_connection_editor_new (GTK_WINDOW (list->dialog),
NM_CONNECTION (connection),
- list->nm_client,
- list->settings);
+ list->client);
g_signal_connect (editor, "done", G_CALLBACK (edit_done_cb), list);
nm_connection_editor_run (editor);
}
@@ -424,11 +422,8 @@ dispose (GObject *object)
if (list->gui)
g_object_unref (list->gui);
- if (list->nm_client)
- g_object_unref (list->nm_client);
-
- if (list->settings)
- g_object_unref (list->settings);
+ if (list->client)
+ g_object_unref (list->client);
G_OBJECT_CLASS (nm_connection_list_parent_class)->dispose (object);
}
@@ -569,7 +564,7 @@ tree_model_visible_func (GtkTreeModel *model,
&& g_strcmp0 (slave_type, NM_SETTING_BRIDGE_SETTING_NAME) != 0)
return TRUE;
- if (nm_remote_settings_get_connection_by_uuid (self->settings, master))
+ if (nm_client_get_connection_by_uuid (self->client, master))
return FALSE;
if (nm_connection_editor_get_master (connection))
return FALSE;
@@ -670,7 +665,7 @@ add_connection_buttons (NMConnectionList *self)
_("Edit the selected connection"),
_("Authenticate to edit the selected connection"),
GTK_STOCK_EDIT,
- self->nm_client,
+ self->client,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
g_object_set_data (G_OBJECT (button), "NMConnectionList", self);
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
@@ -686,7 +681,7 @@ add_connection_buttons (NMConnectionList *self)
_("Delete the selected connection"),
_("Authenticate to delete the selected connection"),
GTK_STOCK_DELETE,
- self->nm_client,
+ self->client,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
g_object_set_data (G_OBJECT (button), "NMConnectionList", self);
gtk_button_set_use_underline (GTK_BUTTON (button), TRUE);
@@ -700,7 +695,7 @@ add_connection_buttons (NMConnectionList *self)
}
static void
-connection_removed (NMRemoteSettings *settings,
+connection_removed (NMClient *client,
NMRemoteConnection *connection,
gpointer user_data)
{
@@ -760,7 +755,7 @@ get_parent_iter_for_connection (NMConnectionList *list,
}
static void
-connection_added (NMRemoteSettings *settings,
+connection_added (NMClient *client,
NMRemoteConnection *connection,
gpointer user_data)
{
@@ -807,7 +802,7 @@ connection_added (NMRemoteSettings *settings,
gtk_tree_path_free (path);
}
- g_signal_connect (settings, NM_REMOTE_SETTINGS_CONNECTION_REMOVED, G_CALLBACK (connection_removed),
self);
+ g_signal_connect (client, NM_CLIENT_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self);
g_signal_connect (connection, NM_CONNECTION_CHANGED, G_CALLBACK (connection_changed), self);
gtk_tree_model_filter_refilter (self->filter);
}
@@ -818,7 +813,8 @@ nm_connection_list_new (void)
NMConnectionList *list;
GtkTreePath *path;
GtkTreeIter iter;
- GSList *all_cons, *it;
+ const GPtrArray *all_cons;
+ int i;
GError *error = NULL;
const char *objects[] = { "NMConnectionList", NULL };
@@ -840,15 +836,11 @@ nm_connection_list_new (void)
gtk_window_set_default_icon_name ("preferences-system-network");
- list->nm_client = nm_client_new (NULL, NULL);
- if (!list->nm_client)
+ list->client = nm_client_new (NULL, NULL);
+ if (!list->client)
goto error;
-
- list->settings = nm_remote_settings_new (NULL, NULL);
- if (!list->settings)
- goto error;
- g_signal_connect (list->settings,
- NM_REMOTE_SETTINGS_CONNECTION_ADDED,
+ g_signal_connect (list->client,
+ NM_CLIENT_CONNECTION_ADDED,
G_CALLBACK (connection_added),
list);
@@ -858,9 +850,9 @@ nm_connection_list_new (void)
/* Fill the treeview initially */
- all_cons = nm_remote_settings_list_connections (list->settings);
- for (it = all_cons; it; it = it->next)
- connection_added (list->settings, it->data, list);
+ all_cons = nm_client_get_connections (list->client);
+ for (i = 0; i < all_cons->len; i++)
+ connection_added (list->client, all_cons->pdata[i], list);
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (list->sortable), &iter)) {
path = gtk_tree_model_get_path (GTK_TREE_MODEL (list->sortable), &iter);
@@ -921,82 +913,29 @@ nm_connection_list_create (NMConnectionList *self, GType ctype, const char *deta
} else {
new_connection_of_type (GTK_WINDOW (self->dialog),
detail,
- self->settings,
+ self->client,
types[i].new_connection_func,
really_add_connection,
self);
}
}
-static NMConnection *
-get_connection (NMRemoteSettings *settings, const gchar *id)
-{
- const gchar *uuid;
- NMConnection *connection = NULL;
- GSList *list, *l;
-
- list = nm_remote_settings_list_connections (settings);
- for (l = list; l; l = l->next) {
- connection = l->data;
- uuid = nm_connection_get_uuid (connection);
- if (g_strcmp0 (uuid, id) == 0) {
- g_slist_free (list);
- return connection;
- }
- }
-
- g_slist_free (list);
- return NULL;
-}
-
-typedef struct {
- NMConnectionList *self;
- const gchar *uuid;
- gboolean wait;
-} EditData;
-
-static void
-connections_read (NMRemoteSettings *settings, EditData *data)
-{
- NMConnection *connection;
- static gulong signal_id = 0;
-
- connection = get_connection (settings, data->uuid);
- if (connection) {
- edit_connection (data->self, connection);
- g_object_unref (connection);
- } else if (data->wait) {
- data->wait = FALSE;
- signal_id = g_signal_connect (settings, "connections-read",
- G_CALLBACK (connections_read), data);
- return;
- } else {
- nm_connection_editor_error (NULL,
- _("Error editing connection"),
- _("Did not find a connection with UUID '%s'"), data->uuid);
- }
-
- if (signal_id != 0) {
- g_signal_handler_disconnect (settings, signal_id);
- signal_id = 0;
- }
-
- g_free (data);
-}
-
void
nm_connection_list_edit (NMConnectionList *self, const gchar *uuid)
{
- EditData *data;
+ NMConnection *connection;
g_return_if_fail (NM_IS_CONNECTION_LIST (self));
- data = g_new0 (EditData, 1);
- data->self = self;
- data->uuid = uuid;
- data->wait = TRUE;
+ connection = (NMConnection *) nm_client_get_connection_by_uuid (self->client, uuid);
+ if (!connection) {
+ nm_connection_editor_error (NULL,
+ _("Error editing connection"),
+ _("Did not find a connection with UUID '%s'"), uuid);
+ return;
+ }
- connections_read (self->settings, data);
+ edit_connection (self, connection);
}
static void
diff --git a/src/connection-editor/nm-connection-list.h b/src/connection-editor/nm-connection-list.h
index ee9cf1c..32cc648 100644
--- a/src/connection-editor/nm-connection-list.h
+++ b/src/connection-editor/nm-connection-list.h
@@ -43,8 +43,7 @@ typedef struct {
GtkTreeSortable *sortable;
GType displayed_type;
- NMClient *nm_client;
- NMRemoteSettings *settings;
+ NMClient *client;
GtkBuilder *gui;
GtkWidget *dialog;
diff --git a/src/connection-editor/page-8021x-security.c b/src/connection-editor/page-8021x-security.c
index ebbdb62..57ff1c5 100644
--- a/src/connection-editor/page-8021x-security.c
+++ b/src/connection-editor/page-8021x-security.c
@@ -96,7 +96,6 @@ CEPage *
ce_page_8021x_security_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -108,7 +107,6 @@ ce_page_8021x_security_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
NULL,
NULL,
_("802.1x Security")));
diff --git a/src/connection-editor/page-8021x-security.h b/src/connection-editor/page-8021x-security.h
index 3e96977..b06e33f 100644
--- a/src/connection-editor/page-8021x-security.h
+++ b/src/connection-editor/page-8021x-security.h
@@ -48,7 +48,6 @@ GType ce_page_8021x_security_get_type (void);
CEPage *ce_page_8021x_security_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index efb511a..dcd2873 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -376,13 +376,13 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
if (priv->slave_arptype == ARPHRD_INFINIBAND) {
new_connection_of_type (priv->toplevel,
NULL,
- CE_PAGE (self)->settings,
+ CE_PAGE (self)->client,
infiniband_connection_new,
result_func,
master);
} else {
new_connection_dialog (priv->toplevel,
- CE_PAGE (self)->settings,
+ CE_PAGE (self)->client,
connection_type_filter,
result_func,
master);
@@ -412,7 +412,6 @@ CEPage *
ce_page_bond_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -423,7 +422,6 @@ ce_page_bond_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-bond.ui",
"BondPage",
_("Bond")));
@@ -571,13 +569,13 @@ ce_page_bond_class_init (CEPageBondClass *bond_class)
void
bond_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
NMConnection *connection;
- int bond_num = 0, num;
- GSList *connections, *iter;
+ int bond_num = 0, num, i;
+ const GPtrArray *connections;
NMConnection *conn2;
const char *iface;
char *my_iface;
@@ -585,14 +583,14 @@ bond_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("Bond connection %d"),
NM_SETTING_BOND_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_bond_new ());
/* Find an available interface name */
- connections = nm_remote_settings_list_connections (settings);
- for (iter = connections; iter; iter = iter->next) {
- conn2 = iter->data;
+ connections = nm_client_get_connections (client);
+ for (i = 0; i < connections->len; i++) {
+ conn2 = connections->pdata[i];
if (!nm_connection_is_type (conn2, NM_SETTING_BOND_SETTING_NAME))
continue;
@@ -604,7 +602,6 @@ bond_connection_new (GtkWindow *parent,
if (bond_num <= num)
bond_num = num + 1;
}
- g_slist_free (connections);
my_iface = g_strdup_printf ("bond%d", bond_num);
g_object_set (G_OBJECT (connection),
diff --git a/src/connection-editor/page-bond.h b/src/connection-editor/page-bond.h
index c987b15..646abe1 100644
--- a/src/connection-editor/page-bond.h
+++ b/src/connection-editor/page-bond.h
@@ -46,13 +46,12 @@ GType ce_page_bond_get_type (void);
CEPage *ce_page_bond_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void bond_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-bridge-port.c b/src/connection-editor/page-bridge-port.c
index 60eb9c4..8d654b1 100644
--- a/src/connection-editor/page-bridge-port.c
+++ b/src/connection-editor/page-bridge-port.c
@@ -91,7 +91,6 @@ CEPage *
ce_page_bridge_port_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -102,7 +101,6 @@ ce_page_bridge_port_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-bridge-port.ui",
"BridgePortPage",
/* Translators: a "Bridge Port" is a network
diff --git a/src/connection-editor/page-bridge-port.h b/src/connection-editor/page-bridge-port.h
index de5307a..a74f7f8 100644
--- a/src/connection-editor/page-bridge-port.h
+++ b/src/connection-editor/page-bridge-port.h
@@ -48,7 +48,6 @@ GType ce_page_bridge_port_get_type (void);
CEPage *ce_page_bridge_port_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-bridge.c b/src/connection-editor/page-bridge.c
index e84e387..2ec037c 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -168,7 +168,7 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
CEPageBridgePrivate *priv = CE_PAGE_BRIDGE_GET_PRIVATE (self);
new_connection_dialog (priv->toplevel,
- CE_PAGE (self)->settings,
+ CE_PAGE (self)->client,
connection_type_filter,
result_func,
master);
@@ -187,7 +187,6 @@ CEPage *
ce_page_bridge_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -198,7 +197,6 @@ ce_page_bridge_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-bridge.ui",
"BridgePage",
_("Bridge")));
@@ -286,14 +284,14 @@ ce_page_bridge_class_init (CEPageBridgeClass *bridge_class)
void
bridge_connection_new (GtkWindow *parent,
- const char *detail,
- NMRemoteSettings *settings,
- PageNewConnectionResultFunc result_func,
- gpointer user_data)
+ const char *detail,
+ NMClient *client,
+ PageNewConnectionResultFunc result_func,
+ gpointer user_data)
{
NMConnection *connection;
- int bridge_num = 0, num;
- GSList *connections, *iter;
+ int bridge_num = 0, num, i;
+ const GPtrArray *connections;
NMConnection *conn2;
const char *iface;
char *my_iface;
@@ -301,14 +299,14 @@ bridge_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("Bridge connection %d"),
NM_SETTING_BRIDGE_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_bridge_new ());
/* Find an available interface name */
- connections = nm_remote_settings_list_connections (settings);
- for (iter = connections; iter; iter = iter->next) {
- conn2 = iter->data;
+ connections = nm_client_get_connections (client);
+ for (i = 0; i < connections->len; i++) {
+ conn2 = connections->pdata[i];
if (!nm_connection_is_type (conn2, NM_SETTING_BRIDGE_SETTING_NAME))
continue;
@@ -320,7 +318,6 @@ bridge_connection_new (GtkWindow *parent,
if (bridge_num <= num)
bridge_num = num + 1;
}
- g_slist_free (connections);
my_iface = g_strdup_printf ("bridge%d", bridge_num);
g_object_set (G_OBJECT (connection),
diff --git a/src/connection-editor/page-bridge.h b/src/connection-editor/page-bridge.h
index f149dd2..4b1873f 100644
--- a/src/connection-editor/page-bridge.h
+++ b/src/connection-editor/page-bridge.h
@@ -46,13 +46,12 @@ GType ce_page_bridge_get_type (void);
CEPage *ce_page_bridge_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void bridge_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c
index 6433f6c..d2e01e7 100644
--- a/src/connection-editor/page-dcb.c
+++ b/src/connection-editor/page-dcb.c
@@ -582,7 +582,6 @@ CEPage *
ce_page_dcb_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -595,7 +594,6 @@ ce_page_dcb_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-dcb.ui",
"DcbPage",
_("DCB")));
diff --git a/src/connection-editor/page-dcb.h b/src/connection-editor/page-dcb.h
index 2b5f393..ad34520 100644
--- a/src/connection-editor/page-dcb.h
+++ b/src/connection-editor/page-dcb.h
@@ -48,7 +48,6 @@ GType ce_page_dcb_get_type (void);
CEPage *ce_page_dcb_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-dsl.c b/src/connection-editor/page-dsl.c
index 3023097..1f46706 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -115,7 +115,6 @@ CEPage *
ce_page_dsl_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -126,7 +125,6 @@ ce_page_dsl_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-dsl.ui",
"DslPage",
_("DSL")));
@@ -183,16 +181,9 @@ validate (CEPage *page, NMConnection *connection, GError **error)
{
CEPageDsl *self = CE_PAGE_DSL (page);
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self);
- GSList *foo;
- gboolean valid;
ui_to_setting (self);
-
- foo = g_slist_append (NULL, nm_connection_get_setting_ppp (connection));
- valid = nm_setting_verify (NM_SETTING (priv->setting), foo, error);
- g_slist_free (foo);
-
- return valid;
+ return nm_setting_verify (NM_SETTING (priv->setting), connection, error);
}
static void
@@ -216,7 +207,7 @@ ce_page_dsl_class_init (CEPageDslClass *dsl_class)
void
dsl_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -226,7 +217,7 @@ dsl_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("DSL connection %d"),
NM_SETTING_PPPOE_SETTING_NAME,
FALSE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_pppoe_new ());
nm_connection_add_setting (connection, nm_setting_wired_new ());
diff --git a/src/connection-editor/page-dsl.h b/src/connection-editor/page-dsl.h
index 68c6f7d..e893c9a 100644
--- a/src/connection-editor/page-dsl.h
+++ b/src/connection-editor/page-dsl.h
@@ -48,13 +48,12 @@ GType ce_page_dsl_get_type (void);
CEPage *ce_page_dsl_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void dsl_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc callback,
gpointer user_data);
diff --git a/src/connection-editor/page-ethernet.c b/src/connection-editor/page-ethernet.c
index c42e49a..d3096ad 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -218,7 +218,6 @@ CEPage *
ce_page_ethernet_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -229,7 +228,6 @@ ce_page_ethernet_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ethernet.ui",
"EthernetPage",
_("Ethernet")));
@@ -366,7 +364,7 @@ ce_page_ethernet_class_init (CEPageEthernetClass *ethernet_class)
void
ethernet_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -375,7 +373,7 @@ ethernet_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("Ethernet connection %d"),
NM_SETTING_WIRED_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_wired_new ());
diff --git a/src/connection-editor/page-ethernet.h b/src/connection-editor/page-ethernet.h
index 623f5e6..0a06a57 100644
--- a/src/connection-editor/page-ethernet.h
+++ b/src/connection-editor/page-ethernet.h
@@ -48,13 +48,12 @@ GType ce_page_ethernet_get_type (void);
CEPage *ce_page_ethernet_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void ethernet_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-general.c b/src/connection-editor/page-general.c
index 99029cf..8576bdc 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -30,7 +30,6 @@ G_DEFINE_TYPE (CEPageGeneral, ce_page_general, CE_TYPE_PAGE)
#define CE_PAGE_GENERAL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_GENERAL,
CEPageGeneralPrivate))
typedef struct {
- NMRemoteSettings *remote_settings;
NMSettingConnection *setting;
gboolean is_vpn;
@@ -152,11 +151,6 @@ dispose (GObject *object)
CEPageGeneral *self = CE_PAGE_GENERAL (object);
CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (self);
- if (priv->remote_settings) {
- g_object_unref (priv->remote_settings);
- priv->remote_settings = NULL;
- }
-
g_strfreev (priv->zones);
priv->zones = NULL;
@@ -224,7 +218,8 @@ populate_ui (CEPageGeneral *self)
NMSettingConnection *setting = priv->setting;
const char *vpn_uuid;
guint32 combo_idx = 0, idx;
- GSList *con_list, *l;
+ const GPtrArray *con_list;
+ int i;
GtkTreeIter iter;
gboolean global_connection = TRUE;
@@ -234,12 +229,13 @@ populate_ui (CEPageGeneral *self)
/* Secondary UUID (VPN) */
vpn_uuid = nm_setting_connection_get_secondary (setting, 0);
- con_list = nm_remote_settings_list_connections (priv->remote_settings);
- for (l = con_list, idx = 0, combo_idx = 0; l; l = l->next) {
- const char *uuid = nm_connection_get_uuid (l->data);
- const char *id = nm_connection_get_id (l->data);
+ con_list = nm_client_get_connections (CE_PAGE (self)->client);
+ for (i = 0, idx = 0, combo_idx = 0; i < con_list->len; i++) {
+ NMConnection *conn = con_list->pdata[i];
+ const char *uuid = nm_connection_get_uuid (conn);
+ const char *id = nm_connection_get_id (conn);
- if (!nm_connection_is_type (l->data, NM_SETTING_VPN_SETTING_NAME))
+ if (!nm_connection_is_type (conn, NM_SETTING_VPN_SETTING_NAME))
continue;
gtk_list_store_append (priv->dependent_vpn_store, &iter);
@@ -248,7 +244,6 @@ populate_ui (CEPageGeneral *self)
combo_idx = idx;
idx++;
}
- g_slist_free (con_list);
gtk_combo_box_set_active (GTK_COMBO_BOX (priv->dependent_vpn), combo_idx);
/* We don't support multiple VPNs at the moment, so hide secondary
@@ -308,7 +303,6 @@ CEPage *
ce_page_general_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -319,7 +313,6 @@ ce_page_general_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-general.ui",
"GeneralPage",
_("General")));
@@ -332,8 +325,6 @@ ce_page_general_new (NMConnection *connection,
general_private_init (self);
priv = CE_PAGE_GENERAL_GET_PRIVATE (self);
- priv->remote_settings = g_object_ref (settings);
-
priv->setting = nm_connection_get_setting_connection (connection);
if (!priv->setting) {
priv->setting = NM_SETTING_CONNECTION (nm_setting_connection_new ());
diff --git a/src/connection-editor/page-general.h b/src/connection-editor/page-general.h
index 6e68e3b..23ee94d 100644
--- a/src/connection-editor/page-general.h
+++ b/src/connection-editor/page-general.h
@@ -44,11 +44,10 @@ 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);
+ GtkWindow *parent,
+ NMClient *client,
+ 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 8a8464f..3f8cb7c 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -134,7 +134,6 @@ CEPage *
ce_page_infiniband_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -145,7 +144,6 @@ ce_page_infiniband_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-infiniband.ui",
"InfinibandPage",
_("InfiniBand")));
@@ -236,7 +234,7 @@ ce_page_infiniband_class_init (CEPageInfinibandClass *infiniband_class)
void
infiniband_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -245,7 +243,7 @@ infiniband_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("InfiniBand connection %d"),
NM_SETTING_INFINIBAND_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_infiniband_new ());
diff --git a/src/connection-editor/page-infiniband.h b/src/connection-editor/page-infiniband.h
index 55c741e..ab45277 100644
--- a/src/connection-editor/page-infiniband.h
+++ b/src/connection-editor/page-infiniband.h
@@ -46,13 +46,12 @@ GType ce_page_infiniband_get_type (void);
CEPage *ce_page_infiniband_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void infiniband_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-ip4.c b/src/connection-editor/page-ip4.c
index 0e0b76c..84b0f1f 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -47,7 +47,7 @@ G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
#define COL_LAST COL_GATEWAY
typedef struct {
- NMSettingIP4Config *setting;
+ NMSettingIPConfig *setting;
char *connection_id;
GType connection_type;
@@ -335,7 +335,7 @@ static void
populate_ui (CEPageIP4 *self)
{
CEPageIP4Private *priv = CE_PAGE_IP4_GET_PRIVATE (self);
- NMSettingIP4Config *setting = priv->setting;
+ NMSettingIPConfig *setting = priv->setting;
GtkListStore *store;
GtkTreeIter model_iter;
int method = IP4_METHOD_AUTO;
@@ -346,7 +346,7 @@ populate_ui (CEPageIP4 *self)
/* Method */
gtk_combo_box_set_active (priv->method, 0);
- str_method = nm_setting_ip4_config_get_method (setting);
+ str_method = nm_setting_ip_config_get_method (setting);
if (str_method) {
if (!strcmp (str_method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL))
method = IP4_METHOD_LINK_LOCAL;
@@ -358,7 +358,7 @@ populate_ui (CEPageIP4 *self)
method = IP4_METHOD_DISABLED;
}
- if (method == IP4_METHOD_AUTO && nm_setting_ip4_config_get_ignore_auto_dns (setting))
+ if (method == IP4_METHOD_AUTO && nm_setting_ip_config_get_ignore_auto_dns (setting))
method = IP4_METHOD_AUTO_ADDRESSES;
info.method = method;
@@ -367,10 +367,8 @@ populate_ui (CEPageIP4 *self)
/* Addresses */
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- for (i = 0; i < nm_setting_ip4_config_get_num_addresses (setting); i++) {
- NMIP4Address *addr = nm_setting_ip4_config_get_address (setting, i);
- struct in_addr tmp_addr;
- char buf[INET_ADDRSTRLEN + 1];
+ for (i = 0; i < nm_setting_ip_config_get_num_addresses (setting); i++) {
+ NMIPAddress *addr = nm_setting_ip_config_get_address (setting, i);
if (!addr) {
g_warning ("%s: empty IP4 Address structure!", __func__);
@@ -378,18 +376,12 @@ populate_ui (CEPageIP4 *self)
}
gtk_list_store_append (store, &model_iter);
-
- tmp_addr.s_addr = nm_ip4_address_get_address (addr);
- (void) inet_ntop (AF_INET, &tmp_addr, &buf[0], sizeof (buf));
- gtk_list_store_set (store, &model_iter, COL_ADDRESS, buf, -1);
-
- tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip4_address_get_prefix (addr));
- (void) inet_ntop (AF_INET, &tmp_addr, &buf[0], sizeof (buf));
- gtk_list_store_set (store, &model_iter, COL_PREFIX, buf, -1);
-
- tmp_addr.s_addr = nm_ip4_address_get_gateway (addr);
- (void) inet_ntop (AF_INET, &tmp_addr, &buf[0], sizeof (buf));
- gtk_list_store_set (store, &model_iter, COL_GATEWAY, buf, -1);
+ gtk_list_store_set (store, &model_iter,
+ COL_ADDRESS, nm_ip_address_get_address (addr),
+ COL_PREFIX, nm_ip_address_get_prefix (addr),
+ /* FIXME */
+ COL_GATEWAY, i == 0 ? nm_setting_ip_config_get_gateway (setting) : NULL,
+ -1);
}
gtk_tree_view_set_model (priv->addr_list, GTK_TREE_MODEL (store));
@@ -399,10 +391,10 @@ populate_ui (CEPageIP4 *self)
/* DNS servers */
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip4_config_get_num_dns (setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_dns (setting); i++) {
const char *dns;
- dns = nm_setting_ip4_config_get_dns (setting, i);
+ dns = nm_setting_ip_config_get_dns (setting, i);
if (!dns)
continue;
@@ -415,24 +407,24 @@ populate_ui (CEPageIP4 *self)
/* DNS searches */
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip4_config_get_num_dns_searches (setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_dns_searches (setting); i++) {
if (string->len)
g_string_append (string, ", ");
- g_string_append (string, nm_setting_ip4_config_get_dns_search (setting, i));
+ g_string_append (string, nm_setting_ip_config_get_dns_search (setting, i));
}
gtk_entry_set_text (priv->dns_searches, string->str);
g_string_free (string, TRUE);
if ((method == IP4_METHOD_AUTO) || (method == IP4_METHOD_AUTO_ADDRESSES)) {
- if (nm_setting_ip4_config_get_dhcp_client_id (setting)) {
+ if (nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (setting))) {
gtk_entry_set_text (priv->dhcp_client_id,
- nm_setting_ip4_config_get_dhcp_client_id (setting));
+ nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG
(setting)));
}
}
/* IPv4 required */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->ip4_required),
- !nm_setting_ip4_config_get_may_fail (setting));
+ !nm_setting_ip_config_get_may_fail (setting));
}
static void
@@ -824,7 +816,7 @@ routes_button_clicked_cb (GtkWidget *button, gpointer user_data)
toplevel = gtk_widget_get_toplevel (CE_PAGE (self)->page);
g_return_if_fail (gtk_widget_is_toplevel (toplevel));
- method = nm_setting_ip4_config_get_method (priv->setting);
+ method = nm_setting_ip_config_get_method (priv->setting);
if (!method || !strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO))
automatic = TRUE;
@@ -978,7 +970,6 @@ CEPage *
ce_page_ip4_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -990,7 +981,6 @@ ce_page_ip4_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ip4.ui",
"IP4Page",
_("IPv4 Settings")));
@@ -1010,7 +1000,7 @@ ce_page_ip4_new (NMConnection *connection,
priv->setting = nm_connection_get_setting_ip4_config (connection);
if (!priv->setting) {
- priv->setting = NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ());
+ priv->setting = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
@@ -1022,7 +1012,7 @@ ce_page_ip4_new (NMConnection *connection,
static void
free_one_addr (gpointer data)
{
- nm_ip4_address_unref ((NMIP4Address *) data);
+ nm_ip_address_unref ((NMIPAddress *) data);
}
static gboolean
@@ -1037,6 +1027,7 @@ ui_to_setting (CEPageIP4 *self)
char **dns_servers = NULL;
char **search_domains = NULL;
GPtrArray *addresses = NULL;
+ char *gateway = NULL;
gboolean valid = FALSE, iter_valid;
const char *text;
gboolean ignore_auto_dns = FALSE;
@@ -1077,52 +1068,56 @@ ui_to_setting (CEPageIP4 *self)
addresses = g_ptr_array_sized_new (1);
while (iter_valid) {
- char *item = NULL;
- struct in_addr tmp_addr, tmp_gateway = { 0 };
- NMIP4Address *nm_addr;
+ char *addr = NULL, *netmask = NULL, *addr_gw = NULL;
+ NMIPAddress *nm_addr;
guint32 prefix;
- gtk_tree_model_get (model, &tree_iter, COL_ADDRESS, &item, -1);
- if (!item || inet_pton (AF_INET, item, &tmp_addr) <= 0) {
- g_warning ("%s: IPv4 address '%s' missing or invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
- goto out;
- }
- g_free (item);
+ gtk_tree_model_get (model, &tree_iter,
+ COL_ADDRESS, &addr,
+ COL_PREFIX, &netmask,
+ COL_GATEWAY, &addr_gw,
+ -1);
- gtk_tree_model_get (model, &tree_iter, COL_PREFIX, &item, -1);
- if (!item) {
- g_warning ("%s: IPv4 prefix '%s' missing!",
- __func__, item ? item : "<none>");
+ if (!addr || !nm_utils_ipaddr_valid (AF_INET, addr)) {
+ g_warning ("%s: IPv4 address '%s' missing or invalid!",
+ __func__, addr ? addr : "<none>");
+ g_free (addr);
+ g_free (netmask);
+ g_free (addr_gw);
goto out;
}
- if (!parse_netmask (item, &prefix)) {
- g_warning ("%s: IPv4 prefix '%s' invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
+ if (!netmask || !parse_netmask (netmask, &prefix)) {
+ g_warning ("%s: IPv4 prefix '%s' missing or invalid!",
+ __func__, netmask ? netmask : "<none>");
+ g_free (addr);
+ g_free (netmask);
+ g_free (addr_gw);
goto out;
}
- g_free (item);
/* Gateway is optional... */
- gtk_tree_model_get (model, &tree_iter, COL_GATEWAY, &item, -1);
- if (item && strlen (item) && inet_pton (AF_INET, item, &tmp_gateway) <= 0) {
+ if (addr_gw && !nm_utils_ipaddr_valid (AF_INET, addr_gw)) {
g_warning ("%s: IPv4 gateway '%s' invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
+ __func__, addr_gw);
+ g_free (addr);
+ g_free (netmask);
+ g_free (addr_gw);
goto out;
}
- g_free (item);
-
- nm_addr = nm_ip4_address_new ();
- nm_ip4_address_set_address (nm_addr, tmp_addr.s_addr);
- nm_ip4_address_set_prefix (nm_addr, (guint32) prefix);
- nm_ip4_address_set_gateway (nm_addr, tmp_gateway.s_addr);
+ nm_addr = nm_ip_address_new (AF_INET, addr, prefix, NULL);
g_ptr_array_add (addresses, nm_addr);
+ if (addresses->len == 1 && addr_gw) {
+ gateway = addr_gw;
+ addr_gw = NULL;
+ }
+
+ g_free (addr);
+ g_free (netmask);
+ g_free (addr_gw);
+
iter_valid = gtk_tree_model_iter_next (model, &tree_iter);
}
@@ -1184,13 +1179,14 @@ ui_to_setting (CEPageIP4 *self)
/* Update setting */
g_object_set (priv->setting,
- NM_SETTING_IP4_CONFIG_METHOD, method,
- NM_SETTING_IP4_CONFIG_ADDRESSES, addresses,
- NM_SETTING_IP4_CONFIG_DNS, dns_servers,
- NM_SETTING_IP4_CONFIG_DNS_SEARCH, search_domains,
- NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, ignore_auto_dns,
+ NM_SETTING_IP_CONFIG_METHOD, method,
+ NM_SETTING_IP_CONFIG_ADDRESSES, addresses,
+ NM_SETTING_IP_CONFIG_GATEWAY, gateway,
+ NM_SETTING_IP_CONFIG_DNS, dns_servers,
+ NM_SETTING_IP_CONFIG_DNS_SEARCH, search_domains,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, ignore_auto_dns,
NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, dhcp_client_id,
- NM_SETTING_IP4_CONFIG_MAY_FAIL, may_fail,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, may_fail,
NULL);
valid = TRUE;
@@ -1199,6 +1195,7 @@ out:
g_ptr_array_foreach (addresses, (GFunc) free_one_addr, NULL);
g_ptr_array_free (addresses, TRUE);
}
+ g_free (gateway);
g_strfreev (dns_servers);
g_strfreev (search_domains);
diff --git a/src/connection-editor/page-ip4.h b/src/connection-editor/page-ip4.h
index 2b2bf1f..e9886cf 100644
--- a/src/connection-editor/page-ip4.h
+++ b/src/connection-editor/page-ip4.h
@@ -48,7 +48,6 @@ GType ce_page_ip4_get_type (void);
CEPage *ce_page_ip4_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-ip6.c b/src/connection-editor/page-ip6.c
index 5bcba42..eb0bb7a 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -46,7 +46,7 @@ G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
#define COL_LAST COL_GATEWAY
typedef struct {
- NMSettingIP6Config *setting;
+ NMSettingIPConfig *setting;
char *connection_id;
GType connection_type;
@@ -342,7 +342,7 @@ static void
populate_ui (CEPageIP6 *self)
{
CEPageIP6Private *priv = CE_PAGE_IP6_GET_PRIVATE (self);
- NMSettingIP6Config *setting = priv->setting;
+ NMSettingIPConfig *setting = priv->setting;
GtkListStore *store;
GtkTreeIter model_iter;
int method = IP6_METHOD_AUTO;
@@ -355,7 +355,7 @@ populate_ui (CEPageIP6 *self)
/* Method */
gtk_combo_box_set_active (priv->method, 0);
- str_method = nm_setting_ip6_config_get_method (setting);
+ str_method = nm_setting_ip_config_get_method (setting);
if (str_method) {
if (!strcmp (str_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE))
method = IP6_METHOD_IGNORE;
@@ -371,7 +371,7 @@ populate_ui (CEPageIP6 *self)
method = IP6_METHOD_SHARED;
}
- if (method == IP6_METHOD_AUTO && nm_setting_ip6_config_get_ignore_auto_dns (setting))
+ if (method == IP6_METHOD_AUTO && nm_setting_ip_config_get_ignore_auto_dns (setting))
method = IP6_METHOD_AUTO_ADDRESSES;
info.method = method;
@@ -380,33 +380,24 @@ populate_ui (CEPageIP6 *self)
/* Addresses */
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
- for (i = 0; i < nm_setting_ip6_config_get_num_addresses (setting); i++) {
- NMIP6Address *addr = nm_setting_ip6_config_get_address (setting, i);
- const struct in6_addr *tmp_addr;
- char buf[INET6_ADDRSTRLEN + 1];
+ for (i = 0; i < nm_setting_ip_config_get_num_addresses (setting); i++) {
+ NMIPAddress *addr = nm_setting_ip_config_get_address (setting, i);
+ char buf[32];
if (!addr) {
g_warning ("%s: empty IP6 Address structure!", __func__);
continue;
}
- gtk_list_store_append (store, &model_iter);
-
- /* Address */
- tmp_addr = nm_ip6_address_get_address (addr);
- (void) inet_ntop (AF_INET6, tmp_addr, &buf[0], sizeof (buf));
- gtk_list_store_set (store, &model_iter, COL_ADDRESS, buf, -1);
+ snprintf (buf, sizeof (buf), "%u", nm_ip_address_get_prefix (addr));
- /* Prefix */
- snprintf (buf, sizeof (buf), "%u", nm_ip6_address_get_prefix (addr));
- gtk_list_store_set (store, &model_iter, COL_PREFIX, buf, -1);
-
- /* Gateway */
- tmp_addr = nm_ip6_address_get_gateway (addr);
- if (tmp_addr && !IN6_IS_ADDR_UNSPECIFIED (tmp_addr)) {
- (void) inet_ntop (AF_INET6, tmp_addr, &buf[0], sizeof (buf));
- gtk_list_store_set (store, &model_iter, COL_GATEWAY, buf, -1);
- }
+ gtk_list_store_append (store, &model_iter);
+ gtk_list_store_set (store, &model_iter,
+ COL_ADDRESS, nm_ip_address_get_address (addr),
+ COL_PREFIX, buf,
+ /* FIXME */
+ COL_GATEWAY, i == 0 ? nm_setting_ip_config_get_gateway (setting) : NULL,
+ -1);
}
gtk_tree_view_set_model (priv->addr_list, GTK_TREE_MODEL (store));
@@ -416,10 +407,10 @@ populate_ui (CEPageIP6 *self)
/* DNS servers */
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip6_config_get_num_dns (setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_dns (setting); i++) {
const char *dns;
- dns = nm_setting_ip6_config_get_dns (setting, i);
+ dns = nm_setting_ip_config_get_dns (setting, i);
if (!dns)
continue;
@@ -432,16 +423,16 @@ populate_ui (CEPageIP6 *self)
/* DNS searches */
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip6_config_get_num_dns_searches (setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_dns_searches (setting); i++) {
if (string->len)
g_string_append (string, ", ");
- g_string_append (string, nm_setting_ip6_config_get_dns_search (setting, i));
+ g_string_append (string, nm_setting_ip_config_get_dns_search (setting, i));
}
gtk_entry_set_text (priv->dns_searches, string->str);
g_string_free (string, TRUE);
/* IPv6 privacy extensions */
- ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (setting);
+ ip6_privacy = nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (setting));
switch (ip6_privacy) {
case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
ip6_privacy_idx = IP6_PRIVACY_DISABLED;
@@ -460,7 +451,7 @@ populate_ui (CEPageIP6 *self)
/* IPv6 required */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->ip6_required),
- !nm_setting_ip6_config_get_may_fail (setting));
+ !nm_setting_ip_config_get_may_fail (setting));
}
static void
@@ -820,7 +811,7 @@ routes_button_clicked_cb (GtkWidget *button, gpointer user_data)
toplevel = gtk_widget_get_toplevel (CE_PAGE (self)->page);
g_return_if_fail (gtk_widget_is_toplevel (toplevel));
- method = nm_setting_ip6_config_get_method (priv->setting);
+ method = nm_setting_ip_config_get_method (priv->setting);
if (!method || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO))
automatic = TRUE;
@@ -973,7 +964,6 @@ CEPage *
ce_page_ip6_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -985,7 +975,6 @@ ce_page_ip6_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ip6.ui",
"IP6Page",
_("IPv6 Settings")));
@@ -1005,7 +994,7 @@ ce_page_ip6_new (NMConnection *connection,
priv->setting = nm_connection_get_setting_ip6_config (connection);
if (!priv->setting) {
- priv->setting = NM_SETTING_IP6_CONFIG (nm_setting_ip6_config_new ());
+ priv->setting = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
nm_connection_add_setting (connection, NM_SETTING (priv->setting));
}
@@ -1061,75 +1050,81 @@ ui_to_setting (CEPageIP6 *self)
g_object_freeze_notify (G_OBJECT (priv->setting));
g_object_set (priv->setting,
- NM_SETTING_IP6_CONFIG_METHOD, method,
- NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, ignore_auto_dns,
+ NM_SETTING_IP_CONFIG_METHOD, method,
+ NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, ignore_auto_dns,
NULL);
/* IP addresses */
- nm_setting_ip6_config_clear_addresses (priv->setting);
+ nm_setting_ip_config_clear_addresses (priv->setting);
model = gtk_tree_view_get_model (priv->addr_list);
iter_valid = gtk_tree_model_get_iter_first (model, &tree_iter);
while (iter_valid) {
- char *item = NULL, *end;
- struct in6_addr tmp_addr, tmp_gw;
- gboolean have_gw = FALSE;
- NMIP6Address *addr;
+ char *addr_str = NULL, *prefix_str = NULL, *addr_gw_str = NULL, *end;
+ NMIPAddress *addr;
guint32 prefix;
- /* IP address */
- gtk_tree_model_get (model, &tree_iter, COL_ADDRESS, &item, -1);
- if (!item || !inet_pton (AF_INET6, item, &tmp_addr)) {
+ gtk_tree_model_get (model, &tree_iter,
+ COL_ADDRESS, &addr_str,
+ COL_PREFIX, &prefix_str,
+ COL_GATEWAY, &addr_gw_str,
+ -1);
+
+ if (!addr_str || !nm_utils_ipaddr_valid (AF_INET6, addr_str)) {
g_warning ("%s: IPv6 address '%s' missing or invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
+ __func__, addr_str ? addr_str : "<none>");
+ g_free (addr_str);
+ g_free (prefix_str);
+ g_free (addr_gw_str);
goto out;
}
- g_free (item);
- /* Prefix */
- gtk_tree_model_get (model, &tree_iter, COL_PREFIX, &item, -1);
- if (!item) {
- g_warning ("%s: IPv6 prefix '%s' missing!",
- __func__, item ? item : "<none>");
+ if (!prefix_str) {
+ g_warning ("%s: IPv6 prefix missing!", __func__);
+ g_free (addr_str);
+ g_free (prefix_str);
+ g_free (addr_gw_str);
goto out;
}
- prefix = strtoul (item, &end, 10);
+ prefix = strtoul (prefix_str, &end, 10);
if (!end || *end || prefix == 0 || prefix > 128) {
g_warning ("%s: IPv6 prefix '%s' invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
+ __func__, prefix_str);
+ g_free (addr_str);
+ g_free (prefix_str);
+ g_free (addr_gw_str);
goto out;
}
- g_free (item);
-
- /* Gateway */
- gtk_tree_model_get (model, &tree_iter, COL_GATEWAY, &item, -1);
- if (item && strlen (item)) {
- if (!inet_pton (AF_INET6, item, &tmp_gw)) {
- g_warning ("%s: IPv6 gateway '%s' missing or invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
- goto out;
- }
- if (!IN6_IS_ADDR_UNSPECIFIED (&tmp_gw))
- have_gw = TRUE;
+
+ /* Gateway is optional... */
+ if (addr_gw_str && !nm_utils_ipaddr_valid (AF_INET6, addr_gw_str)) {
+ g_warning ("%s: IPv6 gateway '%s' invalid!",
+ __func__, addr_gw_str);
+ g_free (addr_str);
+ g_free (prefix_str);
+ g_free (addr_gw_str);
+ goto out;
+ }
+
+ addr = nm_ip_address_new (AF_INET6, addr_str, prefix, NULL);
+ nm_setting_ip_config_add_address (priv->setting, addr);
+ nm_ip_address_unref (addr);
+
+ if (nm_setting_ip_config_get_num_addresses (priv->setting) == 1 && addr_gw_str) {
+ g_object_set (G_OBJECT (priv->setting),
+ NM_SETTING_IP_CONFIG_GATEWAY, addr_gw_str,
+ NULL);
}
- g_free (item);
- addr = nm_ip6_address_new ();
- nm_ip6_address_set_address (addr, &tmp_addr);
- nm_ip6_address_set_prefix (addr, prefix);
- if (have_gw)
- nm_ip6_address_set_gateway (addr, &tmp_gw);
- nm_setting_ip6_config_add_address (priv->setting, addr);
- nm_ip6_address_unref (addr);
+ g_free (addr_str);
+ g_free (prefix_str);
+ g_free (addr_gw_str);
iter_valid = gtk_tree_model_iter_next (model, &tree_iter);
}
/* DNS servers */
- nm_setting_ip6_config_clear_dns (priv->setting);
+ nm_setting_ip_config_clear_dns (priv->setting);
text = gtk_entry_get_text (GTK_ENTRY (priv->dns_servers));
if (text && strlen (text)) {
items = g_strsplit_set (text, ", ;", 0);
@@ -1141,7 +1136,7 @@ ui_to_setting (CEPageIP6 *self)
continue;
if (inet_pton (AF_INET6, stripped, &tmp_addr)) {
- nm_setting_ip6_config_add_dns (priv->setting, stripped);
+ nm_setting_ip_config_add_dns (priv->setting, stripped);
} else {
g_strfreev (items);
goto out;
@@ -1151,7 +1146,7 @@ ui_to_setting (CEPageIP6 *self)
}
/* Search domains */
- nm_setting_ip6_config_clear_dns_searches (priv->setting);
+ nm_setting_ip_config_clear_dns_searches (priv->setting);
text = gtk_entry_get_text (GTK_ENTRY (priv->dns_searches));
if (text && strlen (text)) {
items = g_strsplit_set (text, ", ;:", 0);
@@ -1159,7 +1154,7 @@ ui_to_setting (CEPageIP6 *self)
char *stripped = g_strstrip (*iter);
if (strlen (stripped))
- nm_setting_ip6_config_add_dns_search (priv->setting, stripped);
+ nm_setting_ip_config_add_dns_search (priv->setting, stripped);
}
g_strfreev (items);
}
@@ -1182,7 +1177,7 @@ ui_to_setting (CEPageIP6 *self)
may_fail = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->ip6_required));
g_object_set (G_OBJECT (priv->setting),
- NM_SETTING_IP6_CONFIG_MAY_FAIL, may_fail,
+ NM_SETTING_IP_CONFIG_MAY_FAIL, may_fail,
NM_SETTING_IP6_CONFIG_IP6_PRIVACY, ip6_privacy,
NULL);
diff --git a/src/connection-editor/page-ip6.h b/src/connection-editor/page-ip6.h
index 16d222e..defc23c 100644
--- a/src/connection-editor/page-ip6.h
+++ b/src/connection-editor/page-ip6.h
@@ -48,7 +48,6 @@ GType ce_page_ip6_get_type (void);
CEPage *ce_page_ip6_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-master.c b/src/connection-editor/page-master.c
index 2299944..979adc5 100644
--- a/src/connection-editor/page-master.c
+++ b/src/connection-editor/page-master.c
@@ -96,7 +96,7 @@ dispose (GObject *object)
CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self);
GtkTreeIter iter;
- g_signal_handlers_disconnect_matched (CE_PAGE (self)->settings, G_SIGNAL_MATCH_DATA,
+ g_signal_handlers_disconnect_matched (CE_PAGE (self)->client, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, self);
if (gtk_tree_model_get_iter_first (priv->connections_model, &iter)) {
@@ -143,7 +143,7 @@ find_connection (CEPageMaster *self, NMRemoteConnection *connection, GtkTreeIter
}
static void
-connection_removed (NMRemoteSettings *settings,
+connection_removed (NMClient *client,
NMRemoteConnection *connection,
gpointer user_data)
{
@@ -267,7 +267,7 @@ check_new_slave_physical_port (CEPageMaster *self, NMConnection *conn)
}
static void
-connection_added (NMRemoteSettings *settings,
+connection_added (NMClient *client,
NMRemoteConnection *connection,
gpointer user_data)
{
@@ -307,7 +307,7 @@ connection_added (NMRemoteSettings *settings,
-1);
ce_page_changed (CE_PAGE (self));
- g_signal_connect (settings, NM_REMOTE_SETTINGS_CONNECTION_REMOVED,
+ g_signal_connect (client, NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (connection_removed), self);
g_signal_connect (connection, NM_CONNECTION_CHANGED,
G_CALLBACK (connection_changed), self);
@@ -387,8 +387,7 @@ add_connection (NMConnection *connection,
editor = nm_connection_editor_new (priv->toplevel,
connection,
- CE_PAGE (self)->client,
- CE_PAGE (self)->settings);
+ CE_PAGE (self)->client);
if (!editor) {
g_object_unref (connection);
return;
@@ -457,8 +456,7 @@ edit_clicked (GtkButton *button, gpointer user_data)
editor = nm_connection_editor_new (priv->toplevel,
NM_CONNECTION (connection),
- CE_PAGE (self)->client,
- CE_PAGE (self)->settings);
+ CE_PAGE (self)->client);
if (!editor)
return;
@@ -495,7 +493,8 @@ populate_ui (CEPageMaster *self)
CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self);
NMSettingConnection *s_con;
const char *iface;
- GSList *connections, *c;
+ const GPtrArray *connections;
+ int i;
s_con = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
g_return_if_fail (s_con != NULL);
@@ -505,9 +504,9 @@ populate_ui (CEPageMaster *self)
gtk_entry_set_text (priv->interface_name, iface ? iface : "");
/* Slave connections */
- connections = nm_remote_settings_list_connections (CE_PAGE (self)->settings);
- for (c = connections; c; c = c->next)
- connection_added (CE_PAGE (self)->settings, c->data, self);
+ connections = nm_client_get_connections (CE_PAGE (self)->client);
+ for (i = 0; i < connections->len; i++)
+ connection_added (CE_PAGE (self)->client, connections->pdata[i], self);
}
static void
@@ -545,7 +544,7 @@ finish_setup (CEPageMaster *self, gpointer unused, GError *error, gpointer user_
populate_ui (self);
- g_signal_connect (CE_PAGE (self)->settings, NM_REMOTE_SETTINGS_CONNECTION_ADDED,
+ g_signal_connect (CE_PAGE (self)->client, NM_CLIENT_CONNECTION_ADDED,
G_CALLBACK (connection_added), self);
g_signal_connect (priv->interface_name, "changed", G_CALLBACK (stuff_changed), self);
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 6da78eb..e34614a 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -296,7 +296,6 @@ CEPage *
ce_page_mobile_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -307,7 +306,6 @@ ce_page_mobile_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-mobile.ui",
"MobilePage",
_("Mobile Broadband")));
@@ -452,7 +450,7 @@ add_default_serial_setting (NMConnection *connection)
}
typedef struct {
- NMRemoteSettings *settings;
+ NMClient *client;
PageNewConnectionResultFunc result_func;
gpointer user_data;
} WizardInfo;
@@ -502,7 +500,7 @@ new_connection_mobile_wizard_done (NMAMobileWizard *wizard,
detail = g_strdup_printf ("%s %s %%d", method->provider_name, method->plan_name);
else
detail = g_strdup_printf ("%s connection %%d", method->provider_name);
- connection = ce_page_new_connection (detail, ctype, FALSE, info->settings, info->user_data);
+ connection = ce_page_new_connection (detail, ctype, FALSE, info->client, info->user_data);
g_free (detail);
nm_connection_add_setting (connection, type_setting);
@@ -515,7 +513,7 @@ new_connection_mobile_wizard_done (NMAMobileWizard *wizard,
if (wizard)
nma_mobile_wizard_destroy (wizard);
- g_object_unref (info->settings);
+ g_object_unref (info->client);
g_free (info);
}
@@ -528,7 +526,7 @@ cancel_dialog (GtkDialog *dialog)
void
mobile_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -541,7 +539,7 @@ mobile_connection_new (GtkWindow *parent,
info = g_malloc0 (sizeof (WizardInfo));
info->result_func = result_func;
- info->settings = g_object_ref (settings);
+ info->client = g_object_ref (client);
info->user_data = user_data;
wizard = nma_mobile_wizard_new (parent, NULL, NM_DEVICE_MODEM_CAPABILITY_NONE, FALSE,
diff --git a/src/connection-editor/page-mobile.h b/src/connection-editor/page-mobile.h
index f2c0cdc..914e8cd 100644
--- a/src/connection-editor/page-mobile.h
+++ b/src/connection-editor/page-mobile.h
@@ -48,13 +48,12 @@ GType ce_page_mobile_get_type (void);
CEPage *ce_page_mobile_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void mobile_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-ppp.c b/src/connection-editor/page-ppp.c
index 2ff0dc0..d7d33a4 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -266,7 +266,6 @@ CEPage *
ce_page_ppp_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -278,7 +277,6 @@ ce_page_ppp_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ppp.ui",
"PppPage",
_("PPP Settings")));
diff --git a/src/connection-editor/page-ppp.h b/src/connection-editor/page-ppp.h
index fffc921..b731535 100644
--- a/src/connection-editor/page-ppp.h
+++ b/src/connection-editor/page-ppp.h
@@ -48,7 +48,6 @@ GType ce_page_ppp_get_type (void);
CEPage *ce_page_ppp_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-team-port.c b/src/connection-editor/page-team-port.c
index 80c4d84..5b24bb5 100644
--- a/src/connection-editor/page-team-port.c
+++ b/src/connection-editor/page-team-port.c
@@ -132,11 +132,10 @@ 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)
+ GtkWindow *parent_window,
+ NMClient *client,
+ const char **out_secrets_setting_name,
+ GError **error)
{
CEPageTeamPort *self;
CEPageTeamPortPrivate *priv;
@@ -145,7 +144,6 @@ ce_page_team_port_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-team-port.ui",
"TeamPortPage",
/* Translators: a "Team Port" is a network
diff --git a/src/connection-editor/page-team-port.h b/src/connection-editor/page-team-port.h
index 8e079ef..e086de4 100644
--- a/src/connection-editor/page-team-port.h
+++ b/src/connection-editor/page-team-port.h
@@ -46,7 +46,6 @@ GType ce_page_team_port_get_type (void);
CEPage *ce_page_team_port_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-team.c b/src/connection-editor/page-team.c
index cb8145d..38be55d 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -200,13 +200,13 @@ add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
if (priv->slave_arptype == ARPHRD_INFINIBAND) {
new_connection_of_type (priv->toplevel,
NULL,
- CE_PAGE (self)->settings,
+ CE_PAGE (self)->client,
infiniband_connection_new,
result_func,
master);
} else {
new_connection_dialog (priv->toplevel,
- CE_PAGE (self)->settings,
+ CE_PAGE (self)->client,
connection_type_filter,
result_func,
master);
@@ -226,7 +226,6 @@ CEPage *
ce_page_team_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -237,7 +236,6 @@ ce_page_team_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-team.ui",
"TeamPage",
_("Team")));
@@ -326,13 +324,13 @@ ce_page_team_class_init (CEPageTeamClass *team_class)
void
team_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
NMConnection *connection;
- int team_num, num;
- GSList *connections, *iter;
+ int team_num, num, i;
+ const GPtrArray *connections;
NMConnection *conn2;
const char *iface;
char *my_iface;
@@ -340,15 +338,15 @@ team_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("Team connection %d"),
NM_SETTING_TEAM_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_team_new ());
/* Find an available interface name */
team_num = 0;
- connections = nm_remote_settings_list_connections (settings);
- for (iter = connections; iter; iter = iter->next) {
- conn2 = iter->data;
+ connections = nm_client_get_connections (client);
+ for (i = 0; i < connections->len; i++) {
+ conn2 = connections->pdata[i];
if (!nm_connection_is_type (conn2, NM_SETTING_TEAM_SETTING_NAME))
continue;
@@ -360,7 +358,6 @@ team_connection_new (GtkWindow *parent,
if (team_num <= num)
team_num = num + 1;
}
- g_slist_free (connections);
my_iface = g_strdup_printf ("team%d", team_num);
g_object_set (G_OBJECT (connection),
diff --git a/src/connection-editor/page-team.h b/src/connection-editor/page-team.h
index b94acb4..d3a5270 100644
--- a/src/connection-editor/page-team.h
+++ b/src/connection-editor/page-team.h
@@ -46,13 +46,12 @@ GType ce_page_team_get_type (void);
CEPage *ce_page_team_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void team_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-vlan.c b/src/connection-editor/page-vlan.c
index 061bfbb..358d714 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -258,7 +258,8 @@ static void
build_vlan_parent_list (CEPageVlan *self, GSList *devices)
{
CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self);
- GSList *connections, *c_iter, *d_iter;
+ const GPtrArray *connections;
+ GSList *d_iter;
GPtrArray *parents;
VlanParent *parent;
NMDevice *device;
@@ -288,9 +289,9 @@ build_vlan_parent_list (CEPageVlan *self, GSList *devices)
}
/* Otherwise, VLANs have to be built on top of configured connections */
- connections = nm_remote_settings_list_connections (CE_PAGE (self)->settings);
- for (c_iter = connections; c_iter; c_iter = c_iter->next) {
- NMConnection *candidate = c_iter->data;
+ connections = nm_client_get_connections (CE_PAGE (self)->client);
+ for (i = 0; i < connections->len; i++) {
+ NMConnection *candidate = connections->pdata[i];
NMSettingConnection *s_con = nm_connection_get_setting_connection (candidate);
GType connection_gtype;
@@ -322,8 +323,6 @@ build_vlan_parent_list (CEPageVlan *self, GSList *devices)
}
}
- g_slist_free (connections);
-
g_ptr_array_sort (parents, sort_parents);
g_ptr_array_add (parents, NULL);
@@ -353,7 +352,7 @@ populate_ui (CEPageVlan *self)
parent = nm_setting_vlan_get_parent (priv->setting);
if (parent) {
/* UUID? */
- parent_connection = (NMConnection *)nm_remote_settings_get_connection_by_uuid (CE_PAGE
(self)->settings, parent);
+ parent_connection = (NMConnection *)nm_client_get_connection_by_uuid (CE_PAGE (self)->client,
parent);
if (!parent_connection) {
/* Interface name? */
for (d_iter = devices; d_iter; d_iter = d_iter->next) {
@@ -460,7 +459,6 @@ CEPage *
ce_page_vlan_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -471,7 +469,6 @@ ce_page_vlan_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-vlan.ui",
"VlanPage",
_("VLAN")));
@@ -664,7 +661,7 @@ ce_page_vlan_class_init (CEPageVlanClass *vlan_class)
void
vlan_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -673,7 +670,7 @@ vlan_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("VLAN connection %d"),
NM_SETTING_VLAN_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
nm_connection_add_setting (connection, nm_setting_vlan_new ());
diff --git a/src/connection-editor/page-vlan.h b/src/connection-editor/page-vlan.h
index abacac7..5a96e02 100644
--- a/src/connection-editor/page-vlan.h
+++ b/src/connection-editor/page-vlan.h
@@ -46,13 +46,12 @@ GType ce_page_vlan_get_type (void);
CEPage *ce_page_vlan_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void vlan_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-vpn.c b/src/connection-editor/page-vpn.c
index a2893d6..1870cb1 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -41,14 +41,14 @@ typedef struct {
char *service_type;
- NMVpnPluginUiInterface *plugin;
- NMVpnPluginUiWidgetInterface *ui;
+ NMVpnEditorPlugin *plugin;
+ NMVpnEditor *editor;
gboolean disposed;
} CEPageVpnPrivate;
static void
-vpn_plugin_changed_cb (NMVpnPluginUiInterface *plugin, CEPageVpn *self)
+vpn_plugin_changed_cb (NMVpnEditorPlugin *plugin, CEPageVpn *self)
{
ce_page_changed (CE_PAGE (self));
}
@@ -65,17 +65,17 @@ finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_dat
g_return_if_fail (priv->plugin != NULL);
- priv->ui = nm_vpn_plugin_ui_interface_ui_factory (priv->plugin, parent->connection, &vpn_error);
- if (!priv->ui) {
+ priv->editor = nm_vpn_editor_plugin_get_editor (priv->plugin, parent->connection, &vpn_error);
+ if (!priv->editor) {
g_warning ("Could not load VPN user interface for service '%s': %s.",
priv->service_type,
(vpn_error && vpn_error->message) ? vpn_error->message : "(unknown)");
g_error_free (vpn_error);
return;
}
- g_signal_connect (priv->ui, "changed", G_CALLBACK (vpn_plugin_changed_cb), self);
+ g_signal_connect (priv->editor, "changed", G_CALLBACK (vpn_plugin_changed_cb), self);
- parent->page = GTK_WIDGET (nm_vpn_plugin_ui_widget_interface_get_widget (priv->ui));
+ parent->page = GTK_WIDGET (nm_vpn_editor_get_widget (priv->editor));
if (!parent->page) {
g_warning ("Could not load VPN user interface for service '%s'.", priv->service_type);
return;
@@ -88,7 +88,6 @@ CEPage *
ce_page_vpn_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -100,7 +99,6 @@ ce_page_vpn_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
NULL,
NULL,
_("VPN")));
@@ -137,7 +135,7 @@ ce_page_vpn_can_export (CEPageVpn *page)
{
CEPageVpnPrivate *priv = CE_PAGE_VPN_GET_PRIVATE (page);
- return (nm_vpn_plugin_ui_interface_get_capabilities (priv->plugin) &
NM_VPN_PLUGIN_UI_CAPABILITY_EXPORT) != 0;
+ return (nm_vpn_editor_plugin_get_capabilities (priv->plugin) &
NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT) != 0;
}
static gboolean
@@ -146,7 +144,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
CEPageVpn *self = CE_PAGE_VPN (page);
CEPageVpnPrivate *priv = CE_PAGE_VPN_GET_PRIVATE (self);
- return nm_vpn_plugin_ui_widget_interface_update_connection (priv->ui, connection, error);
+ return nm_vpn_editor_update_connection (priv->editor, connection, error);
}
static void
@@ -164,8 +162,8 @@ dispose (GObject *object)
priv->disposed = TRUE;
- if (priv->ui)
- g_object_unref (priv->ui);
+ if (priv->editor)
+ g_object_unref (priv->editor);
g_free (priv->service_type);
@@ -187,7 +185,7 @@ ce_page_vpn_class_init (CEPageVpnClass *vpn_class)
}
typedef struct {
- NMRemoteSettings *settings;
+ NMClient *client;
PageNewConnectionResultFunc result_func;
gpointer user_data;
} NewVpnInfo;
@@ -211,14 +209,12 @@ import_cb (NMConnection *connection, gpointer user_data)
s = (char *) nm_setting_connection_get_id (s_con);
if (!s) {
- GSList *connections;
+ const GPtrArray *connections;
- connections = nm_remote_settings_list_connections (info->settings);
+ connections = nm_client_get_connections (info->client);
s = ce_page_get_next_available_name (connections, _("VPN connection %d"));
g_object_set (s_con, NM_SETTING_CONNECTION_ID, s, NULL);
g_free (s);
-
- g_slist_free (connections);
}
s = (char *) nm_setting_connection_get_connection_type (s_con);
@@ -245,14 +241,14 @@ import_cb (NMConnection *connection, gpointer user_data)
info->result_func (connection, FALSE, error, info->user_data);
g_clear_error (&error);
- g_object_unref (info->settings);
+ g_object_unref (info->client);
g_slice_free (NewVpnInfo, info);
}
void
vpn_connection_import (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -260,7 +256,7 @@ vpn_connection_import (GtkWindow *parent,
info = g_slice_new (NewVpnInfo);
info->result_func = result_func;
- info->settings = g_object_ref (settings);
+ info->client = g_object_ref (client);
info->user_data = user_data;
vpn_import (import_cb, info);
}
@@ -286,7 +282,7 @@ vpn_type_result_func (NMConnection *connection, gpointer user_data)
void
vpn_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -303,7 +299,7 @@ vpn_connection_new (GtkWindow *parent,
info = g_slice_new (NewVpnInfo);
info->result_func = result_func;
info->user_data = user_data;
- new_connection_dialog_full (parent, settings,
+ new_connection_dialog_full (parent, client,
NEW_VPN_CONNECTION_PRIMARY_LABEL,
NEW_VPN_CONNECTION_SECONDARY_LABEL,
vpn_type_filter_func,
@@ -314,7 +310,7 @@ vpn_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("VPN connection %d"),
NM_SETTING_VPN_SETTING_NAME,
FALSE,
- settings,
+ client,
user_data);
s_vpn = nm_setting_vpn_new ();
g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, detail, NULL);
diff --git a/src/connection-editor/page-vpn.h b/src/connection-editor/page-vpn.h
index 4a618ce..d9df6a1 100644
--- a/src/connection-editor/page-vpn.h
+++ b/src/connection-editor/page-vpn.h
@@ -48,7 +48,6 @@ GType ce_page_vpn_get_type (void);
CEPage *ce_page_vpn_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
@@ -56,13 +55,13 @@ gboolean ce_page_vpn_can_export (CEPageVpn *page);
void vpn_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
void vpn_connection_import (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-wifi-security.c b/src/connection-editor/page-wifi-security.c
index 73af50b..25be3f4 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -370,7 +370,6 @@ CEPage *
ce_page_wifi_security_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -389,7 +388,6 @@ ce_page_wifi_security_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-wifi-security.ui",
"WifiSecurityPage",
_("Wi-Fi Security")));
diff --git a/src/connection-editor/page-wifi-security.h b/src/connection-editor/page-wifi-security.h
index b1c3a16..bf16e96 100644
--- a/src/connection-editor/page-wifi-security.h
+++ b/src/connection-editor/page-wifi-security.h
@@ -54,7 +54,6 @@ GType ce_page_wifi_security_get_type (void);
CEPage *ce_page_wifi_security_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
diff --git a/src/connection-editor/page-wifi.c b/src/connection-editor/page-wifi.c
index eee33df..1f8ff64 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -432,7 +432,6 @@ CEPage *
ce_page_wifi_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -445,7 +444,6 @@ ce_page_wifi_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-wifi.ui",
"WifiPage",
_("Wi-Fi")));
@@ -606,7 +604,7 @@ ce_page_wifi_class_init (CEPageWifiClass *wifi_class)
void
wifi_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -616,7 +614,7 @@ wifi_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("Wi-Fi connection %d"),
NM_SETTING_WIRELESS_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
s_wifi = nm_setting_wireless_new ();
g_object_set (s_wifi, NM_SETTING_WIRELESS_MODE, "infrastructure", NULL);
diff --git a/src/connection-editor/page-wifi.h b/src/connection-editor/page-wifi.h
index 9bb1dd2..c12c029 100644
--- a/src/connection-editor/page-wifi.h
+++ b/src/connection-editor/page-wifi.h
@@ -48,7 +48,6 @@ GType ce_page_wifi_get_type (void);
CEPage *ce_page_wifi_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
@@ -58,7 +57,7 @@ GBytes *ce_page_wifi_get_ssid (CEPageWifi *self);
void wifi_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-wimax.c b/src/connection-editor/page-wimax.c
index b0f2eac..3d39341 100644
--- a/src/connection-editor/page-wimax.c
+++ b/src/connection-editor/page-wimax.c
@@ -98,7 +98,6 @@ CEPage *
ce_page_wimax_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -111,7 +110,6 @@ ce_page_wimax_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-wimax.ui",
"WimaxPage",
_("WiMAX")));
@@ -204,7 +202,7 @@ ce_page_wimax_class_init (CEPageWimaxClass *wimax_class)
void
wimax_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -214,7 +212,7 @@ wimax_connection_new (GtkWindow *parent,
connection = ce_page_new_connection (_("WiMAX connection %d"),
NM_SETTING_WIMAX_SETTING_NAME,
TRUE,
- settings,
+ client,
user_data);
s_wimax = nm_setting_wimax_new ();
nm_connection_add_setting (connection, s_wimax);
diff --git a/src/connection-editor/page-wimax.h b/src/connection-editor/page-wimax.h
index 47ea554..57a4401 100644
--- a/src/connection-editor/page-wimax.h
+++ b/src/connection-editor/page-wimax.h
@@ -46,13 +46,12 @@ GType ce_page_wimax_get_type (void);
CEPage *ce_page_wimax_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void wimax_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/vpn-helpers.c b/src/connection-editor/vpn-helpers.c
index bc3d065..43c252b 100644
--- a/src/connection-editor/vpn-helpers.c
+++ b/src/connection-editor/vpn-helpers.c
@@ -35,7 +35,7 @@
static GHashTable *plugins = NULL;
-NMVpnPluginUiInterface *
+NMVpnEditorPlugin *
vpn_get_plugin_by_service (const char *service)
{
g_return_val_if_fail (service != NULL, NULL);
@@ -69,7 +69,7 @@ vpn_get_plugins (GError **error)
char *so_path = NULL, *so_name = NULL;
GKeyFile *keyfile = NULL;
GModule *module = NULL;
- NMVpnPluginUiFactory factory = NULL;
+ NMVpnEditorPluginFactory factory = NULL;
if (!g_str_has_suffix (f, ".name"))
continue;
@@ -108,8 +108,8 @@ vpn_get_plugins (GError **error)
}
}
- if (g_module_symbol (module, "nm_vpn_plugin_ui_factory", (gpointer) &factory)) {
- NMVpnPluginUiInterface *plugin;
+ if (g_module_symbol (module, "nm_vpn_editor_plugin_factory", (gpointer) &factory)) {
+ NMVpnEditorPlugin *plugin;
GError *factory_error = NULL;
gboolean success = FALSE;
@@ -119,8 +119,8 @@ vpn_get_plugins (GError **error)
/* Validate plugin properties */
g_object_get (G_OBJECT (plugin),
- NM_VPN_PLUGIN_UI_INTERFACE_NAME, &plug_name,
- NM_VPN_PLUGIN_UI_INTERFACE_SERVICE, &plug_service,
+ NM_VPN_EDITOR_PLUGIN_NAME, &plug_name,
+ NM_VPN_EDITOR_PLUGIN_SERVICE, &plug_service,
NULL);
if (!plug_name || !strlen (plug_name)) {
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot load VPN
plugin in '%s': missing plugin name",
@@ -145,7 +145,7 @@ vpn_get_plugins (GError **error)
if (!success)
g_module_close (module);
} else {
- g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot locate
nm_vpn_plugin_ui_factory() in '%s': %s",
+ g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, "cannot locate
nm_vpn_editor_plugin_factory() in '%s': %s",
g_module_name (module), g_module_error ());
g_module_close (module);
}
@@ -173,7 +173,7 @@ import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
ActionInfo *info = (ActionInfo *) user_data;
GHashTableIter iter;
gpointer key;
- NMVpnPluginUiInterface *plugin;
+ NMVpnEditorPlugin *plugin;
NMConnection *connection = NULL;
GError *error = NULL;
@@ -189,7 +189,7 @@ import_vpn_from_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
g_hash_table_iter_init (&iter, plugins);
while (!connection && g_hash_table_iter_next (&iter, &key, (gpointer *)&plugin)) {
g_clear_error (&error);
- connection = nm_vpn_plugin_ui_interface_import (plugin, filename, &error);
+ connection = nm_vpn_editor_plugin_import (plugin, filename, &error);
}
if (connection)
@@ -253,7 +253,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
NMConnection *connection = NM_CONNECTION (user_data);
char *filename = NULL;
GError *error = NULL;
- NMVpnPluginUiInterface *plugin;
+ NMVpnEditorPlugin *plugin;
NMSettingConnection *s_con = NULL;
NMSettingVpn *s_vpn = NULL;
const char *service_type;
@@ -308,7 +308,7 @@ export_vpn_to_file_cb (GtkWidget *dialog, gint response, gpointer user_data)
plugin = vpn_get_plugin_by_service (service_type);
if (plugin)
- success = nm_vpn_plugin_ui_interface_export (plugin, filename, connection, &error);
+ success = nm_vpn_editor_plugin_export (plugin, filename, connection, &error);
done:
if (!success) {
@@ -343,7 +343,7 @@ void
vpn_export (NMConnection *connection)
{
GtkWidget *dialog;
- NMVpnPluginUiInterface *plugin;
+ NMVpnEditorPlugin *plugin;
NMSettingVpn *s_vpn = NULL;
const char *service_type;
const char *home_folder;
@@ -369,7 +369,7 @@ vpn_export (NMConnection *connection)
if (plugin) {
char *suggested = NULL;
- suggested = nm_vpn_plugin_ui_interface_get_suggested_name (plugin, connection);
+ suggested = nm_vpn_editor_plugin_get_suggested_filename (plugin, connection);
if (suggested) {
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested);
g_free (suggested);
@@ -386,7 +386,7 @@ vpn_supports_ipv6 (NMConnection *connection)
{
NMSettingVpn *s_vpn;
const char *service_type;
- NMVpnPluginUiInterface *plugin;
+ NMVpnEditorPlugin *plugin;
guint32 capabilities;
s_vpn = nm_connection_get_setting_vpn (connection);
@@ -398,6 +398,6 @@ vpn_supports_ipv6 (NMConnection *connection)
plugin = vpn_get_plugin_by_service (service_type);
g_return_val_if_fail (plugin != NULL, FALSE);
- capabilities = nm_vpn_plugin_ui_interface_get_capabilities (plugin);
- return (capabilities & NM_VPN_PLUGIN_UI_CAPABILITY_IPV6) != 0;
+ capabilities = nm_vpn_editor_plugin_get_capabilities (plugin);
+ return (capabilities & NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6) != 0;
}
diff --git a/src/connection-editor/vpn-helpers.h b/src/connection-editor/vpn-helpers.h
index 8043308..10c9f55 100644
--- a/src/connection-editor/vpn-helpers.h
+++ b/src/connection-editor/vpn-helpers.h
@@ -30,7 +30,7 @@
GHashTable *vpn_get_plugins (GError **error);
-NMVpnPluginUiInterface *vpn_get_plugin_by_service (const char *service);
+NMVpnEditorPlugin *vpn_get_plugin_by_service (const char *service);
typedef void (*VpnImportSuccessCallback) (NMConnection *connection, gpointer user_data);
void vpn_import (VpnImportSuccessCallback callback, gpointer user_data);
diff --git a/src/gnome-bluetooth/bt-widget.c b/src/gnome-bluetooth/bt-widget.c
index 3195d6f..bfee2bf 100644
--- a/src/gnome-bluetooth/bt-widget.c
+++ b/src/gnome-bluetooth/bt-widget.c
@@ -478,7 +478,7 @@ get_config_widgets (const char *bdaddr, const char **uuids)
/**************************************************************/
typedef struct {
- NMRemoteSettings *settings;
+ NMClient *settings;
GByteArray *bdaddr;
char *str_bdaddr;
guint timeout_id;
@@ -505,7 +505,7 @@ delete_cb (NMRemoteConnection *connection, GError *error, gpointer user_data)
}
static void
-remove_connections_read (NMRemoteSettings *settings, gpointer user_data)
+remove_connections_read (NMClient *settings, gpointer user_data)
{
RemoveInfo *info = user_data;
GSList *list, *iter;
@@ -514,7 +514,7 @@ remove_connections_read (NMRemoteSettings *settings, gpointer user_data)
g_message ("Removing Bluetooth connections for %s", info->str_bdaddr);
- list = nm_remote_settings_list_connections (settings);
+ list = nm_client_list_connections (settings);
for (iter = list; iter != NULL; iter = g_slist_next (iter)) {
NMConnection *connection = iter->data;
NMSettingBluetooth *s_bt;
@@ -570,7 +570,7 @@ device_removed (const char *bdaddr)
}
info = g_malloc0 (sizeof (RemoveInfo));
- info->settings = nm_remote_settings_new (bus);
+ info->settings = nm_client_new (bus);
info->bdaddr = g_byte_array_sized_new (ETH_ALEN);
g_byte_array_append (info->bdaddr, (const guint8 *) addr->ether_addr_octet, ETH_ALEN);
diff --git a/src/gnome-bluetooth/nma-bt-device.c b/src/gnome-bluetooth/nma-bt-device.c
index a2f4cd6..7e360b7 100644
--- a/src/gnome-bluetooth/nma-bt-device.c
+++ b/src/gnome-bluetooth/nma-bt-device.c
@@ -52,7 +52,7 @@ G_DEFINE_TYPE (NmaBtDevice, nma_bt_device, G_TYPE_OBJECT)
typedef struct {
DBusGConnection *bus;
- NMRemoteSettings *settings;
+ NMClient *settings;
char *bdaddr;
GByteArray *bdaddr_array;
@@ -175,13 +175,13 @@ delete_cb (NMRemoteConnection *connection, GError *error, gpointer user_data)
}
static void
-delete_connections_of_type (NMRemoteSettings *settings,
+delete_connections_of_type (NMClient *settings,
const GByteArray *bdaddr,
gboolean pan)
{
GSList *list, *iter;
- list = nm_remote_settings_list_connections (settings);
+ list = nm_client_list_connections (settings);
for (iter = list; iter != NULL; iter = g_slist_next (iter)) {
NMRemoteConnection *remote = iter->data;
@@ -202,7 +202,7 @@ recheck_services_enabled (NmaBtDevice *self)
* existing Bluetooth connections for the given device for either PAN
* or DUN, then we consider that service enabled.
*/
- list = nm_remote_settings_list_connections (priv->settings);
+ list = nm_client_list_connections (priv->settings);
for (iter = list; iter != NULL; iter = g_slist_next (iter)) {
NMConnection *connection = iter->data;
@@ -419,7 +419,7 @@ dun_new_gsm (NMAMobileWizardAccessMethod *method)
}
static void
-dun_add_cb (NMRemoteSettings *settings,
+dun_add_cb (NMClient *settings,
NMRemoteConnection *connection,
GError *error,
gpointer user_data)
@@ -481,7 +481,7 @@ wizard_done_cb (NMAMobileWizard *wizard,
g_message ("%s: adding new setting", __func__);
/* Add the connection to the settings service */
- nm_remote_settings_add_connection (priv->settings,
+ nm_client_add_connection (priv->settings,
connection,
dun_add_cb,
self);
@@ -943,7 +943,7 @@ _set_pan_enabled (NmaBtDevice *device, gboolean enabled)
}
static void
-pan_add_cb (NMRemoteSettings *settings,
+pan_add_cb (NMClient *settings,
NMRemoteConnection *connection,
GError *error,
gpointer user_data)
@@ -1009,7 +1009,7 @@ add_pan_connection (NmaBtDevice *self)
nm_connection_add_setting (connection, ip_setting);
/* Add the connection to the settings service */
- nm_remote_settings_add_connection (priv->settings,
+ nm_client_add_connection (priv->settings,
connection,
pan_add_cb,
self);
@@ -1050,7 +1050,7 @@ nma_bt_device_set_parent_window (NmaBtDevice *device, GtkWindow *window)
/*********************************************************************/
static void
-connections_read (NMRemoteSettings *settings, gpointer user_data)
+connections_read (NMClient *settings, gpointer user_data)
{
recheck_services_enabled (NMA_BT_DEVICE (user_data));
}
@@ -1101,7 +1101,7 @@ nma_bt_device_new (const char *bdaddr,
priv->window_group = gtk_window_group_new ();
- priv->settings = nm_remote_settings_new (priv->bus);
+ priv->settings = nm_client_new (priv->bus);
g_signal_connect (priv->settings,
NM_REMOTE_SETTINGS_CONNECTIONS_READ,
G_CALLBACK (connections_read),
diff --git a/src/libnm-gtk/nm-wifi-dialog.c b/src/libnm-gtk/nm-wifi-dialog.c
index 7a4164a..84202a3 100644
--- a/src/libnm-gtk/nm-wifi-dialog.c
+++ b/src/libnm-gtk/nm-wifi-dialog.c
@@ -49,7 +49,6 @@ typedef struct {
typedef struct {
NMClient *client;
- NMRemoteSettings *settings;
GtkBuilder *builder;
@@ -426,7 +425,9 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
C_NAME_COLUMN, id,
C_CON_COLUMN, connection, -1);
} else {
- GSList *connections, *iter, *to_add = NULL;
+ GSList *to_add, *iter;
+ const GPtrArray *connections;
+ int i;
gtk_list_store_append (store, &tree_iter);
gtk_list_store_set (store, &tree_iter,
@@ -436,9 +437,9 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
gtk_list_store_append (store, &tree_iter);
gtk_list_store_set (store, &tree_iter, C_SEP_COLUMN, TRUE, -1);
- connections = nm_remote_settings_list_connections (priv->settings);
- for (iter = connections; iter; iter = g_slist_next (iter)) {
- NMConnection *candidate = NM_CONNECTION (iter->data);
+ connections = nm_client_get_connections (priv->client);
+ for (i = 0; i < connections->len; i++) {
+ NMConnection *candidate = NM_CONNECTION (connections->pdata[i]);
NMSettingWireless *s_wireless;
const char *connection_type;
const char *mode;
@@ -458,14 +459,14 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
/* If creating a new Ad-Hoc network, only show shared network connections */
if (priv->operation == OP_CREATE_ADHOC) {
- NMSettingIP4Config *s_ip4;
+ NMSettingIPConfig *s_ip4;
const char *method = NULL;
s_ip4 = nm_connection_get_setting_ip4_config (candidate);
if (s_ip4)
- method = nm_setting_ip4_config_get_method (s_ip4);
+ method = nm_setting_ip_config_get_method (s_ip4);
- if (!s_ip4 || strcmp (method, "shared"))
+ if (!s_ip4 || strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
continue;
/* Ignore non-Ad-Hoc connections too */
@@ -484,7 +485,6 @@ connection_combo_init (NMAWifiDialog *self, NMConnection *connection)
to_add = g_slist_append (to_add, candidate);
}
- g_slist_free (connections);
/* Alphabetize the list then add the connections */
to_add = g_slist_sort (to_add, (GCompareFunc) alphabetize_connections);
@@ -1194,13 +1194,15 @@ nma_wifi_dialog_get_connection (NMAWifiDialog *self,
g_object_set (s_wireless, NM_SETTING_WIRELESS_SSID, validate_dialog_ssid (self), NULL);
if (priv->operation == OP_CREATE_ADHOC) {
- NMSettingIP4Config *s_ip4;
+ NMSetting *s_ip4;
g_object_set (s_wireless, NM_SETTING_WIRELESS_MODE, "adhoc", NULL);
- s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD,
NM_SETTING_IP4_CONFIG_METHOD_SHARED, NULL);
- nm_connection_add_setting (connection, (NMSetting *) s_ip4);
+ s_ip4 = nm_setting_ip4_config_new ();
+ g_object_set (s_ip4,
+ NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_SHARED,
+ NULL);
+ nm_connection_add_setting (connection, s_ip4);
} else if (priv->operation == OP_CONNECT_HIDDEN) {
/* Mark as a hidden SSID network */
g_object_set (s_wireless, NM_SETTING_WIRELESS_HIDDEN, TRUE, NULL);
@@ -1239,7 +1241,6 @@ nma_wifi_dialog_get_connection (NMAWifiDialog *self,
GtkWidget *
nma_wifi_dialog_new (NMClient *client,
- NMRemoteSettings *settings,
NMConnection *connection,
NMDevice *device,
NMAccessPoint *ap,
@@ -1250,7 +1251,6 @@ nma_wifi_dialog_new (NMClient *client,
guint32 dev_caps;
g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
- g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
/* Ensure device validity */
@@ -1265,7 +1265,6 @@ nma_wifi_dialog_new (NMClient *client,
priv = NMA_WIFI_DIALOG_GET_PRIVATE (self);
priv->client = g_object_ref (client);
- priv->settings = g_object_ref (settings);
if (ap)
priv->ap = g_object_ref (ap);
@@ -1287,14 +1286,12 @@ nma_wifi_dialog_new (NMClient *client,
static GtkWidget *
internal_new_operation (NMClient *client,
- NMRemoteSettings *settings,
guint operation)
{
NMAWifiDialog *self;
NMAWifiDialogPrivate *priv;
g_return_val_if_fail (NM_IS_CLIENT (client), NULL);
- g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
self = NMA_WIFI_DIALOG (g_object_new (NMA_TYPE_WIFI_DIALOG, NULL));
if (!self)
@@ -1303,7 +1300,6 @@ internal_new_operation (NMClient *client,
priv = NMA_WIFI_DIALOG_GET_PRIVATE (self);
priv->client = g_object_ref (client);
- priv->settings = g_object_ref (settings);
priv->sec_combo = GTK_WIDGET (gtk_builder_get_object (priv->builder, "security_combo"));
priv->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
priv->operation = operation;
@@ -1318,21 +1314,21 @@ internal_new_operation (NMClient *client,
}
GtkWidget *
-nma_wifi_dialog_new_for_hidden (NMClient *client, NMRemoteSettings *settings)
+nma_wifi_dialog_new_for_hidden (NMClient *client)
{
- return internal_new_operation (client, settings, OP_CONNECT_HIDDEN);
+ return internal_new_operation (client, OP_CONNECT_HIDDEN);
}
GtkWidget *
-nma_wifi_dialog_new_for_other (NMClient *client, NMRemoteSettings *settings)
+nma_wifi_dialog_new_for_other (NMClient *client)
{
- return internal_new_operation (client, settings, OP_CONNECT_HIDDEN);
+ return internal_new_operation (client, OP_CONNECT_HIDDEN);
}
GtkWidget *
-nma_wifi_dialog_new_for_create (NMClient *client, NMRemoteSettings *settings)
+nma_wifi_dialog_new_for_create (NMClient *client)
{
- return internal_new_operation (client, settings, OP_CREATE_ADHOC);
+ return internal_new_operation (client, OP_CREATE_ADHOC);
}
/**
@@ -1377,7 +1373,6 @@ dispose (GObject *object)
priv->secrets_info->canceled = TRUE;
g_object_unref (priv->client);
- g_object_unref (priv->settings);
g_object_unref (priv->builder);
g_object_unref (priv->device_model);
diff --git a/src/libnm-gtk/nm-wifi-dialog.h b/src/libnm-gtk/nm-wifi-dialog.h
index 8a96ca2..6f02bfc 100644
--- a/src/libnm-gtk/nm-wifi-dialog.h
+++ b/src/libnm-gtk/nm-wifi-dialog.h
@@ -51,17 +51,14 @@ typedef struct {
GType nma_wifi_dialog_get_type (void);
GtkWidget *nma_wifi_dialog_new (NMClient *client,
- NMRemoteSettings *settings,
NMConnection *connection,
NMDevice *device,
NMAccessPoint *ap,
gboolean secrets_only);
-GtkWidget *nma_wifi_dialog_new_for_hidden (NMClient *client,
- NMRemoteSettings *settings);
+GtkWidget *nma_wifi_dialog_new_for_hidden (NMClient *client);
-GtkWidget *nma_wifi_dialog_new_for_create (NMClient *client,
- NMRemoteSettings *settings);
+GtkWidget *nma_wifi_dialog_new_for_create (NMClient *client);
NMConnection * nma_wifi_dialog_get_connection (NMAWifiDialog *self,
NMDevice **device,
@@ -77,8 +74,7 @@ GLIB_DEPRECATED
gboolean nma_wifi_dialog_get_nag_ignored (NMAWifiDialog *self);
GLIB_DEPRECATED_FOR(nma_wifi_dialog_new_for_hidden)
-GtkWidget *nma_wifi_dialog_new_for_other (NMClient *client,
- NMRemoteSettings *settings);
+GtkWidget *nma_wifi_dialog_new_for_other (NMClient *client);
#endif /* NMA_WIFI_DIALOG_H */
diff --git a/src/libnm-gtk/nm-wireless-dialog.c b/src/libnm-gtk/nm-wireless-dialog.c
index 05a5aaf..bf8ea36 100644
--- a/src/libnm-gtk/nm-wireless-dialog.c
+++ b/src/libnm-gtk/nm-wireless-dialog.c
@@ -41,24 +41,23 @@ nma_wireless_dialog_get_connection (NMAWirelessDialog *self,
GtkWidget *
nma_wireless_dialog_new (NMClient *client,
- NMRemoteSettings *settings,
NMConnection *connection,
NMDevice *device,
NMAccessPoint *ap,
gboolean secrets_only)
{
- return nma_wifi_dialog_new (client, settings, connection, device, ap, secrets_only);
+ return nma_wifi_dialog_new (client, connection, device, ap, secrets_only);
}
GtkWidget *
-nma_wireless_dialog_new_for_other (NMClient *client, NMRemoteSettings *settings)
+nma_wireless_dialog_new_for_other (NMClient *client)
{
- return nma_wifi_dialog_new_for_hidden (client, settings);
+ return nma_wifi_dialog_new_for_hidden (client);
}
GtkWidget *
-nma_wireless_dialog_new_for_create (NMClient *client, NMRemoteSettings *settings)
+nma_wireless_dialog_new_for_create (NMClient *client)
{
- return nma_wifi_dialog_new_for_create (client, settings);
+ return nma_wifi_dialog_new_for_create (client);
}
diff --git a/src/libnm-gtk/nm-wireless-dialog.h b/src/libnm-gtk/nm-wireless-dialog.h
index 9c6c2d9..8c12b39 100644
--- a/src/libnm-gtk/nm-wireless-dialog.h
+++ b/src/libnm-gtk/nm-wireless-dialog.h
@@ -53,19 +53,16 @@ GType nma_wireless_dialog_get_type (void);
GLIB_DEPRECATED_FOR(nma_wifi_dialog_new)
GtkWidget *nma_wireless_dialog_new (NMClient *client,
- NMRemoteSettings *settings,
NMConnection *connection,
NMDevice *device,
NMAccessPoint *ap,
gboolean secrets_only);
GLIB_DEPRECATED_FOR(nma_wifi_dialog_new_for_other)
-GtkWidget *nma_wireless_dialog_new_for_other (NMClient *client,
- NMRemoteSettings *settings);
+GtkWidget *nma_wireless_dialog_new_for_other (NMClient *client);
GLIB_DEPRECATED_FOR(nma_wifi_dialog_new_for_create)
-GtkWidget *nma_wireless_dialog_new_for_create (NMClient *client,
- NMRemoteSettings *settings);
+GtkWidget *nma_wireless_dialog_new_for_create (NMClient *client);
GLIB_DEPRECATED_FOR(nma_wifi_dialog_get_connection)
NMConnection * nma_wireless_dialog_get_connection (NMAWirelessDialog *dialog,
diff --git a/src/migration-tool.c b/src/migration-tool.c
index 7ef77b1..416613d 100644
--- a/src/migration-tool.c
+++ b/src/migration-tool.c
@@ -37,7 +37,7 @@ add_cb (GObject *settings,
NMRemoteConnection *c;
GError *error = NULL;
- c = nm_remote_settings_add_connection_finish (NM_REMOTE_SETTINGS (settings),
+ c = nm_client_add_connection_finish (NM_REMOTE_SETTINGS (settings),
result, &error);
if (error) {
g_printerr ("Failed to move connection '%s' to NetworkManager system settings: %s",
@@ -51,15 +51,15 @@ add_cb (GObject *settings,
static void
import_cb (NMConnection *connection, gpointer user_data)
{
- NMRemoteSettings *settings = user_data;
+ NMClient *settings = user_data;
- nm_remote_settings_add_connection_async (settings, connection, TRUE, NULL, add_cb, NULL);
+ nm_client_add_connection_async (settings, connection, TRUE, NULL, add_cb, NULL);
}
int
main (int argc, char **argv)
{
- NMRemoteSettings *settings;
+ NMClient *settings;
GError *error = NULL;
bindtextdomain (GETTEXT_PACKAGE, NMALOCALEDIR);
@@ -73,7 +73,7 @@ main (int argc, char **argv)
exit (1);
}
- settings = nm_remote_settings_new (NULL, &error);
+ settings = nm_client_new (NULL, &error);
if (!settings) {
g_printerr ("Failed to create remote settings: %s", error->message);
g_error_free (error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]