Commit 37845af9 authored by Dan Williams's avatar Dan Williams

settings: return new connection object path from AddConnection

Finally.
parent 856a1c6b
......@@ -29,6 +29,11 @@
Connection settings and properties.
</tp:docstring>
</arg>
<arg name="path" type="o" direction="out">
<tp:docstring>
Object path of the new connection that was just added.
</tp:docstring>
</arg>
</method>
<method name="SaveHostname">
......
......@@ -154,12 +154,12 @@ connection_init_result_cb (NMRemoteConnection *remote,
g_signal_emit (self, signals[CONNECTIONS_READ], 0);
}
static void
static NMRemoteConnection *
new_connection_cb (DBusGProxy *proxy, const char *path, gpointer user_data)
{
NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
NMRemoteConnection *connection;
NMRemoteConnection *connection = NULL;
connection = nm_remote_connection_new (priv->bus, path);
if (connection) {
......@@ -177,6 +177,7 @@ new_connection_cb (DBusGProxy *proxy, const char *path, gpointer user_data)
*/
g_hash_table_insert (priv->pending, g_strdup (path), connection);
}
return connection;
}
static void
......@@ -205,17 +206,17 @@ fetch_connections_done (DBusGProxy *proxy,
}
/* Let listeners know we are done getting connections */
if (connections->len == 0) {
if (connections->len == 0)
g_signal_emit (self, signals[CONNECTIONS_READ], 0);
return;
}
for (i = 0; connections && (i < connections->len); i++) {
char *path = g_ptr_array_index (connections, i);
else {
for (i = 0; i < connections->len; i++) {
char *path = g_ptr_array_index (connections, i);
new_connection_cb (proxy, path, user_data);
g_free (path);
new_connection_cb (proxy, path, user_data);
g_free (path);
}
}
g_ptr_array_free (connections, TRUE);
}
......@@ -268,13 +269,19 @@ typedef struct {
static void
add_connection_done (DBusGProxy *proxy,
char *path,
GError *error,
gpointer user_data)
{
AddConnectionInfo *info = user_data;
NMRemoteConnection *connection;
connection = new_connection_cb (proxy, path, info->self);
g_assert (connection);
info->callback (info->self, connection, error, info->callback_data);
info->callback (info->self, error, info->callback_data);
g_free (info);
g_free (path);
}
/**
* nm_remote_settings_add_connection:
......
......@@ -51,6 +51,7 @@ typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass;
typedef void (*NMRemoteSettingsAddConnectionFunc) (NMRemoteSettings *settings,
NMRemoteConnection *connection,
GError *error,
gpointer user_data);
......
......@@ -129,7 +129,6 @@ enum {
NEW_CONNECTION, /* exported, not used internally */
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
enum {
......@@ -575,16 +574,45 @@ load_plugins (NMSettings *self, const char *plugins, GError **error)
return success;
}
#define REMOVED_ID_TAG "removed-id-tag"
#define UPDATED_ID_TAG "updated-id-tag"
#define VISIBLE_ID_TAG "visible-id-tag"
static void
connection_removed (NMSysconfigConnection *connection, gpointer user_data)
connection_removed (NMSysconfigConnection *obj, gpointer user_data)
{
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (user_data);
GObject *connection = G_OBJECT (obj);
guint id;
g_object_ref (connection);
g_hash_table_remove (NM_SETTINGS_GET_PRIVATE (user_data)->connections, connection);
/* Disconnect signal handlers, as plugins might still keep references
* to the connection (and thus the signal handlers would still be live)
* even after NMSettings has dropped all its references.
*/
id = GPOINTER_TO_UINT (g_object_get_data (connection, REMOVED_ID_TAG));
if (id)
g_signal_handler_disconnect (connection, id);
id = GPOINTER_TO_UINT (g_object_get_data (connection, UPDATED_ID_TAG));
if (id)
g_signal_handler_disconnect (connection, id);
id = GPOINTER_TO_UINT (g_object_get_data (connection, VISIBLE_ID_TAG));
if (id)
g_signal_handler_disconnect (connection, id);
/* Unregister the connection with D-Bus and forget about it */
dbus_g_connection_unregister_g_object (priv->bus, connection);
g_hash_table_remove (NM_SETTINGS_GET_PRIVATE (user_data)->connections,
(gpointer) nm_connection_get_path (NM_CONNECTION (connection)));
g_signal_emit (NM_SETTINGS (user_data),
signals[CONNECTION_REMOVED],
0,
connection);
g_object_unref (connection);
}
......@@ -619,6 +647,7 @@ claim_connection (NMSettings *self,
GHashTableIter iter;
gpointer data;
char *path;
guint id;
g_return_if_fail (NM_IS_SYSCONFIG_CONNECTION (connection));
......@@ -640,19 +669,20 @@ claim_connection (NMSettings *self,
/* Ensure it's initial visibility is up-to-date */
nm_sysconfig_connection_recheck_visibility (connection);
g_signal_connect (connection,
NM_SYSCONFIG_CONNECTION_REMOVED,
G_CALLBACK (connection_removed),
self);
id = g_signal_connect (connection, NM_SYSCONFIG_CONNECTION_REMOVED,
G_CALLBACK (connection_removed),
self);
g_object_set_data (G_OBJECT (connection), REMOVED_ID_TAG, GUINT_TO_POINTER (id));
g_signal_connect (connection,
NM_SYSCONFIG_CONNECTION_UPDATED,
G_CALLBACK (connection_updated),
self);
id = g_signal_connect (connection, NM_SYSCONFIG_CONNECTION_UPDATED,
G_CALLBACK (connection_updated),
self);
g_object_set_data (G_OBJECT (connection), UPDATED_ID_TAG, GUINT_TO_POINTER (id));
g_signal_connect (connection, "notify::" NM_SYSCONFIG_CONNECTION_VISIBLE,
G_CALLBACK (connection_visibility_changed),
self);
id = g_signal_connect (connection, "notify::" NM_SYSCONFIG_CONNECTION_VISIBLE,
G_CALLBACK (connection_visibility_changed),
self);
g_object_set_data (G_OBJECT (connection), VISIBLE_ID_TAG, GUINT_TO_POINTER (id));
/* Export the connection over D-Bus */
g_warn_if_fail (nm_connection_get_path (NM_CONNECTION (connection)) == NULL);
......@@ -750,7 +780,7 @@ polkit_call_free (PolkitCall *call)
g_free (call);
}
static gboolean
static NMSysconfigConnection *
add_new_connection (NMSettings *self,
NMConnection *connection,
GError **error)
......@@ -758,29 +788,28 @@ add_new_connection (NMSettings *self,
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
GError *tmp_error = NULL, *last_error = NULL;
GSList *iter;
gboolean success = FALSE;
/* Here's how it works:
1) plugin writes a connection.
2) plugin notices that a new connection is available for reading.
3) plugin reads the new connection (the one it wrote in 1) and emits 'connection-added' signal.
4) NMSettings receives the signal and adds it to it's connection list.
*/
for (iter = priv->plugins; iter && !success; iter = iter->next) {
success = nm_system_config_interface_add_connection (NM_SYSTEM_CONFIG_INTERFACE (iter->data),
connection,
&tmp_error);
NMSysconfigConnection *added = NULL;
/* 1) plugin writes the NMConnection to disk
* 2) plugin creates a new NMSysconfigConnection subclass with the settings
* from the NMConnection and returns it to the settings service
* 3) settings service exports the new NMSysconfigConnection subclass
* 4) plugin notices that something on the filesystem has changed
* 5) plugin reads the changes and ignores them because they will
* contain the same data as the connection it already knows about
*/
for (iter = priv->plugins; iter && !added; iter = g_slist_next (iter)) {
added = nm_system_config_interface_add_connection (NM_SYSTEM_CONFIG_INTERFACE (iter->data),
connection,
&tmp_error);
g_clear_error (&last_error);
if (!success) {
last_error = tmp_error;
tmp_error = NULL;
}
if (!added)
g_propagate_error (&last_error, tmp_error);
}
if (!success)
*error = last_error;
return success;
if (!added)
g_propagate_error (error, last_error);
return added;
}
static void
......@@ -791,6 +820,7 @@ pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
NMSettingsPrivate *priv;
PolkitAuthorizationResult *pk_result;
GError *error = NULL, *add_error = NULL;
NMSysconfigConnection *added_connection;
/* If NMSettings is already gone, do nothing */
if (call->disposed) {
......@@ -825,8 +855,9 @@ pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
goto out;
}
if (add_new_connection (self, call->connection, &add_error))
dbus_g_method_return (call->context);
added_connection = add_new_connection (self, call->connection, &add_error);
if (added_connection)
dbus_g_method_return (call->context, added_connection);
else {
error = g_error_new (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_ADD_FAILED,
......@@ -1201,6 +1232,7 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
GError *error = NULL;
NMSettingConnection *s_con;
const char *id;
NMSysconfigConnection *added;
/* Try to move this default wired conneciton to a plugin so that it has
* persistent storage.
......@@ -1213,7 +1245,8 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
g_assert (id);
remove_default_wired_connection (self, NM_SYSCONFIG_CONNECTION (wired), FALSE);
if (add_new_connection (self, NM_CONNECTION (wired), &error)) {
added = add_new_connection (self, NM_CONNECTION (wired), &error);
if (added) {
nm_sysconfig_connection_delete (NM_SYSCONFIG_CONNECTION (wired),
delete_cb,
NULL);
......@@ -1229,6 +1262,7 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
id,
error ? error->code : -1,
(error && error->message) ? error->message : "(unknown)");
g_clear_error (&error);
/* If there was an error, don't destroy the default wired connection,
* but add it back to the system settings service. Connection is already
......
......@@ -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 (C) 2007 - 2008 Red Hat, Inc.
* Copyright (C) 2007 - 2010 Red Hat, Inc.
* Copyright (C) 2008 Novell, Inc.
*/
......@@ -146,18 +146,16 @@ nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config)
return NULL;
}
gboolean
NMSysconfigConnection *
nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
NMConnection *connection,
GError **error)
{
gboolean success = FALSE;
g_return_val_if_fail (config != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection)
success = NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, error);
return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, error);
return success;
return NULL;
}
......@@ -117,11 +117,13 @@ struct _NMSystemConfigInterface {
GSList * (*get_unmanaged_specs) (NMSystemConfigInterface *config);
/*
* Add a new connection.
* Save the given connection to backing storage, and return a new
* NMSysconfigConnection subclass that contains the same settings as the
* original connection.
*/
gboolean (*add_connection) (NMSystemConfigInterface *config,
NMConnection *connection,
GError **error);
NMSysconfigConnection * (*add_connection) (NMSystemConfigInterface *config,
NMConnection *connection,
GError **error);
/* Signals */
......@@ -142,9 +144,9 @@ GSList *nm_system_config_interface_get_connections (NMSystemConfigInterface *con
GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config);
gboolean nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
NMConnection *connection,
GError **error);
NMSysconfigConnection *nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
NMConnection *connection,
GError **error);
G_END_DECLS
......
......@@ -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 (C) 2008 - 2009 Red Hat, Inc.
* Copyright (C) 2008 - 2010 Red Hat, Inc.
*/
#include <string.h>
......@@ -47,7 +47,7 @@ G_DEFINE_TYPE (NMIfcfgConnection, nm_ifcfg_connection, NM_TYPE_SYSCONFIG_CONNECT
typedef struct {
gulong ih_event_id;
char *filename;
char *path;
int file_wd;
char *keyfile;
......@@ -64,9 +64,7 @@ typedef struct {
enum {
PROP_0,
PROP_FILENAME,
PROP_UNMANAGED,
LAST_PROP
};
......@@ -87,7 +85,10 @@ files_changed_cb (NMInotifyHelper *ih,
NMIfcfgConnection *self = NM_IFCFG_CONNECTION (user_data);
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (self);
if ((evt->wd != priv->file_wd) && (evt->wd != priv->keyfile_wd) && (evt->wd != priv->routefile_wd) && (evt->wd != priv->route6file_wd))
if ( (evt->wd != priv->file_wd)
&& (evt->wd != priv->keyfile_wd)
&& (evt->wd != priv->routefile_wd)
&& (evt->wd != priv->route6file_wd))
return;
/* push the event up to the plugin */
......@@ -95,7 +96,8 @@ files_changed_cb (NMInotifyHelper *ih,
}
NMIfcfgConnection *
nm_ifcfg_connection_new (const char *filename,
nm_ifcfg_connection_new (const char *full_path,
NMConnection *source,
GError **error,
gboolean *ignore_error)
{
......@@ -108,14 +110,24 @@ nm_ifcfg_connection_new (const char *filename,
char *route6file = NULL;
NMInotifyHelper *ih;
g_return_val_if_fail (filename != NULL, NULL);
tmp = connection_from_file (filename, NULL, NULL, NULL, &unmanaged, &keyfile, &routefile, &route6file, error, ignore_error);
if (!tmp)
return NULL;
g_return_val_if_fail (full_path != NULL, NULL);
/* If we're given a connection already, prefer that instead of re-reading */
if (source)
tmp = g_object_ref (source);
else {
tmp = connection_from_file (full_path, NULL, NULL, NULL,
&unmanaged,
&keyfile,
&routefile,
&route6file,
error,
ignore_error);
if (!tmp)
return NULL;
}
object = (GObject *) g_object_new (NM_TYPE_IFCFG_CONNECTION,
NM_IFCFG_CONNECTION_FILENAME, filename,
NM_IFCFG_CONNECTION_UNMANAGED, unmanaged,
NULL);
if (!object) {
......@@ -128,11 +140,12 @@ nm_ifcfg_connection_new (const char *filename,
g_object_unref (tmp);
priv = NM_IFCFG_CONNECTION_GET_PRIVATE (object);
priv->path = g_strdup (full_path);
ih = nm_inotify_helper_get ();
priv->ih_event_id = g_signal_connect (ih, "event", G_CALLBACK (files_changed_cb), object);
priv->file_wd = nm_inotify_helper_add_watch (ih, filename);
priv->file_wd = nm_inotify_helper_add_watch (ih, full_path);
priv->keyfile = keyfile;
priv->keyfile_wd = nm_inotify_helper_add_watch (ih, keyfile);
......@@ -147,11 +160,11 @@ nm_ifcfg_connection_new (const char *filename,
}
const char *
nm_ifcfg_connection_get_filename (NMIfcfgConnection *self)
nm_ifcfg_connection_get_path (NMIfcfgConnection *self)
{
g_return_val_if_fail (NM_IS_IFCFG_CONNECTION (self), NULL);
return NM_IFCFG_CONNECTION_GET_PRIVATE (self)->filename;
return NM_IFCFG_CONNECTION_GET_PRIVATE (self)->path;
}
const char *
......@@ -176,7 +189,7 @@ commit_changes (NMSysconfigConnection *connection,
* processes on-disk, read the existing connection back in and only rewrite
* it if it's really changed.
*/
reread = connection_from_file (priv->filename, NULL, NULL, NULL,
reread = connection_from_file (priv->path, NULL, NULL, NULL,
&unmanaged, &keyfile, &routefile, &route6file,
NULL, NULL);
g_free (unmanaged);
......@@ -191,7 +204,7 @@ commit_changes (NMSysconfigConnection *connection,
if (!writer_update_connection (NM_CONNECTION (connection),
IFCFG_DIR,
priv->filename,
priv->path,
priv->keyfile,
&error)) {
callback (connection, error, user_data);
......@@ -212,7 +225,7 @@ do_delete (NMSysconfigConnection *connection,
{
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection);
g_unlink (priv->filename);
g_unlink (priv->path);
if (priv->keyfile)
g_unlink (priv->keyfile);
if (priv->routefile)
......@@ -243,7 +256,7 @@ finalize (GObject *object)
g_signal_handler_disconnect (ih, priv->ih_event_id);
g_free (priv->filename);
g_free (priv->path);
if (priv->file_wd >= 0)
nm_inotify_helper_remove_watch (ih, priv->file_wd);
......@@ -269,10 +282,6 @@ set_property (GObject *object, guint prop_id,
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (object);
switch (prop_id) {
case PROP_FILENAME:
/* Construct only */
priv->filename = g_value_dup_string (value);
break;
case PROP_UNMANAGED:
priv->unmanaged = g_value_dup_string (value);
break;
......@@ -289,9 +298,6 @@ get_property (GObject *object, guint prop_id,
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (object);
switch (prop_id) {
case PROP_FILENAME:
g_value_set_string (value, priv->filename);
break;
case PROP_UNMANAGED:
g_value_set_string (value, priv->unmanaged);
break;
......@@ -317,14 +323,6 @@ nm_ifcfg_connection_class_init (NMIfcfgConnectionClass *ifcfg_connection_class)
sysconfig_class->commit_changes = commit_changes;
/* Properties */
g_object_class_install_property
(object_class, PROP_FILENAME,
g_param_spec_string (NM_IFCFG_CONNECTION_FILENAME,
"FileName",
"File name",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(object_class, PROP_UNMANAGED,
g_param_spec_string (NM_IFCFG_CONNECTION_UNMANAGED,
......
......@@ -33,7 +33,6 @@ G_BEGIN_DECLS
#define NM_IS_IFCFG_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_IFCFG_CONNECTION))
#define NM_IFCFG_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IFCFG_CONNECTION, NMIfcfgConnectionClass))
#define NM_IFCFG_CONNECTION_FILENAME "filename"
#define NM_IFCFG_CONNECTION_UNMANAGED "unmanaged"
typedef struct {
......@@ -47,10 +46,11 @@ typedef struct {
GType nm_ifcfg_connection_get_type (void);
NMIfcfgConnection *nm_ifcfg_connection_new (const char *filename,
NMConnection *source,
GError **error,
gboolean *ignore_error);
const char *nm_ifcfg_connection_get_filename (NMIfcfgConnection *self);
const char *nm_ifcfg_connection_get_path (NMIfcfgConnection *self);
const char *nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self);
......
This diff is collapsed.
......@@ -2973,8 +2973,8 @@ get_wireless_name (NMConnection * connection)
return result;
}
gboolean
ifnet_add_new_connection (NMConnection * connection,
char *
ifnet_add_new_connection (NMConnection *connection,
const char *config_file,
const char *wpa_file,
GError **error)
......@@ -3024,10 +3024,10 @@ ifnet_add_new_connection (NMConnection * connection,
}
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Added new connection: %s, result: %s",
new_name, success ? "success" : "fail");
new_name, success ? "success" : "fail");
out:
if (new_name)
if (!success)
g_free (new_name);
return success;
return success ? new_name : NULL;
}
......@@ -39,8 +39,8 @@ gboolean ifnet_delete_connection_in_parsers (const char *conn_name,
const char *config_file,
const char *wpa_file);
gboolean ifnet_add_new_connection (NMConnection *connection,
const char *config_file,
const char *wpa_file,
GError ** error);
char * ifnet_add_new_connection (NMConnection *connection,
const char *config_file,
const char *wpa_file,
GError ** error);
#endif
......@@ -57,25 +57,32 @@ typedef struct {
} NMIfnetConnectionPrivate;
NMIfnetConnection *
nm_ifnet_connection_new (gchar * conn_name)
nm_ifnet_connection_new (const char *conn_name, NMConnection *source)
{
NMConnection *tmp;
GObject *object;
GError **error = NULL;
g_return_val_if_fail (conn_name != NULL, NULL);
tmp = ifnet_update_connection_from_config_block (conn_name, error);
if (!tmp)
return NULL;
object = (GObject *) g_object_new (NM_TYPE_IFNET_CONNECTION,
NM_IFNET_CONNECTION_CONN_NAME,
conn_name, NULL);
if (source)
tmp = g_object_ref (source);
else {
tmp = ifnet_update_connection_from_config_block (conn_name, error);
if (!tmp)
return NULL;
}
object = (GObject *) g_object_new (NM_TYPE_IFNET_CONNECTION, NULL);
if (!object) {
g_object_unref (tmp);
return NULL;
}
NM_IFNET_CONNECTION_GET_PRIVATE (object)->conn_name = g_strdup (conn_name);
nm_sysconfig_connection_replace_settings (NM_SYSCONFIG_CONNECTION (object), tmp, NULL);
g_object_unref (tmp);
return NM_IFNET_CONNECTION (object);
}
......@@ -144,44 +151,6 @@ do_delete (NMSysconfigConnection *connection,
g_signal_emit (connection, signals[IFNET_SETUP_MONITORS], 0);
}
static void
set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
NMIfnetConnectionPrivate *priv =
NM_IFNET_CONNECTION_GET_PRIVATE (object);
g_return_if_fail (priv);
switch (prop_id) {
case PROP_CONN_NAME:
if (priv->conn_name)
g_free (priv->conn_name);
priv->conn_name = g_strdup (g_value_get_pointer (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
NMIfnetConnectionPrivate *priv =
NM_IFNET_CONNECTION_GET_PRIVATE (object);
g_return_if_fail (priv);
switch (prop_id) {
case PROP_CONN_NAME:
g_value_set_pointer (value, priv->conn_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
finalize (GObject * object)
{
......@@ -203,19 +172,10 @@ nm_ifnet_connection_class_init (NMIfnetConnectionClass * ifnet_connection_class)
g_type_class_add_private (ifnet_connection_class,
sizeof (NMIfnetConnectionPrivate));
object_class->set_property = set_property;
object_class->get_property = get_property;
object_class->finalize = finalize;
sysconfig_class->delete = do_delete;
sysconfig_class->commit_changes = commit_changes;
/* Properties */
g_object_class_install_property
(object_class, PROP_CONN_NAME,
g_param_spec_pointer (NM_IFNET_CONNECTION_CONN_NAME,
"config_block",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
signals[IFNET_SETUP_MONITORS] =
g_signal_new ("ifnet_setup_monitors",
G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST,
......
......@@ -26,14 +26,15 @@
#include "net_parser.h"
G_BEGIN_DECLS
#define NM_TYPE_IFNET_CONNECTION (nm_ifnet_connection_get_type ())
#define NM_IFNET_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IFNET_CONNECTION, NMIfnetConnection))
#define NM_IFNET_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_IFNET_CONNECTION, NMIfnetConnectionClass))
#define NM_IS_IFNET_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_IFNET_CONNECTION))
#define NM_IS_IFNET_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_IFNET_CONNECTION))
#define NM_IFNET_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IFNET_CONNECTION, NMIfnetConnectionClass))
#define NM_IFNET_CONNECTION_CONN_NAME "connection_name"
typedef struct {
typedef struct {
NMSysconfigConnection parent;
} NMIfnetConnection;
......@@ -43,7 +44,8 @@ typedef struct {
GType nm_ifnet_connection_get_type (void);
NMIfnetConnection *nm_ifnet_connection_new (gchar * conn_name);
NMIfnetConnection *nm_ifnet_connection_new (const char *conn_name,
NMConnection *source);
G_END_DECLS
#endif /* NM_IFNET_CONNECTION_H */
......@@ -201,18 +201,6 @@ commit_cb (NMSysconfigConnection *connection, GError *error, gpointer unused)
}
}
static void
update_old_connection (gchar * conn_name,