[network-manager-applet/dcbw/libnm-bgo736911: 10/16] connection-editor: port to libnm
- From: Dan Williams <dcbw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/dcbw/libnm-bgo736911: 10/16] connection-editor: port to libnm
- Date: Wed, 18 Feb 2015 22:53:42 +0000 (UTC)
commit 2f217a1200a584d2c685329063a8f40ae70d39d0
Author: Dan Winship <danw redhat com>
Date: Tue Nov 25 10:00:33 2014 -0500
connection-editor: port to libnm
Based on a patch by Jiří Klimeš.
src/connection-editor/Makefile.am | 13 +-
src/connection-editor/ce-page.c | 98 +++++--------
src/connection-editor/ce-page.h | 24 +--
src/connection-editor/ce-polkit-button.c | 2 +-
src/connection-editor/ce-polkit-button.h | 4 +-
src/connection-editor/connection-helpers.c | 49 +++---
src/connection-editor/connection-helpers.h | 11 +-
src/connection-editor/ip4-routes-dialog.c | 101 ++++++------
src/connection-editor/ip4-routes-dialog.h | 8 +-
src/connection-editor/ip6-routes-dialog.c | 94 ++++++------
src/connection-editor/ip6-routes-dialog.h | 8 +-
src/connection-editor/main.c | 7 +-
src/connection-editor/nm-connection-editor.c | 129 +++++++---------
src/connection-editor/nm-connection-editor.h | 12 +-
src/connection-editor/nm-connection-list.c | 178 ++++++---------------
src/connection-editor/nm-connection-list.h | 9 +-
src/connection-editor/page-8021x-security.c | 13 +--
src/connection-editor/page-8021x-security.h | 7 +-
src/connection-editor/page-bluetooth.c | 21 +--
src/connection-editor/page-bluetooth.h | 5 +-
src/connection-editor/page-bond.c | 38 ++---
src/connection-editor/page-bond.h | 7 +-
src/connection-editor/page-bridge-port.c | 8 +-
src/connection-editor/page-bridge-port.h | 5 +-
src/connection-editor/page-bridge.c | 42 ++----
src/connection-editor/page-bridge.h | 7 +-
src/connection-editor/page-dcb.c | 9 +-
src/connection-editor/page-dcb.h | 7 +-
src/connection-editor/page-dsl.c | 26 +---
src/connection-editor/page-dsl.h | 7 +-
src/connection-editor/page-ethernet.c | 44 ++----
src/connection-editor/page-ethernet.h | 7 +-
src/connection-editor/page-general.c | 26 ++--
src/connection-editor/page-general.h | 13 +-
src/connection-editor/page-infiniband.c | 25 +--
src/connection-editor/page-infiniband.h | 7 +-
src/connection-editor/page-ip4.c | 190 +++++++++++------------
src/connection-editor/page-ip4.h | 5 +-
src/connection-editor/page-ip6.c | 179 ++++++++++------------
src/connection-editor/page-ip6.h | 5 +-
src/connection-editor/page-master.c | 45 +++---
src/connection-editor/page-master.h | 4 +-
src/connection-editor/page-mobile.c | 23 +--
src/connection-editor/page-mobile.h | 7 +-
src/connection-editor/page-ppp.c | 11 +-
src/connection-editor/page-ppp.h | 5 +-
src/connection-editor/page-team-port.c | 19 +--
src/connection-editor/page-team-port.h | 8 +-
src/connection-editor/page-team.c | 39 ++---
src/connection-editor/page-team.h | 10 +-
src/connection-editor/page-vlan.c | 63 +++-----
src/connection-editor/page-vlan.h | 7 +-
src/connection-editor/page-vpn.c | 55 +++----
src/connection-editor/page-vpn.h | 9 +-
src/connection-editor/page-wifi-security.c | 13 +--
src/connection-editor/page-wifi-security.h | 7 +-
src/connection-editor/page-wifi.c | 88 ++++-------
src/connection-editor/page-wifi.h | 11 +-
src/connection-editor/page-wimax.c | 30 +---
src/connection-editor/page-wimax.h | 7 +-
src/connection-editor/ppp-auth-methods-dialog.c | 4 +-
src/connection-editor/vpn-helpers.c | 49 +++----
src/connection-editor/vpn-helpers.h | 8 +-
63 files changed, 770 insertions(+), 1202 deletions(-)
---
diff --git a/src/connection-editor/Makefile.am b/src/connection-editor/Makefile.am
index 6a1c084..000bf46 100644
--- a/src/connection-editor/Makefile.am
+++ b/src/connection-editor/Makefile.am
@@ -2,8 +2,8 @@ bin_PROGRAMS = nm-connection-editor
nm_connection_editor_CPPFLAGS = \
$(GTK_CFLAGS) \
- $(NMA_CFLAGS) \
- -DLIBNM_GLIB_BUILD \
+ $(LIBNM_CFLAGS) \
+ -DLIBNM_BUILD \
-DNM_VERSION_MIN_REQUIRED=NM_VERSION_0_9_10 \
-DNM_VERSION_MAX_ALLOWED=NM_VERSION_0_9_10 \
-DICONDIR=\""$(datadir)/icons"\" \
@@ -16,7 +16,7 @@ nm_connection_editor_CPPFLAGS = \
$(DBUS_GLIB_CFLAGS) \
-I${top_srcdir}/src/utils \
-I${top_srcdir}/src/wireless-security \
- -I${top_srcdir}/src/libnm-gtk
+ -I${top_srcdir}/src/libnma
nm_connection_editor_SOURCES = \
nm-connection-editor.c \
@@ -87,11 +87,10 @@ nm-connection-editor-service-glue.h: $(top_srcdir)/src/connection-editor/nm-conn
$(AM_V_GEN) dbus-binding-tool --prefix=nm_connection_editor_service --mode=glib-server --output=$@ $<
nm_connection_editor_LDADD = \
- ${top_builddir}/src/wireless-security/libwireless-security-libnm-glib.la \
- ${top_builddir}/src/utils/libutils-libnm-glib.la \
- ${top_builddir}/src/libnm-gtk/libnm-gtk.la \
+ ${top_builddir}/src/wireless-security/libwireless-security-libnm.la \
+ ${top_builddir}/src/utils/libutils-libnm.la \
+ ${top_builddir}/src/libnma/libnma.la \
$(GTK_LIBS) \
- $(NMA_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBNM_LIBS) \
-lm
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 278e946..51adee6 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include <config.h>
@@ -29,9 +29,6 @@
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-utils.h>
-
#include "ce-page.h"
G_DEFINE_ABSTRACT_TYPE (CEPage, ce_page, G_TYPE_OBJECT)
@@ -151,7 +148,7 @@ ce_page_get_mac_list (CEPage *self, GType device_type, const char *mac_property)
macs = g_ptr_array_new ();
devices = nm_client_get_devices (self->client);
- for (i = 0; devices && (i < devices->len); i++) {
+ for (i = 0; i < devices->len; i++) {
NMDevice *dev = g_ptr_array_index (devices, i);
const char *iface;
char *mac, *item;
@@ -207,31 +204,11 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
}
}
-void
-ce_page_mac_to_entry (const GByteArray *mac, int type, GtkEntry *entry)
-{
- char *str_addr;
-
- g_return_if_fail (entry != NULL);
- g_return_if_fail (GTK_IS_ENTRY (entry));
-
- if (!mac || !mac->len)
- return;
-
- if (mac->len != nm_utils_hwaddr_len (type))
- return;
-
- str_addr = nm_utils_hwaddr_ntoa (mac->data, type);
- gtk_entry_set_text (entry, str_addr);
- g_free (str_addr);
-}
-
-GByteArray *
+char *
ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid)
{
- const char *temp, *sp;
- char *buf = NULL;
- GByteArray *mac;
+ const char *sp, *temp;
+ char *mac;
g_return_val_if_fail (entry != NULL, NULL);
g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL);
@@ -240,48 +217,41 @@ ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid)
g_return_val_if_fail (*invalid == FALSE, NULL);
temp = gtk_entry_get_text (entry);
- if (!temp || !strlen (temp))
+ if (!temp || !*temp)
return NULL;
sp = strchr (temp, ' ');
if (sp)
- temp = buf = g_strndup (temp, sp - temp);
-
- mac = nm_utils_hwaddr_atoba (temp, type);
- g_free (buf);
- if (!mac) {
- if (invalid)
- *invalid = TRUE;
- return NULL;
- }
+ mac = g_strndup (temp, sp - temp);
+ else
+ mac = g_strdup (temp);
- if (type == ARPHRD_ETHER && !utils_ether_addr_valid ((struct ether_addr *)mac->data)) {
- g_byte_array_free (mac, TRUE);
+ if (!nm_utils_hwaddr_valid (mac, nm_utils_hwaddr_len (type))) {
+ g_free (mac);
if (invalid)
*invalid = TRUE;
return NULL;
}
-
return mac;
}
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;
@@ -312,23 +282,30 @@ emit_initialized (CEPage *self, GError *error)
void
ce_page_complete_init (CEPage *self,
const char *setting_name,
- GHashTable *secrets,
+ GVariant *secrets,
GError *error)
{
GError *update_error = NULL;
- GHashTable *setting_hash;
+ GVariant *setting_dict;
+ char *dbus_err;
+ gboolean ignore_error = FALSE;
g_return_if_fail (self != NULL);
g_return_if_fail (CE_IS_PAGE (self));
+ if (error) {
+ dbus_err = g_dbus_error_get_remote_error (error);
+ ignore_error = !g_strcmp0 (dbus_err,
"org.freedesktop.NetworkManager.Settings.InvalidSetting")
+ || !g_strcmp0 (dbus_err,
"org.freedesktop.NetworkManager.Settings.Connection.SettingNotFound")
+ || !g_strcmp0 (dbus_err,
"org.freedesktop.NetworkManager.AgentManager.NoSecrets");
+ g_free (dbus_err);
+ }
+
/* Ignore missing settings errors */
- if ( error
- && !dbus_g_error_has_name (error, "org.freedesktop.NetworkManager.Settings.InvalidSetting")
- && !dbus_g_error_has_name (error,
"org.freedesktop.NetworkManager.Settings.Connection.SettingNotFound")
- && !dbus_g_error_has_name (error, "org.freedesktop.NetworkManager.AgentManager.NoSecrets")) {
+ if (error && !ignore_error) {
emit_initialized (self, error);
return;
- } else if (!setting_name || !secrets || !g_hash_table_size (secrets)) {
+ } else if (!setting_name || !secrets || g_variant_n_children (secrets) == 0) {
/* Success, no secrets */
emit_initialized (self, NULL);
return;
@@ -337,12 +314,13 @@ ce_page_complete_init (CEPage *self,
g_assert (setting_name);
g_assert (secrets);
- setting_hash = g_hash_table_lookup (secrets, setting_name);
- if (!setting_hash) {
+ setting_dict = g_variant_lookup_value (secrets, setting_name, NM_VARIANT_TYPE_SETTING);
+ if (!setting_dict) {
/* Success, no secrets */
emit_initialized (self, NULL);
return;
}
+ g_variant_unref (setting_dict);
/* Update the connection with the new secrets */
if (nm_connection_update_secrets (self->connection,
@@ -376,7 +354,6 @@ dispose (GObject *object)
g_clear_object (&self->page);
g_clear_object (&self->builder);
- g_clear_object (&self->proxy);
g_clear_object (&self->connection);
G_OBJECT_CLASS (ce_page_parent_class)->dispose (object);
@@ -522,24 +499,23 @@ 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_connection_new ();
+ connection = nm_simple_connection_new ();
s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
nm_connection_add_setting (connection, NM_SETTING (s_con));
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,
@@ -559,7 +535,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)
@@ -577,7 +552,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 639beb3..66e317d 100644
--- a/src/connection-editor/ce-page.h
+++ b/src/connection-editor/ce-page.h
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __CE_PAGE_H__
@@ -28,10 +28,8 @@
#include <gtk/gtk.h>
-#include <dbus/dbus-glib.h>
-#include <nm-connection.h>
-#include <nm-client.h>
-#include <nm-remote-settings.h>
+#include <NetworkManager.h>
+
#include "utils.h"
/* for ARPHRD_ETHER / ARPHRD_INFINIBAND for MAC utilies */
@@ -46,7 +44,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);
@@ -69,13 +67,11 @@ typedef struct {
GtkWidget *page;
char *title;
- DBusGProxy *proxy;
gulong secrets_done_validate;
NMConnection *connection;
GtkWindow *parent_window;
NMClient *client;
- NMRemoteSettings *settings;
} CEPage;
typedef struct {
@@ -93,7 +89,6 @@ typedef struct {
typedef CEPage* (*CEPageNewFunc)(NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
@@ -112,9 +107,7 @@ void ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
void ce_page_changed (CEPage *self);
-void ce_page_mac_to_entry (const GByteArray *mac, int type, GtkEntry *entry);
-
-GByteArray *ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid);
+char *ce_page_entry_to_mac (GtkEntry *entry, int type, gboolean *invalid);
gboolean ce_spin_output_with_automatic (GtkSpinButton *spin, gpointer user_data);
@@ -124,25 +117,24 @@ int ce_get_property_default (NMSetting *setting, const char *property_name);
void ce_page_complete_init (CEPage *self,
const char *setting_name,
- GHashTable *secrets,
+ GVariant *secrets,
GError *error);
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/ce-polkit-button.c b/src/connection-editor/ce-polkit-button.c
index ebd4355..c72177f 100644
--- a/src/connection-editor/ce-polkit-button.c
+++ b/src/connection-editor/ce-polkit-button.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2009 Red Hat, Inc.
+ * Copyright 2009 - 2014 Red Hat, Inc.
*/
#include <string.h>
diff --git a/src/connection-editor/ce-polkit-button.h b/src/connection-editor/ce-polkit-button.h
index 86496fd..da2f3e3 100644
--- a/src/connection-editor/ce-polkit-button.h
+++ b/src/connection-editor/ce-polkit-button.h
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2009 - 2012 Red Hat, Inc.
+ * Copyright 2009 - 2014444 Red Hat, Inc.
*/
#ifndef __CE_POLKIT_BUTTON_H__
@@ -25,7 +25,7 @@
#include <gtk/gtk.h>
-#include <nm-client.h>
+#include <NetworkManager.h>
#define CE_TYPE_POLKIT_BUTTON (ce_polkit_button_get_type ())
#define CE_POLKIT_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CE_TYPE_POLKIT_BUTTON,
CEPolkitButton))
diff --git a/src/connection-editor/connection-helpers.c b/src/connection-editor/connection-helpers.c
index 23942e8..b4df108 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);
@@ -180,7 +180,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))
@@ -194,7 +194,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;
@@ -293,10 +293,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);
@@ -312,7 +312,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;
}
@@ -338,7 +338,7 @@ set_up_connection_type_combo (GtkComboBox *combo,
typedef struct {
GtkWindow *parent_window;
- NMRemoteSettings *settings;
+ NMClient *client;
NewConnectionResultFunc result_func;
gpointer user_data;
} NewConnectionData;
@@ -372,7 +372,7 @@ new_connection_result (NMConnection *connection,
void
new_connection_of_type (GtkWindow *parent_window,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionFunc new_func,
NewConnectionResultFunc result_func,
gpointer user_data)
@@ -381,25 +381,25 @@ new_connection_of_type (GtkWindow *parent_window,
ncd = g_slice_new (NewConnectionData);
ncd->parent_window = parent_window;
- ncd->settings = settings;
+ ncd->client = client;
ncd->result_func = result_func;
ncd->user_data = user_data;
new_func (parent_window,
detail,
- settings,
+ client,
new_connection_result,
ncd);
}
void
new_connection_dialog (GtkWindow *parent_window,
- NMRemoteSettings *settings,
+ NMClient *client,
NewConnectionTypeFilterFunc type_filter_func,
NewConnectionResultFunc result_func,
gpointer user_data)
{
- new_connection_dialog_full (parent_window, settings,
+ new_connection_dialog_full (parent_window, client,
NULL, NULL,
type_filter_func,
result_func,
@@ -408,7 +408,7 @@ new_connection_dialog (GtkWindow *parent_window,
void
new_connection_dialog_full (GtkWindow *parent_window,
- NMRemoteSettings *settings,
+ NMClient *client,
const char *primary_label,
const char *secondary_label,
NewConnectionTypeFilterFunc type_filter_func,
@@ -423,7 +423,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;
@@ -463,7 +463,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);
}
}
@@ -472,7 +472,7 @@ new_connection_dialog_full (GtkWindow *parent_window,
g_object_unref (gui);
if (new_func)
- new_connection_of_type (parent_window, vpn_type, settings, new_func, result_func, user_data);
+ new_connection_of_type (parent_window, vpn_type, client, new_func, result_func, user_data);
else
result_func (NULL, user_data);
@@ -487,13 +487,15 @@ typedef struct {
} DeleteInfo;
static void
-delete_cb (NMRemoteConnection *connection,
- GError *error,
+delete_cb (GObject *connection,
+ GAsyncResult *result,
gpointer user_data)
{
DeleteInfo *info = user_data;
DeleteConnectionResultFunc result_func;
+ GError *error = NULL;
+ nm_remote_connection_delete_finish (NM_REMOTE_CONNECTION (connection), result, &error);
if (error) {
nm_connection_editor_error (info->parent_window,
_("Connection delete failed"),
@@ -510,9 +512,10 @@ delete_cb (NMRemoteConnection *connection,
result_func = info->result_func;
user_data = info->user_data;
g_free (info);
+ g_clear_error (&error);
if (result_func)
- (*result_func) (connection, error == NULL, user_data);
+ (*result_func) (NM_REMOTE_CONNECTION (connection), error == NULL, user_data);
}
void
@@ -565,7 +568,7 @@ delete_connection (GtkWindow *parent_window,
if (editor)
nm_connection_editor_set_busy (editor, TRUE);
- nm_remote_connection_delete (connection, delete_cb, info);
+ nm_remote_connection_delete_async (connection, NULL, delete_cb, info);
}
gboolean
diff --git a/src/connection-editor/connection-helpers.h b/src/connection-editor/connection-helpers.h
index 92b8325..9ac82a3 100644
--- a/src/connection-editor/connection-helpers.h
+++ b/src/connection-editor/connection-helpers.h
@@ -15,14 +15,15 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __CONNECTION_HELPERS_H__
#define __CONNECTION_HELPERS_H__
+#include <NetworkManager.h>
+
#include "ce-page.h"
-#include <nm-remote-settings.h>
typedef struct {
const char *name;
@@ -39,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,
@@ -53,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 95c1107..e399e4d 100644
--- a/src/connection-editor/ip4-routes-dialog.c
+++ b/src/connection-editor/ip4-routes-dialog.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -33,8 +33,6 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include <nm-utils.h>
-
#include "ip4-routes-dialog.h"
#include "utils.h"
@@ -127,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)) {
@@ -139,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
@@ -168,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))
@@ -187,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))
@@ -629,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;
@@ -675,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_ip_route_get_prefix (route));
+ if (!inet_ntop (AF_INET, &tmp_addr, netmask, sizeof (netmask)))
+ *netmask = '\0';
- 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);
+ /* FIXME */
+ g_snprintf (metric, sizeof (metric), "%u",
+ (guint32) MIN (0, nm_ip_route_get_metric (route)));
- 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);
-
- 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"));
@@ -797,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);
@@ -811,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;
@@ -830,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)) {
@@ -845,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 4f5ef77..b7e38b2 100644
--- a/src/connection-editor/ip4-routes-dialog.h
+++ b/src/connection-editor/ip4-routes-dialog.h
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef IP4_ROUTES_DIALOG_H
@@ -26,10 +26,12 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include <NetworkManager.h>
+
#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 c1fef55..67197a7 100644
--- a/src/connection-editor/ip6-routes-dialog.c
+++ b/src/connection-editor/ip6-routes-dialog.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2013 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -33,7 +33,7 @@
#include <glib/gi18n.h>
#include <gdk/gdkkeysyms.h>
-#include <nm-utils.h>
+#include <NetworkManager.h>
#include "ip6-routes-dialog.h"
#include "utils.h"
@@ -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 e7d5d09..746eab1 100644
--- a/src/connection-editor/ip6-routes-dialog.h
+++ b/src/connection-editor/ip6-routes-dialog.h
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef IP6_ROUTES_DIALOG_H
@@ -26,10 +26,12 @@
#include <glib.h>
#include <gtk/gtk.h>
+#include <NetworkManager.h>
+
#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/main.c b/src/connection-editor/main.c
index d552201..8a0dd16 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2004 - 2013 Red Hat, Inc.
+ * Copyright 2004 - 2014 Red Hat, Inc.
*/
#ifdef HAVE_CONFIG_H
@@ -36,9 +36,6 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
#include "nm-connection-list.h"
#include "nm-connection-editor.h"
@@ -171,7 +168,7 @@ handle_arguments (NMConnectionList *list,
type = NM_SETTING_WIRED_SETTING_NAME;
/* Grab type to create or show */
- ctype = nm_connection_lookup_setting_type (type);
+ ctype = nm_setting_lookup_type (type);
if (ctype == 0) {
g_warning ("Unknown connection type '%s'", type);
g_free (type_tmp);
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index e588994..be3a06d 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -19,8 +19,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2007 - 2011 Red Hat, Inc.
- * (C) Copyright 2007 - 2008 Novell, Inc.
+ * Copyright 2007 - 2014 Red Hat, Inc.
+ * Copyright 2007 - 2008 Novell, Inc.
*/
#include "config.h"
@@ -33,27 +33,6 @@
#include <gdk/gdkx.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-setting-ip6-config.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-wireless-security.h>
-#include <nm-setting-vpn.h>
-#include <nm-setting-pppoe.h>
-#include <nm-setting-ppp.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-wimax.h>
-#include <nm-setting-infiniband.h>
-#include <nm-setting-bond.h>
-#include <nm-setting-team.h>
-#include <nm-setting-bridge.h>
-#include <nm-utils.h>
-
-#include <nm-remote-connection.h>
-
#include "nm-connection-editor.h"
#include "ce-page.h"
@@ -368,8 +347,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);
}
@@ -395,8 +372,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;
@@ -405,12 +381,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);
@@ -482,7 +457,7 @@ nm_connection_editor_get_master (NMConnection *slave)
while (g_hash_table_iter_next (&iter, &connection, &editor)) {
if (!g_strcmp0 (master, nm_connection_get_uuid (connection)))
return editor;
- if (!g_strcmp0 (master, nm_connection_get_virtual_iface_name (connection)))
+ if (!g_strcmp0 (master, nm_connection_get_interface_name (connection)))
return editor;
}
@@ -613,19 +588,23 @@ page_initialized (CEPage *page, GError *error, gpointer user_data)
static void request_secrets (GetSecretsInfo *info);
static void
-get_secrets_cb (NMRemoteConnection *connection,
- GHashTable *secrets,
- GError *error,
+get_secrets_cb (GObject *object,
+ GAsyncResult *result,
gpointer user_data)
{
+ NMRemoteConnection *connection = NM_REMOTE_CONNECTION (object);
GetSecretsInfo *info = user_data;
NMConnectionEditor *self;
+ GVariant *secrets;
+ GError *error = NULL;
if (info->canceled) {
get_secrets_info_free (info);
return;
}
+ secrets = nm_remote_connection_get_secrets_finish (connection, result, &error);
+
self = info->self;
/* Complete this secrets request; completion can actually dispose of the
@@ -651,10 +630,8 @@ request_secrets (GetSecretsInfo *info)
{
g_return_if_fail (info != NULL);
- nm_remote_connection_get_secrets (NM_REMOTE_CONNECTION (info->self->orig_connection),
- info->setting_name,
- get_secrets_cb,
- info);
+ nm_remote_connection_get_secrets_async (NM_REMOTE_CONNECTION (info->self->orig_connection),
+ info->setting_name, NULL, get_secrets_cb, info);
}
static void
@@ -704,7 +681,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),
@@ -740,7 +717,7 @@ nm_connection_editor_set_connection (NMConnectionEditor *editor,
if (editor->connection)
g_object_unref (editor->connection);
- editor->connection = nm_connection_duplicate (orig_connection);
+ editor->connection = nm_simple_connection_new_clone (orig_connection);
editor->orig_connection = g_object_ref (orig_connection);
nm_connection_editor_update_title (editor);
@@ -902,22 +879,25 @@ editor_closed_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
}
static void
-added_connection_cb (NMRemoteSettings *settings,
- NMRemoteConnection *connection,
- GError *error,
+added_connection_cb (GObject *client,
+ GAsyncResult *result,
gpointer user_data)
{
NMConnectionEditor *self = user_data;
+ NMRemoteConnection *connection;
+ GError *error = NULL;
nm_connection_editor_set_busy (self, FALSE);
+ 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);
-
/* Leave the editor open */
return;
}
+ g_clear_object (&connection);
+ g_clear_error (&error);
g_signal_emit (self, editor_signals[EDITOR_DONE], 0, GTK_RESPONSE_OK);
}
@@ -930,9 +910,15 @@ update_complete (NMConnectionEditor *self, GError *error)
}
static void
-updated_connection_cb (NMRemoteConnection *connection, GError *error, gpointer user_data)
+updated_connection_cb (GObject *connection,
+ GAsyncResult *result,
+ gpointer user_data)
{
NMConnectionEditor *self = NM_CONNECTION_EDITOR (user_data);
+ GError *error = NULL;
+
+ nm_remote_connection_commit_changes_finish (NM_REMOTE_CONNECTION (connection),
+ result, &error);
/* Clear secrets so they don't lay around in memory; they'll get requested
* again anyway next time the connection is edited.
@@ -940,39 +926,30 @@ updated_connection_cb (NMRemoteConnection *connection, GError *error, gpointer u
nm_connection_clear_secrets (NM_CONNECTION (connection));
update_complete (self, error);
+ g_clear_error (&error);
}
static void
ok_button_clicked_save_connection (NMConnectionEditor *self)
{
- GError *error = NULL;
-
/* Copy the modified connection to the original connection */
- if (!nm_connection_replace_settings_from_connection (self->orig_connection,
- self->connection,
- &error)) {
- nm_connection_editor_error (GTK_WINDOW (self->window),
- _("Error saving connection"),
- _("The property '%s' / '%s' is invalid: %d"),
- g_type_name (nm_connection_lookup_setting_type_by_quark
(error->domain)),
- error->message, error->code);
- g_error_free (error);
- return;
- }
-
+ nm_connection_replace_settings_from_connection (self->orig_connection,
+ self->connection);
nm_connection_editor_set_busy (self, TRUE);
/* Save new CA cert ignore values to GSettings */
eap_method_ca_cert_ignore_save (self->connection);
if (self->is_new_connection) {
- nm_remote_settings_add_connection (self->settings,
- self->orig_connection,
- 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 (NM_REMOTE_CONNECTION (self->orig_connection),
- updated_connection_cb, self);
+ nm_remote_connection_commit_changes_async (NM_REMOTE_CONNECTION (self->orig_connection),
+ TRUE, NULL, updated_connection_cb, self);
}
}
@@ -994,24 +971,31 @@ ok_button_clicked_cb (GtkWidget *widget, gpointer user_data)
}
static void
-vpn_export_get_secrets_cb (NMRemoteConnection *connection,
- GHashTable *secrets,
- GError *error,
+vpn_export_get_secrets_cb (GObject *object,
+ GAsyncResult *result,
gpointer user_data)
{
NMConnection *tmp;
+ GVariant *secrets;
+ GError *error = NULL;
+
+ secrets = nm_remote_connection_get_secrets_finish (NM_REMOTE_CONNECTION (object),
+ result, &error);
/* We don't really care about errors; if the user couldn't authenticate
* then just let them export everything except secrets. Duplicate the
* connection so that we don't let secrets sit around in the original
* one.
*/
- tmp = nm_connection_duplicate (NM_CONNECTION (connection));
+ tmp = nm_simple_connection_new_clone (NM_CONNECTION (object));
g_assert (tmp);
if (secrets)
nm_connection_update_secrets (tmp, NM_SETTING_VPN_SETTING_NAME, secrets, NULL);
vpn_export (tmp);
g_object_unref (tmp);
+ if (secrets)
+ g_variant_ref (secrets);
+ g_clear_error (&error);
}
static void
@@ -1021,10 +1005,11 @@ export_button_clicked_cb (GtkWidget *widget, gpointer user_data)
if (NM_IS_REMOTE_CONNECTION (self->orig_connection)) {
/* Grab secrets if we can */
- nm_remote_connection_get_secrets (NM_REMOTE_CONNECTION (self->orig_connection),
- NM_SETTING_VPN_SETTING_NAME,
- vpn_export_get_secrets_cb,
- self);
+ nm_remote_connection_get_secrets_async (NM_REMOTE_CONNECTION (self->orig_connection),
+ NM_SETTING_VPN_SETTING_NAME,
+ NULL,
+ vpn_export_get_secrets_cb,
+ self);
} else
vpn_export (self->connection);
}
diff --git a/src/connection-editor/nm-connection-editor.h b/src/connection-editor/nm-connection-editor.h
index 0a13afd..7c953b8 100644
--- a/src/connection-editor/nm-connection-editor.h
+++ b/src/connection-editor/nm-connection-editor.h
@@ -15,8 +15,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2007 Rodrigo Moya <rodrigo gnome-db org>
- * (C) Copyright 2007 - 2010 Red Hat, Inc.
+ * Copyright 2007 Rodrigo Moya <rodrigo gnome-db org>
+ * Copyright 2007 - 2014 Red Hat, Inc.
*/
#ifndef NM_CONNECTION_EDITOR_H
@@ -24,8 +24,8 @@
#include <glib-object.h>
-#include <nm-client.h>
-#include <nm-remote-settings.h>
+#include <NetworkManager.h>
+
#include "utils.h"
#define NM_TYPE_CONNECTION_EDITOR (nm_connection_editor_get_type ())
@@ -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 e6cb8e4..d74995d 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -18,7 +18,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2007 - 2012 Red Hat, Inc.
+ * Copyright 2007 - 2014 Red Hat, Inc.
*/
#include <config.h>
@@ -30,23 +30,6 @@
#include <gdk/gdkx.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-connection.h>
-#include <nm-setting.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-vpn.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-pppoe.h>
-#include <nm-setting-ppp.h>
-#include <nm-setting-serial.h>
-#include <nm-setting-wimax.h>
-#include <nm-setting-infiniband.h>
-#include <nm-utils.h>
-#include <nm-remote-settings.h>
-
#include "ce-page.h"
#include "nm-connection-editor.h"
#include "nm-connection-list.h"
@@ -243,7 +226,7 @@ delete_slaves_of_connection (NMConnectionList *list, NMConnection *connection)
return;
uuid = nm_connection_get_uuid (connection);
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
do {
if (!gtk_tree_model_iter_children (list->model, &iter, &types_iter))
@@ -297,8 +280,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);
@@ -315,7 +297,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);
@@ -354,8 +336,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);
}
@@ -445,11 +426,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);
}
@@ -588,7 +566,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;
@@ -698,7 +676,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);
@@ -714,7 +692,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);
@@ -728,7 +706,9 @@ add_connection_buttons (NMConnectionList *self)
}
static void
-connection_removed (NMRemoteConnection *connection, gpointer user_data)
+connection_removed (NMClient *client,
+ NMRemoteConnection *connection,
+ gpointer user_data)
{
NMConnectionList *self = NM_CONNECTION_LIST (user_data);
GtkTreeIter iter, parent_iter;
@@ -741,7 +721,7 @@ connection_removed (NMRemoteConnection *connection, gpointer user_data)
}
static void
-connection_updated (NMRemoteConnection *connection, gpointer user_data)
+connection_changed (NMRemoteConnection *connection, gpointer user_data)
{
NMConnectionList *self = NM_CONNECTION_LIST (user_data);
GtkTreeIter iter;
@@ -767,7 +747,7 @@ get_parent_iter_for_connection (NMConnectionList *list,
return FALSE;
}
- type = nm_connection_lookup_setting_type (str_type);
+ type = nm_setting_lookup_type (str_type);
if (gtk_tree_model_get_iter_first (list->model, iter)) {
do {
@@ -786,7 +766,7 @@ get_parent_iter_for_connection (NMConnectionList *list,
}
static void
-connection_added (NMRemoteSettings *settings,
+connection_added (NMClient *client,
NMRemoteConnection *connection,
gpointer user_data)
{
@@ -837,33 +817,19 @@ connection_added (NMRemoteSettings *settings,
gtk_tree_path_free (path);
}
- g_signal_connect (connection, NM_REMOTE_CONNECTION_REMOVED, G_CALLBACK (connection_removed), self);
- g_signal_connect (connection, NM_REMOTE_CONNECTION_UPDATED, G_CALLBACK (connection_updated), 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);
}
-static void
-initial_connections_read (NMRemoteSettings *settings, gpointer user_data)
-{
- NMConnectionList *list = user_data;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- g_signal_handlers_disconnect_by_func (settings, G_CALLBACK (initial_connections_read), 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);
- gtk_tree_view_scroll_to_cell (list->connection_list,
- path, NULL,
- FALSE, 0, 0);
- gtk_tree_path_free (path);
- }
-}
-
NMConnectionList *
nm_connection_list_new (void)
{
NMConnectionList *list;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ const GPtrArray *all_cons;
+ int i;
GError *error = NULL;
const char *objects[] = { "NMConnectionList", NULL };
@@ -885,24 +851,31 @@ nm_connection_list_new (void)
gtk_window_set_default_icon_name ("preferences-system-network");
- list->nm_client = nm_client_new ();
- if (!list->nm_client)
+ list->client = nm_client_new (NULL, NULL);
+ if (!list->client)
goto error;
-
- list->settings = nm_remote_settings_new (NULL);
- g_signal_connect (list->settings,
- NM_REMOTE_SETTINGS_NEW_CONNECTION,
+ g_signal_connect (list->client,
+ NM_CLIENT_CONNECTION_ADDED,
G_CALLBACK (connection_added),
list);
- g_signal_connect (list->settings,
- NM_REMOTE_SETTINGS_CONNECTIONS_READ,
- G_CALLBACK (initial_connections_read),
- list);
list->connection_list = GTK_TREE_VIEW (gtk_builder_get_object (list->gui, "connection_list"));
initialize_treeview (list);
add_connection_buttons (list);
+ /* Fill the treeview initially */
+ 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);
+ gtk_tree_view_scroll_to_cell (list->connection_list,
+ path, NULL,
+ FALSE, 0, 0);
+ gtk_tree_path_free (path);
+ }
+
list->dialog = GTK_WIDGET (gtk_builder_get_object (list->gui, "NMConnectionList"));
if (!list->dialog)
goto error;
@@ -957,82 +930,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 e77c58a..32cc648 100644
--- a/src/connection-editor/nm-connection-list.h
+++ b/src/connection-editor/nm-connection-list.h
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2004-2009 Red Hat, Inc.
+ * Copyright 2004 - 2014 Red Hat, Inc.
*/
#ifndef NM_CONNECTION_LIST_H
@@ -26,8 +26,8 @@
#include <glib-object.h>
#include <gdk/gdk.h>
#include <gtk/gtk.h>
-#include <nm-client.h>
-#include <nm-remote-settings.h>
+
+#include <NetworkManager.h>
#define NM_TYPE_CONNECTION_LIST (nm_connection_list_get_type ())
#define NM_IS_CONNECTION_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_LIST))
@@ -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 69968aa..0c62d85 100644
--- a/src/connection-editor/page-8021x-security.c
+++ b/src/connection-editor/page-8021x-security.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,13 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <NetworkManager.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-wireless.h>
-#include <nm-utils.h>
-
#include "wireless-security.h"
#include "page-ethernet.h"
#include "page-8021x-security.h"
@@ -101,7 +94,6 @@ CEPage *
ce_page_8021x_security_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -113,7 +105,6 @@ ce_page_8021x_security_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
NULL,
NULL,
_("802.1x Security")));
@@ -158,7 +149,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
NMSetting *s_con;
/* Here's a nice hack to work around the fact that ws_802_1x_fill_connection needs
wireless setting. */
- tmp_connection = nm_connection_new ();
+ tmp_connection = nm_simple_connection_new ();
nm_connection_add_setting (tmp_connection, nm_setting_wireless_new ());
/* temp connection needs a 'connection' setting too, since most of
diff --git a/src/connection-editor/page-8021x-security.h b/src/connection-editor/page-8021x-security.h
index fc749e3..b06e33f 100644
--- a/src/connection-editor/page-8021x-security.h
+++ b/src/connection-editor/page-8021x-security.h
@@ -17,16 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_8021X_SECURITY_H__
#define __PAGE_8021X_SECURITY_H__
-#include "nm-connection-editor.h"
-
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -52,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-bluetooth.c b/src/connection-editor/page-bluetooth.c
index b1fa0a1..36f2359 100644
--- a/src/connection-editor/page-bluetooth.c
+++ b/src/connection-editor/page-bluetooth.c
@@ -27,8 +27,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-bluetooth.h>
+#include <NetworkManager.h>
#include "page-bluetooth.h"
#include "nm-connection-editor.h"
@@ -62,9 +61,11 @@ populate_ui (CEPageBluetooth *self, NMConnection *connection)
{
CEPageBluetoothPrivate *priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self);
NMSettingBluetooth *setting = priv->setting;
+ const char *bdaddr;
- ce_page_mac_to_entry (nm_setting_bluetooth_get_bdaddr (setting),
- ARPHRD_ETHER, priv->bdaddr);
+ bdaddr = nm_setting_bluetooth_get_bdaddr (setting);
+ if (bdaddr)
+ gtk_entry_set_text (priv->bdaddr, bdaddr);
}
static void
@@ -91,7 +92,6 @@ CEPage *
ce_page_bluetooth_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -102,7 +102,6 @@ ce_page_bluetooth_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-bluetooth.ui",
"BluetoothPage",
_("Bluetooth")));
@@ -131,14 +130,13 @@ static void
ui_to_setting (CEPageBluetooth *self)
{
CEPageBluetoothPrivate *priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self);
- GByteArray *bdaddr;
+ char *bdaddr;
bdaddr = ce_page_entry_to_mac (priv->bdaddr, ARPHRD_ETHER, NULL);
g_object_set (priv->setting,
NM_SETTING_BLUETOOTH_BDADDR, bdaddr,
NULL);
- if (bdaddr)
- g_byte_array_free (bdaddr, TRUE);
+ g_free (bdaddr);
}
static gboolean
@@ -146,14 +144,13 @@ validate (CEPage *page, NMConnection *connection, GError **error)
{
CEPageBluetooth *self = CE_PAGE_BLUETOOTH (page);
CEPageBluetoothPrivate *priv = CE_PAGE_BLUETOOTH_GET_PRIVATE (self);
- GByteArray *bdaddr;
+ char *bdaddr;
gboolean invalid;
bdaddr = ce_page_entry_to_mac (priv->bdaddr, ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (bdaddr)
- g_byte_array_free (bdaddr, TRUE);
+ g_free (bdaddr);
ui_to_setting (self);
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
diff --git a/src/connection-editor/page-bluetooth.h b/src/connection-editor/page-bluetooth.h
index fb98865..dd2207a 100644
--- a/src/connection-editor/page-bluetooth.h
+++ b/src/connection-editor/page-bluetooth.h
@@ -23,7 +23,7 @@
#ifndef __PAGE_BLUETOOTH_H__
#define __PAGE_BLUETOOTH_H__
-#include <nm-connection.h>
+#include <NetworkManager.h>
#include <glib.h>
#include <glib-object.h>
@@ -50,13 +50,12 @@ GType ce_page_bluetooth_get_type (void);
CEPage *ce_page_bluetooth_new (NMConnection *connection,
GtkWindow *parent,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error);
void bluetooth_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data);
diff --git a/src/connection-editor/page-bond.c b/src/connection-editor/page-bond.c
index b2bf914..b40254e 100644
--- a/src/connection-editor/page-bond.c
+++ b/src/connection-editor/page-bond.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -24,10 +24,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-bond.h>
-#include <nm-utils.h>
-
#include "page-bond.h"
#include "page-infiniband.h"
#include "nm-connection-editor.h"
@@ -396,13 +392,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);
@@ -433,7 +429,6 @@ CEPage *
ce_page_bond_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -444,7 +439,6 @@ ce_page_bond_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-bond.ui",
"BondPage",
_("Bond")));
@@ -604,36 +598,32 @@ 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;
- NMSettingBond *s_bond;
const char *iface;
char *my_iface;
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;
- s_bond = nm_connection_get_setting_bond (conn2);
- if (!s_bond)
- continue;
- iface = nm_setting_bond_get_interface_name (s_bond);
+ iface = nm_connection_get_interface_name (conn2);
if (!iface || strncmp (iface, "bond", 4) != 0 || !g_ascii_isdigit (iface[4]))
continue;
@@ -641,12 +631,10 @@ 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);
- s_bond = nm_connection_get_setting_bond (connection);
- g_object_set (G_OBJECT (s_bond),
- NM_SETTING_BOND_INTERFACE_NAME, my_iface,
+ g_object_set (G_OBJECT (connection),
+ NM_SETTING_CONNECTION_INTERFACE_NAME, my_iface,
NULL);
g_free (my_iface);
diff --git a/src/connection-editor/page-bond.h b/src/connection-editor/page-bond.h
index dcc8e1f..646abe1 100644
--- a/src/connection-editor/page-bond.h
+++ b/src/connection-editor/page-bond.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_BOND_H__
#define __PAGE_BOND_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -48,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 6383d15..8d654b1 100644
--- a/src/connection-editor/page-bridge-port.c
+++ b/src/connection-editor/page-bridge-port.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,10 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-bridge-port.h>
-#include <nm-utils.h>
-
#include "page-bridge-port.h"
G_DEFINE_TYPE (CEPageBridgePort, ce_page_bridge_port, CE_TYPE_PAGE)
@@ -95,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)
{
@@ -106,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 2a35240..a74f7f8 100644
--- a/src/connection-editor/page-bridge-port.h
+++ b/src/connection-editor/page-bridge-port.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_BRIDGE_PORT_H__
#define __PAGE_BRIDGE_PORT_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 2221e07..2ec037c 100644
--- a/src/connection-editor/page-bridge.c
+++ b/src/connection-editor/page-bridge.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -24,10 +24,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-bridge.h>
-#include <nm-utils.h>
-
#include "page-bridge.h"
#include "nm-connection-editor.h"
#include "connection-helpers.h"
@@ -172,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);
@@ -191,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)
{
@@ -202,7 +197,6 @@ ce_page_bridge_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-bridge.ui",
"BridgePage",
_("Bridge")));
@@ -290,37 +284,33 @@ 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;
- NMSettingBridge *s_bridge;
const char *iface;
char *my_iface;
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;
- s_bridge = nm_connection_get_setting_bridge (conn2);
- if (!s_bridge)
- continue;
- iface = nm_setting_bridge_get_interface_name (s_bridge);
+ iface = nm_connection_get_interface_name (connection);
if (!iface || strncmp (iface, "bridge", 6) != 0 || !g_ascii_isdigit (iface[6]))
continue;
@@ -328,12 +318,10 @@ 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);
- s_bridge = nm_connection_get_setting_bridge (connection);
- g_object_set (G_OBJECT (s_bridge),
- NM_SETTING_BRIDGE_INTERFACE_NAME, my_iface,
+ g_object_set (G_OBJECT (connection),
+ NM_SETTING_CONNECTION_INTERFACE_NAME, my_iface,
NULL);
g_free (my_iface);
diff --git a/src/connection-editor/page-bridge.h b/src/connection-editor/page-bridge.h
index fa6d927..4b1873f 100644
--- a/src/connection-editor/page-bridge.h
+++ b/src/connection-editor/page-bridge.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_BRIDGE_H__
#define __PAGE_BRIDGE_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -48,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 1093f17..a8f64fe 100644
--- a/src/connection-editor/page-dcb.c
+++ b/src/connection-editor/page-dcb.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2013 Red Hat, Inc.
+ * Copyright 2013 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -29,11 +29,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <NetworkManager.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-dcb.h>
-#include <nm-utils.h>
-
#include "page-dcb.h"
G_DEFINE_TYPE (CEPageDcb, ce_page_dcb, CE_TYPE_PAGE)
@@ -586,7 +581,6 @@ CEPage *
ce_page_dcb_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -599,7 +593,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 2420b26..ad34520 100644
--- a/src/connection-editor/page-dcb.h
+++ b/src/connection-editor/page-dcb.h
@@ -17,16 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2013 Red Hat, Inc.
+ * Copyright 2013 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_DCB_H__
#define __PAGE_DCB_H__
-#include "nm-connection-editor.h"
-
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -52,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 c327979..ac480ee 100644
--- a/src/connection-editor/page-dsl.c
+++ b/src/connection-editor/page-dsl.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,11 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-pppoe.h>
-#include <nm-setting-ppp.h>
-#include <nm-setting-wired.h>
-
#include "page-dsl.h"
#include "nm-connection-editor.h"
@@ -40,7 +35,7 @@ G_DEFINE_TYPE (CEPageDsl, ce_page_dsl, CE_TYPE_PAGE)
#define CE_PAGE_DSL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_DSL, CEPageDslPrivate))
typedef struct {
- NMSettingPPPOE *setting;
+ NMSettingPppoe *setting;
GtkEntry *username;
GtkEntry *password;
@@ -64,7 +59,7 @@ static void
populate_ui (CEPageDsl *self, NMConnection *connection)
{
CEPageDslPrivate *priv = CE_PAGE_DSL_GET_PRIVATE (self);
- NMSettingPPPOE *setting = priv->setting;
+ NMSettingPppoe *setting = priv->setting;
const char *str;
str = nm_setting_pppoe_get_username (setting);
@@ -118,7 +113,6 @@ CEPage *
ce_page_dsl_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -129,7 +123,6 @@ ce_page_dsl_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-dsl.ui",
"DslPage",
_("DSL")));
@@ -186,16 +179,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
@@ -219,7 +205,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)
{
@@ -229,7 +215,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 514699a..e893c9a 100644
--- a/src/connection-editor/page-dsl.h
+++ b/src/connection-editor/page-dsl.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_DSL_H__
#define __PAGE_DSL_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 16c8204..dd3b2f1 100644
--- a/src/connection-editor/page-ethernet.c
+++ b/src/connection-editor/page-ethernet.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -28,11 +28,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-device-ethernet.h>
-#include <nm-utils.h>
-
#include "page-ethernet.h"
G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
@@ -111,8 +106,7 @@ populate_ui (CEPageEthernet *self)
int speed_idx;
int mtu_def;
char **mac_list;
- const GByteArray *s_mac;
- char *s_mac_str;
+ const char *s_mac_str;
/* Port */
port = nm_setting_wired_get_port (setting);
@@ -162,17 +156,16 @@ populate_ui (CEPageEthernet *self)
/* Device MAC address */
mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_ETHERNET,
NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
- s_mac = nm_setting_wired_get_mac_address (setting);
- s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_ETHER) : NULL;
+ s_mac_str = nm_setting_wired_get_mac_address (setting);
ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac),
s_mac_str, mac_list);
- g_free (s_mac_str);
g_strfreev (mac_list);
g_signal_connect (priv->device_mac, "changed", G_CALLBACK (stuff_changed), self);
/* Cloned MAC address */
- ce_page_mac_to_entry (nm_setting_wired_get_cloned_mac_address (setting),
- ARPHRD_ETHER, priv->cloned_mac);
+ s_mac_str = nm_setting_wired_get_cloned_mac_address (setting);
+ if (s_mac_str)
+ gtk_entry_set_text (priv->cloned_mac, s_mac_str);
g_signal_connect (priv->cloned_mac, "changed", G_CALLBACK (stuff_changed), self);
/* MTU */
@@ -223,7 +216,6 @@ CEPage *
ce_page_ethernet_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -234,7 +226,6 @@ ce_page_ethernet_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ethernet.ui",
"EthernetPage",
_("Ethernet")));
@@ -263,8 +254,8 @@ ui_to_setting (CEPageEthernet *self)
CEPageEthernetPrivate *priv = CE_PAGE_ETHERNET_GET_PRIVATE (self);
const char *port;
guint32 speed;
- GByteArray *device_mac = NULL;
- GByteArray *cloned_mac = NULL;
+ char *device_mac = NULL;
+ char *cloned_mac = NULL;
GtkWidget *entry;
/* Port */
@@ -320,11 +311,8 @@ ui_to_setting (CEPageEthernet *self)
NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (priv->mtu),
NULL);
- if (device_mac)
- g_byte_array_free (device_mac, TRUE);
- if (cloned_mac)
- g_byte_array_free (cloned_mac, TRUE);
-
+ g_free (device_mac);
+ g_free (cloned_mac);
}
static gboolean
@@ -333,7 +321,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
CEPageEthernet *self = CE_PAGE_ETHERNET (page);
CEPageEthernetPrivate *priv = CE_PAGE_ETHERNET_GET_PRIVATE (self);
gboolean invalid = FALSE;
- GByteArray *ignore;
+ char *ignore;
GtkWidget *entry;
entry = gtk_bin_get_child (GTK_BIN (priv->device_mac));
@@ -341,15 +329,13 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
}
ignore = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
ui_to_setting (self);
return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
@@ -376,7 +362,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)
{
@@ -385,7 +371,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 4dd4a5c..0a06a57 100644
--- a/src/connection-editor/page-ethernet.h
+++ b/src/connection-editor/page-ethernet.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_ETHERNET_H__
#define __PAGE_ETHERNET_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 37fb8c2..9e62505 100644
--- a/src/connection-editor/page-general.c
+++ b/src/connection-editor/page-general.c
@@ -15,15 +15,14 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-
-#include <nm-setting-connection.h>
+#include <dbus/dbus-glib.h>
#include "page-general.h"
#include "nm-glib-compat.h"
@@ -33,7 +32,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;
@@ -154,7 +152,6 @@ dispose (GObject *object)
{
CEPageGeneralPrivate *priv = CE_PAGE_GENERAL_GET_PRIVATE (object);
- g_clear_object (&priv->remote_settings);
g_clear_pointer (&priv->zones, g_strfreev);
G_OBJECT_CLASS (ce_page_general_parent_class)->dispose (object);
@@ -221,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;
@@ -231,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);
@@ -245,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
@@ -305,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)
{
@@ -316,7 +313,6 @@ ce_page_general_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-general.ui",
"GeneralPage",
_("General")));
@@ -329,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 d8a2a2f..23ee94d 100644
--- a/src/connection-editor/page-general.h
+++ b/src/connection-editor/page-general.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_GENERAL_H__
#define __PAGE_GENERAL_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -46,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 f85e453..6df0078 100644
--- a/src/connection-editor/page-infiniband.c
+++ b/src/connection-editor/page-infiniband.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -23,11 +23,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-infiniband.h>
-#include <nm-device-infiniband.h>
-#include <nm-utils.h>
-
#include <net/if_arp.h>
#include <linux/if_infiniband.h>
@@ -91,8 +86,7 @@ populate_ui (CEPageInfiniband *self)
int mode_idx = TRANSPORT_MODE_DATAGRAM;
int mtu_def;
char **mac_list;
- const GByteArray *s_mac;
- char *s_mac_str;
+ const char *s_mac_str;
/* Port */
mode = nm_setting_infiniband_get_transport_mode (setting);
@@ -107,11 +101,9 @@ populate_ui (CEPageInfiniband *self)
/* Device MAC address */
mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_INFINIBAND,
NM_DEVICE_INFINIBAND_HW_ADDRESS);
- s_mac = nm_setting_infiniband_get_mac_address (setting);
- s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_INFINIBAND) : NULL;
+ s_mac_str = nm_setting_infiniband_get_mac_address (setting);
ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac),
s_mac_str, mac_list);
- g_free (s_mac_str);
g_strfreev (mac_list);
g_signal_connect (priv->device_mac, "changed", G_CALLBACK (stuff_changed), self);
@@ -142,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)
{
@@ -153,7 +144,6 @@ ce_page_infiniband_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-infiniband.ui",
"InfinibandPage",
_("InfiniBand")));
@@ -212,7 +202,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
CEPageInfiniband *self = CE_PAGE_INFINIBAND (page);
CEPageInfinibandPrivate *priv = CE_PAGE_INFINIBAND_GET_PRIVATE (self);
gboolean invalid = FALSE;
- GByteArray *ignore;
+ char *ignore;
GtkWidget *entry;
entry = gtk_bin_get_child (GTK_BIN (priv->device_mac));
@@ -220,8 +210,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_INFINIBAND, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
}
ui_to_setting (self);
@@ -249,7 +238,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)
{
@@ -258,7 +247,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 e895a98..ab45277 100644
--- a/src/connection-editor/page-infiniband.h
+++ b/src/connection-editor/page-infiniband.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_INFINIBAND_H__
#define __PAGE_INFINIBAND_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -48,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 5559e66..d28475d 100644
--- a/src/connection-editor/page-ip4.c
+++ b/src/connection-editor/page-ip4.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -33,16 +33,6 @@
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-pppoe.h>
-#include <nm-setting-vpn.h>
-#include <nm-utils.h>
-
#include "page-ip4.h"
#include "ip4-routes-dialog.h"
#include "connection-helpers.h"
@@ -58,7 +48,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;
@@ -129,7 +119,7 @@ ip4_private_init (CEPageIP4 *self, NMConnection *connection)
connection_type = nm_setting_connection_get_connection_type (s_con);
g_assert (connection_type);
- priv->connection_type = nm_connection_lookup_setting_type (connection_type);
+ priv->connection_type = nm_setting_lookup_type (connection_type);
if (priv->connection_type == NM_TYPE_SETTING_VPN) {
str_auto = _("Automatic (VPN)");
@@ -346,7 +336,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;
@@ -357,7 +347,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;
@@ -369,7 +359,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;
@@ -378,10 +368,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__);
@@ -389,18 +377,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));
@@ -410,42 +392,40 @@ populate_ui (CEPageIP4 *self)
/* DNS servers */
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip4_config_get_num_dns (setting); i++) {
- struct in_addr tmp_addr;
- char buf[INET_ADDRSTRLEN + 1];
+ for (i = 0; i < nm_setting_ip_config_get_num_dns (setting); i++) {
+ const char *dns;
- tmp_addr.s_addr = nm_setting_ip4_config_get_dns (setting, i);
- if (!tmp_addr.s_addr)
+ dns = nm_setting_ip_config_get_dns (setting, i);
+ if (!dns)
continue;
- (void) inet_ntop (AF_INET, &tmp_addr, &buf[0], sizeof (buf));
if (string->len)
g_string_append (string, ", ");
- g_string_append (string, buf);
+ g_string_append (string, dns);
}
gtk_entry_set_text (priv->dns_servers, string->str);
g_string_free (string, TRUE);
/* 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
@@ -837,7 +817,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;
@@ -991,7 +971,6 @@ CEPage *
ce_page_ip4_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -1003,7 +982,6 @@ ce_page_ip4_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ip4.ui",
"IP4Page",
_("IPv4 Settings")));
@@ -1023,7 +1001,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));
}
@@ -1035,7 +1013,7 @@ ce_page_ip4_new (NMConnection *connection,
static void
free_one_addr (gpointer data)
{
- g_array_free ((GArray *) data, TRUE);
+ nm_ip_address_unref ((NMIPAddress *) data);
}
static gboolean
@@ -1046,9 +1024,11 @@ ui_to_setting (CEPageIP4 *self)
GtkTreeIter tree_iter;
int int_method = IP4_METHOD_AUTO;
const char *method;
- GArray *dns_servers = NULL;
- GSList *search_domains = NULL;
+ GPtrArray *tmp_array = NULL;
+ 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;
@@ -1089,53 +1069,55 @@ 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 };
- GArray *addr;
- guint32 empty_val = 0, prefix;
+ char *addr = NULL, *netmask = NULL, *addr_gw = NULL;
+ NMIPAddress *nm_addr;
+ guint32 prefix;
+
+ 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_ADDRESS, &item, -1);
- if (!item || inet_pton (AF_INET, item, &tmp_addr) <= 0) {
+ if (!addr || !nm_utils_ipaddr_valid (AF_INET, addr)) {
g_warning ("%s: IPv4 address '%s' missing or invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
+ __func__, addr ? addr : "<none>");
+ g_free (addr);
+ g_free (netmask);
+ g_free (addr_gw);
goto out;
}
- g_free (item);
- 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 (!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;
}
- if (!parse_netmask (item, &prefix)) {
- g_warning ("%s: IPv4 prefix '%s' invalid!",
- __func__, item ? item : "<none>");
- g_free (item);
- 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);
- addr = g_array_sized_new (FALSE, TRUE, sizeof (guint32), 3);
- g_array_append_val (addr, tmp_addr.s_addr);
- g_array_append_val (addr, prefix);
- if (tmp_gateway.s_addr)
- g_array_append_val (addr, tmp_gateway.s_addr);
- else
- g_array_append_val (addr, empty_val);
- g_ptr_array_add (addresses, 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);
}
@@ -1147,8 +1129,7 @@ ui_to_setting (CEPageIP4 *self)
}
/* DNS servers */
- dns_servers = g_array_new (FALSE, FALSE, sizeof (guint));
-
+ tmp_array = g_ptr_array_new ();
text = gtk_entry_get_text (GTK_ENTRY (priv->dns_servers));
if (text && strlen (text)) {
items = g_strsplit_set (text, ", ;:", 0);
@@ -1156,20 +1137,24 @@ ui_to_setting (CEPageIP4 *self)
struct in_addr tmp_addr;
char *stripped = g_strstrip (*iter);
- if (!strlen (stripped))
+ if (!*stripped)
continue;
if (inet_pton (AF_INET, stripped, &tmp_addr))
- g_array_append_val (dns_servers, tmp_addr.s_addr);
+ g_ptr_array_add (tmp_array, g_strdup (stripped));
else {
g_strfreev (items);
+ g_ptr_array_free (tmp_array, TRUE);
goto out;
}
}
g_strfreev (items);
}
+ g_ptr_array_add (tmp_array, NULL);
+ dns_servers = (char **) g_ptr_array_free (tmp_array, FALSE);
/* Search domains */
+ tmp_array = g_ptr_array_new ();
text = gtk_entry_get_text (GTK_ENTRY (priv->dns_searches));
if (text && strlen (text)) {
items = g_strsplit_set (text, ", ;:", 0);
@@ -1177,12 +1162,12 @@ ui_to_setting (CEPageIP4 *self)
char *stripped = g_strstrip (*iter);
if (strlen (stripped))
- search_domains = g_slist_prepend (search_domains, g_strdup (stripped));
+ g_ptr_array_add (tmp_array, g_strdup (stripped));
}
g_strfreev (items);
}
-
- search_domains = g_slist_reverse (search_domains);
+ g_ptr_array_add (tmp_array, NULL);
+ search_domains = (char **) g_ptr_array_free (tmp_array, FALSE);
/* DHCP client ID */
if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
@@ -1195,13 +1180,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;
@@ -1210,12 +1196,10 @@ out:
g_ptr_array_foreach (addresses, (GFunc) free_one_addr, NULL);
g_ptr_array_free (addresses, TRUE);
}
+ g_free (gateway);
- if (dns_servers)
- g_array_free (dns_servers, TRUE);
-
- g_slist_foreach (search_domains, (GFunc) g_free, NULL);
- g_slist_free (search_domains);
+ g_strfreev (dns_servers);
+ g_strfreev (search_domains);
return valid;
}
diff --git a/src/connection-editor/page-ip4.h b/src/connection-editor/page-ip4.h
index 4fcad4c..e9886cf 100644
--- a/src/connection-editor/page-ip4.h
+++ b/src/connection-editor/page-ip4.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_IP4_H__
#define __PAGE_IP4_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 6aa55cc..1e58b78 100644
--- a/src/connection-editor/page-ip6.c
+++ b/src/connection-editor/page-ip6.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -33,16 +33,6 @@
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-ip6-config.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-pppoe.h>
-#include <nm-setting-vpn.h>
-#include <nm-utils.h>
-
#include "page-ip6.h"
#include "ip6-routes-dialog.h"
#include "nm-glib-compat.h"
@@ -57,7 +47,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;
@@ -135,7 +125,7 @@ ip6_private_init (CEPageIP6 *self, NMConnection *connection)
connection_type = nm_setting_connection_get_connection_type (s_con);
g_assert (connection_type);
- priv->connection_type = nm_connection_lookup_setting_type (connection_type);
+ priv->connection_type = nm_setting_lookup_type (connection_type);
if (priv->connection_type == NM_TYPE_SETTING_VPN) {
str_auto = _("Automatic (VPN)");
@@ -353,7 +343,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;
@@ -366,7 +356,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;
@@ -382,7 +372,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;
@@ -391,33 +381,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);
-
- /* Prefix */
- snprintf (buf, sizeof (buf), "%u", nm_ip6_address_get_prefix (addr));
- gtk_list_store_set (store, &model_iter, COL_PREFIX, buf, -1);
+ snprintf (buf, sizeof (buf), "%u", nm_ip_address_get_prefix (addr));
- /* 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));
@@ -427,34 +408,32 @@ populate_ui (CEPageIP6 *self)
/* DNS servers */
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip6_config_get_num_dns (setting); i++) {
- const struct in6_addr *tmp_addr;
- char buf[INET6_ADDRSTRLEN + 1];
+ for (i = 0; i < nm_setting_ip_config_get_num_dns (setting); i++) {
+ const char *dns;
- tmp_addr = nm_setting_ip6_config_get_dns (setting, i);
- if (!tmp_addr)
+ dns = nm_setting_ip_config_get_dns (setting, i);
+ if (!dns)
continue;
- (void) inet_ntop (AF_INET6, tmp_addr, &buf[0], sizeof (buf));
if (string->len)
g_string_append (string, ", ");
- g_string_append (string, buf);
+ g_string_append (string, dns);
}
gtk_entry_set_text (priv->dns_servers, string->str);
g_string_free (string, TRUE);
/* 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;
@@ -473,7 +452,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
@@ -833,7 +812,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;
@@ -986,7 +965,6 @@ CEPage *
ce_page_ip6_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -998,7 +976,6 @@ ce_page_ip6_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-ip6.ui",
"IP6Page",
_("IPv6 Settings")));
@@ -1018,7 +995,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));
}
@@ -1074,75 +1051,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);
@@ -1154,7 +1137,7 @@ ui_to_setting (CEPageIP6 *self)
continue;
if (inet_pton (AF_INET6, stripped, &tmp_addr)) {
- nm_setting_ip6_config_add_dns (priv->setting, &tmp_addr);
+ nm_setting_ip_config_add_dns (priv->setting, stripped);
} else {
g_strfreev (items);
goto out;
@@ -1164,7 +1147,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);
@@ -1172,7 +1155,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);
}
@@ -1195,7 +1178,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 433fa14..defc23c 100644
--- a/src/connection-editor/page-ip6.h
+++ b/src/connection-editor/page-ip6.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_IP6_H__
#define __PAGE_IP6_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 c2c63db..71da39b 100644
--- a/src/connection-editor/page-master.c
+++ b/src/connection-editor/page-master.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -24,7 +24,7 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
+#include <NetworkManager.h>
#include "page-master.h"
#include "nm-connection-editor.h"
@@ -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,9 @@ find_connection (CEPageMaster *self, NMRemoteConnection *connection, GtkTreeIter
}
static void
-connection_removed (NMRemoteConnection *connection, gpointer user_data)
+connection_removed (NMClient *client,
+ NMRemoteConnection *connection,
+ gpointer user_data)
{
CEPageMaster *self = CE_PAGE_MASTER (user_data);
CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self);
@@ -159,7 +161,7 @@ connection_removed (NMRemoteConnection *connection, gpointer user_data)
}
static void
-connection_updated (NMRemoteConnection *connection, gpointer user_data)
+connection_changed (NMRemoteConnection *connection, gpointer user_data)
{
CEPageMaster *self = CE_PAGE_MASTER (user_data);
CEPageMasterPrivate *priv = CE_PAGE_MASTER_GET_PRIVATE (self);
@@ -190,7 +192,7 @@ get_device_for_connection (NMClient *client, NMConnection *conn)
/* Make sure the connection is actually locked to a specific device */
s_con = nm_connection_get_setting_connection (conn);
if ( !nm_setting_connection_get_interface_name (s_con)
- && !nm_connection_get_virtual_iface_name (conn)) {
+ && !nm_connection_get_interface_name (conn)) {
NMSetting *s_hw;
GByteArray *mac_address;
@@ -265,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)
{
@@ -292,7 +294,7 @@ connection_added (NMRemoteSettings *settings,
if (!master)
return;
- interface_name = nm_connection_get_virtual_iface_name (CE_PAGE (self)->connection);
+ interface_name = nm_connection_get_interface_name (CE_PAGE (self)->connection);
if (strcmp (master, interface_name) != 0 && strcmp (master, priv->uuid) != 0)
return;
@@ -305,10 +307,10 @@ connection_added (NMRemoteSettings *settings,
-1);
ce_page_changed (CE_PAGE (self));
- g_signal_connect (connection, NM_REMOTE_CONNECTION_REMOVED,
+ g_signal_connect (client, NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (connection_removed), self);
- g_signal_connect (connection, NM_REMOTE_CONNECTION_UPDATED,
- G_CALLBACK (connection_updated), self);
+ g_signal_connect (connection, NM_CONNECTION_CHANGED,
+ G_CALLBACK (connection_changed), self);
g_signal_emit (self, signals[CONNECTION_ADDED], 0, connection);
}
@@ -367,7 +369,7 @@ add_connection (NMConnection *connection,
iface_name = gtk_entry_get_text (priv->interface_name);
if (!*iface_name)
- iface_name = nm_connection_get_virtual_iface_name (connection);
+ iface_name = nm_connection_get_interface_name (connection);
if (!*iface_name)
iface_name = nm_connection_get_id (connection);
name = g_strdup_printf (_("%s slave %d"), iface_name,
@@ -385,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;
@@ -455,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;
@@ -493,19 +493,20 @@ 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);
/* Interface name */
- iface = nm_connection_get_virtual_iface_name (CE_PAGE (self)->connection);
+ iface = nm_connection_get_interface_name (CE_PAGE (self)->connection);
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
@@ -543,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_NEW_CONNECTION,
+ 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-master.h b/src/connection-editor/page-master.h
index 380d896..7e45281 100644
--- a/src/connection-editor/page-master.h
+++ b/src/connection-editor/page-master.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_MASTER_H__
#define __PAGE_MASTER_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
diff --git a/src/connection-editor/page-mobile.c b/src/connection-editor/page-mobile.c
index 7da1367..b15cc1d 100644
--- a/src/connection-editor/page-mobile.c
+++ b/src/connection-editor/page-mobile.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,16 +27,9 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-glib-compat.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-serial.h>
-#include <nm-setting-ppp.h>
-
#include "page-mobile.h"
#include "nm-connection-editor.h"
-#include "nm-mobile-wizard.h"
+#include "nma-mobile-wizard.h"
G_DEFINE_TYPE (CEPageMobile, ce_page_mobile, CE_TYPE_PAGE)
@@ -301,7 +294,6 @@ CEPage *
ce_page_mobile_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -312,7 +304,6 @@ ce_page_mobile_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-mobile.ui",
"MobilePage",
_("Mobile Broadband")));
@@ -453,7 +444,7 @@ add_default_serial_setting (NMConnection *connection)
}
typedef struct {
- NMRemoteSettings *settings;
+ NMClient *client;
PageNewConnectionResultFunc result_func;
gpointer user_data;
} WizardInfo;
@@ -503,7 +494,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);
@@ -516,7 +507,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);
}
@@ -529,7 +520,7 @@ cancel_dialog (GtkDialog *dialog)
void
mobile_connection_new (GtkWindow *parent,
const char *detail,
- NMRemoteSettings *settings,
+ NMClient *client,
PageNewConnectionResultFunc result_func,
gpointer user_data)
{
@@ -542,7 +533,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 ab2903c..914e8cd 100644
--- a/src/connection-editor/page-mobile.h
+++ b/src/connection-editor/page-mobile.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_MOBILE_H__
#define __PAGE_MOBILE_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 472b075..e509a72 100644
--- a/src/connection-editor/page-ppp.c
+++ b/src/connection-editor/page-ppp.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,9 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-ppp.h>
-
#include "page-ppp.h"
#include "ppp-auth-methods-dialog.h"
#include "nm-connection-editor.h"
@@ -50,7 +47,7 @@ G_DEFINE_TYPE (CEPagePpp, ce_page_ppp, CE_TYPE_PAGE)
#define TAG_MSCHAPV2 4
typedef struct {
- NMSettingPPP *setting;
+ NMSettingPpp *setting;
GtkLabel *auth_methods_label;
GtkButton *auth_methods_button;
@@ -213,7 +210,7 @@ static void
populate_ui (CEPagePpp *self, NMConnection *connection)
{
CEPagePppPrivate *priv = CE_PAGE_PPP_GET_PRIVATE (self);
- NMSettingPPP *setting = priv->setting;
+ NMSettingPpp *setting = priv->setting;
gboolean require_mppe, require_mppe_128, mppe_stateful, nobsdcomp, nodeflate, no_vj_comp;
g_object_get (setting,
@@ -268,7 +265,6 @@ CEPage *
ce_page_ppp_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -280,7 +276,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 9b53575..b731535 100644
--- a/src/connection-editor/page-ppp.h
+++ b/src/connection-editor/page-ppp.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_PPP_H__
#define __PAGE_PPP_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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 149e00e..5b24bb5 100644
--- a/src/connection-editor/page-team-port.c
+++ b/src/connection-editor/page-team-port.c
@@ -1,7 +1,5 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2013 Jiri Pirko <jiri resnulli us>
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -15,6 +13,9 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2013 Jiri Pirko <jiri resnulli us>
+ * Copyright 2013 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -24,10 +25,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-team-port.h>
-#include <nm-utils.h>
-
#include "page-team-port.h"
G_DEFINE_TYPE (CEPageTeamPort, ce_page_team_port, CE_TYPE_PAGE)
@@ -135,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;
@@ -148,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 6eccb15..e086de4 100644
--- a/src/connection-editor/page-team-port.h
+++ b/src/connection-editor/page-team-port.h
@@ -1,7 +1,5 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2013 Jiri Pirko <jiri resnulli us>
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -15,13 +13,14 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2013 Jiri Pirko <jiri resnulli us>
+ * Copyright 2013 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_TEAM_PORT_H__
#define __PAGE_TEAM_PORT_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -47,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 26e3432..38be55d 100644
--- a/src/connection-editor/page-team.c
+++ b/src/connection-editor/page-team.c
@@ -15,6 +15,9 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2013 Jiri Pirko <jiri resnulli us>
+ * Copyright 2013 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -23,10 +26,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-team.h>
-#include <nm-utils.h>
-
#include "page-team.h"
#include "page-infiniband.h"
#include "nm-connection-editor.h"
@@ -201,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);
@@ -227,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)
{
@@ -238,7 +236,6 @@ ce_page_team_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-team.ui",
"TeamPage",
_("Team")));
@@ -327,37 +324,33 @@ 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;
- NMSettingTeam *s_team;
const char *iface;
char *my_iface;
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;
- s_team = nm_connection_get_setting_team (conn2);
- if (!s_team)
- continue;
- iface = nm_setting_team_get_interface_name (s_team);
+ iface = nm_connection_get_interface_name (conn2);
if (!iface || strncmp (iface, "team", 4) != 0 || !g_ascii_isdigit (iface[4]))
continue;
@@ -365,12 +358,10 @@ 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);
- s_team = nm_connection_get_setting_team (connection);
- g_object_set (G_OBJECT (s_team),
- NM_SETTING_TEAM_INTERFACE_NAME, my_iface,
+ g_object_set (G_OBJECT (connection),
+ NM_SETTING_CONNECTION_INTERFACE_NAME, my_iface,
NULL);
g_free (my_iface);
diff --git a/src/connection-editor/page-team.h b/src/connection-editor/page-team.h
index d1936b3..d3a5270 100644
--- a/src/connection-editor/page-team.h
+++ b/src/connection-editor/page-team.h
@@ -1,7 +1,5 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
- * Copyright (C) 2013 Jiri Pirko <jiri resnulli us>
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -15,13 +13,14 @@
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2013 Jiri Pirko <jiri resnulli us>
+ * Copyright 2013 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_TEAM_H__
#define __PAGE_TEAM_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -47,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 6fa6cc5..cd68ca7 100644
--- a/src/connection-editor/page-vlan.c
+++ b/src/connection-editor/page-vlan.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,11 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-vlan.h>
-#include <nm-device-ethernet.h>
-#include <nm-utils.h>
-
#include "page-vlan.h"
G_DEFINE_TYPE (CEPageVlan, ce_page_vlan, CE_TYPE_PAGE)
@@ -246,7 +241,7 @@ get_vlan_devices (CEPageVlan *self)
devices_array = nm_client_get_devices (CE_PAGE (self)->client);
devices = NULL;
- for (i = 0; devices_array && (i < devices_array->len); i++) {
+ for (i = 0; i < devices_array->len; i++) {
device = devices_array->pdata[i];
if (!nm_utils_check_virtual_device_compatibility (NM_TYPE_SETTING_VLAN,
@@ -263,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;
@@ -293,16 +289,16 @@ 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;
if (nm_setting_connection_get_master (s_con))
continue;
- connection_gtype = nm_connection_lookup_setting_type
(nm_setting_connection_get_connection_type (s_con));
+ connection_gtype = nm_setting_lookup_type (nm_setting_connection_get_connection_type (s_con));
if (!nm_utils_check_virtual_device_compatibility (NM_TYPE_SETTING_VLAN, connection_gtype))
continue;
@@ -327,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);
@@ -358,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) {
@@ -376,9 +370,8 @@ populate_ui (CEPageVlan *self)
* wired setting, figure out the device from that.
*/
if (priv->s_hw && !parent_device) {
- const GByteArray *mac;
- const char *device_mac_str;
- char *mac_str;
+ const char *device_mac;
+ const char *mac;
if (NM_IS_SETTING_WIRED (priv->s_hw))
mac = nm_setting_wired_get_mac_address (NM_SETTING_WIRED (priv->s_hw));
@@ -386,17 +379,15 @@ populate_ui (CEPageVlan *self)
mac = NULL;
if (mac) {
- mac_str = nm_utils_hwaddr_ntoa (mac->data, ARPHRD_ETHER);
-
for (d_iter = devices; d_iter; d_iter = d_iter->next) {
device = d_iter->data;
if (NM_IS_DEVICE_ETHERNET (device))
- device_mac_str = nm_device_ethernet_get_permanent_hw_address
(NM_DEVICE_ETHERNET (device));
+ device_mac = nm_device_ethernet_get_permanent_hw_address
(NM_DEVICE_ETHERNET (device));
else
- device_mac_str = NULL;
+ device_mac = NULL;
- if (!g_strcmp0 (mac_str, device_mac_str)) {
+ if (device_mac && nm_utils_hwaddr_matches (mac, -1, device_mac, -1)) {
parent_device = device;
break;
}
@@ -423,7 +414,7 @@ populate_ui (CEPageVlan *self)
priv->last_parent = g_strndup (current_parent, strcspn (current_parent, " "));
/* Name */
- iface = nm_setting_vlan_get_interface_name (priv->setting);
+ iface = nm_connection_get_interface_name (CE_PAGE (self)->connection);
if (iface)
gtk_entry_set_text (priv->name_entry, iface);
g_signal_connect (priv->name_entry, "changed", G_CALLBACK (name_changed), self);
@@ -434,10 +425,8 @@ populate_ui (CEPageVlan *self)
g_signal_connect (priv->id_entry, "value-changed", G_CALLBACK (id_changed), self);
/* Cloned MAC address */
- if (NM_IS_SETTING_WIRED (priv->s_hw)) {
- ce_page_mac_to_entry (nm_setting_wired_get_cloned_mac_address (NM_SETTING_WIRED (priv->s_hw)),
- ARPHRD_ETHER, priv->cloned_mac);
- }
+ if (NM_IS_SETTING_WIRED (priv->s_hw))
+ gtk_entry_set_text (priv->cloned_mac, nm_setting_wired_get_cloned_mac_address
(NM_SETTING_WIRED (priv->s_hw)));
g_signal_connect (priv->cloned_mac, "changed", G_CALLBACK (stuff_changed), self);
/* MTU */
@@ -470,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)
{
@@ -481,7 +469,6 @@ ce_page_vlan_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-vlan.ui",
"VlanPage",
_("VLAN")));
@@ -511,7 +498,7 @@ ui_to_setting (CEPageVlan *self)
CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self);
NMConnection *connection = CE_PAGE (self)->connection;
NMSettingConnection *s_con = nm_connection_get_setting_connection (connection);
- GByteArray *cloned_mac = NULL;
+ char *cloned_mac = NULL;
VlanParent *parent = NULL;
int parent_id, vid;
const char *parent_iface = NULL, *parent_uuid = NULL;
@@ -567,9 +554,9 @@ ui_to_setting (CEPageVlan *self)
iface = gtk_entry_get_text (priv->name_entry);
vid = gtk_spin_button_get_value_as_int (priv->id_entry);
+ g_object_set (s_con, NM_SETTING_CONNECTION_INTERFACE_NAME, iface, NULL);
g_object_set (priv->setting,
NM_SETTING_VLAN_PARENT, parent_uuid ? parent_uuid : parent_iface,
- NM_SETTING_VLAN_INTERFACE_NAME, iface,
NM_SETTING_VLAN_ID, vid,
NULL);
@@ -589,8 +576,7 @@ ui_to_setting (CEPageVlan *self)
NM_SETTING_WIRED_MTU, (guint32) mtu,
NULL);
- if (cloned_mac)
- g_byte_array_free (cloned_mac, TRUE);
+ g_free(cloned_mac);
} else if (priv->s_hw) {
nm_connection_remove_setting (connection, G_OBJECT_TYPE (priv->s_hw));
priv->s_hw = NULL;
@@ -606,7 +592,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
CEPageVlan *self = CE_PAGE_VLAN (page);
CEPageVlanPrivate *priv = CE_PAGE_VLAN_GET_PRIVATE (self);
gboolean invalid = FALSE;
- GByteArray *ignore;
+ char *ignore;
int parent_id;
const char *parent;
char *parent_iface;
@@ -626,8 +612,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ignore = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
ui_to_setting (self);
@@ -676,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)
{
@@ -685,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 0e66a06..5a96e02 100644
--- a/src/connection-editor/page-vlan.h
+++ b/src/connection-editor/page-vlan.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_VLAN_H__
#define __PAGE_VLAN_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -48,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 004a260..1b97656 100644
--- a/src/connection-editor/page-vpn.c
+++ b/src/connection-editor/page-vpn.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,13 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-vpn.h>
-#include <nm-utils.h>
-
-#define NM_VPN_API_SUBJECT_TO_CHANGE
-#include <nm-vpn-plugin-ui-interface.h>
-
#include "page-vpn.h"
#include "connection-helpers.h"
#include "nm-connection-editor.h"
@@ -45,16 +38,16 @@ G_DEFINE_TYPE (CEPageVpn, ce_page_vpn, CE_TYPE_PAGE)
#define CE_PAGE_VPN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CE_TYPE_PAGE_VPN, CEPageVpnPrivate))
typedef struct {
- NMSettingVPN *setting;
+ NMSettingVpn *setting;
char *service_type;
- NMVpnPluginUiInterface *plugin;
- NMVpnPluginUiWidgetInterface *ui;
+ NMVpnEditorPlugin *plugin;
+ NMVpnEditor *editor;
} 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));
}
@@ -71,17 +64,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;
@@ -94,7 +87,6 @@ CEPage *
ce_page_vpn_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -106,7 +98,6 @@ ce_page_vpn_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
NULL,
NULL,
_("VPN")));
@@ -143,7 +134,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
@@ -152,7 +143,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
@@ -165,7 +156,7 @@ dispose (GObject *object)
{
CEPageVpnPrivate *priv = CE_PAGE_VPN_GET_PRIVATE (object);
- g_clear_object (&priv->ui);
+ g_clear_object (&priv->editor);
g_clear_pointer (&priv->service_type, g_free);
G_OBJECT_CLASS (ce_page_vpn_parent_class)->dispose (object);
@@ -186,7 +177,7 @@ ce_page_vpn_class_init (CEPageVpnClass *vpn_class)
}
typedef struct {
- NMRemoteSettings *settings;
+ NMClient *client;
PageNewConnectionResultFunc result_func;
gpointer user_data;
} NewVpnInfo;
@@ -196,7 +187,7 @@ import_cb (NMConnection *connection, gpointer user_data)
{
NewVpnInfo *info = (NewVpnInfo *) user_data;
NMSettingConnection *s_con;
- NMSettingVPN *s_vpn;
+ NMSettingVpn *s_vpn;
const char *service_type;
char *s;
GError *error = NULL;
@@ -210,14 +201,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);
@@ -244,14 +233,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)
{
@@ -259,7 +248,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);
}
@@ -285,7 +274,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)
{
@@ -302,7 +291,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,
@@ -313,7 +302,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 2339732..d9df6a1 100644
--- a/src/connection-editor/page-vpn.h
+++ b/src/connection-editor/page-vpn.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_VPN_H__
#define __PAGE_VPN_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,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);
@@ -58,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 d2d09c6..3e8d50e 100644
--- a/src/connection-editor/page-wifi-security.c
+++ b/src/connection-editor/page-wifi-security.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -27,13 +27,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <NetworkManager.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-wireless-security.h>
-#include <nm-setting-8021x.h>
-#include <nm-utils.h>
-
#include "wireless-security.h"
#include "page-wifi.h"
#include "page-wifi-security.h"
@@ -386,7 +379,6 @@ CEPage *
ce_page_wifi_security_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -405,7 +397,6 @@ ce_page_wifi_security_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-wifi-security.ui",
"WifiSecurityPage",
_("Wi-Fi Security")));
@@ -481,7 +472,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
sec = wireless_security_combo_get_active (self);
if (sec) {
- const GByteArray *ssid = nm_setting_wireless_get_ssid (s_wireless);
+ GBytes *ssid = nm_setting_wireless_get_ssid (s_wireless);
if (ssid) {
/* FIXME: get failed property and error out of wifi security objects */
diff --git a/src/connection-editor/page-wifi-security.h b/src/connection-editor/page-wifi-security.h
index db35836..a4b2d48 100644
--- a/src/connection-editor/page-wifi-security.h
+++ b/src/connection-editor/page-wifi-security.h
@@ -17,16 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_WIFI_SECURITY_H__
#define __PAGE_WIFI_SECURITY_H__
-#include "nm-connection-editor.h"
-
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
@@ -53,7 +49,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 dbf4e20..c6d0cc4 100644
--- a/src/connection-editor/page-wifi.c
+++ b/src/connection-editor/page-wifi.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -28,11 +28,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wireless.h>
-#include <nm-device-wifi.h>
-#include <nm-utils.h>
-
#include "page-wifi.h"
G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
@@ -297,17 +292,16 @@ populate_ui (CEPageWifi *self)
{
CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self);
NMSettingWireless *setting = priv->setting;
- GByteArray *ssid = NULL;
- char *mode = NULL;
- char *band = NULL;
+ GBytes *ssid;
+ const char *mode;
+ const char *band;
int band_idx = 0;
int rate_def;
int tx_power_def;
int mtu_def;
char *utf8_ssid;
char **mac_list;
- const GByteArray *s_mac, *s_bssid;
- char *s_mac_str, *s_bssid_str;
+ const char *s_mac_str, *s_bssid_str;
GPtrArray *bssid_array;
char **bssid_list;
guint32 idx;
@@ -330,21 +324,18 @@ populate_ui (CEPageWifi *self)
GINT_TO_POINTER (mtu_def));
g_signal_connect_swapped (priv->mtu, "value-changed", G_CALLBACK (ce_page_changed), self);
- g_object_get (setting,
- NM_SETTING_WIRELESS_SSID, &ssid,
- NM_SETTING_WIRELESS_MODE, &mode,
- NM_SETTING_WIRELESS_BAND, &band,
- NULL);
+ ssid = nm_setting_wireless_get_ssid (setting);
+ mode = nm_setting_wireless_get_mode (setting);
+ band = nm_setting_wireless_get_band (setting);
if (ssid)
- utf8_ssid = nm_utils_ssid_to_utf8 (ssid);
+ utf8_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL),
+ g_bytes_get_size (ssid));
else
utf8_ssid = g_strdup ("");
gtk_entry_set_text (priv->ssid, utf8_ssid);
g_signal_connect_swapped (priv->ssid, "changed", G_CALLBACK (ce_page_changed), self);
g_free (utf8_ssid);
- if (ssid)
- g_byte_array_free (ssid, TRUE);
/* Default to Infrastructure */
gtk_combo_box_set_active (priv->mode, 0);
@@ -352,7 +343,6 @@ populate_ui (CEPageWifi *self)
gtk_combo_box_set_active (priv->mode, 1);
mode_combo_changed_cb (priv->mode, self);
g_signal_connect (priv->mode, "changed", G_CALLBACK (mode_combo_changed_cb), self);
- g_free (mode);
g_signal_connect (priv->channel, "output",
G_CALLBACK (channel_spin_output_cb),
@@ -370,7 +360,6 @@ populate_ui (CEPageWifi *self)
band_idx = 2;
gtk_widget_set_sensitive (GTK_WIDGET (priv->channel), TRUE);
}
- g_free (band);
}
gtk_combo_box_set_active (priv->band, band_idx);
@@ -390,28 +379,25 @@ populate_ui (CEPageWifi *self)
g_ptr_array_add (bssid_array, g_strdup (nm_setting_wireless_get_seen_bssid (setting, idx)));
g_ptr_array_add (bssid_array, NULL);
bssid_list = (char **) g_ptr_array_free (bssid_array, FALSE);
- s_bssid = nm_setting_wireless_get_bssid (setting);
- s_bssid_str = s_bssid ? nm_utils_hwaddr_ntoa (s_bssid->data, ARPHRD_ETHER) : NULL;
+ s_bssid_str = nm_setting_wireless_get_bssid (setting);
ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->bssid),
s_bssid_str, bssid_list);
- g_free (s_bssid_str);
g_strfreev (bssid_list);
g_signal_connect_swapped (priv->bssid, "changed", G_CALLBACK (ce_page_changed), self);
/* Device MAC address */
mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_WIFI,
NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS);
- s_mac = nm_setting_wireless_get_mac_address (setting);
- s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_ETHER) : NULL;
+ s_mac_str = nm_setting_wireless_get_mac_address (setting);
ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac),
s_mac_str, mac_list);
- g_free (s_mac_str);
g_strfreev (mac_list);
g_signal_connect_swapped (priv->device_mac, "changed", G_CALLBACK (ce_page_changed), self);
/* Cloned MAC address */
- ce_page_mac_to_entry (nm_setting_wireless_get_cloned_mac_address (setting),
- ARPHRD_ETHER, priv->cloned_mac);
+ s_mac_str = nm_setting_wireless_get_cloned_mac_address (setting);
+ if (s_mac_str)
+ gtk_entry_set_text (priv->cloned_mac, s_mac_str);
g_signal_connect_swapped (priv->cloned_mac, "changed", G_CALLBACK (ce_page_changed), self);
gtk_spin_button_set_value (priv->rate, (gdouble) nm_setting_wireless_get_rate (setting));
@@ -445,7 +431,6 @@ CEPage *
ce_page_wifi_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -458,7 +443,6 @@ ce_page_wifi_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-wifi.ui",
"WifiPage",
_("Wi-Fi")));
@@ -481,12 +465,12 @@ ce_page_wifi_new (NMConnection *connection,
return CE_PAGE (self);
}
-GByteArray *
+GBytes *
ce_page_wifi_get_ssid (CEPageWifi *self)
{
CEPageWifiPrivate *priv;
const char *txt_ssid;
- GByteArray *ssid;
+ GBytes *ssid;
g_return_val_if_fail (CE_IS_PAGE_WIFI (self), NULL);
@@ -495,8 +479,7 @@ ce_page_wifi_get_ssid (CEPageWifi *self)
if (!txt_ssid || !strlen (txt_ssid))
return NULL;
- ssid = g_byte_array_sized_new (strlen (txt_ssid));
- g_byte_array_append (ssid, (const guint8 *) txt_ssid, strlen (txt_ssid));
+ ssid = g_bytes_new (txt_ssid, strlen (txt_ssid));
return ssid;
}
@@ -505,10 +488,10 @@ static void
ui_to_setting (CEPageWifi *self)
{
CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self);
- GByteArray *ssid;
- GByteArray *bssid = NULL;
- GByteArray *device_mac = NULL;
- GByteArray *cloned_mac = NULL;
+ GBytes *ssid;
+ char *bssid = NULL;
+ char *device_mac = NULL;
+ char *cloned_mac = NULL;
const char *mode;
const char *band;
GtkWidget *entry;
@@ -555,14 +538,10 @@ ui_to_setting (CEPageWifi *self)
NM_SETTING_WIRELESS_MTU, gtk_spin_button_get_value_as_int (priv->mtu),
NULL);
- if (ssid)
- g_byte_array_free (ssid, TRUE);
- if (device_mac)
- g_byte_array_free (device_mac, TRUE);
- if (cloned_mac)
- g_byte_array_free (cloned_mac, TRUE);
- if (bssid)
- g_byte_array_free (bssid, TRUE);
+ g_bytes_unref (ssid);
+ g_free (device_mac);
+ g_free (cloned_mac);
+ g_free (bssid);
}
static gboolean
@@ -572,7 +551,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
CEPageWifiPrivate *priv = CE_PAGE_WIFI_GET_PRIVATE (self);
gboolean success;
gboolean invalid = FALSE;
- GByteArray *ignore;
+ char *ignore;
GtkWidget *entry;
entry = gtk_bin_get_child (GTK_BIN (priv->bssid));
@@ -580,8 +559,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
}
entry = gtk_bin_get_child (GTK_BIN (priv->device_mac));
@@ -589,15 +567,13 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
}
ignore = ce_page_entry_to_mac (priv->cloned_mac, ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
ui_to_setting (self);
@@ -627,7 +603,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)
{
@@ -637,7 +613,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 c039b00..c12c029 100644
--- a/src/connection-editor/page-wifi.h
+++ b/src/connection-editor/page-wifi.h
@@ -17,14 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_WIFI_H__
#define __PAGE_WIFI_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -50,17 +48,16 @@ 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);
-/* Caller must free returned array */
-GByteArray *ce_page_wifi_get_ssid (CEPageWifi *self);
+/* Caller must free returned value with g_bytes_unref() */
+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 3b786c2..757f294 100644
--- a/src/connection-editor/page-wimax.c
+++ b/src/connection-editor/page-wimax.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -23,11 +23,6 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wimax.h>
-#include <nm-device-wimax.h>
-#include <nm-utils.h>
-
#include "page-wimax.h"
G_DEFINE_TYPE (CEPageWimax, ce_page_wimax, CE_TYPE_PAGE)
@@ -73,8 +68,7 @@ populate_ui (CEPageWimax *self)
CEPageWimaxPrivate *priv = CE_PAGE_WIMAX_GET_PRIVATE (self);
NMSettingWimax *setting = priv->setting;
char **mac_list;
- const GByteArray *s_mac;
- char *s_mac_str;
+ const char *s_mac_str;
gtk_entry_set_text (priv->name, nm_setting_wimax_get_network_name (setting));
g_signal_connect_swapped (priv->name, "changed", G_CALLBACK (ce_page_changed), self);
@@ -82,11 +76,9 @@ populate_ui (CEPageWimax *self)
/* Device MAC address */
mac_list = ce_page_get_mac_list (CE_PAGE (self), NM_TYPE_DEVICE_WIMAX,
NM_DEVICE_WIMAX_HW_ADDRESS);
- s_mac = nm_setting_wimax_get_mac_address (setting);
- s_mac_str = s_mac ? nm_utils_hwaddr_ntoa (s_mac->data, ARPHRD_ETHER) : NULL;
+ s_mac_str = nm_setting_wimax_get_mac_address (setting);
ce_page_setup_mac_combo (CE_PAGE (self), GTK_COMBO_BOX (priv->device_mac),
s_mac_str, mac_list);
- g_free (s_mac_str);
g_strfreev (mac_list);
g_signal_connect_swapped (priv->device_mac, "changed", G_CALLBACK (ce_page_changed), self);
}
@@ -104,7 +96,6 @@ CEPage *
ce_page_wimax_new (NMConnection *connection,
GtkWindow *parent_window,
NMClient *client,
- NMRemoteSettings *settings,
const char **out_secrets_setting_name,
GError **error)
{
@@ -117,7 +108,6 @@ ce_page_wimax_new (NMConnection *connection,
connection,
parent_window,
client,
- settings,
UIDIR "/ce-page-wimax.ui",
"WimaxPage",
_("WiMAX")));
@@ -146,7 +136,7 @@ ui_to_setting (CEPageWimax *self)
{
CEPageWimaxPrivate *priv = CE_PAGE_WIMAX_GET_PRIVATE (self);
const char *name;
- GByteArray *device_mac = NULL;
+ char *device_mac = NULL;
GtkWidget *entry;
name = gtk_entry_get_text (priv->name);
@@ -160,8 +150,7 @@ ui_to_setting (CEPageWimax *self)
NM_SETTING_WIMAX_MAC_ADDRESS, device_mac,
NULL);
- if (device_mac)
- g_byte_array_free (device_mac, TRUE);
+ g_free (device_mac);
}
static gboolean
@@ -171,7 +160,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
CEPageWimaxPrivate *priv = CE_PAGE_WIMAX_GET_PRIVATE (self);
const char *name;
gboolean invalid = FALSE;
- GByteArray *ignore;
+ char *ignore;
GtkWidget *entry;
name = gtk_entry_get_text (priv->name);
@@ -183,8 +172,7 @@ validate (CEPage *page, NMConnection *connection, GError **error)
ignore = ce_page_entry_to_mac (GTK_ENTRY (entry), ARPHRD_ETHER, &invalid);
if (invalid)
return FALSE;
- if (ignore)
- g_byte_array_free (ignore, TRUE);
+ g_free (ignore);
}
ui_to_setting (self);
@@ -212,7 +200,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)
{
@@ -222,7 +210,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 6938284..57a4401 100644
--- a/src/connection-editor/page-wimax.h
+++ b/src/connection-editor/page-wimax.h
@@ -15,14 +15,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright 2012 Red Hat, Inc.
+ * Copyright 2012 - 2014 Red Hat, Inc.
*/
#ifndef __PAGE_WIMAX_H__
#define __PAGE_WIMAX_H__
-#include <nm-connection.h>
-
#include <glib.h>
#include <glib-object.h>
@@ -48,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/ppp-auth-methods-dialog.c b/src/connection-editor/ppp-auth-methods-dialog.c
index 7e6207b..873ceef 100644
--- a/src/connection-editor/ppp-auth-methods-dialog.c
+++ b/src/connection-editor/ppp-auth-methods-dialog.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include <netinet/in.h>
@@ -30,7 +30,7 @@
#include <glib/gi18n.h>
-#include <nm-utils.h>
+#include <NetworkManager.h>
#include "ppp-auth-methods-dialog.h"
diff --git a/src/connection-editor/vpn-helpers.c b/src/connection-editor/vpn-helpers.c
index c8a3f11..8a2b8fa 100644
--- a/src/connection-editor/vpn-helpers.c
+++ b/src/connection-editor/vpn-helpers.c
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#include "config.h"
@@ -28,21 +28,14 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#include <nm-connection.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-vpn.h>
-
#include "vpn-helpers.h"
#include "utils.h"
-#define NM_VPN_API_SUBJECT_TO_CHANGE
-#include "nm-vpn-plugin-ui-interface.h"
-
#define VPN_NAME_FILES_DIR SYSCONFDIR"/NetworkManager/VPN"
static GHashTable *plugins = NULL;
-NMVpnPluginUiInterface *
+NMVpnEditorPlugin *
vpn_get_plugin_by_service (const char *service)
{
g_return_val_if_fail (service != NULL, NULL);
@@ -76,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;
@@ -91,7 +84,7 @@ vpn_get_plugins (GError **error)
if (!service)
goto next;
- so_path = g_key_file_get_string (keyfile, "GNOME", "properties", NULL);
+ so_path = g_key_file_get_string (keyfile, "libnm", "properties", NULL);
if (!so_path)
goto next;
@@ -115,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;
@@ -126,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",
@@ -152,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);
}
@@ -180,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;
@@ -196,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)
@@ -260,9 +253,9 @@ 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;
+ NMSettingVpn *s_vpn = NULL;
const char *service_type;
const char *id = NULL;
gboolean success = FALSE;
@@ -315,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) {
@@ -350,8 +343,8 @@ void
vpn_export (NMConnection *connection)
{
GtkWidget *dialog;
- NMVpnPluginUiInterface *plugin;
- NMSettingVPN *s_vpn = NULL;
+ NMVpnEditorPlugin *plugin;
+ NMSettingVpn *s_vpn = NULL;
const char *service_type;
const char *home_folder;
@@ -376,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);
@@ -391,9 +384,9 @@ vpn_export (NMConnection *connection)
gboolean
vpn_supports_ipv6 (NMConnection *connection)
{
- NMSettingVPN *s_vpn;
+ NMSettingVpn *s_vpn;
const char *service_type;
- NMVpnPluginUiInterface *plugin;
+ NMVpnEditorPlugin *plugin;
guint32 capabilities;
s_vpn = nm_connection_get_setting_vpn (connection);
@@ -405,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 d14fc8f..10c9f55 100644
--- a/src/connection-editor/vpn-helpers.h
+++ b/src/connection-editor/vpn-helpers.h
@@ -17,7 +17,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * (C) Copyright 2008 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
*/
#ifndef _VPN_HELPERS_H_
@@ -25,14 +25,12 @@
#include <glib.h>
#include <gtk/gtk.h>
-#include <nm-connection.h>
-#define NM_VPN_API_SUBJECT_TO_CHANGE
-#include <nm-vpn-plugin-ui-interface.h>
+#include <NetworkManager.h>
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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]