Commit fa8c9304 authored by Daniel Gnoutcheff's avatar Daniel Gnoutcheff

libnm-*: remove user settings support

Remove code related to "connection scope" and such. Later, we will also
do lots of code flattening and simplification that's possible now that
user settings are gone.
parent 80f14217
......@@ -45,7 +45,6 @@
#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config"
#define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings"
#define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManagerSettings"
#define NM_DBUS_IFACE_SETTINGS_SYSTEM "org.freedesktop.NetworkManagerSettings.System"
......
......@@ -20,8 +20,6 @@ global:
nm_active_connection_get_default;
nm_active_connection_get_default6;
nm_active_connection_get_devices;
nm_active_connection_get_scope;
nm_active_connection_get_service_name;
nm_active_connection_get_specific_object;
nm_active_connection_get_state;
nm_active_connection_get_type;
......
......@@ -43,8 +43,6 @@ typedef struct {
gboolean disposed;
DBusGProxy *proxy;
char *service_name;
NMConnectionScope scope;
char *connection;
char *specific_object;
GPtrArray *devices;
......@@ -55,7 +53,6 @@ typedef struct {
enum {
PROP_0,
PROP_SERVICE_NAME,
PROP_CONNECTION,
PROP_SPECIFIC_OBJECT,
PROP_DEVICES,
......@@ -66,7 +63,6 @@ enum {
LAST_PROP
};
#define DBUS_PROP_SERVICE_NAME "ServiceName"
#define DBUS_PROP_CONNECTION "Connection"
#define DBUS_PROP_SPECIFIC_OBJECT "SpecificObject"
#define DBUS_PROP_DEVICES "Devices"
......@@ -95,62 +91,6 @@ nm_active_connection_new (DBusGConnection *connection, const char *path)
NULL);
}
static NMConnectionScope
get_scope_for_service_name (const char *service_name)
{
if (service_name && !strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS))
return NM_CONNECTION_SCOPE_USER;
else if (service_name && !strcmp (service_name, NM_DBUS_SERVICE_SYSTEM_SETTINGS))
return NM_CONNECTION_SCOPE_SYSTEM;
return NM_CONNECTION_SCOPE_UNKNOWN;
}
/**
* nm_active_connection_get_service_name:
* @connection: a #NMActiveConnection
*
* Gets the service name of the active connection.
*
* Returns: the service name. This is the internal string used by the
* connection, and must not be modified.
**/
const char *
nm_active_connection_get_service_name (NMActiveConnection *connection)
{
NMActiveConnectionPrivate *priv;
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
if (!priv->service_name) {
priv->service_name = _nm_object_get_string_property (NM_OBJECT (connection),
NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
DBUS_PROP_SERVICE_NAME);
priv->scope = get_scope_for_service_name (priv->service_name);
}
return priv->service_name;
}
/**
* nm_active_connection_get_scope:
* @connection: a #NMActiveConnection
*
* Gets the scope of the active connection.
*
* Returns: the connection's scope
**/
NMConnectionScope
nm_active_connection_get_scope (NMActiveConnection *connection)
{
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NM_CONNECTION_SCOPE_UNKNOWN);
/* Make sure service_name and scope are up-to-date */
nm_active_connection_get_service_name (connection);
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->scope;
}
/**
* nm_active_connection_get_connection:
* @connection: a #NMActiveConnection
......@@ -345,7 +285,6 @@ finalize (GObject *object)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
g_free (priv->service_name);
g_free (priv->connection);
g_free (priv->specific_object);
......@@ -361,9 +300,6 @@ get_property (GObject *object,
NMActiveConnection *self = NM_ACTIVE_CONNECTION (object);
switch (prop_id) {
case PROP_SERVICE_NAME:
g_value_set_string (value, nm_active_connection_get_service_name (self));
break;
case PROP_CONNECTION:
g_value_set_boxed (value, nm_active_connection_get_connection (self));
break;
......@@ -401,24 +337,11 @@ demarshal_devices (NMObject *object, GParamSpec *pspec, GValue *value, gpointer
return TRUE;
}
static gboolean
demarshal_service (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
if (_nm_object_demarshal_generic (object, pspec, value, field)) {
priv->scope = get_scope_for_service_name (priv->service_name);
return TRUE;
}
return FALSE;
}
static void
register_for_property_changed (NMActiveConnection *connection)
{
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
const NMPropertiesChangedInfo property_changed_info[] = {
{ NM_ACTIVE_CONNECTION_SERVICE_NAME, demarshal_service, &priv->service_name },
{ NM_ACTIVE_CONNECTION_CONNECTION, _nm_object_demarshal_generic, &priv->connection },
{ NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, _nm_object_demarshal_generic, &priv->specific_object },
{ NM_ACTIVE_CONNECTION_DEVICES, demarshal_devices, &priv->devices },
......@@ -475,19 +398,6 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
/* properties */
/**
* NMActiveConnection:service-name:
*
* The service name of the active connection.
**/
g_object_class_install_property
(object_class, PROP_SERVICE_NAME,
g_param_spec_string (NM_ACTIVE_CONNECTION_SERVICE_NAME,
"Service Name",
"Service Name",
NULL,
G_PARAM_READABLE));
/**
* NMActiveConnection:connection:
*
......
......@@ -39,7 +39,6 @@ G_BEGIN_DECLS
#define NM_IS_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_ACTIVE_CONNECTION))
#define NM_ACTIVE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
#define NM_ACTIVE_CONNECTION_SERVICE_NAME "service-name"
#define NM_ACTIVE_CONNECTION_CONNECTION "connection"
#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object"
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
......@@ -67,8 +66,6 @@ GType nm_active_connection_get_type (void);
GObject *nm_active_connection_new (DBusGConnection *connection, const char *path);
const char * nm_active_connection_get_service_name (NMActiveConnection *connection);
NMConnectionScope nm_active_connection_get_scope (NMActiveConnection *connection);
const char * nm_active_connection_get_connection (NMActiveConnection *connection);
const char * nm_active_connection_get_specific_object (NMActiveConnection *connection);
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
......
......@@ -247,19 +247,15 @@ settings_connection_interface_init (NMSettingsConnectionInterface *iface)
/**
* nm_exported_connection_new:
* @scope: the Connection scope (either user or system)
*
* Creates a new object representing the remote connection.
*
* Returns: the new exported connection object on success, or %NULL on failure
**/
NMExportedConnection *
nm_exported_connection_new (NMConnectionScope scope)
nm_exported_connection_new ()
{
g_return_val_if_fail (scope != NM_CONNECTION_SCOPE_UNKNOWN, NULL);
return (NMExportedConnection *) g_object_new (NM_TYPE_EXPORTED_CONNECTION,
NM_CONNECTION_SCOPE, scope,
NULL);
}
......
......@@ -68,7 +68,7 @@ typedef struct {
GType nm_exported_connection_get_type (void);
NMExportedConnection *nm_exported_connection_new (NMConnectionScope scope);
NMExportedConnection *nm_exported_connection_new (void);
G_END_DECLS
......
......@@ -206,9 +206,8 @@ replace_settings (NMRemoteConnection *self, GHashTable *new_settings)
GError *error = NULL;
if (!nm_connection_replace_settings (NM_CONNECTION (self), new_settings, &error)) {
g_warning ("%s: error updating %s connection %s settings: (%d) %s",
g_warning ("%s: error updating connection %s settings: (%d) %s",
__func__,
(nm_connection_get_scope (NM_CONNECTION (self)) == NM_CONNECTION_SCOPE_USER) ? "user" : "system",
nm_connection_get_path (NM_CONNECTION (self)),
error ? error->code : -1,
(error && error->message) ? error->message : "(unknown)");
......@@ -233,9 +232,8 @@ get_settings_cb (DBusGProxy *proxy,
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
if (error) {
g_warning ("%s: error getting %s connection %s settings: (%d) %s",
g_warning ("%s: error getting connection %s settings: (%d) %s",
__func__,
(nm_connection_get_scope (NM_CONNECTION (self)) == NM_CONNECTION_SCOPE_USER) ? "user" : "system",
nm_connection_get_path (NM_CONNECTION (self)),
error ? error->code : -1,
(error && error->message) ? error->message : "(unknown)");
......@@ -276,9 +274,7 @@ settings_connection_interface_init (NMSettingsConnectionInterface *klass)
/**
* nm_remote_connection_new:
* @bus: a valid and connected D-Bus connection
* @scope: the Connection scope (either user or system)
* @path: the D-Bus path of the connection as exported by the settings service
* indicated by @scope
*
* Creates a new object representing the remote connection.
*
......@@ -286,7 +282,6 @@ settings_connection_interface_init (NMSettingsConnectionInterface *klass)
**/
NMRemoteConnection *
nm_remote_connection_new (DBusGConnection *bus,
NMConnectionScope scope,
const char *path)
{
g_return_val_if_fail (bus != NULL, NULL);
......@@ -294,7 +289,6 @@ nm_remote_connection_new (DBusGConnection *bus,
return (NMRemoteConnection *) g_object_new (NM_TYPE_REMOTE_CONNECTION,
NM_REMOTE_CONNECTION_BUS, bus,
NM_CONNECTION_SCOPE, scope,
NM_CONNECTION_PATH, path,
NULL);
}
......@@ -306,7 +300,6 @@ constructor (GType type,
{
GObject *object;
NMRemoteConnectionPrivate *priv;
const char *service = NM_DBUS_SERVICE_USER_SETTINGS;
object = G_OBJECT_CLASS (nm_remote_connection_parent_class)->constructor (type, n_construct_params, construct_params);
if (!object)
......@@ -316,18 +309,15 @@ constructor (GType type,
g_assert (priv->bus);
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
if (nm_connection_get_scope (NM_CONNECTION (object)) == NM_CONNECTION_SCOPE_SYSTEM)
service = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
service,
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
nm_connection_get_path (NM_CONNECTION (object)),
NM_DBUS_IFACE_SETTINGS_CONNECTION);
g_assert (priv->proxy);
dbus_g_proxy_set_default_timeout (priv->proxy, G_MAXINT);
priv->secrets_proxy = dbus_g_proxy_new_for_name (priv->bus,
service,
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
nm_connection_get_path (NM_CONNECTION (object)),
NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS);
g_assert (priv->secrets_proxy);
......
......@@ -57,7 +57,6 @@ typedef struct {
GType nm_remote_connection_get_type (void);
NMRemoteConnection *nm_remote_connection_new (DBusGConnection *bus,
NMConnectionScope scope,
const char *path);
G_END_DECLS
......
......@@ -240,7 +240,6 @@ nm_remote_settings_system_new (DBusGConnection *bus)
return (NMRemoteSettingsSystem *) g_object_new (NM_TYPE_REMOTE_SETTINGS_SYSTEM,
NM_REMOTE_SETTINGS_BUS, bus,
NM_REMOTE_SETTINGS_SCOPE, NM_CONNECTION_SCOPE_SYSTEM,
NULL);
}
......
......@@ -40,7 +40,6 @@ G_DEFINE_TYPE_EXTENDED (NMRemoteSettings, nm_remote_settings, G_TYPE_OBJECT, 0,
typedef struct {
DBusGConnection *bus;
NMConnectionScope scope;
DBusGProxy *proxy;
GHashTable *connections;
......@@ -57,7 +56,6 @@ typedef struct {
enum {
PROP_0,
PROP_BUS,
PROP_SCOPE,
PROP_SERVICE_RUNNING,
LAST_PROP
......@@ -137,7 +135,7 @@ new_connection_cb (DBusGProxy *proxy, const char *path, gpointer user_data)
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
NMRemoteConnection *connection;
connection = nm_remote_connection_new (priv->bus, priv->scope, path);
connection = nm_remote_connection_new (priv->bus, path);
if (connection) {
g_signal_connect (connection, "removed",
G_CALLBACK (connection_removed_cb),
......@@ -162,13 +160,11 @@ fetch_connections_done (DBusGProxy *proxy,
gpointer user_data)
{
NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
int i;
if (error) {
g_warning ("%s: error fetching %s connections: (%d) %s.",
g_warning ("%s: error fetching connections: (%d) %s.",
__func__,
priv->scope == NM_CONNECTION_SCOPE_USER ? "user" : "system",
error->code,
error->message ? error->message : "(unknown)");
g_clear_error (&error);
......@@ -296,10 +292,7 @@ name_owner_changed (DBusGProxy *proxy,
{
NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
const char *sname = NM_DBUS_SERVICE_USER_SETTINGS;
if (priv->scope == NM_CONNECTION_SCOPE_SYSTEM)
sname = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
const char *sname = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
if (!strcmp (name, sname)) {
if (priv->fetch_id)
......@@ -330,21 +323,18 @@ settings_interface_init (NMSettingsInterface *iface)
/**
* nm_remote_settings_new:
* @bus: a valid and connected D-Bus connection
* @scope: the settings service scope (either user or system)
*
* Creates a new object representing the remote settings service.
*
* Returns: the new remote settings object on success, or %NULL on failure
**/
NMRemoteSettings *
nm_remote_settings_new (DBusGConnection *bus, NMConnectionScope scope)
nm_remote_settings_new (DBusGConnection *bus)
{
g_return_val_if_fail (bus != NULL, NULL);
g_return_val_if_fail (scope != NM_CONNECTION_SCOPE_UNKNOWN, NULL);
return (NMRemoteSettings *) g_object_new (NM_TYPE_REMOTE_SETTINGS,
NM_REMOTE_SETTINGS_BUS, bus,
NM_REMOTE_SETTINGS_SCOPE, scope,
NULL);
}
......@@ -364,7 +354,6 @@ constructor (GType type,
{
GObject *object;
NMRemoteSettingsPrivate *priv;
const char *service = NM_DBUS_SERVICE_USER_SETTINGS;
GError *error = NULL;
object = G_OBJECT_CLASS (nm_remote_settings_parent_class)->constructor (type, n_construct_params, construct_params);
......@@ -392,12 +381,8 @@ constructor (GType type,
G_CALLBACK (name_owner_changed),
object, NULL);
/* Settings service proxy */
if (priv->scope == NM_CONNECTION_SCOPE_SYSTEM)
service = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", &error,
G_TYPE_STRING, service,
G_TYPE_STRING, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
G_TYPE_INVALID,
G_TYPE_BOOLEAN, &priv->service_running,
G_TYPE_INVALID)) {
......@@ -410,7 +395,7 @@ constructor (GType type,
}
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
service,
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
NM_DBUS_PATH_SETTINGS,
NM_DBUS_IFACE_SETTINGS);
g_assert (priv->proxy);
......@@ -466,9 +451,6 @@ set_property (GObject *object, guint prop_id,
/* Construct only */
priv->bus = dbus_g_connection_ref ((DBusGConnection *) g_value_get_boxed (value));
break;
case PROP_SCOPE:
priv->scope = (NMConnectionScope) g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -485,9 +467,6 @@ get_property (GObject *object, guint prop_id,
case PROP_BUS:
g_value_set_boxed (value, priv->bus);
break;
case PROP_SCOPE:
g_value_set_uint (value, priv->scope);
break;
case PROP_SERVICE_RUNNING:
g_value_set_boolean (value, priv->service_running);
break;
......@@ -519,16 +498,6 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class)
DBUS_TYPE_G_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(object_class, PROP_SCOPE,
g_param_spec_uint (NM_REMOTE_SETTINGS_SCOPE,
"Scope",
"NMConnection scope",
NM_CONNECTION_SCOPE_UNKNOWN,
NM_CONNECTION_SCOPE_USER,
NM_CONNECTION_SCOPE_USER,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(object_class, PROP_SERVICE_RUNNING,
g_param_spec_boolean (NM_REMOTE_SETTINGS_SERVICE_RUNNING,
......
......@@ -39,7 +39,6 @@ G_BEGIN_DECLS
#define NM_REMOTE_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
#define NM_REMOTE_SETTINGS_BUS "bus"
#define NM_REMOTE_SETTINGS_SCOPE "scope"
#define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
typedef struct {
......@@ -60,7 +59,7 @@ typedef struct {
GType nm_remote_settings_get_type (void);
NMRemoteSettings *nm_remote_settings_new (DBusGConnection *bus, NMConnectionScope scope);
NMRemoteSettings *nm_remote_settings_new (DBusGConnection *bus);
G_END_DECLS
......
......@@ -49,7 +49,6 @@ G_DEFINE_TYPE_EXTENDED (NMSettingsService, nm_settings_service, G_TYPE_OBJECT, G
typedef struct {
DBusGConnection *bus;
NMConnectionScope scope;
gboolean exported;
gboolean disposed;
......@@ -58,7 +57,6 @@ typedef struct {
enum {
PROP_0,
PROP_BUS,
PROP_SCOPE,
LAST_PROP
};
......@@ -236,7 +234,6 @@ nm_settings_service_export_connection (NMSettingsService *self,
path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++);
nm_connection_set_path (NM_CONNECTION (connection), path);
nm_connection_set_scope (NM_CONNECTION (connection), priv->scope);
dbus_g_connection_register_g_object (priv->bus, path, G_OBJECT (connection));
g_free (path);
......@@ -264,9 +261,6 @@ constructor (GType type,
GObject *object;
object = G_OBJECT_CLASS (nm_settings_service_parent_class)->constructor (type, n_construct_params, construct_params);
if (object) {
g_assert (NM_SETTINGS_SERVICE_GET_PRIVATE (object)->scope != NM_CONNECTION_SCOPE_UNKNOWN);
}
return object;
}
......@@ -289,10 +283,6 @@ set_property (GObject *object, guint prop_id,
if (bus)
priv->bus = dbus_g_connection_ref (bus);
break;
case PROP_SCOPE:
/* Construct only */
priv->scope = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -309,9 +299,6 @@ get_property (GObject *object, guint prop_id,
case PROP_BUS:
g_value_set_boxed (value, priv->bus);
break;
case PROP_SCOPE:
g_value_set_uint (value, priv->scope);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -356,17 +343,4 @@ nm_settings_service_class_init (NMSettingsServiceClass *class)
"Bus",
DBUS_TYPE_G_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
/**
* NMSettingsService:scope:
*
* The capabilities of the device.
**/
g_object_class_install_property (object_class, PROP_SCOPE,
g_param_spec_uint (NM_SETTINGS_SERVICE_SCOPE,
"Scope",
"Scope",
NM_CONNECTION_SCOPE_SYSTEM,
NM_CONNECTION_SCOPE_USER,
NM_CONNECTION_SCOPE_USER,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
}
......@@ -37,7 +37,6 @@ G_BEGIN_DECLS
#define NM_SETTINGS_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTINGS_SERVICE, NMSettingsServiceClass))
#define NM_SETTINGS_SERVICE_BUS "bus"
#define NM_SETTINGS_SERVICE_SCOPE "scope"
typedef struct {
GObject parent;
......
......@@ -10,7 +10,6 @@ global:
nm_connection_error_quark;
nm_connection_for_each_setting_value;
nm_connection_get_path;
nm_connection_get_scope;
nm_connection_get_setting;
nm_connection_get_setting_by_name;
nm_connection_get_type;
......@@ -22,7 +21,6 @@ global:
nm_connection_remove_setting;
nm_connection_replace_settings;
nm_connection_set_path;
nm_connection_set_scope;
nm_connection_to_hash;
nm_connection_update_secrets;
nm_connection_verify;
......
......@@ -65,12 +65,6 @@
* parameters (MTU, SSID, APN, channel, rate, etc) and IP-level parameters
* (addresses, routes, addressing methods, etc).
*
* Most connections also have a %NMConnectionScope; a connection will be
* provided over D-Bus either by the user settings service
* (org.freedesktop.NetworkManagerUserSettings) running in an active user
* session, or by the system-wide system settings service
* (org.freedesktop.NetworkManagerSystemSettings) which provides connections
* for all users.
*/
/**
......@@ -112,9 +106,6 @@ nm_connection_error_get_type (void)
typedef struct {
GHashTable *settings;
/* Type of the connection (system or user) */
NMConnectionScope scope;
/* D-Bus path of the connection, if any */
char *path;
} NMConnectionPrivate;
......@@ -125,7 +116,6 @@ G_DEFINE_TYPE (NMConnection, nm_connection, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_SCOPE,
PROP_PATH,
LAST_PROP
......@@ -900,43 +890,6 @@ nm_connection_dump (NMConnection *connection)
g_hash_table_foreach (NM_CONNECTION_GET_PRIVATE (connection)->settings, dump_setting, NULL);
}
/**
* nm_connection_set_scope:
* @connection: the #NMConnection
* @scope: the scope of the connection
*
* Sets the scope of the connection. This property is not serialized, and is
* only for the reference of the caller. A connection may have no scope
* (internal, temporary connections), "system" scope (provided by the system
* settings service), or "user" scope, provided by a user settings service. The
* creator of the #NMConnection object is responsible for setting the
* connection's scope if needed. Sets the #NMConnection:scope property.
**/
void
nm_connection_set_scope (NMConnection *connection, NMConnectionScope scope)
{
g_return_if_fail (NM_IS_CONNECTION (connection));
NM_CONNECTION_GET_PRIVATE (connection)->scope = scope;
}
/**
* nm_connection_get_scope:
* @connection: the #NMConnection
*
* Returns the connection scope.
*
* Returns: the scope of the connection, previously set by a call to
* nm_connection_set_scope().
**/
NMConnectionScope
nm_connection_get_scope (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NM_CONNECTION_SCOPE_UNKNOWN);
return NM_CONNECTION_GET_PRIVATE (connection)->scope;
}
/**
* nm_connection_set_path:
* @connection: the #NMConnection
......@@ -1055,7 +1008,6 @@ nm_connection_duplicate (NMConnection *connection)
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
dup = nm_connection_new ();
nm_connection_set_scope (dup, nm_connection_get_scope (connection));
nm_connection_set_path (dup, nm_connection_get_path (connection));
g_hash_table_foreach (NM_CONNECTION_GET_PRIVATE (connection)->settings, duplicate_cb, dup);
......@@ -1092,9 +1044,6 @@ set_property (GObject *object, guint prop_id,
NMConnection *connection = NM_CONNECTION (object);
switch (prop_id) {
case PROP_SCOPE:
nm_connection_set_scope (connection, g_value_get_uint (value));
break;
case PROP_PATH:
nm_connection_set_path (connection, g_value_get_string (value));
break;
......@@ -1111,9 +1060,6 @@ get_property (GObject *object, guint prop_id,
NMConnection *connection = NM_CONNECTION (object);
switch (prop_id) {
case PROP_SCOPE:
g_value_set_uint (value, nm_connection_get_scope (connection));
break;
case PROP_PATH:
g_value_set_string (value, nm_connection_get_path (connection));
break;
......@@ -1137,23 +1083,6 @@ nm_connection_class_init (NMConnectionClass *klass)
/* Properties */
/**
* NMConnection:scope:
*
* The connection's scope, used only by the calling process as a record
* of which settings service the connection is provided by. One of the
* NM_CONNECTION_SCOPE_* defines.
**/
g_object_class_install_property
(object_class, PROP_SCOPE,
g_param_spec_uint (NM_CONNECTION_SCOPE,
"Scope",
"Scope",
NM_CONNECTION_SCOPE_UNKNOWN,
NM_CONNECTION_SCOPE_USER,
NM_CONNECTION_SCOPE_UNKNOWN,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
/**
* NMConnection:path:
*
......
......@@ -39,23 +39,6 @@ G_BEGIN_DECLS
#define NM_IS_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_CONNECTION))
#define NM_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CONNECTION, NMConnectionClass))
/**
* NMConnectionScope:
* @NM_CONNECTION_SCOPE_UNKNOWN: scope not known or not yet set
* @NM_CONNECTION_SCOPE_SYSTEM: connection is provided by the system settings
* service
* @NM_CONNECTION_SCOPE_USER: connection is provided by a user settings service
*
* Connection scope indicated what settings service, if any, provides the
* connection.
*
**/
typedef enum {
NM_CONNECTION_SCOPE_UNKNOWN = 0,
NM_CONNECTION_SCOPE_SYSTEM,
NM_CONNECTION_SCOPE_USER
} NMConnectionScope;
/**
* NMConnectionError:
......@@ -79,7 +62,6 @@ GType nm_connection_error_get_type (void);
#define NM_CONNECTION_ERROR nm_connection_error_quark ()
GQuark nm_connection_error_quark (void);
#define NM_CONNECTION_SCOPE "scope"
#define NM_CONNECTION_PATH "path"
/**
......@@ -139,11 +121,6 @@ gboolean nm_connection_update_secrets (NMConnection *connection,
GHashTable *secrets,
GError **error);
void nm_connection_set_scope (NMConnection *connection,
NMConnectionScope scope);
NMConnectionScope nm_connection_get_scope (NMConnection *connection);
void nm_connection_set_path (NMConnection *connection,
const char *path);
......
......@@ -1312,10 +1312,8 @@ nm_sysconfig_settings_new (const char *config_file,
NMSysconfigSettings *self;
NMSysconfigSettingsPrivate *priv;
/* TODO remove the scope parameter. */
self = g_object_new (NM_TYPE_SYSCONFIG_SETTINGS,
NM_SETTINGS_SERVICE_BUS, bus,
NM_SETTINGS_SERVICE_SCOPE, NM_CONNECTION_SCOPE_SYSTEM,
NULL);
if (!self)
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment