core: rename NMSysconfigConnection -> NMSettingsConnection

This commit is contained in:
Dan Williams
2011-01-26 11:38:12 -06:00
parent b92e3cca6e
commit b3959aefa3
31 changed files with 450 additions and 461 deletions

View File

@@ -45,7 +45,7 @@ IGNORE_HFILES= \
nm-device-wifi-bindings.h \ nm-device-wifi-bindings.h \
nm-dhcp4-config-bindings.h \ nm-dhcp4-config-bindings.h \
nm-dhcp6-config-bindings.h \ nm-dhcp6-config-bindings.h \
nm-sysconfig-connection-glue.h \ nm-settings-connection-glue.h \
nm-ip4-config-bindings.h \ nm-ip4-config-bindings.h \
nm-ip6-config-bindings.h \ nm-ip6-config-bindings.h \
nm-settings-bindings.h \ nm-settings-bindings.h \

View File

@@ -18,7 +18,7 @@ EXTRA_DIST = \
nm-manager.xml \ nm-manager.xml \
nm-manager-client.xml \ nm-manager-client.xml \
nm-settings.xml \ nm-settings.xml \
nm-sysconfig-connection.xml \ nm-settings-connection.xml \
nm-vpn-plugin.xml \ nm-vpn-plugin.xml \
nm-vpn-connection.xml \ nm-vpn-connection.xml \
nm-ppp-manager.xml \ nm-ppp-manager.xml \

View File

@@ -42,7 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</
<xi:include href="nm-dhcp4-config.xml"/> <xi:include href="nm-dhcp4-config.xml"/>
<xi:include href="nm-dhcp6-config.xml"/> <xi:include href="nm-dhcp6-config.xml"/>
<xi:include href="nm-settings.xml"/> <xi:include href="nm-settings.xml"/>
<xi:include href="nm-sysconfig-connection.xml"/> <xi:include href="nm-settings-connection.xml"/>
<xi:include href="nm-active-connection.xml"/> <xi:include href="nm-active-connection.xml"/>
<xi:include href="nm-agent-manager.xml"/> <xi:include href="nm-agent-manager.xml"/>
<xi:include href="nm-vpn-connection.xml"/> <xi:include href="nm-vpn-connection.xml"/>

View File

@@ -14,7 +14,7 @@
update request, and will be either stored in persistent storage or update request, and will be either stored in persistent storage or
given to a Secret Agent for storage, depending on the request. given to a Secret Agent for storage, depending on the request.
</tp:docstring> </tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_sysconfig_connection_update"/> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_connection_update"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="properties" type="a{sa{sv}}" direction="in"> <arg name="properties" type="a{sa{sv}}" direction="in">
<tp:docstring> <tp:docstring>
@@ -27,7 +27,7 @@
<tp:docstring> <tp:docstring>
Delete the connection. Delete the connection.
</tp:docstring> </tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_sysconfig_connection_delete"/> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_connection_delete"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
</method> </method>
@@ -38,7 +38,7 @@
to the network, as those are often protected. Secrets must to the network, as those are often protected. Secrets must
be requested separately using the GetSecrets() call. be requested separately using the GetSecrets() call.
</tp:docstring> </tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_sysconfig_connection_get_settings"/> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_connection_get_settings"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="settings" type="a{sa{sv}}" direction="out" tp:type="String_String_Variant_Map_Map"> <arg name="settings" type="a{sa{sv}}" direction="out" tp:type="String_String_Variant_Map_Map">
<tp:docstring> <tp:docstring>
@@ -54,7 +54,7 @@
the requestor's session will be returned. The user will never the requestor's session will be returned. The user will never
be prompted for secrets as a result of this request. be prompted for secrets as a result of this request.
</tp:docstring> </tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_sysconfig_connection_get_secrets"/> <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_connection_get_secrets"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="setting_name" type="s" direction="in"> <arg name="setting_name" type="s" direction="in">
<tp:docstring> <tp:docstring>

View File

@@ -12,7 +12,7 @@ BUILT_SOURCES = \
nm-device-ethernet-bindings.h \ nm-device-ethernet-bindings.h \
nm-device-wifi-bindings.h \ nm-device-wifi-bindings.h \
nm-device-bt-bindings.h \ nm-device-bt-bindings.h \
nm-sysconfig-connection-bindings.h \ nm-settings-connection-bindings.h \
nm-device-wimax-bindings.h \ nm-device-wimax-bindings.h \
nm-settings-bindings.h \ nm-settings-bindings.h \
nm-vpn-connection-bindings.h \ nm-vpn-connection-bindings.h \
@@ -198,8 +198,8 @@ nm-access-point-bindings.h: $(top_srcdir)/introspection/nm-access-point.xml
nm-settings-bindings.h: $(top_srcdir)/introspection/nm-settings.xml nm-settings-bindings.h: $(top_srcdir)/introspection/nm-settings.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-client --output=$@ $< $(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-client --output=$@ $<
nm-sysconfig-connection-bindings.h: $(top_srcdir)/introspection/nm-sysconfig-connection.xml nm-settings-connection-bindings.h: $(top_srcdir)/introspection/nm-settings-connection.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_sysconfig_connection --mode=glib-client --output=$@ $< $(AM_V_GEN) dbus-binding-tool --prefix=nm_settings_connection --mode=glib-client --output=$@ $<
nm-vpn-connection-bindings.h: $(top_srcdir)/introspection/nm-vpn-connection.xml nm-vpn-connection-bindings.h: $(top_srcdir)/introspection/nm-vpn-connection.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection --mode=glib-client --output=$@ $< $(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_connection --mode=glib-client --output=$@ $<

View File

@@ -29,7 +29,7 @@
#include "nm-remote-connection.h" #include "nm-remote-connection.h"
#include "nm-remote-connection-private.h" #include "nm-remote-connection-private.h"
#include "nm-dbus-glib-types.h" #include "nm-dbus-glib-types.h"
#include "nm-sysconfig-connection-bindings.h" #include "nm-settings-connection-bindings.h"
#define NM_REMOTE_CONNECTION_BUS "bus" #define NM_REMOTE_CONNECTION_BUS "bus"

View File

@@ -31,7 +31,7 @@
#include "nm-agent-manager.h" #include "nm-agent-manager.h"
#include "nm-secret-agent.h" #include "nm-secret-agent.h"
#include "nm-manager-auth.h" #include "nm-manager-auth.h"
#include "nm-sysconfig-connection.h" #include "nm-settings-connection.h"
#include "nm-dbus-glib-types.h" #include "nm-dbus-glib-types.h"
G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, G_TYPE_OBJECT) G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, G_TYPE_OBJECT)
@@ -571,9 +571,9 @@ request_start_secrets (gpointer user_data)
req, req->setting_name); req, req->setting_name);
/* Grab any secrets from persistent storage */ /* Grab any secrets from persistent storage */
secrets = nm_sysconfig_connection_get_secrets (NM_SYSCONFIG_CONNECTION (req->connection), secrets = nm_settings_connection_get_secrets (NM_SETTINGS_CONNECTION (req->connection),
req->setting_name, req->setting_name,
&error); &error);
if (secrets) if (secrets)
setting_secrets = g_hash_table_lookup (secrets, req->setting_name); setting_secrets = g_hash_table_lookup (secrets, req->setting_name);
@@ -795,7 +795,7 @@ nm_agent_manager_get_secrets (NMAgentManager *self,
g_return_val_if_fail (self != NULL, 0); g_return_val_if_fail (self != NULL, 0);
g_return_val_if_fail (connection != NULL, 0); g_return_val_if_fail (connection != NULL, 0);
g_return_val_if_fail (NM_IS_SYSCONFIG_CONNECTION (connection), 0); g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), 0);
g_return_val_if_fail (callback != NULL, 0); g_return_val_if_fail (callback != NULL, 0);
nm_log_dbg (LOGD_SETTINGS, nm_log_dbg (LOGD_SETTINGS,

View File

@@ -57,7 +57,7 @@
#include "nm-bluez-manager.h" #include "nm-bluez-manager.h"
#include "nm-bluez-common.h" #include "nm-bluez-common.h"
#include "nm-settings.h" #include "nm-settings.h"
#include "nm-sysconfig-connection.h" #include "nm-settings-connection.h"
#include "nm-manager-auth.h" #include "nm-manager-auth.h"
#include "nm-agent-manager.h" #include "nm-agent-manager.h"
#include "NetworkManagerUtils.h" #include "NetworkManagerUtils.h"
@@ -480,7 +480,7 @@ nm_manager_update_state (NMManager *manager)
} }
static void static void
ignore_cb (NMSysconfigConnection *connection, GError *error, gpointer user_data) ignore_cb (NMSettingsConnection *connection, GError *error, gpointer user_data)
{ {
} }
@@ -509,7 +509,7 @@ update_active_connection_timestamp (NMManager *manager, NMDevice *device)
if (nm_setting_connection_get_read_only (s_con)) if (nm_setting_connection_get_read_only (s_con))
return; return;
nm_sysconfig_connection_commit_changes (NM_SYSCONFIG_CONNECTION (connection), ignore_cb, NULL); nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (connection), ignore_cb, NULL);
} }
static void static void
@@ -918,7 +918,7 @@ get_active_connections (NMManager *manager, NMConnection *filter)
static void static void
connections_changed (NMSettings *settings, connections_changed (NMSettings *settings,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
NMManager *manager) NMManager *manager)
{ {
bluez_manager_resync_devices (manager); bluez_manager_resync_devices (manager);
@@ -1995,7 +1995,7 @@ static void
pending_activate (NMManager *self, PendingActivation *pending) pending_activate (NMManager *self, PendingActivation *pending)
{ {
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
NMSysconfigConnection *connection; NMSettingsConnection *connection;
const char *path = NULL; const char *path = NULL;
GError *error = NULL; GError *error = NULL;
@@ -2069,7 +2069,7 @@ impl_manager_activate_connection (NMManager *self,
static void static void
activation_add_done (NMSettings *self, activation_add_done (NMSettings *self,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
gpointer user_data) gpointer user_data)
@@ -3097,13 +3097,13 @@ nm_manager_get (NMSettings *settings,
G_CALLBACK (system_unmanaged_devices_changed_cb), singleton); G_CALLBACK (system_unmanaged_devices_changed_cb), singleton);
g_signal_connect (priv->settings, "notify::" NM_SETTINGS_HOSTNAME, g_signal_connect (priv->settings, "notify::" NM_SETTINGS_HOSTNAME,
G_CALLBACK (system_hostname_changed_cb), singleton); G_CALLBACK (system_hostname_changed_cb), singleton);
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_ADDED, g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_ADDED,
G_CALLBACK (connections_changed), singleton); G_CALLBACK (connections_changed), singleton);
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_UPDATED, g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED,
G_CALLBACK (connections_changed), singleton); G_CALLBACK (connections_changed), singleton);
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_REMOVED, g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED,
G_CALLBACK (connections_changed), singleton); G_CALLBACK (connections_changed), singleton);
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED, g_signal_connect (priv->settings, NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED,
G_CALLBACK (connections_changed), singleton); G_CALLBACK (connections_changed), singleton);
dbus_g_connection_register_g_object (bus, NM_DBUS_PATH, G_OBJECT (singleton)); dbus_g_connection_register_g_object (bus, NM_DBUS_PATH, G_OBJECT (singleton));

View File

@@ -741,7 +741,7 @@ auto_activate_device (gpointer user_data)
/* Ignore connections that aren't visible to any logged-in users */ /* Ignore connections that aren't visible to any logged-in users */
if (ignore == FALSE) { if (ignore == FALSE) {
if (!nm_sysconfig_connection_is_visible (NM_SYSCONFIG_CONNECTION (candidate))) if (!nm_settings_connection_is_visible (NM_SETTINGS_CONNECTION (candidate)))
ignore = TRUE; ignore = TRUE;
} }
@@ -1099,12 +1099,12 @@ connection_removed (NMSettings *settings,
static void static void
connection_visibility_changed (NMSettings *settings, connection_visibility_changed (NMSettings *settings,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
gpointer user_data) gpointer user_data)
{ {
NMPolicy *policy = user_data; NMPolicy *policy = user_data;
if (nm_sysconfig_connection_is_visible (connection)) if (nm_settings_connection_is_visible (connection))
schedule_activate_all (policy); schedule_activate_all (policy);
else else
_deactivate_if_active (policy->manager, NM_CONNECTION (connection)); _deactivate_if_active (policy->manager, NM_CONNECTION (connection));
@@ -1169,11 +1169,11 @@ nm_policy_new (NMManager *manager,
_connect_manager_signal (policy, "device-added", device_added); _connect_manager_signal (policy, "device-added", device_added);
_connect_manager_signal (policy, "device-removed", device_removed); _connect_manager_signal (policy, "device-removed", device_removed);
_connect_settings_signal (policy, NM_SETTINGS_CONNECTIONS_LOADED, connections_loaded); _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED, connections_loaded);
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_ADDED, connection_added); _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_ADDED, connection_added);
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_UPDATED, connection_updated); _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_UPDATED, connection_updated);
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_REMOVED, connection_removed); _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_REMOVED, connection_removed);
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED, _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED,
connection_visibility_changed); connection_visibility_changed);
initialized = TRUE; initialized = TRUE;

View File

@@ -9,7 +9,7 @@ noinst_LTLIBRARIES = libsettings.la
BUILT_SOURCES = \ BUILT_SOURCES = \
nm-settings-glue.h \ nm-settings-glue.h \
nm-sysconfig-connection-glue.h nm-settings-connection-glue.h
libsettings_la_SOURCES = \ libsettings_la_SOURCES = \
nm-settings.c \ nm-settings.c \
@@ -21,8 +21,8 @@ libsettings_la_SOURCES = \
nm-settings-error.h \ nm-settings-error.h \
nm-system-config-interface.c \ nm-system-config-interface.c \
nm-system-config-interface.h \ nm-system-config-interface.h \
nm-sysconfig-connection.c \ nm-settings-connection.c \
nm-sysconfig-connection.h \ nm-settings-connection.h \
nm-default-wired-connection.c \ nm-default-wired-connection.c \
nm-default-wired-connection.h nm-default-wired-connection.h
@@ -56,8 +56,8 @@ libsettings_la_LDFLAGS = -rdynamic
nm-settings-glue.h: $(top_srcdir)/introspection/nm-settings.xml nm-settings-glue.h: $(top_srcdir)/introspection/nm-settings.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-server --output=$@ $< $(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-server --output=$@ $<
nm-sysconfig-connection-glue.h: $(top_srcdir)/introspection/nm-sysconfig-connection.xml nm-settings-connection-glue.h: $(top_srcdir)/introspection/nm-settings-connection.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_sysconfig_connection --mode=glib-server --output=$@ $< $(AM_V_GEN) dbus-binding-tool --prefix=nm_settings_connection --mode=glib-server --output=$@ $<
CLEANFILES = \ CLEANFILES = \
$(BUILT_SOURCES) $(BUILT_SOURCES)

View File

@@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* (C) Copyright 2008 Novell, Inc. * (C) Copyright 2008 Novell, Inc.
* (C) Copyright 2009 Red Hat, Inc. * (C) Copyright 2009 - 2011 Red Hat, Inc.
*/ */
#include <netinet/ether.h> #include <netinet/ether.h>
@@ -32,7 +32,7 @@
#include "nm-marshal.h" #include "nm-marshal.h"
#include "nm-default-wired-connection.h" #include "nm-default-wired-connection.h"
G_DEFINE_TYPE (NMDefaultWiredConnection, nm_default_wired_connection, NM_TYPE_SYSCONFIG_CONNECTION) G_DEFINE_TYPE (NMDefaultWiredConnection, nm_default_wired_connection, NM_TYPE_SETTINGS_CONNECTION)
#define NM_DEFAULT_WIRED_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEFAULT_WIRED_CONNECTION, NMDefaultWiredConnectionPrivate)) #define NM_DEFAULT_WIRED_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEFAULT_WIRED_CONNECTION, NMDefaultWiredConnectionPrivate))
@@ -85,8 +85,8 @@ nm_default_wired_connection_get_device (NMDefaultWiredConnection *wired)
} }
static void static void
commit_changes (NMSysconfigConnection *connection, commit_changes (NMSettingsConnection *connection,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
NMDefaultWiredConnection *self = NM_DEFAULT_WIRED_CONNECTION (connection); NMDefaultWiredConnection *self = NM_DEFAULT_WIRED_CONNECTION (connection);
@@ -101,17 +101,17 @@ commit_changes (NMSysconfigConnection *connection,
} }
static void static void
do_delete (NMSysconfigConnection *connection, do_delete (NMSettingsConnection *connection,
NMSysconfigConnectionDeleteFunc callback, NMSettingsConnectionDeleteFunc callback,
gpointer user_data) gpointer user_data)
{ {
NMDefaultWiredConnection *self = NM_DEFAULT_WIRED_CONNECTION (connection); NMDefaultWiredConnection *self = NM_DEFAULT_WIRED_CONNECTION (connection);
NMDefaultWiredConnectionPrivate *priv = NM_DEFAULT_WIRED_CONNECTION_GET_PRIVATE (connection); NMDefaultWiredConnectionPrivate *priv = NM_DEFAULT_WIRED_CONNECTION_GET_PRIVATE (connection);
g_signal_emit (self, signals[DELETED], 0, priv->mac); g_signal_emit (self, signals[DELETED], 0, priv->mac);
NM_SYSCONFIG_CONNECTION_CLASS (nm_default_wired_connection_parent_class)->delete (connection, NM_SETTINGS_CONNECTION_CLASS (nm_default_wired_connection_parent_class)->delete (connection,
callback, callback,
user_data); user_data);
} }
/****************************************************************/ /****************************************************************/
@@ -237,7 +237,7 @@ static void
nm_default_wired_connection_class_init (NMDefaultWiredConnectionClass *klass) nm_default_wired_connection_class_init (NMDefaultWiredConnectionClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMSysconfigConnectionClass *sysconfig_class = NM_SYSCONFIG_CONNECTION_CLASS (klass); NMSettingsConnectionClass *settings_class = NM_SETTINGS_CONNECTION_CLASS (klass);
g_type_class_add_private (klass, sizeof (NMDefaultWiredConnectionPrivate)); g_type_class_add_private (klass, sizeof (NMDefaultWiredConnectionPrivate));
@@ -246,8 +246,8 @@ nm_default_wired_connection_class_init (NMDefaultWiredConnectionClass *klass)
object_class->set_property = set_property; object_class->set_property = set_property;
object_class->get_property = get_property; object_class->get_property = get_property;
object_class->finalize = finalize; object_class->finalize = finalize;
sysconfig_class->commit_changes = commit_changes; settings_class->commit_changes = commit_changes;
sysconfig_class->delete = do_delete; settings_class->delete = do_delete;
/* Properties */ /* Properties */
g_object_class_install_property g_object_class_install_property

View File

@@ -16,13 +16,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* (C) Copyright 2008 Novell, Inc. * (C) Copyright 2008 Novell, Inc.
* (C) Copyright 2009 Red Hat, Inc. * (C) Copyright 2009 - 2011 Red Hat, Inc.
*/ */
#ifndef NM_DEFAULT_WIRED_CONNECTION_H #ifndef NM_DEFAULT_WIRED_CONNECTION_H
#define NM_DEFAULT_WIRED_CONNECTION_H #define NM_DEFAULT_WIRED_CONNECTION_H
#include "nm-sysconfig-connection.h" #include "nm-settings-connection.h"
#include "nm-device.h" #include "nm-device.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -39,11 +39,11 @@ G_BEGIN_DECLS
#define NM_DEFAULT_WIRED_CONNECTION_READ_ONLY "read-only" #define NM_DEFAULT_WIRED_CONNECTION_READ_ONLY "read-only"
typedef struct { typedef struct {
NMSysconfigConnection parent; NMSettingsConnection parent;
} NMDefaultWiredConnection; } NMDefaultWiredConnection;
typedef struct { typedef struct {
NMSysconfigConnectionClass parent; NMSettingsConnectionClass parent;
} NMDefaultWiredConnectionClass; } NMDefaultWiredConnectionClass;
GType nm_default_wired_connection_get_type (void); GType nm_default_wired_connection_get_type (void);

View File

@@ -26,7 +26,7 @@
#include <nm-setting-connection.h> #include <nm-setting-connection.h>
#include <nm-utils.h> #include <nm-utils.h>
#include "nm-sysconfig-connection.h" #include "nm-settings-connection.h"
#include "nm-session-monitor.h" #include "nm-session-monitor.h"
#include "nm-dbus-manager.h" #include "nm-dbus-manager.h"
#include "nm-settings-error.h" #include "nm-settings-error.h"
@@ -35,27 +35,27 @@
#include "nm-logging.h" #include "nm-logging.h"
#include "nm-manager-auth.h" #include "nm-manager-auth.h"
static void impl_sysconfig_connection_get_settings (NMSysconfigConnection *connection, static void impl_settings_connection_get_settings (NMSettingsConnection *connection,
DBusGMethodInvocation *context);
static void impl_sysconfig_connection_update (NMSysconfigConnection *connection,
GHashTable *new_settings,
DBusGMethodInvocation *context);
static void impl_sysconfig_connection_delete (NMSysconfigConnection *connection,
DBusGMethodInvocation *context);
static void impl_sysconfig_connection_get_secrets (NMSysconfigConnection *connection,
const gchar *setting_name,
DBusGMethodInvocation *context); DBusGMethodInvocation *context);
#include "nm-sysconfig-connection-glue.h" static void impl_settings_connection_update (NMSettingsConnection *connection,
GHashTable *new_settings,
DBusGMethodInvocation *context);
G_DEFINE_TYPE (NMSysconfigConnection, nm_sysconfig_connection, NM_TYPE_CONNECTION) static void impl_settings_connection_delete (NMSettingsConnection *connection,
DBusGMethodInvocation *context);
#define NM_SYSCONFIG_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \ static void impl_settings_connection_get_secrets (NMSettingsConnection *connection,
NM_TYPE_SYSCONFIG_CONNECTION, \ const gchar *setting_name,
NMSysconfigConnectionPrivate)) DBusGMethodInvocation *context);
#include "nm-settings-connection-glue.h"
G_DEFINE_TYPE (NMSettingsConnection, nm_settings_connection, NM_TYPE_CONNECTION)
#define NM_SETTINGS_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
NM_TYPE_SETTINGS_CONNECTION, \
NMSettingsConnectionPrivate))
enum { enum {
PROP_0 = 0, PROP_0 = 0,
@@ -77,7 +77,7 @@ typedef struct {
NMSessionMonitor *session_monitor; NMSessionMonitor *session_monitor;
guint session_changed_id; guint session_changed_id;
} NMSysconfigConnectionPrivate; } NMSettingsConnectionPrivate;
/**************************************************************/ /**************************************************************/
@@ -113,37 +113,36 @@ perm_to_user (const char *perm, char *out_user, gsize out_user_size)
/**************************************************************/ /**************************************************************/
static void static void
set_visible (NMSysconfigConnection *self, gboolean new_visible) set_visible (NMSettingsConnection *self, gboolean new_visible)
{ {
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
if (new_visible == priv->visible) if (new_visible == priv->visible)
return; return;
priv->visible = new_visible; priv->visible = new_visible;
g_object_notify (G_OBJECT (self), NM_SYSCONFIG_CONNECTION_VISIBLE); g_object_notify (G_OBJECT (self), NM_SETTINGS_CONNECTION_VISIBLE);
} }
gboolean gboolean
nm_sysconfig_connection_is_visible (NMSysconfigConnection *self) nm_settings_connection_is_visible (NMSettingsConnection *self)
{ {
g_return_val_if_fail (NM_SYSCONFIG_CONNECTION (self), FALSE); g_return_val_if_fail (NM_SETTINGS_CONNECTION (self), FALSE);
return NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self)->visible; return NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->visible;
} }
void void
nm_sysconfig_connection_recheck_visibility (NMSysconfigConnection *self) nm_settings_connection_recheck_visibility (NMSettingsConnection *self)
{ {
NMSysconfigConnectionPrivate *priv; NMSettingsConnectionPrivate *priv;
NMSettingConnection *s_con; NMSettingConnection *s_con;
guint32 num, i; guint32 num, i;
g_return_if_fail (NM_SYSCONFIG_CONNECTION (self)); g_return_if_fail (NM_SETTINGS_CONNECTION (self));
priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (NM_CONNECTION (self), s_con = (NMSettingConnection *) nm_connection_get_setting (NM_CONNECTION (self), NM_TYPE_SETTING_CONNECTION);
NM_TYPE_SETTING_CONNECTION));
g_assert (s_con); g_assert (s_con);
/* Check every user in the ACL for a session */ /* Check every user in the ACL for a session */
@@ -174,7 +173,7 @@ nm_sysconfig_connection_recheck_visibility (NMSysconfigConnection *self)
static void static void
session_changed_cb (NMSessionMonitor *self, gpointer user_data) session_changed_cb (NMSessionMonitor *self, gpointer user_data)
{ {
nm_sysconfig_connection_recheck_visibility (NM_SYSCONFIG_CONNECTION (user_data)); nm_settings_connection_recheck_visibility (NM_SETTINGS_CONNECTION (user_data));
} }
/**************************************************************/ /**************************************************************/
@@ -182,20 +181,20 @@ session_changed_cb (NMSessionMonitor *self, gpointer user_data)
/* Update the settings of this connection to match that of 'new', taking care to /* Update the settings of this connection to match that of 'new', taking care to
* make a private copy of secrets. */ * make a private copy of secrets. */
gboolean gboolean
nm_sysconfig_connection_replace_settings (NMSysconfigConnection *self, nm_settings_connection_replace_settings (NMSettingsConnection *self,
NMConnection *new, NMConnection *new,
GError **error) GError **error)
{ {
NMSysconfigConnectionPrivate *priv; NMSettingsConnectionPrivate *priv;
GHashTable *new_settings; GHashTable *new_settings;
gboolean success = FALSE; gboolean success = FALSE;
g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (NM_IS_SYSCONFIG_CONNECTION (self), FALSE); g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (self), FALSE);
g_return_val_if_fail (new != NULL, FALSE); g_return_val_if_fail (new != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (new), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (new), FALSE);
priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
new_settings = nm_connection_to_hash (new); new_settings = nm_connection_to_hash (new);
g_assert (new_settings); g_assert (new_settings);
@@ -207,7 +206,7 @@ nm_sysconfig_connection_replace_settings (NMSysconfigConnection *self,
g_object_unref (priv->secrets); g_object_unref (priv->secrets);
priv->secrets = nm_connection_duplicate (NM_CONNECTION (self)); priv->secrets = nm_connection_duplicate (NM_CONNECTION (self));
nm_sysconfig_connection_recheck_visibility (self); nm_settings_connection_recheck_visibility (self);
success = TRUE; success = TRUE;
} }
g_hash_table_destroy (new_settings); g_hash_table_destroy (new_settings);
@@ -215,7 +214,7 @@ nm_sysconfig_connection_replace_settings (NMSysconfigConnection *self,
} }
static void static void
ignore_cb (NMSysconfigConnection *connection, ignore_cb (NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
@@ -227,15 +226,15 @@ ignore_cb (NMSysconfigConnection *connection,
* 'user_data' along with any errors encountered. * 'user_data' along with any errors encountered.
*/ */
void void
nm_sysconfig_connection_replace_and_commit (NMSysconfigConnection *self, nm_settings_connection_replace_and_commit (NMSettingsConnection *self,
NMConnection *new, NMConnection *new,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
GError *error = NULL; GError *error = NULL;
g_return_if_fail (self != NULL); g_return_if_fail (self != NULL);
g_return_if_fail (NM_IS_SYSCONFIG_CONNECTION (self)); g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
g_return_if_fail (new != NULL); g_return_if_fail (new != NULL);
g_return_if_fail (NM_IS_CONNECTION (new)); g_return_if_fail (NM_IS_CONNECTION (new));
@@ -246,12 +245,12 @@ nm_sysconfig_connection_replace_and_commit (NMSysconfigConnection *self,
if (nm_connection_compare (NM_CONNECTION (self), if (nm_connection_compare (NM_CONNECTION (self),
NM_CONNECTION (new), NM_CONNECTION (new),
NM_SETTING_COMPARE_FLAG_EXACT)) { NM_SETTING_COMPARE_FLAG_EXACT)) {
callback (self, NULL, user_data); callback (self, NULL, user_data);
return; return;
} }
if (nm_sysconfig_connection_replace_settings (self, new, &error)) { if (nm_settings_connection_replace_settings (self, new, &error)) {
nm_sysconfig_connection_commit_changes (self, callback, user_data); nm_settings_connection_commit_changes (self, callback, user_data);
} else { } else {
callback (self, error, user_data); callback (self, error, user_data);
g_clear_error (&error); g_clear_error (&error);
@@ -259,18 +258,18 @@ nm_sysconfig_connection_replace_and_commit (NMSysconfigConnection *self,
} }
void void
nm_sysconfig_connection_commit_changes (NMSysconfigConnection *connection, nm_settings_connection_commit_changes (NMSettingsConnection *connection,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
g_return_if_fail (connection != NULL); g_return_if_fail (connection != NULL);
g_return_if_fail (NM_IS_SYSCONFIG_CONNECTION (connection)); g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
g_return_if_fail (callback != NULL); g_return_if_fail (callback != NULL);
if (NM_SYSCONFIG_CONNECTION_GET_CLASS (connection)->commit_changes) { if (NM_SETTINGS_CONNECTION_GET_CLASS (connection)->commit_changes) {
NM_SYSCONFIG_CONNECTION_GET_CLASS (connection)->commit_changes (connection, NM_SETTINGS_CONNECTION_GET_CLASS (connection)->commit_changes (connection,
callback, callback,
user_data); user_data);
} else { } else {
GError *error = g_error_new (NM_SETTINGS_ERROR, GError *error = g_error_new (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_INTERNAL_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
@@ -281,18 +280,18 @@ nm_sysconfig_connection_commit_changes (NMSysconfigConnection *connection,
} }
void void
nm_sysconfig_connection_delete (NMSysconfigConnection *connection, nm_settings_connection_delete (NMSettingsConnection *connection,
NMSysconfigConnectionDeleteFunc callback, NMSettingsConnectionDeleteFunc callback,
gpointer user_data) gpointer user_data)
{ {
g_return_if_fail (connection != NULL); g_return_if_fail (connection != NULL);
g_return_if_fail (NM_IS_SYSCONFIG_CONNECTION (connection)); g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
g_return_if_fail (callback != NULL); g_return_if_fail (callback != NULL);
if (NM_SYSCONFIG_CONNECTION_GET_CLASS (connection)->delete) { if (NM_SETTINGS_CONNECTION_GET_CLASS (connection)->delete) {
NM_SYSCONFIG_CONNECTION_GET_CLASS (connection)->delete (connection, NM_SETTINGS_CONNECTION_GET_CLASS (connection)->delete (connection,
callback, callback,
user_data); user_data);
} else { } else {
GError *error = g_error_new (NM_SETTINGS_ERROR, GError *error = g_error_new (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_INTERNAL_ERROR, NM_SETTINGS_ERROR_INTERNAL_ERROR,
@@ -303,8 +302,8 @@ nm_sysconfig_connection_delete (NMSysconfigConnection *connection,
} }
static void static void
commit_changes (NMSysconfigConnection *connection, commit_changes (NMSettingsConnection *connection,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
g_object_ref (connection); g_object_ref (connection);
@@ -314,9 +313,9 @@ commit_changes (NMSysconfigConnection *connection,
} }
static void static void
do_delete (NMSysconfigConnection *connection, do_delete (NMSettingsConnection *connection,
NMSysconfigConnectionDeleteFunc callback, NMSettingsConnectionDeleteFunc callback,
gpointer user_data) gpointer user_data)
{ {
g_object_ref (connection); g_object_ref (connection);
set_visible (connection, FALSE); set_visible (connection, FALSE);
@@ -328,7 +327,7 @@ do_delete (NMSysconfigConnection *connection,
/**************************************************************/ /**************************************************************/
static gboolean static gboolean
supports_secrets (NMSysconfigConnection *connection, const char *setting_name) supports_secrets (NMSettingsConnection *connection, const char *setting_name)
{ {
/* All secrets supported */ /* All secrets supported */
return TRUE; return TRUE;
@@ -409,8 +408,8 @@ destroy_gvalue (gpointer data)
} }
/** /**
* nm_sysconfig_connection_get_secrets: * nm_settings_connection_get_secrets:
* @connection: the #NMSysconfigConnection * @connection: the #NMSettingsConnection
* @setting_name: the setting to return secrets for * @setting_name: the setting to return secrets for
* @error: an error on return, if an error occured * @error: an error on return, if an error occured
* *
@@ -418,11 +417,11 @@ destroy_gvalue (gpointer data)
* Agents for secrets. * Agents for secrets.
**/ **/
GHashTable * GHashTable *
nm_sysconfig_connection_get_secrets (NMSysconfigConnection *connection, nm_settings_connection_get_secrets (NMSettingsConnection *connection,
const char *setting_name, const char *setting_name,
GError **error) GError **error)
{ {
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (connection); NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (connection);
GHashTable *settings = NULL; GHashTable *settings = NULL;
GHashTable *secrets = NULL; GHashTable *secrets = NULL;
NMSetting *setting; NMSetting *setting;
@@ -430,7 +429,7 @@ nm_sysconfig_connection_get_secrets (NMSysconfigConnection *connection,
/* Use priv->secrets to work around the fact that nm_connection_clear_secrets() /* Use priv->secrets to work around the fact that nm_connection_clear_secrets()
* will clear secrets on this object's settings. priv->secrets should be * will clear secrets on this object's settings. priv->secrets should be
* a complete copy of this object and kept in sync by * a complete copy of this object and kept in sync by
* nm_sysconfig_connection_replace_settings(). * nm_settings_connection_replace_settings().
*/ */
if (!priv->secrets) { if (!priv->secrets) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
@@ -466,10 +465,10 @@ nm_sysconfig_connection_get_secrets (NMSysconfigConnection *connection,
/**** User authorization **************************************/ /**** User authorization **************************************/
typedef void (*AuthCallback) (NMSysconfigConnection *connection, typedef void (*AuthCallback) (NMSettingsConnection *connection,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
GError *error, GError *error,
gpointer data); gpointer data);
static void static void
pk_auth_cb (NMAuthChain *chain, pk_auth_cb (NMAuthChain *chain,
@@ -477,8 +476,8 @@ pk_auth_cb (NMAuthChain *chain,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
gpointer user_data) gpointer user_data)
{ {
NMSysconfigConnection *self = NM_SYSCONFIG_CONNECTION (user_data); NMSettingsConnection *self = NM_SETTINGS_CONNECTION (user_data);
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
GError *error = NULL; GError *error = NULL;
NMAuthCallResult result; NMAuthCallResult result;
AuthCallback callback; AuthCallback callback;
@@ -486,7 +485,7 @@ pk_auth_cb (NMAuthChain *chain,
priv->pending_auths = g_slist_remove (priv->pending_auths, chain); priv->pending_auths = g_slist_remove (priv->pending_auths, chain);
/* If our NMSysconfigConnection is already gone, do nothing */ /* If our NMSettingsConnection is already gone, do nothing */
if (chain_error) { if (chain_error) {
error = g_error_new (NM_SETTINGS_ERROR, error = g_error_new (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_GENERAL, NM_SETTINGS_ERROR_GENERAL,
@@ -498,8 +497,8 @@ pk_auth_cb (NMAuthChain *chain,
/* Caller didn't successfully authenticate */ /* Caller didn't successfully authenticate */
if (result != NM_AUTH_CALL_RESULT_YES) { if (result != NM_AUTH_CALL_RESULT_YES) {
error = g_error_new_literal (NM_SETTINGS_ERROR, error = g_error_new_literal (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_NOT_PRIVILEGED, NM_SETTINGS_ERROR_NOT_PRIVILEGED,
"Insufficient privileges."); "Insufficient privileges.");
} }
} }
@@ -512,13 +511,13 @@ pk_auth_cb (NMAuthChain *chain,
} }
static void static void
auth_start (NMSysconfigConnection *self, auth_start (NMSettingsConnection *self,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
gboolean check_modify, gboolean check_modify,
AuthCallback callback, AuthCallback callback,
gpointer callback_data) gpointer callback_data)
{ {
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
NMAuthChain *chain; NMAuthChain *chain;
gulong sender_uid = G_MAXULONG; gulong sender_uid = G_MAXULONG;
GError *error = NULL; GError *error = NULL;
@@ -540,8 +539,8 @@ auth_start (NMSysconfigConnection *self,
sender_uid, sender_uid,
&error_desc)) { &error_desc)) {
error = g_error_new_literal (NM_SETTINGS_ERROR, error = g_error_new_literal (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_PERMISSION_DENIED, NM_SETTINGS_ERROR_PERMISSION_DENIED,
error_desc); error_desc);
g_free (error_desc); g_free (error_desc);
goto error; goto error;
} }
@@ -576,8 +575,7 @@ check_writable (NMConnection *connection, GError **error)
g_return_val_if_fail (connection != NULL, FALSE); g_return_val_if_fail (connection != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE); g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
NM_TYPE_SETTING_CONNECTION);
if (!s_con) { if (!s_con) {
g_set_error_literal (error, g_set_error_literal (error,
NM_SETTINGS_ERROR, NM_SETTINGS_ERROR,
@@ -602,7 +600,7 @@ check_writable (NMConnection *connection, GError **error)
} }
static void static void
get_settings_auth_cb (NMSysconfigConnection *self, get_settings_auth_cb (NMSettingsConnection *self,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
GError *error, GError *error,
gpointer data) gpointer data)
@@ -632,14 +630,14 @@ get_settings_auth_cb (NMSysconfigConnection *self,
} }
static void static void
impl_sysconfig_connection_get_settings (NMSysconfigConnection *self, impl_settings_connection_get_settings (NMSettingsConnection *self,
DBusGMethodInvocation *context) DBusGMethodInvocation *context)
{ {
auth_start (self, context, FALSE, get_settings_auth_cb, NULL); auth_start (self, context, FALSE, get_settings_auth_cb, NULL);
} }
static void static void
con_update_cb (NMSysconfigConnection *connection, con_update_cb (NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
@@ -652,10 +650,10 @@ con_update_cb (NMSysconfigConnection *connection,
} }
static void static void
update_auth_cb (NMSysconfigConnection *self, update_auth_cb (NMSettingsConnection *self,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
GError *error, GError *error,
gpointer data) gpointer data)
{ {
NMConnection *new_settings = data; NMConnection *new_settings = data;
@@ -665,19 +663,19 @@ update_auth_cb (NMSysconfigConnection *self,
} }
/* Update and commit our settings. */ /* Update and commit our settings. */
nm_sysconfig_connection_replace_and_commit (self, nm_settings_connection_replace_and_commit (self,
new_settings, new_settings,
con_update_cb, con_update_cb,
context); context);
out: out:
g_object_unref (new_settings); g_object_unref (new_settings);
} }
static void static void
impl_sysconfig_connection_update (NMSysconfigConnection *self, impl_settings_connection_update (NMSettingsConnection *self,
GHashTable *new_settings, GHashTable *new_settings,
DBusGMethodInvocation *context) DBusGMethodInvocation *context)
{ {
NMConnection *tmp; NMConnection *tmp;
GError *error = NULL; GError *error = NULL;
@@ -705,7 +703,7 @@ impl_sysconfig_connection_update (NMSysconfigConnection *self,
} }
static void static void
con_delete_cb (NMSysconfigConnection *connection, con_delete_cb (NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
@@ -718,22 +716,22 @@ con_delete_cb (NMSysconfigConnection *connection,
} }
static void static void
delete_auth_cb (NMSysconfigConnection *self, delete_auth_cb (NMSettingsConnection *self,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
GError *error, GError *error,
gpointer data) gpointer data)
{ {
if (error) { if (error) {
dbus_g_method_return_error (context, error); dbus_g_method_return_error (context, error);
return; return;
} }
nm_sysconfig_connection_delete (self, con_delete_cb, context); nm_settings_connection_delete (self, con_delete_cb, context);
} }
static void static void
impl_sysconfig_connection_delete (NMSysconfigConnection *self, impl_settings_connection_delete (NMSettingsConnection *self,
DBusGMethodInvocation *context) DBusGMethodInvocation *context)
{ {
GError *error = NULL; GError *error = NULL;
@@ -747,10 +745,10 @@ impl_sysconfig_connection_delete (NMSysconfigConnection *self,
} }
static void static void
secrets_auth_cb (NMSysconfigConnection *self, secrets_auth_cb (NMSettingsConnection *self,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
char *setting_name = user_data; char *setting_name = user_data;
GHashTable *secrets; GHashTable *secrets;
@@ -761,7 +759,7 @@ secrets_auth_cb (NMSysconfigConnection *self,
goto out; goto out;
} }
secrets = nm_sysconfig_connection_get_secrets (self, setting_name, &error); secrets = nm_settings_connection_get_secrets (self, setting_name, &error);
if (secrets) { if (secrets) {
dbus_g_method_return (context, secrets); dbus_g_method_return (context, secrets);
g_hash_table_destroy (secrets); g_hash_table_destroy (secrets);
@@ -775,9 +773,9 @@ out:
} }
static void static void
impl_sysconfig_connection_get_secrets (NMSysconfigConnection *self, impl_settings_connection_get_secrets (NMSettingsConnection *self,
const gchar *setting_name, const gchar *setting_name,
DBusGMethodInvocation *context) DBusGMethodInvocation *context)
{ {
auth_start (self, context, TRUE, secrets_auth_cb, g_strdup (setting_name)); auth_start (self, context, TRUE, secrets_auth_cb, g_strdup (setting_name));
} }
@@ -785,9 +783,9 @@ impl_sysconfig_connection_get_secrets (NMSysconfigConnection *self,
/**************************************************************/ /**************************************************************/
static void static void
nm_sysconfig_connection_init (NMSysconfigConnection *self) nm_settings_connection_init (NMSettingsConnection *self)
{ {
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
static guint32 dbus_counter = 0; static guint32 dbus_counter = 0;
char *dbus_path; char *dbus_path;
GError *error = NULL; GError *error = NULL;
@@ -815,8 +813,8 @@ nm_sysconfig_connection_init (NMSysconfigConnection *self)
static void static void
dispose (GObject *object) dispose (GObject *object)
{ {
NMSysconfigConnection *self = NM_SYSCONFIG_CONNECTION (object); NMSettingsConnection *self = NM_SETTINGS_CONNECTION (object);
NMSysconfigConnectionPrivate *priv = NM_SYSCONFIG_CONNECTION_GET_PRIVATE (self); NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
GSList *iter; GSList *iter;
if (priv->secrets) if (priv->secrets)
@@ -832,16 +830,16 @@ dispose (GObject *object)
g_object_unref (priv->session_monitor); g_object_unref (priv->session_monitor);
G_OBJECT_CLASS (nm_sysconfig_connection_parent_class)->dispose (object); G_OBJECT_CLASS (nm_settings_connection_parent_class)->dispose (object);
} }
static void static void
get_property (GObject *object, guint prop_id, get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec) GValue *value, GParamSpec *pspec)
{ {
switch (prop_id) { switch (prop_id) {
case PROP_VISIBLE: case PROP_VISIBLE:
g_value_set_boolean (value, NM_SYSCONFIG_CONNECTION_GET_PRIVATE (object)->visible); g_value_set_boolean (value, NM_SETTINGS_CONNECTION_GET_PRIVATE (object)->visible);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -851,17 +849,17 @@ get_property (GObject *object, guint prop_id,
static void static void
set_property (GObject *object, guint prop_id, set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec) const GValue *value, GParamSpec *pspec)
{ {
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
} }
static void static void
nm_sysconfig_connection_class_init (NMSysconfigConnectionClass *class) nm_settings_connection_class_init (NMSettingsConnectionClass *class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class);
g_type_class_add_private (class, sizeof (NMSysconfigConnectionPrivate)); g_type_class_add_private (class, sizeof (NMSettingsConnectionPrivate));
/* Virtual methods */ /* Virtual methods */
object_class->dispose = dispose; object_class->dispose = dispose;
@@ -875,7 +873,7 @@ nm_sysconfig_connection_class_init (NMSysconfigConnectionClass *class)
/* Properties */ /* Properties */
g_object_class_install_property g_object_class_install_property
(object_class, PROP_VISIBLE, (object_class, PROP_VISIBLE,
g_param_spec_boolean (NM_SYSCONFIG_CONNECTION_VISIBLE, g_param_spec_boolean (NM_SETTINGS_CONNECTION_VISIBLE,
"Visible", "Visible",
"Visible", "Visible",
FALSE, FALSE,
@@ -883,7 +881,7 @@ nm_sysconfig_connection_class_init (NMSysconfigConnectionClass *class)
/* Signals */ /* Signals */
signals[UPDATED] = signals[UPDATED] =
g_signal_new (NM_SYSCONFIG_CONNECTION_UPDATED, g_signal_new (NM_SETTINGS_CONNECTION_UPDATED,
G_TYPE_FROM_CLASS (class), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
0, 0,
@@ -892,7 +890,7 @@ nm_sysconfig_connection_class_init (NMSysconfigConnectionClass *class)
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
signals[REMOVED] = signals[REMOVED] =
g_signal_new (NM_SYSCONFIG_CONNECTION_REMOVED, g_signal_new (NM_SETTINGS_CONNECTION_REMOVED,
G_TYPE_FROM_CLASS (class), G_TYPE_FROM_CLASS (class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
0, 0,
@@ -901,6 +899,5 @@ nm_sysconfig_connection_class_init (NMSysconfigConnectionClass *class)
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (class), dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (class),
&dbus_glib_nm_sysconfig_connection_object_info); &dbus_glib_nm_settings_connection_object_info);
} }

View File

@@ -0,0 +1,101 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager system settings service
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*
* (C) Copyright 2008 Novell, Inc.
* (C) Copyright 2008 - 2011 Red Hat, Inc.
*/
#ifndef NM_SETTINGS_CONNECTION_H
#define NM_SETTINGS_CONNECTION_H
#include <nm-connection.h>
#include <dbus/dbus-glib.h>
G_BEGIN_DECLS
#define NM_TYPE_SETTINGS_CONNECTION (nm_settings_connection_get_type ())
#define NM_SETTINGS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS_CONNECTION, NMSettingsConnection))
#define NM_SETTINGS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTINGS_CONNECTION, NMSettingsConnectionClass))
#define NM_IS_SETTINGS_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS_CONNECTION))
#define NM_IS_SETTINGS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SETTINGS_CONNECTION))
#define NM_SETTINGS_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTINGS_CONNECTION, NMSettingsConnectionClass))
#define NM_SETTINGS_CONNECTION_UPDATED "updated"
#define NM_SETTINGS_CONNECTION_REMOVED "removed"
#define NM_SETTINGS_CONNECTION_VISIBLE "visible"
typedef struct _NMSettingsConnection NMSettingsConnection;
typedef struct _NMSettingsConnectionClass NMSettingsConnectionClass;
typedef void (*NMSettingsConnectionCommitFunc) (NMSettingsConnection *connection,
GError *error,
gpointer user_data);
typedef void (*NMSettingsConnectionDeleteFunc) (NMSettingsConnection *connection,
GError *error,
gpointer user_data);
struct _NMSettingsConnection {
NMConnection parent;
};
struct _NMSettingsConnectionClass {
NMConnectionClass parent;
void (*commit_changes) (NMSettingsConnection *connection,
NMSettingsConnectionCommitFunc callback,
gpointer user_data);
void (*delete) (NMSettingsConnection *connection,
NMSettingsConnectionDeleteFunc callback,
gpointer user_data);
gboolean (*supports_secrets) (NMSettingsConnection *connection,
const char *setting_name);
};
GType nm_settings_connection_get_type (void);
void nm_settings_connection_commit_changes (NMSettingsConnection *connection,
NMSettingsConnectionCommitFunc callback,
gpointer user_data);
gboolean nm_settings_connection_replace_settings (NMSettingsConnection *self,
NMConnection *new_settings,
GError **error);
void nm_settings_connection_replace_and_commit (NMSettingsConnection *self,
NMConnection *new_settings,
NMSettingsConnectionCommitFunc callback,
gpointer user_data);
void nm_settings_connection_delete (NMSettingsConnection *connection,
NMSettingsConnectionDeleteFunc callback,
gpointer user_data);
GHashTable *nm_settings_connection_get_secrets (NMSettingsConnection *connection,
const char *setting_name,
GError **error);
gboolean nm_settings_connection_is_visible (NMSettingsConnection *self);
void nm_settings_connection_recheck_visibility (NMSettingsConnection *self);
G_END_DECLS
#endif /* NM_SETTINGS_CONNECTION_H */

View File

@@ -54,7 +54,7 @@
#include "../nm-device-ethernet.h" #include "../nm-device-ethernet.h"
#include "nm-dbus-glib-types.h" #include "nm-dbus-glib-types.h"
#include "nm-settings.h" #include "nm-settings.h"
#include "nm-sysconfig-connection.h" #include "nm-settings-connection.h"
#include "nm-polkit-helpers.h" #include "nm-polkit-helpers.h"
#include "nm-settings-error.h" #include "nm-settings-error.h"
#include "nm-default-wired-connection.h" #include "nm-default-wired-connection.h"
@@ -75,13 +75,13 @@ EXPORT(nm_inotify_helper_get)
EXPORT(nm_inotify_helper_add_watch) EXPORT(nm_inotify_helper_add_watch)
EXPORT(nm_inotify_helper_remove_watch) EXPORT(nm_inotify_helper_remove_watch)
EXPORT(nm_sysconfig_connection_get_type) EXPORT(nm_settings_connection_get_type)
EXPORT(nm_sysconfig_connection_replace_settings) EXPORT(nm_settings_connection_replace_settings)
EXPORT(nm_sysconfig_connection_replace_and_commit) EXPORT(nm_settings_connection_replace_and_commit)
/* END LINKER CRACKROCK */ /* END LINKER CRACKROCK */
static void claim_connection (NMSettings *self, static void claim_connection (NMSettings *self,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
gboolean do_export); gboolean do_export);
static gboolean impl_settings_list_connections (NMSettings *self, static gboolean impl_settings_list_connections (NMSettings *self,
@@ -164,7 +164,7 @@ load_connections (NMSettings *self)
// priority plugin. // priority plugin.
for (elt = plugin_connections; elt; elt = g_slist_next (elt)) for (elt = plugin_connections; elt; elt = g_slist_next (elt))
claim_connection (self, NM_SYSCONFIG_CONNECTION (elt->data), TRUE); claim_connection (self, NM_SETTINGS_CONNECTION (elt->data), TRUE);
g_slist_free (plugin_connections); g_slist_free (plugin_connections);
} }
@@ -196,7 +196,7 @@ nm_settings_for_each_connection (NMSettings *self,
g_hash_table_iter_init (&iter, priv->connections); g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, &data)) while (g_hash_table_iter_next (&iter, NULL, &data))
for_each_func (self, NM_SYSCONFIG_CONNECTION (data), user_data); for_each_func (self, NM_SETTINGS_CONNECTION (data), user_data);
} }
static gboolean static gboolean
@@ -243,7 +243,7 @@ connection_sort (gconstpointer pa, gconstpointer pb)
return 1; return 1;
} }
/* Returns a list of NMSysconfigConnections. Caller must free the list with /* Returns a list of NMSettingsConnections. Caller must free the list with
* g_slist_free(). * g_slist_free().
*/ */
GSList * GSList *
@@ -261,7 +261,7 @@ nm_settings_get_connections (NMSettings *self)
return list; return list;
} }
NMSysconfigConnection * NMSettingsConnection *
nm_settings_get_connection_by_path (NMSettings *self, const char *path) nm_settings_get_connection_by_path (NMSettings *self, const char *path)
{ {
NMSettingsPrivate *priv; NMSettingsPrivate *priv;
@@ -274,7 +274,7 @@ nm_settings_get_connection_by_path (NMSettings *self, const char *path)
load_connections (self); load_connections (self);
return (NMSysconfigConnection *) g_hash_table_lookup (priv->connections, path); return (NMSettingsConnection *) g_hash_table_lookup (priv->connections, path);
} }
static void static void
@@ -389,7 +389,7 @@ nm_settings_get_hostname (NMSettings *self)
static void static void
plugin_connection_added (NMSystemConfigInterface *config, plugin_connection_added (NMSystemConfigInterface *config,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
gpointer user_data) gpointer user_data)
{ {
claim_connection (NM_SETTINGS (user_data), connection, TRUE); claim_connection (NM_SETTINGS (user_data), connection, TRUE);
@@ -586,7 +586,7 @@ load_plugins (NMSettings *self, const char *plugins, GError **error)
#define VISIBLE_ID_TAG "visible-id-tag" #define VISIBLE_ID_TAG "visible-id-tag"
static void static void
connection_removed (NMSysconfigConnection *obj, gpointer user_data) connection_removed (NMSettingsConnection *obj, gpointer user_data)
{ {
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (user_data); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (user_data);
GObject *connection = G_OBJECT (obj); GObject *connection = G_OBJECT (obj);
@@ -626,7 +626,7 @@ connection_removed (NMSysconfigConnection *obj, gpointer user_data)
} }
static void static void
connection_updated (NMSysconfigConnection *connection, gpointer user_data) connection_updated (NMSettingsConnection *connection, gpointer user_data)
{ {
/* Re-emit for listeners like NMPolicy */ /* Re-emit for listeners like NMPolicy */
g_signal_emit (NM_SETTINGS (user_data), g_signal_emit (NM_SETTINGS (user_data),
@@ -636,7 +636,7 @@ connection_updated (NMSysconfigConnection *connection, gpointer user_data)
} }
static void static void
connection_visibility_changed (NMSysconfigConnection *connection, connection_visibility_changed (NMSettingsConnection *connection,
GParamSpec *pspec, GParamSpec *pspec,
gpointer user_data) gpointer user_data)
{ {
@@ -649,7 +649,7 @@ connection_visibility_changed (NMSysconfigConnection *connection,
static void static void
claim_connection (NMSettings *self, claim_connection (NMSettings *self,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
gboolean do_export) gboolean do_export)
{ {
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
@@ -660,7 +660,7 @@ claim_connection (NMSettings *self,
char *path; char *path;
guint id; guint id;
g_return_if_fail (NM_IS_SYSCONFIG_CONNECTION (connection)); g_return_if_fail (NM_IS_SETTINGS_CONNECTION (connection));
g_return_if_fail (nm_connection_get_path (NM_CONNECTION (connection)) == NULL); g_return_if_fail (nm_connection_get_path (NM_CONNECTION (connection)) == NULL);
g_hash_table_iter_init (&iter, priv->connections); g_hash_table_iter_init (&iter, priv->connections);
@@ -679,19 +679,19 @@ claim_connection (NMSettings *self,
} }
/* Ensure it's initial visibility is up-to-date */ /* Ensure it's initial visibility is up-to-date */
nm_sysconfig_connection_recheck_visibility (connection); nm_settings_connection_recheck_visibility (connection);
id = g_signal_connect (connection, NM_SYSCONFIG_CONNECTION_REMOVED, id = g_signal_connect (connection, NM_SETTINGS_CONNECTION_REMOVED,
G_CALLBACK (connection_removed), G_CALLBACK (connection_removed),
self); self);
g_object_set_data (G_OBJECT (connection), REMOVED_ID_TAG, GUINT_TO_POINTER (id)); g_object_set_data (G_OBJECT (connection), REMOVED_ID_TAG, GUINT_TO_POINTER (id));
id = g_signal_connect (connection, NM_SYSCONFIG_CONNECTION_UPDATED, id = g_signal_connect (connection, NM_SETTINGS_CONNECTION_UPDATED,
G_CALLBACK (connection_updated), G_CALLBACK (connection_updated),
self); self);
g_object_set_data (G_OBJECT (connection), UPDATED_ID_TAG, GUINT_TO_POINTER (id)); g_object_set_data (G_OBJECT (connection), UPDATED_ID_TAG, GUINT_TO_POINTER (id));
id = g_signal_connect (connection, "notify::" NM_SYSCONFIG_CONNECTION_VISIBLE, id = g_signal_connect (connection, "notify::" NM_SETTINGS_CONNECTION_VISIBLE,
G_CALLBACK (connection_visibility_changed), G_CALLBACK (connection_visibility_changed),
self); self);
g_object_set_data (G_OBJECT (connection), VISIBLE_ID_TAG, GUINT_TO_POINTER (id)); g_object_set_data (G_OBJECT (connection), VISIBLE_ID_TAG, GUINT_TO_POINTER (id));
@@ -726,31 +726,31 @@ claim_connection (NMSettings *self,
// *needs* a better name! // *needs* a better name!
static void static void
remove_default_wired_connection (NMSettings *self, remove_default_wired_connection (NMSettings *self,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
gboolean do_signal) gboolean do_signal)
{ {
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
const char *path = nm_connection_get_path (NM_CONNECTION (connection)); const char *path = nm_connection_get_path (NM_CONNECTION (connection));
if (g_hash_table_lookup (priv->connections, path)) { if (g_hash_table_lookup (priv->connections, path)) {
g_signal_emit_by_name (G_OBJECT (connection), NM_SYSCONFIG_CONNECTION_REMOVED); g_signal_emit_by_name (G_OBJECT (connection), NM_SETTINGS_SIGNAL_CONNECTION_REMOVED);
g_hash_table_remove (priv->connections, path); g_hash_table_remove (priv->connections, path);
} }
} }
static NMSysconfigConnection * static NMSettingsConnection *
add_new_connection (NMSettings *self, add_new_connection (NMSettings *self,
NMConnection *connection, NMConnection *connection,
GError **error) GError **error)
{ {
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
GSList *iter; GSList *iter;
NMSysconfigConnection *added = NULL; NMSettingsConnection *added = NULL;
/* 1) plugin writes the NMConnection to disk /* 1) plugin writes the NMConnection to disk
* 2) plugin creates a new NMSysconfigConnection subclass with the settings * 2) plugin creates a new NMSettingsConnection subclass with the settings
* from the NMConnection and returns it to the settings service * from the NMConnection and returns it to the settings service
* 3) settings service exports the new NMSysconfigConnection subclass * 3) settings service exports the new NMSettingsConnection subclass
* 4) plugin notices that something on the filesystem has changed * 4) plugin notices that something on the filesystem has changed
* 5) plugin reads the changes and ignores them because they will * 5) plugin reads the changes and ignores them because they will
* contain the same data as the connection it already knows about * contain the same data as the connection it already knows about
@@ -781,7 +781,7 @@ pk_add_cb (NMAuthChain *chain,
NMAuthCallResult result; NMAuthCallResult result;
GError *error = NULL, *add_error = NULL; GError *error = NULL, *add_error = NULL;
NMConnection *connection; NMConnection *connection;
NMSysconfigConnection *added = NULL; NMSettingsConnection *added = NULL;
gulong caller_uid = G_MAXULONG; gulong caller_uid = G_MAXULONG;
char *error_desc = NULL; char *error_desc = NULL;
NMSettingsAddCallback callback; NMSettingsAddCallback callback;
@@ -858,7 +858,7 @@ done:
static void static void
add_cb (NMSettings *self, add_cb (NMSettings *self,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
gpointer user_data) gpointer user_data)
@@ -935,7 +935,7 @@ pk_hostname_cb (NMAuthChain *chain,
priv->auths = g_slist_remove (priv->auths, chain); priv->auths = g_slist_remove (priv->auths, chain);
/* If our NMSysconfigConnection is already gone, do nothing */ /* If our NMSettingsConnection is already gone, do nothing */
if (chain_error) { if (chain_error) {
error = g_error_new (NM_SETTINGS_ERROR, error = g_error_new (NM_SETTINGS_ERROR,
NM_SETTINGS_ERROR_GENERAL, NM_SETTINGS_ERROR_GENERAL,
@@ -1209,7 +1209,7 @@ cleanup:
} }
static void static void
delete_cb (NMSysconfigConnection *connection, GError *error, gpointer user_data) delete_cb (NMSettingsConnection *connection, GError *error, gpointer user_data)
{ {
} }
@@ -1220,7 +1220,7 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
GError *error = NULL; GError *error = NULL;
NMSettingConnection *s_con; NMSettingConnection *s_con;
const char *id; const char *id;
NMSysconfigConnection *added; NMSettingsConnection *added;
/* Try to move this default wired conneciton to a plugin so that it has /* Try to move this default wired conneciton to a plugin so that it has
* persistent storage. * persistent storage.
@@ -1232,12 +1232,10 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
id = nm_setting_connection_get_id (s_con); id = nm_setting_connection_get_id (s_con);
g_assert (id); g_assert (id);
remove_default_wired_connection (self, NM_SYSCONFIG_CONNECTION (wired), FALSE); remove_default_wired_connection (self, NM_SETTINGS_CONNECTION (wired), FALSE);
added = add_new_connection (self, NM_CONNECTION (wired), &error); added = add_new_connection (self, NM_CONNECTION (wired), &error);
if (added) { if (added) {
nm_sysconfig_connection_delete (NM_SYSCONFIG_CONNECTION (wired), nm_settings_connection_delete (NM_SETTINGS_CONNECTION (wired), delete_cb, NULL);
delete_cb,
NULL);
g_object_set_data (G_OBJECT (nm_default_wired_connection_get_device (wired)), g_object_set_data (G_OBJECT (nm_default_wired_connection_get_device (wired)),
DEFAULT_WIRED_TAG, DEFAULT_WIRED_TAG,
@@ -1256,7 +1254,7 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
* but add it back to the system settings service. Connection is already * but add it back to the system settings service. Connection is already
* exported on the bus, don't export it again, thus do_export == FALSE. * exported on the bus, don't export it again, thus do_export == FALSE.
*/ */
claim_connection (self, NM_SYSCONFIG_CONNECTION (wired), FALSE); claim_connection (self, NM_SETTINGS_CONNECTION (wired), FALSE);
return TRUE; return TRUE;
} }
@@ -1307,7 +1305,7 @@ nm_settings_device_added (NMSettings *self, NMDevice *device)
g_signal_connect (wired, "try-update", (GCallback) default_wired_try_update, self); g_signal_connect (wired, "try-update", (GCallback) default_wired_try_update, self);
g_signal_connect (wired, "deleted", (GCallback) default_wired_deleted, self); g_signal_connect (wired, "deleted", (GCallback) default_wired_deleted, self);
claim_connection (self, NM_SYSCONFIG_CONNECTION (wired), TRUE); claim_connection (self, NM_SETTINGS_CONNECTION (wired), TRUE);
g_object_unref (wired); g_object_unref (wired);
g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_TAG, wired); g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_TAG, wired);
@@ -1326,7 +1324,7 @@ nm_settings_device_removed (NMSettings *self, NMDevice *device)
connection = (NMDefaultWiredConnection *) g_object_get_data (G_OBJECT (device), DEFAULT_WIRED_TAG); connection = (NMDefaultWiredConnection *) g_object_get_data (G_OBJECT (device), DEFAULT_WIRED_TAG);
if (connection) if (connection)
remove_default_wired_connection (self, NM_SYSCONFIG_CONNECTION (connection), TRUE); remove_default_wired_connection (self, NM_SETTINGS_CONNECTION (connection), TRUE);
} }
/***************************************************************/ /***************************************************************/
@@ -1508,7 +1506,7 @@ nm_settings_class_init (NMSettingsClass *class)
g_cclosure_marshal_VOID__BOXED, g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT); G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT);
signals[CONNECTION_ADDED] = signals[CONNECTION_ADDED] =
g_signal_new (NM_SETTINGS_CONNECTION_ADDED, g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_ADDED,
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsClass, connection_added), G_STRUCT_OFFSET (NMSettingsClass, connection_added),
@@ -1517,7 +1515,7 @@ nm_settings_class_init (NMSettingsClass *class)
G_TYPE_NONE, 1, G_TYPE_OBJECT); G_TYPE_NONE, 1, G_TYPE_OBJECT);
signals[CONNECTION_UPDATED] = signals[CONNECTION_UPDATED] =
g_signal_new (NM_SETTINGS_CONNECTION_UPDATED, g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_UPDATED,
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsClass, connection_updated), G_STRUCT_OFFSET (NMSettingsClass, connection_updated),
@@ -1526,7 +1524,7 @@ nm_settings_class_init (NMSettingsClass *class)
G_TYPE_NONE, 1, G_TYPE_OBJECT); G_TYPE_NONE, 1, G_TYPE_OBJECT);
signals[CONNECTION_REMOVED] = signals[CONNECTION_REMOVED] =
g_signal_new (NM_SETTINGS_CONNECTION_REMOVED, g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_REMOVED,
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsClass, connection_removed), G_STRUCT_OFFSET (NMSettingsClass, connection_removed),
@@ -1535,7 +1533,7 @@ nm_settings_class_init (NMSettingsClass *class)
G_TYPE_NONE, 1, G_TYPE_OBJECT); G_TYPE_NONE, 1, G_TYPE_OBJECT);
signals[CONNECTION_VISIBILITY_CHANGED] = signals[CONNECTION_VISIBILITY_CHANGED] =
g_signal_new (NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED, g_signal_new (NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED,
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsClass, connection_visibility_changed), G_STRUCT_OFFSET (NMSettingsClass, connection_visibility_changed),
@@ -1544,7 +1542,7 @@ nm_settings_class_init (NMSettingsClass *class)
G_TYPE_NONE, 1, G_TYPE_OBJECT); G_TYPE_NONE, 1, G_TYPE_OBJECT);
signals[CONNECTIONS_LOADED] = signals[CONNECTIONS_LOADED] =
g_signal_new (NM_SETTINGS_CONNECTIONS_LOADED, g_signal_new (NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED,
G_OBJECT_CLASS_TYPE (object_class), G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST, G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsClass, connections_loaded), G_STRUCT_OFFSET (NMSettingsClass, connections_loaded),

View File

@@ -28,7 +28,7 @@
#include <nm-connection.h> #include <nm-connection.h>
#include "nm-sysconfig-connection.h" #include "nm-settings-connection.h"
#include "nm-system-config-interface.h" #include "nm-system-config-interface.h"
#include "nm-device.h" #include "nm-device.h"
@@ -43,11 +43,11 @@
#define NM_SETTINGS_HOSTNAME "hostname" #define NM_SETTINGS_HOSTNAME "hostname"
#define NM_SETTINGS_CAN_MODIFY "can-modify" #define NM_SETTINGS_CAN_MODIFY "can-modify"
#define NM_SETTINGS_CONNECTION_ADDED "connection-added" #define NM_SETTINGS_SIGNAL_CONNECTION_ADDED "connection-added"
#define NM_SETTINGS_CONNECTION_UPDATED "connection-updated" #define NM_SETTINGS_SIGNAL_CONNECTION_UPDATED "connection-updated"
#define NM_SETTINGS_CONNECTION_REMOVED "connection-removed" #define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-removed"
#define NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed" #define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed"
#define NM_SETTINGS_CONNECTIONS_LOADED "connections-loaded" #define NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED "connections-loaded"
typedef struct { typedef struct {
GObject parent_instance; GObject parent_instance;
@@ -77,7 +77,7 @@ NMSettings *nm_settings_new (const char *config_file,
GError **error); GError **error);
typedef void (*NMSettingsForEachFunc) (NMSettings *settings, typedef void (*NMSettingsForEachFunc) (NMSettings *settings,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
gpointer user_data); gpointer user_data);
void nm_settings_for_each_connection (NMSettings *settings, void nm_settings_for_each_connection (NMSettings *settings,
@@ -85,7 +85,7 @@ void nm_settings_for_each_connection (NMSettings *settings,
gpointer user_data); gpointer user_data);
typedef void (*NMSettingsAddCallback) (NMSettings *settings, typedef void (*NMSettingsAddCallback) (NMSettings *settings,
NMSysconfigConnection *connection, NMSettingsConnection *connection,
GError *error, GError *error,
DBusGMethodInvocation *context, DBusGMethodInvocation *context,
gpointer user_data); gpointer user_data);
@@ -96,13 +96,13 @@ void nm_settings_add_connection (NMSettings *self,
NMSettingsAddCallback callback, NMSettingsAddCallback callback,
gpointer user_data); gpointer user_data);
/* Returns a list of NMSysconfigConnections. Caller must free the list with /* Returns a list of NMSettingsConnections. Caller must free the list with
* g_slist_free(). * g_slist_free().
*/ */
GSList *nm_settings_get_connections (NMSettings *settings); GSList *nm_settings_get_connections (NMSettings *settings);
NMSysconfigConnection *nm_settings_get_connection_by_path (NMSettings *settings, NMSettingsConnection *nm_settings_get_connection_by_path (NMSettings *settings,
const char *path); const char *path);
const GSList *nm_settings_get_unmanaged_specs (NMSettings *self); const GSList *nm_settings_get_unmanaged_specs (NMSettings *self);

View File

@@ -1,101 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager system settings service
*
* 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
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*
* (C) Copyright 2008 Novell, Inc.
* (C) Copyright 2008 - 2011 Red Hat, Inc.
*/
#ifndef NM_SYSCONFIG_CONNECTION_H
#define NM_SYSCONFIG_CONNECTION_H
#include <nm-connection.h>
#include <dbus/dbus-glib.h>
G_BEGIN_DECLS
#define NM_TYPE_SYSCONFIG_CONNECTION (nm_sysconfig_connection_get_type ())
#define NM_SYSCONFIG_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SYSCONFIG_CONNECTION, NMSysconfigConnection))
#define NM_SYSCONFIG_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SYSCONFIG_CONNECTION, NMSysconfigConnectionClass))
#define NM_IS_SYSCONFIG_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SYSCONFIG_CONNECTION))
#define NM_IS_SYSCONFIG_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SYSCONFIG_CONNECTION))
#define NM_SYSCONFIG_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SYSCONFIG_CONNECTION, NMSysconfigConnectionClass))
#define NM_SYSCONFIG_CONNECTION_UPDATED "updated"
#define NM_SYSCONFIG_CONNECTION_REMOVED "removed"
#define NM_SYSCONFIG_CONNECTION_VISIBLE "visible"
typedef struct _NMSysconfigConnection NMSysconfigConnection;
typedef struct _NMSysconfigConnectionClass NMSysconfigConnectionClass;
typedef void (*NMSysconfigConnectionCommitFunc) (NMSysconfigConnection *connection,
GError *error,
gpointer user_data);
typedef void (*NMSysconfigConnectionDeleteFunc) (NMSysconfigConnection *connection,
GError *error,
gpointer user_data);
struct _NMSysconfigConnection {
NMConnection parent;
};
struct _NMSysconfigConnectionClass {
NMConnectionClass parent;
void (*commit_changes) (NMSysconfigConnection *connection,
NMSysconfigConnectionCommitFunc callback,
gpointer user_data);
void (*delete) (NMSysconfigConnection *connection,
NMSysconfigConnectionDeleteFunc callback,
gpointer user_data);
gboolean (*supports_secrets) (NMSysconfigConnection *connection,
const char *setting_name);
};
GType nm_sysconfig_connection_get_type (void);
void nm_sysconfig_connection_commit_changes (NMSysconfigConnection *connection,
NMSysconfigConnectionCommitFunc callback,
gpointer user_data);
gboolean nm_sysconfig_connection_replace_settings (NMSysconfigConnection *self,
NMConnection *new_settings,
GError **error);
void nm_sysconfig_connection_replace_and_commit (NMSysconfigConnection *self,
NMConnection *new_settings,
NMSysconfigConnectionCommitFunc callback,
gpointer user_data);
void nm_sysconfig_connection_delete (NMSysconfigConnection *connection,
NMSysconfigConnectionDeleteFunc callback,
gpointer user_data);
GHashTable *nm_sysconfig_connection_get_secrets (NMSysconfigConnection *connection,
const char *setting_name,
GError **error);
gboolean nm_sysconfig_connection_is_visible (NMSysconfigConnection *self);
void nm_sysconfig_connection_recheck_visibility (NMSysconfigConnection *self);
G_END_DECLS
#endif /* NM_SYSCONFIG_CONNECTION_H */

View File

@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2007 - 2010 Red Hat, Inc. * Copyright (C) 2007 - 2011 Red Hat, Inc.
* Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Novell, Inc.
*/ */
@@ -73,7 +73,7 @@ interface_init (gpointer g_iface)
NULL, NULL, NULL, NULL,
g_cclosure_marshal_VOID__OBJECT, g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
NM_TYPE_SYSCONFIG_CONNECTION); NM_TYPE_SETTINGS_CONNECTION);
g_signal_new (NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED, g_signal_new (NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED,
iface_type, iface_type,
@@ -146,7 +146,7 @@ nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config)
return NULL; return NULL;
} }
NMSysconfigConnection * NMSettingsConnection *
nm_system_config_interface_add_connection (NMSystemConfigInterface *config, nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
NMConnection *connection, NMConnection *connection,
GError **error) GError **error)

View File

@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2007 - 2010 Red Hat, Inc. * Copyright (C) 2007 - 2011 Red Hat, Inc.
* Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Novell, Inc.
*/ */
@@ -25,7 +25,7 @@
#include <glib.h> #include <glib.h>
#include <glib-object.h> #include <glib-object.h>
#include <nm-connection.h> #include <nm-connection.h>
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -90,7 +90,7 @@ struct _NMSystemConfigInterface {
/* Called when the plugin is loaded to initialize it */ /* Called when the plugin is loaded to initialize it */
void (*init) (NMSystemConfigInterface *config); void (*init) (NMSystemConfigInterface *config);
/* Returns a GSList of NMSysconfigConnection objects that represent /* Returns a GSList of NMSettingsConnection objects that represent
* connections the plugin knows about. The returned list is freed by the * connections the plugin knows about. The returned list is freed by the
* system settings service. * system settings service.
*/ */
@@ -118,18 +118,18 @@ struct _NMSystemConfigInterface {
/* /*
* Save the given connection to backing storage, and return a new * Save the given connection to backing storage, and return a new
* NMSysconfigConnection subclass that contains the same settings as the * NMSettingsConnection subclass that contains the same settings as the
* original connection. * original connection.
*/ */
NMSysconfigConnection * (*add_connection) (NMSystemConfigInterface *config, NMSettingsConnection * (*add_connection) (NMSystemConfigInterface *config,
NMConnection *connection, NMConnection *connection,
GError **error); GError **error);
/* Signals */ /* Signals */
/* Emitted when a new connection has been found by the plugin */ /* Emitted when a new connection has been found by the plugin */
void (*connection_added) (NMSystemConfigInterface *config, void (*connection_added) (NMSystemConfigInterface *config,
NMSysconfigConnection *connection); NMSettingsConnection *connection);
/* Emitted when the list of unmanaged device specifications changes */ /* Emitted when the list of unmanaged device specifications changes */
void (*unmanaged_specs_changed) (NMSystemConfigInterface *config); void (*unmanaged_specs_changed) (NMSystemConfigInterface *config);
@@ -144,9 +144,9 @@ GSList *nm_system_config_interface_get_connections (NMSystemConfigInterface *con
GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config); GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config);
NMSysconfigConnection *nm_system_config_interface_add_connection (NMSystemConfigInterface *config, NMSettingsConnection *nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
NMConnection *connection, NMConnection *connection,
GError **error); GError **error);
G_END_DECLS G_END_DECLS

View File

@@ -40,7 +40,7 @@
#include "writer.h" #include "writer.h"
#include "nm-inotify-helper.h" #include "nm-inotify-helper.h"
G_DEFINE_TYPE (NMIfcfgConnection, nm_ifcfg_connection, NM_TYPE_SYSCONFIG_CONNECTION) G_DEFINE_TYPE (NMIfcfgConnection, nm_ifcfg_connection, NM_TYPE_SETTINGS_CONNECTION)
#define NM_IFCFG_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFCFG_CONNECTION, NMIfcfgConnectionPrivate)) #define NM_IFCFG_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFCFG_CONNECTION, NMIfcfgConnectionPrivate))
@@ -134,7 +134,7 @@ nm_ifcfg_connection_new (const char *full_path,
goto out; goto out;
/* Update our settings with what was read from the file */ /* Update our settings with what was read from the file */
if (!nm_sysconfig_connection_replace_settings (NM_SYSCONFIG_CONNECTION (object), tmp, error)) { if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), tmp, error)) {
g_object_unref (object); g_object_unref (object);
object = NULL; object = NULL;
goto out; goto out;
@@ -179,8 +179,8 @@ nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self)
} }
static void static void
commit_changes (NMSysconfigConnection *connection, commit_changes (NMSettingsConnection *connection,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection); NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection);
@@ -218,12 +218,12 @@ commit_changes (NMSysconfigConnection *connection,
out: out:
if (reread) if (reread)
g_object_unref (reread); g_object_unref (reread);
NM_SYSCONFIG_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->commit_changes (connection, callback, user_data); NM_SETTINGS_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->commit_changes (connection, callback, user_data);
} }
static void static void
do_delete (NMSysconfigConnection *connection, do_delete (NMSettingsConnection *connection,
NMSysconfigConnectionDeleteFunc callback, NMSettingsConnectionDeleteFunc callback,
gpointer user_data) gpointer user_data)
{ {
NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection); NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection);
@@ -237,7 +237,7 @@ do_delete (NMSysconfigConnection *connection,
if (priv->route6file) if (priv->route6file)
g_unlink (priv->route6file); g_unlink (priv->route6file);
NM_SYSCONFIG_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->delete (connection, callback, user_data); NM_SETTINGS_CONNECTION_CLASS (nm_ifcfg_connection_parent_class)->delete (connection, callback, user_data);
} }
/* GObject */ /* GObject */
@@ -315,7 +315,7 @@ static void
nm_ifcfg_connection_class_init (NMIfcfgConnectionClass *ifcfg_connection_class) nm_ifcfg_connection_class_init (NMIfcfgConnectionClass *ifcfg_connection_class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (ifcfg_connection_class); GObjectClass *object_class = G_OBJECT_CLASS (ifcfg_connection_class);
NMSysconfigConnectionClass *sysconfig_class = NM_SYSCONFIG_CONNECTION_CLASS (ifcfg_connection_class); NMSettingsConnectionClass *settings_class = NM_SETTINGS_CONNECTION_CLASS (ifcfg_connection_class);
g_type_class_add_private (ifcfg_connection_class, sizeof (NMIfcfgConnectionPrivate)); g_type_class_add_private (ifcfg_connection_class, sizeof (NMIfcfgConnectionPrivate));
@@ -323,8 +323,8 @@ nm_ifcfg_connection_class_init (NMIfcfgConnectionClass *ifcfg_connection_class)
object_class->set_property = set_property; object_class->set_property = set_property;
object_class->get_property = get_property; object_class->get_property = get_property;
object_class->finalize = finalize; object_class->finalize = finalize;
sysconfig_class->delete = do_delete; settings_class->delete = do_delete;
sysconfig_class->commit_changes = commit_changes; settings_class->commit_changes = commit_changes;
/* Properties */ /* Properties */
g_object_class_install_property g_object_class_install_property

View File

@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2008 Red Hat, Inc. * Copyright (C) 2008 - 2011 Red Hat, Inc.
*/ */
#ifndef NM_IFCFG_CONNECTION_H #ifndef NM_IFCFG_CONNECTION_H
@@ -24,7 +24,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#include <NetworkManager.h> #include <NetworkManager.h>
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
#define NM_TYPE_IFCFG_CONNECTION (nm_ifcfg_connection_get_type ()) #define NM_TYPE_IFCFG_CONNECTION (nm_ifcfg_connection_get_type ())
#define NM_IFCFG_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IFCFG_CONNECTION, NMIfcfgConnection)) #define NM_IFCFG_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IFCFG_CONNECTION, NMIfcfgConnection))
@@ -36,11 +36,11 @@ G_BEGIN_DECLS
#define NM_IFCFG_CONNECTION_UNMANAGED "unmanaged" #define NM_IFCFG_CONNECTION_UNMANAGED "unmanaged"
typedef struct { typedef struct {
NMSysconfigConnection parent; NMSettingsConnection parent;
} NMIfcfgConnection; } NMIfcfgConnection;
typedef struct { typedef struct {
NMSysconfigConnectionClass parent; NMSettingsConnectionClass parent;
} NMIfcfgConnectionClass; } NMIfcfgConnectionClass;
GType nm_ifcfg_connection_get_type (void); GType nm_ifcfg_connection_get_type (void);

View File

@@ -18,7 +18,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2007 - 2010 Red Hat, Inc. * Copyright (C) 2007 - 2011 Red Hat, Inc.
*/ */
#include <config.h> #include <config.h>
@@ -195,10 +195,10 @@ read_connections (SCPluginIfcfg *plugin)
/* Monitoring */ /* Monitoring */
/* Callback for nm_sysconfig_connection_replace_and_commit. Report any errors /* Callback for nm_settings_connection_replace_and_commit. Report any errors
* encountered when commiting connection settings updates. */ * encountered when commiting connection settings updates. */
static void static void
commit_cb (NMSysconfigConnection *connection, GError *error, gpointer unused) commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused)
{ {
if (error) { if (error) {
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " error updating: %s", PLUGIN_WARN (IFCFG_PLUGIN_NAME, " error updating: %s",
@@ -221,7 +221,7 @@ remove_connection (SCPluginIfcfg *self, NMIfcfgConnection *connection)
g_object_ref (connection); g_object_ref (connection);
g_hash_table_remove (priv->connections, path); g_hash_table_remove (priv->connections, path);
g_signal_emit_by_name (connection, NM_SYSCONFIG_CONNECTION_REMOVED); g_signal_emit_by_name (connection, NM_SETTINGS_CONNECTION_REMOVED);
g_object_unref (connection); g_object_unref (connection);
/* Emit unmanaged changes _after_ removing the connection */ /* Emit unmanaged changes _after_ removing the connection */
@@ -294,7 +294,7 @@ connection_new_or_changed (SCPluginIfcfg *self,
* been removed, and notify the settings service by signalling that * been removed, and notify the settings service by signalling that
* unmanaged specs have changed. * unmanaged specs have changed.
*/ */
g_signal_emit_by_name (existing, NM_SYSCONFIG_CONNECTION_REMOVED); g_signal_emit_by_name (existing, NM_SETTINGS_CONNECTION_REMOVED);
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
} }
} else { } else {
@@ -312,9 +312,9 @@ connection_new_or_changed (SCPluginIfcfg *self,
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, existing); g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, existing);
} }
nm_sysconfig_connection_replace_and_commit (NM_SYSCONFIG_CONNECTION (existing), nm_settings_connection_replace_and_commit (NM_SETTINGS_CONNECTION (existing),
NM_CONNECTION (new), NM_CONNECTION (new),
commit_cb, NULL); commit_cb, NULL);
/* Update unmanaged status */ /* Update unmanaged status */
g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL); g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL);
@@ -445,7 +445,7 @@ get_unmanaged_specs (NMSystemConfigInterface *config)
return list; return list;
} }
static NMSysconfigConnection * static NMSettingsConnection *
add_connection (NMSystemConfigInterface *config, add_connection (NMSystemConfigInterface *config,
NMConnection *connection, NMConnection *connection,
GError **error) GError **error)
@@ -459,7 +459,7 @@ add_connection (NMSystemConfigInterface *config,
added = _internal_new_connection (self, path, connection, error); added = _internal_new_connection (self, path, connection, error);
g_free (path); g_free (path);
} }
return (NMSysconfigConnection *) added; return (NMSettingsConnection *) added;
} }
#define SC_NETWORK_FILE SYSCONFDIR"/sysconfig/network" #define SC_NETWORK_FILE SYSCONFDIR"/sysconfig/network"

View File

@@ -24,7 +24,7 @@
#include <NetworkManager.h> #include <NetworkManager.h>
#include <nm-utils.h> #include <nm-utils.h>
#include <nm-setting-wireless-security.h> #include <nm-setting-wireless-security.h>
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
#include <nm-system-config-interface.h> #include <nm-system-config-interface.h>
#include <nm-settings-error.h> #include <nm-settings-error.h>
#include "nm-ifnet-connection.h" #include "nm-ifnet-connection.h"
@@ -34,7 +34,7 @@
#include "wpa_parser.h" #include "wpa_parser.h"
#include "plugin.h" #include "plugin.h"
G_DEFINE_TYPE (NMIfnetConnection, nm_ifnet_connection, NM_TYPE_SYSCONFIG_CONNECTION) G_DEFINE_TYPE (NMIfnetConnection, nm_ifnet_connection, NM_TYPE_SETTINGS_CONNECTION)
#define NM_IFNET_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFNET_CONNECTION, NMIfnetConnectionPrivate)) #define NM_IFNET_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFNET_CONNECTION, NMIfnetConnectionPrivate))
enum { enum {
@@ -80,7 +80,7 @@ nm_ifnet_connection_new (const char *conn_name, NMConnection *source)
} }
NM_IFNET_CONNECTION_GET_PRIVATE (object)->conn_name = g_strdup (conn_name); NM_IFNET_CONNECTION_GET_PRIVATE (object)->conn_name = g_strdup (conn_name);
nm_sysconfig_connection_replace_settings (NM_SYSCONFIG_CONNECTION (object), tmp, NULL); nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), tmp, NULL);
g_object_unref (tmp); g_object_unref (tmp);
return NM_IFNET_CONNECTION (object); return NM_IFNET_CONNECTION (object);
@@ -92,8 +92,8 @@ nm_ifnet_connection_init (NMIfnetConnection * connection)
} }
static void static void
commit_changes (NMSysconfigConnection *connection, commit_changes (NMSettingsConnection *connection,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
GError *error = NULL; GError *error = NULL;
@@ -118,15 +118,15 @@ commit_changes (NMSysconfigConnection *connection,
g_free (priv->conn_name); g_free (priv->conn_name);
priv->conn_name = g_strdup (new_name); priv->conn_name = g_strdup (new_name);
NM_SYSCONFIG_CONNECTION_CLASS (nm_ifnet_connection_parent_class)->commit_changes (connection, callback, user_data); NM_SETTINGS_CONNECTION_CLASS (nm_ifnet_connection_parent_class)->commit_changes (connection, callback, user_data);
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Successfully updated %s", priv->conn_name); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Successfully updated %s", priv->conn_name);
g_signal_emit (connection, signals[IFNET_SETUP_MONITORS], 0); g_signal_emit (connection, signals[IFNET_SETUP_MONITORS], 0);
} }
static void static void
do_delete (NMSysconfigConnection *connection, do_delete (NMSettingsConnection *connection,
NMSysconfigConnectionDeleteFunc callback, NMSettingsConnectionDeleteFunc callback,
gpointer user_data) gpointer user_data)
{ {
GError *error = NULL; GError *error = NULL;
@@ -144,7 +144,7 @@ do_delete (NMSysconfigConnection *connection,
return; return;
} }
NM_SYSCONFIG_CONNECTION_CLASS (nm_ifnet_connection_parent_class)->delete (connection, callback, user_data); NM_SETTINGS_CONNECTION_CLASS (nm_ifnet_connection_parent_class)->delete (connection, callback, user_data);
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Successfully deleted %s", PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Successfully deleted %s",
priv->conn_name); priv->conn_name);
@@ -167,14 +167,14 @@ static void
nm_ifnet_connection_class_init (NMIfnetConnectionClass * ifnet_connection_class) nm_ifnet_connection_class_init (NMIfnetConnectionClass * ifnet_connection_class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (ifnet_connection_class); GObjectClass *object_class = G_OBJECT_CLASS (ifnet_connection_class);
NMSysconfigConnectionClass *sysconfig_class = NM_SYSCONFIG_CONNECTION_CLASS (ifnet_connection_class); NMSettingsConnectionClass *settings_class = NM_SETTINGS_CONNECTION_CLASS (ifnet_connection_class);
g_type_class_add_private (ifnet_connection_class, g_type_class_add_private (ifnet_connection_class,
sizeof (NMIfnetConnectionPrivate)); sizeof (NMIfnetConnectionPrivate));
object_class->finalize = finalize; object_class->finalize = finalize;
sysconfig_class->delete = do_delete; settings_class->delete = do_delete;
sysconfig_class->commit_changes = commit_changes; settings_class->commit_changes = commit_changes;
signals[IFNET_SETUP_MONITORS] = signals[IFNET_SETUP_MONITORS] =
g_signal_new ("ifnet_setup_monitors", g_signal_new ("ifnet_setup_monitors",

View File

@@ -22,7 +22,7 @@
#ifndef NM_IFNET_CONNECTION_H #ifndef NM_IFNET_CONNECTION_H
#define NM_IFNET_CONNECTION_H #define NM_IFNET_CONNECTION_H
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
#include "net_parser.h" #include "net_parser.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -35,11 +35,11 @@ G_BEGIN_DECLS
#define NM_IFNET_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IFNET_CONNECTION, NMIfnetConnectionClass)) #define NM_IFNET_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IFNET_CONNECTION, NMIfnetConnectionClass))
typedef struct { typedef struct {
NMSysconfigConnection parent; NMSettingsConnection parent;
} NMIfnetConnection; } NMIfnetConnection;
typedef struct { typedef struct {
NMSysconfigConnectionClass parent; NMSettingsConnectionClass parent;
} NMIfnetConnectionClass; } NMIfnetConnectionClass;
GType nm_ifnet_connection_get_type (void); GType nm_ifnet_connection_get_type (void);

View File

@@ -182,10 +182,10 @@ monitor_file_changes (const char *filename,
return monitor; return monitor;
} }
/* Callback for nm_sysconfig_connection_replace_and_commit. Report any errors /* Callback for nm_settings_connection_replace_and_commit. Report any errors
* encountered when commiting connection settings updates. */ * encountered when commiting connection settings updates. */
static void static void
commit_cb (NMSysconfigConnection *connection, GError *error, gpointer unused) commit_cb (NMSettingsConnection *connection, GError *error, gpointer unused)
{ {
if (error) { if (error) {
PLUGIN_WARN (IFNET_PLUGIN_NAME, " error updating: %s", PLUGIN_WARN (IFNET_PLUGIN_NAME, " error updating: %s",
@@ -287,7 +287,7 @@ reload_connections (gpointer config)
PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Auto refreshing %s", conn_name); PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Auto refreshing %s", conn_name);
/* Remove and re-add to disconnect and reconnect with new settings */ /* Remove and re-add to disconnect and reconnect with new settings */
g_signal_emit_by_name (old, NM_SYSCONFIG_CONNECTION_REMOVED); g_signal_emit_by_name (old, NM_SETTINGS_CONNECTION_REMOVED);
g_hash_table_remove (priv->config_connections, conn_name); g_hash_table_remove (priv->config_connections, conn_name);
g_hash_table_insert (priv->config_connections, g_strdup (conn_name), new); g_hash_table_insert (priv->config_connections, g_strdup (conn_name), new);
if (is_managed (conn_name)) if (is_managed (conn_name))
@@ -295,9 +295,9 @@ reload_connections (gpointer config)
} }
} else { } else {
/* Update existing connection with new settings */ /* Update existing connection with new settings */
nm_sysconfig_connection_replace_and_commit (NM_SYSCONFIG_CONNECTION (old), nm_settings_connection_replace_and_commit (NM_SETTINGS_CONNECTION (old),
NM_CONNECTION (new), NM_CONNECTION (new),
commit_cb, NULL); commit_cb, NULL);
g_object_unref (new); g_object_unref (new);
} }
g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED);
@@ -313,7 +313,7 @@ reload_connections (gpointer config)
g_hash_table_iter_init (&iter, priv->config_connections); g_hash_table_iter_init (&iter, priv->config_connections);
while (g_hash_table_iter_next (&iter, &key, &value)) { while (g_hash_table_iter_next (&iter, &key, &value)) {
if (!g_hash_table_lookup (new_conn_names, key)) { if (!g_hash_table_lookup (new_conn_names, key)) {
g_signal_emit_by_name (value, NM_SYSCONFIG_CONNECTION_REMOVED); g_signal_emit_by_name (value, NM_SETTINGS_CONNECTION_REMOVED);
g_hash_table_remove (priv->config_connections, key); g_hash_table_remove (priv->config_connections, key);
} }
} }
@@ -321,7 +321,7 @@ reload_connections (gpointer config)
g_list_free (conn_names); g_list_free (conn_names);
} }
static NMSysconfigConnection * static NMSettingsConnection *
add_connection (NMSystemConfigInterface *config, add_connection (NMSystemConfigInterface *config,
NMConnection *source, NMConnection *source,
GError **error) GError **error)
@@ -333,7 +333,7 @@ add_connection (NMSystemConfigInterface *config,
if (conn_name) if (conn_name)
connection = nm_ifnet_connection_new (conn_name, source); connection = nm_ifnet_connection_new (conn_name, source);
reload_connections (config); reload_connections (config);
return connection ? NM_SYSCONFIG_CONNECTION (connection) : NULL; return connection ? NM_SETTINGS_CONNECTION (connection) : NULL;
} }
static void static void

View File

@@ -26,13 +26,13 @@
#include <NetworkManager.h> #include <NetworkManager.h>
#include <nm-utils.h> #include <nm-utils.h>
#include <nm-setting-wireless-security.h> #include <nm-setting-wireless-security.h>
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
#include <nm-system-config-interface.h> #include <nm-system-config-interface.h>
#include <nm-settings-error.h> #include <nm-settings-error.h>
#include "nm-ifupdown-connection.h" #include "nm-ifupdown-connection.h"
#include "parser.h" #include "parser.h"
G_DEFINE_TYPE (NMIfupdownConnection, nm_ifupdown_connection, NM_TYPE_SYSCONFIG_CONNECTION) G_DEFINE_TYPE (NMIfupdownConnection, nm_ifupdown_connection, NM_TYPE_SETTINGS_CONNECTION)
#define NM_IFUPDOWN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFUPDOWN_CONNECTION, NMIfupdownConnectionPrivate)) #define NM_IFUPDOWN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IFUPDOWN_CONNECTION, NMIfupdownConnectionPrivate))
@@ -58,7 +58,7 @@ nm_ifupdown_connection_new (if_block *block)
} }
static gboolean static gboolean
supports_secrets (NMSysconfigConnection *connection, const char *setting_name) supports_secrets (NMSettingsConnection *connection, const char *setting_name)
{ {
PLUGIN_PRINT ("SCPlugin-Ifupdown", "supports_secrets() for setting_name: '%s'", setting_name); PLUGIN_PRINT ("SCPlugin-Ifupdown", "supports_secrets() for setting_name: '%s'", setting_name);
@@ -146,7 +146,7 @@ static void
nm_ifupdown_connection_class_init (NMIfupdownConnectionClass *ifupdown_connection_class) nm_ifupdown_connection_class_init (NMIfupdownConnectionClass *ifupdown_connection_class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (ifupdown_connection_class); GObjectClass *object_class = G_OBJECT_CLASS (ifupdown_connection_class);
NMSysconfigConnectionClass *connection_class = NM_SYSCONFIG_CONNECTION_CLASS (ifupdown_connection_class); NMSettingsConnectionClass *connection_class = NM_SETTINGS_CONNECTION_CLASS (ifupdown_connection_class);
g_type_class_add_private (ifupdown_connection_class, sizeof (NMIfupdownConnectionPrivate)); g_type_class_add_private (ifupdown_connection_class, sizeof (NMIfupdownConnectionPrivate));

View File

@@ -24,7 +24,7 @@
#ifndef NM_IFUPDOWN_CONNECTION_H #ifndef NM_IFUPDOWN_CONNECTION_H
#define NM_IFUPDOWN_CONNECTION_H #define NM_IFUPDOWN_CONNECTION_H
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
#include "interface_parser.h" #include "interface_parser.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -39,11 +39,11 @@ G_BEGIN_DECLS
#define NM_IFUPDOWN_CONNECTION_IFBLOCK "ifblock" #define NM_IFUPDOWN_CONNECTION_IFBLOCK "ifblock"
typedef struct { typedef struct {
NMSysconfigConnection parent; NMSettingsConnection parent;
} NMIfupdownConnection; } NMIfupdownConnection;
typedef struct { typedef struct {
NMSysconfigConnectionClass parent; NMSettingsConnectionClass parent;
} NMIfupdownConnectionClass; } NMIfupdownConnectionClass;
GType nm_ifupdown_connection_get_type (void); GType nm_ifupdown_connection_get_type (void);

View File

@@ -179,7 +179,7 @@ sc_plugin_ifupdown_class_init (SCPluginIfupdownClass *req_class)
} }
static void static void
ignore_cb (NMSysconfigConnection *connection, ignore_cb (NMSettingsConnection *connection,
GError *error, GError *error,
gpointer user_data) gpointer user_data)
{ {
@@ -229,9 +229,7 @@ bind_device_to_connection (SCPluginIfupdown *self,
} }
g_byte_array_free (mac_address, TRUE); g_byte_array_free (mac_address, TRUE);
nm_sysconfig_connection_commit_changes (NM_SYSCONFIG_CONNECTION (exported), nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL);
ignore_cb,
NULL);
} }
static void static void
@@ -411,9 +409,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
exported = g_hash_table_lookup (priv->iface_connections, block->name); exported = g_hash_table_lookup (priv->iface_connections, block->name);
if (exported) { if (exported) {
PLUGIN_PRINT("SCPlugin-Ifupdown", "deleting %s from iface_connections", block->name); PLUGIN_PRINT("SCPlugin-Ifupdown", "deleting %s from iface_connections", block->name);
nm_sysconfig_connection_delete (NM_SYSCONFIG_CONNECTION (exported), nm_settings_connection_delete (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL);
ignore_cb,
NULL);
g_hash_table_remove (priv->iface_connections, block->name); g_hash_table_remove (priv->iface_connections, block->name);
} }
@@ -446,9 +442,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
setting = NM_SETTING (nm_connection_get_setting (NM_CONNECTION (exported), NM_TYPE_SETTING_CONNECTION)); setting = NM_SETTING (nm_connection_get_setting (NM_CONNECTION (exported), NM_TYPE_SETTING_CONNECTION));
g_object_set (setting, NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, NULL); g_object_set (setting, NM_SETTING_CONNECTION_AUTOCONNECT, TRUE, NULL);
nm_sysconfig_connection_commit_changes (NM_SYSCONFIG_CONNECTION (exported), nm_settings_connection_commit_changes (NM_SETTINGS_CONNECTION (exported), ignore_cb, NULL);
ignore_cb,
NULL);
PLUGIN_PRINT("SCPlugin-Ifupdown", "autoconnect"); PLUGIN_PRINT("SCPlugin-Ifupdown", "autoconnect");
} }
@@ -507,7 +501,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config)
for (cl_iter = con_list; cl_iter; cl_iter = g_list_next (cl_iter)) { for (cl_iter = con_list; cl_iter; cl_iter = g_list_next (cl_iter)) {
g_signal_emit_by_name (self, g_signal_emit_by_name (self,
NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED,
NM_SYSCONFIG_CONNECTION (cl_iter->data)); NM_SETTINGS_CONNECTION (cl_iter->data));
} }
g_list_free (con_list); g_list_free (con_list);
} }

View File

@@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Novell, Inc.
* Copyright (C) 2008 - 2010 Red Hat, Inc. * Copyright (C) 2008 - 2011 Red Hat, Inc.
*/ */
#include <string.h> #include <string.h>
@@ -32,7 +32,7 @@
#include "writer.h" #include "writer.h"
#include "common.h" #include "common.h"
G_DEFINE_TYPE (NMKeyfileConnection, nm_keyfile_connection, NM_TYPE_SYSCONFIG_CONNECTION) G_DEFINE_TYPE (NMKeyfileConnection, nm_keyfile_connection, NM_TYPE_SETTINGS_CONNECTION)
#define NM_KEYFILE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnectionPrivate)) #define NM_KEYFILE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnectionPrivate))
@@ -69,7 +69,7 @@ nm_keyfile_connection_new (const char *full_path,
priv->path = g_strdup (full_path); priv->path = g_strdup (full_path);
/* Update our settings with what was read from the file */ /* Update our settings with what was read from the file */
if (!nm_sysconfig_connection_replace_settings (NM_SYSCONFIG_CONNECTION (object), tmp, error)) { if (!nm_settings_connection_replace_settings (NM_SETTINGS_CONNECTION (object), tmp, error)) {
g_object_unref (object); g_object_unref (object);
object = NULL; object = NULL;
goto out; goto out;
@@ -109,8 +109,8 @@ nm_keyfile_connection_get_path (NMKeyfileConnection *self)
} }
static void static void
commit_changes (NMSysconfigConnection *connection, commit_changes (NMSettingsConnection *connection,
NMSysconfigConnectionCommitFunc callback, NMSettingsConnectionCommitFunc callback,
gpointer user_data) gpointer user_data)
{ {
NMKeyfileConnectionPrivate *priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (connection); NMKeyfileConnectionPrivate *priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (connection);
@@ -130,23 +130,23 @@ commit_changes (NMSysconfigConnection *connection,
} else } else
g_free (path); g_free (path);
NM_SYSCONFIG_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->commit_changes (connection, NM_SETTINGS_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->commit_changes (connection,
callback, callback,
user_data); user_data);
} }
static void static void
do_delete (NMSysconfigConnection *connection, do_delete (NMSettingsConnection *connection,
NMSysconfigConnectionDeleteFunc callback, NMSettingsConnectionDeleteFunc callback,
gpointer user_data) gpointer user_data)
{ {
NMKeyfileConnectionPrivate *priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (connection); NMKeyfileConnectionPrivate *priv = NM_KEYFILE_CONNECTION_GET_PRIVATE (connection);
g_unlink (priv->path); g_unlink (priv->path);
NM_SYSCONFIG_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->delete (connection, NM_SETTINGS_CONNECTION_CLASS (nm_keyfile_connection_parent_class)->delete (connection,
callback, callback,
user_data); user_data);
} }
/* GObject */ /* GObject */
@@ -172,12 +172,12 @@ static void
nm_keyfile_connection_class_init (NMKeyfileConnectionClass *keyfile_connection_class) nm_keyfile_connection_class_init (NMKeyfileConnectionClass *keyfile_connection_class)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (keyfile_connection_class); GObjectClass *object_class = G_OBJECT_CLASS (keyfile_connection_class);
NMSysconfigConnectionClass *sysconfig_class = NM_SYSCONFIG_CONNECTION_CLASS (keyfile_connection_class); NMSettingsConnectionClass *settings_class = NM_SETTINGS_CONNECTION_CLASS (keyfile_connection_class);
g_type_class_add_private (keyfile_connection_class, sizeof (NMKeyfileConnectionPrivate)); g_type_class_add_private (keyfile_connection_class, sizeof (NMKeyfileConnectionPrivate));
/* Virtual methods */ /* Virtual methods */
object_class->finalize = finalize; object_class->finalize = finalize;
sysconfig_class->commit_changes = commit_changes; settings_class->commit_changes = commit_changes;
sysconfig_class->delete = do_delete; settings_class->delete = do_delete;
} }

View File

@@ -16,13 +16,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Novell, Inc.
* Copyright (C) 2008 Red Hat, Inc. * Copyright (C) 2008 - 2011 Red Hat, Inc.
*/ */
#ifndef NM_KEYFILE_CONNECTION_H #ifndef NM_KEYFILE_CONNECTION_H
#define NM_KEYFILE_CONNECTION_H #define NM_KEYFILE_CONNECTION_H
#include <nm-sysconfig-connection.h> #include <nm-settings-connection.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@@ -34,11 +34,11 @@ G_BEGIN_DECLS
#define NM_KEYFILE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnectionClass)) #define NM_KEYFILE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_KEYFILE_CONNECTION, NMKeyfileConnectionClass))
typedef struct { typedef struct {
NMSysconfigConnection parent; NMSettingsConnection parent;
} NMKeyfileConnection; } NMKeyfileConnection;
typedef struct { typedef struct {
NMSysconfigConnectionClass parent; NMSettingsConnectionClass parent;
} NMKeyfileConnectionClass; } NMKeyfileConnectionClass;
GType nm_keyfile_connection_get_type (void); GType nm_keyfile_connection_get_type (void);

View File

@@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* Copyright (C) 2008 Novell, Inc. * Copyright (C) 2008 Novell, Inc.
* Copyright (C) 2008 - 2010 Red Hat, Inc. * Copyright (C) 2008 - 2011 Red Hat, Inc.
*/ */
#include <config.h> #include <config.h>
@@ -69,7 +69,7 @@ typedef struct {
gboolean disposed; gboolean disposed;
} SCPluginKeyfilePrivate; } SCPluginKeyfilePrivate;
static NMSysconfigConnection * static NMSettingsConnection *
_internal_new_connection (SCPluginKeyfile *self, _internal_new_connection (SCPluginKeyfile *self,
const char *full_path, const char *full_path,
NMConnection *source, NMConnection *source,
@@ -102,7 +102,7 @@ _internal_new_connection (SCPluginKeyfile *self,
if (out_cid) if (out_cid)
*out_cid = cid; *out_cid = cid;
return NM_SYSCONFIG_CONNECTION (connection); return NM_SETTINGS_CONNECTION (connection);
} }
static void static void
@@ -124,7 +124,7 @@ read_connections (NMSystemConfigInterface *config)
} }
while ((item = g_dir_read_name (dir))) { while ((item = g_dir_read_name (dir))) {
NMSysconfigConnection *connection; NMSettingsConnection *connection;
char *full_path; char *full_path;
if (utils_should_ignore_file (item)) if (utils_should_ignore_file (item))
@@ -147,7 +147,7 @@ read_connections (NMSystemConfigInterface *config)
} }
static void static void
update_connection_settings_commit_cb (NMSysconfigConnection *orig, GError *error, gpointer user_data) update_connection_settings_commit_cb (NMSettingsConnection *orig, GError *error, gpointer user_data)
{ {
if (error) { if (error) {
g_warning ("%s: '%s' / '%s' invalid: %d", g_warning ("%s: '%s' / '%s' invalid: %d",
@@ -165,9 +165,9 @@ static void
update_connection_settings (NMKeyfileConnection *orig, update_connection_settings (NMKeyfileConnection *orig,
NMKeyfileConnection *new) NMKeyfileConnection *new)
{ {
nm_sysconfig_connection_replace_and_commit (NM_SYSCONFIG_CONNECTION (orig), nm_settings_connection_replace_and_commit (NM_SETTINGS_CONNECTION (orig),
NM_CONNECTION (new), NM_CONNECTION (new),
update_connection_settings_commit_cb, NULL); update_connection_settings_commit_cb, NULL);
} }
/* Monitoring */ /* Monitoring */
@@ -406,13 +406,13 @@ get_connections (NMSystemConfigInterface *config)
return list; return list;
} }
static NMSysconfigConnection * static NMSettingsConnection *
add_connection (NMSystemConfigInterface *config, add_connection (NMSystemConfigInterface *config,
NMConnection *connection, NMConnection *connection,
GError **error) GError **error)
{ {
SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config); SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config);
NMSysconfigConnection *added = NULL; NMSettingsConnection *added = NULL;
char *path = NULL; char *path = NULL;
/* Write it out first, then add the connection to our internal list */ /* Write it out first, then add the connection to our internal list */