Commit c2f4b10a authored by Daniel Gnoutcheff's avatar Daniel Gnoutcheff

libnm-glib: remove NMSettingsInterface

NMSettingsInterface was created to allow code to operate on a settings
service without caring about what kind of settings service it was. Now
that we have just one settings service, this is no longer needed.

More work needs to be done in order to handle errors and permission
settings in an appropriate manner.
parent aee48901
......@@ -45,7 +45,6 @@
#include <nm-device-bt.h>
//#include <nm-device-olpc-mesh.h>
#include <nm-remote-settings.h>
#include <nm-settings-interface.h>
#include <nm-settings-connection-interface.h>
#include <nm-vpn-connection.h>
......@@ -141,7 +140,7 @@ static gboolean find_device_for_connection (NmCli *nmc, NMConnection *connection
static const char *active_connection_state_to_string (NMActiveConnectionState state);
static void active_connection_state_cb (NMActiveConnection *active, GParamSpec *pspec, gpointer user_data);
static void activate_connection_cb (gpointer user_data, const char *path, GError *error);
static void get_connections_cb (NMSettingsInterface *settings, gpointer user_data);
static void get_connections_cb (NMRemoteSettings *settings, gpointer user_data);
static NMCResultCode do_connections_list (NmCli *nmc, int argc, char **argv);
static NMCResultCode do_connections_status (NmCli *nmc, int argc, char **argv);
static NMCResultCode do_connection_up (NmCli *nmc, int argc, char **argv);
......@@ -1454,12 +1453,12 @@ error:
/* callback called when connections are obtained from the settings service */
static void
get_connections_cb (NMSettingsInterface *settings, gpointer user_data)
get_connections_cb (NMRemoteSettings *settings, gpointer user_data)
{
ArgsInfo *args = (ArgsInfo *) user_data;
GError *error = NULL;
args->nmc->system_connections = nm_settings_interface_list_connections (settings);
args->nmc->system_connections = nm_remote_settings_list_connections (settings);
if (args->argc == 0) {
if (!nmc_terse_option_check (args->nmc->print_output, args->nmc->required_fields, &error))
......@@ -1545,7 +1544,7 @@ do_connections (NmCli *nmc, int argc, char **argv)
}
/* connect to signal "connections-read" - emitted when connections are fetched and ready */
g_signal_connect (nmc->system_settings, NM_SETTINGS_INTERFACE_CONNECTIONS_READ,
g_signal_connect (nmc->system_settings, NM_REMOTE_SETTINGS_CONNECTIONS_READ,
G_CALLBACK (get_connections_cb), &args_info);
......
......@@ -35,7 +35,6 @@
#include <nm-client.h>
#include <nm-setting-connection.h>
#include <nm-remote-settings.h>
#include <nm-settings-interface.h>
#include <nm-settings-connection-interface.h>
#include "nmcli.h"
......
......@@ -32,7 +32,6 @@
<xi:include href="xml/nm-remote-connection.xml"/>
<xi:include href="xml/nm-remote-settings.xml"/>
<xi:include href="xml/nm-settings-connection-interface.xml"/>
<xi:include href="xml/nm-settings-interface.xml"/>
<xi:include href="xml/nm-settings-service.xml"/>
<xi:include href="xml/nm-types.xml"/>
<xi:include href="xml/nm-vpn-connection.xml"/>
......
......@@ -76,7 +76,6 @@ libnminclude_HEADERS = \
nm-ip6-config.h \
nm-dhcp6-config.h \
nm-remote-connection.h \
nm-settings-interface.h \
nm-remote-settings.h \
nm-settings-connection-interface.h
......@@ -107,7 +106,6 @@ libnm_glib_la_SOURCES = \
nm-dhcp6-config.c \
nm-remote-connection.c \
nm-remote-connection-private.h \
nm-settings-interface.c \
nm-remote-settings.c \
nm-settings-connection-interface.c
......
......@@ -118,6 +118,11 @@ global:
nm_object_get_type;
nm_remote_connection_get_type;
nm_remote_connection_new;
nm_remote_settings_add_connection;
nm_remote_settings_get_connection_by_path;
nm_remote_settings_list_connections;
nm_remote_settings_get_permissions;
nm_remote_settings_save_hostname;
nm_remote_settings_get_type;
nm_remote_settings_new;
nm_serial_device_get_bytes_received;
......@@ -128,14 +133,6 @@ global:
nm_settings_connection_interface_get_secrets;
nm_settings_connection_interface_get_type;
nm_settings_connection_interface_update;
nm_settings_interface_add_connection;
nm_settings_interface_error_get_type;
nm_settings_interface_error_quark;
nm_settings_interface_get_connection_by_path;
nm_settings_interface_get_type;
nm_settings_interface_list_connections;
nm_settings_interface_get_permissions;
nm_settings_interface_save_hostname;
nm_settings_error_quark;
nm_settings_get_type;
nm_settings_list_connections;
......
......@@ -29,13 +29,9 @@
#include "nm-dbus-glib-types.h"
#include "nm-remote-settings.h"
#include "nm-settings-bindings.h"
#include "nm-settings-interface.h"
#include "nm-remote-connection-private.h"
static void settings_interface_init (NMSettingsInterface *class);
G_DEFINE_TYPE_EXTENDED (NMRemoteSettings, nm_remote_settings, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_INTERFACE, settings_interface_init))
G_DEFINE_TYPE (NMRemoteSettings, nm_remote_settings, G_TYPE_OBJECT)
#define NM_REMOTE_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsPrivate))
......@@ -64,13 +60,39 @@ enum {
PROP_0,
PROP_BUS,
PROP_SERVICE_RUNNING,
PROP_HOSTNAME,
PROP_CAN_MODIFY,
LAST_PROP
};
static NMSettingsConnectionInterface *
get_connection_by_path (NMSettingsInterface *settings, const char *path)
/* Signals */
enum {
NEW_CONNECTION,
CONNECTIONS_READ,
CHECK_PERMISSIONS,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
/**
* nm_remote_settings_get_connection_by_path:
* @settings: the %NMRemoteSettings
* @path: the D-Bus object path of the remote connection
*
* Returns the %NMRemoteConnection representing the connection at @path.
*
* Returns: the remote connection object on success, or NULL if the object was
* not known
**/
NMRemoteConnection *
nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings, const char *path)
{
g_return_val_if_fail (settings != NULL, NULL);
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
g_return_val_if_fail (path != NULL, NULL);
return g_hash_table_lookup (NM_REMOTE_SETTINGS_GET_PRIVATE (settings)->connections, path);
}
......@@ -121,7 +143,7 @@ connection_init_result_cb (NMRemoteConnection *remote,
/* Finally, let users know of the new connection now that it has all
* its settings and is valid.
*/
g_signal_emit_by_name (self, "new-connection", remote);
g_signal_emit (self, signals[NEW_CONNECTION], 0, remote);
break;
case NM_REMOTE_CONNECTION_INIT_RESULT_ERROR:
default:
......@@ -132,7 +154,7 @@ connection_init_result_cb (NMRemoteConnection *remote,
/* Let listeners know that all connections have been found */
if (!g_hash_table_size (priv->pending))
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ);
g_signal_emit (self, signals[CONNECTIONS_READ], 0);
}
static void
......@@ -180,7 +202,7 @@ fetch_connections_done (DBusGProxy *proxy,
/* Let listeners know we are done getting connections */
if (connections->len == 0) {
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CONNECTIONS_READ);
g_signal_emit (self, signals[CONNECTIONS_READ], 0);
return;
}
......@@ -207,14 +229,26 @@ fetch_connections (gpointer user_data)
return FALSE;
}
static GSList *
list_connections (NMSettingsInterface *settings)
/**
* nm_remote_settings_list_connections:
* @settings: the %NMRemoteSettings
*
* Returns: all connections in the remote settings service, represented as
* %NMRemoteConnection instances
**/
GSList *
nm_remote_settings_list_connections (NMRemoteSettings *settings)
{
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
NMRemoteSettingsPrivate *priv;
GSList *list = NULL;
GHashTableIter iter;
gpointer value;
g_return_val_if_fail (settings != NULL, NULL);
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
g_hash_table_iter_init (&iter, priv->connections);
while (g_hash_table_iter_next (&iter, NULL, &value))
list = g_slist_prepend (list, NM_REMOTE_CONNECTION (value));
......@@ -223,8 +257,8 @@ list_connections (NMSettingsInterface *settings)
}
typedef struct {
NMSettingsInterface *self;
NMSettingsAddConnectionFunc callback;
NMRemoteSettings *self;
NMRemoteSettingsAddConnectionFunc callback;
gpointer callback_data;
} AddConnectionInfo;
......@@ -238,18 +272,37 @@ add_connection_done (DBusGProxy *proxy,
info->callback (info->self, error, info->callback_data);
g_free (info);
}
static gboolean
add_connection (NMSettingsInterface *settings,
NMConnection *connection,
NMSettingsAddConnectionFunc callback,
gpointer user_data)
/**
* nm_remote_settings_add_connection:
* @settings: the %NMRemoteSettings
* @connection: the connection to add. Note that this object's settings will be
* added, not the object itself
* @callback: callback to be called when the add operation completes
* @user_data: caller-specific data passed to @callback
*
* Requests that the remote settings service add the given settings to a new
* connection.
*
* Returns: TRUE if the request was successful, FALSE if it failed
**/
gboolean
nm_remote_settings_add_connection (NMRemoteSettings *settings,
NMConnection *connection,
NMRemoteSettingsAddConnectionFunc callback,
gpointer user_data)
{
NMRemoteSettings *self = NM_REMOTE_SETTINGS (settings);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
NMRemoteSettingsPrivate *priv;
AddConnectionInfo *info;
GHashTable *new_settings;
g_return_val_if_fail (settings != NULL, FALSE);
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
g_return_val_if_fail (connection != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
g_return_val_if_fail (callback != NULL, FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
info = g_malloc0 (sizeof (AddConnectionInfo));
info->self = settings;
info->callback = callback;
......@@ -291,8 +344,8 @@ remove_connections (gpointer user_data)
}
typedef struct {
NMSettingsInterface *settings;
NMSettingsSaveHostnameFunc callback;
NMRemoteSettings *settings;
NMRemoteSettingsSaveHostnameFunc callback;
gpointer callback_data;
} SaveHostnameInfo;
......@@ -309,16 +362,35 @@ save_hostname_cb (DBusGProxy *proxy,
g_clear_error (&error);
}
static gboolean
save_hostname (NMSettingsInterface *settings,
const char *hostname,
NMSettingsSaveHostnameFunc callback,
gpointer user_data)
/**
* nm_remote_settings_save_hostname:
* @settings: the %NMRemoteSettings
* @hostname: the new persistent hostname to set, or NULL to clear any existing
* persistent hostname
* @callback: callback to be called when the hostname operation completes
* @user_data: caller-specific data passed to @callback
*
* Requests that the machine's persistent hostname be set to the specified value
* or cleared.
*
* Returns: TRUE if the request was successful, FALSE if it failed
**/
gboolean
nm_remote_settings_save_hostname (NMRemoteSettings *settings,
const char *hostname,
NMRemoteSettingsSaveHostnameFunc callback,
gpointer user_data)
{
NMRemoteSettings *self = NM_REMOTE_SETTINGS (settings);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
NMRemoteSettingsPrivate *priv;
SaveHostnameInfo *info;
g_return_val_if_fail (settings != NULL, FALSE);
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
g_return_val_if_fail (hostname != NULL, FALSE);
g_return_val_if_fail (callback != NULL, FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
info = g_malloc0 (sizeof (SaveHostnameInfo));
info->settings = settings;
info->callback = callback;
......@@ -334,8 +406,8 @@ save_hostname (NMSettingsInterface *settings,
}
typedef struct {
NMSettingsInterface *settings;
NMSettingsGetPermissionsFunc callback;
NMRemoteSettings *settings;
NMRemoteSettingsGetPermissionsFunc callback;
gpointer callback_data;
} GetPermissionsInfo;
......@@ -359,14 +431,31 @@ get_permissions_cb (DBusGProxy *proxy,
g_clear_error (&error);
}
static gboolean
get_permissions (NMSettingsInterface *settings,
NMSettingsGetPermissionsFunc callback,
gpointer user_data)
/**
* nm_remote_settings_get_permissions:
* @settings: the %NMRemoteSettings
* @callback: callback to be called when the permissions operation completes
* @user_data: caller-specific data passed to @callback
*
* Requests an indication of the operations the caller is permitted to perform
* including those that may require authorization.
*
* Returns: TRUE if the request was successful, FALSE if it failed
**/
gboolean
nm_remote_settings_get_permissions (NMRemoteSettings *settings,
NMRemoteSettingsGetPermissionsFunc callback,
gpointer user_data)
{
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
NMRemoteSettingsPrivate *priv;
GetPermissionsInfo *info;
g_return_val_if_fail (settings != NULL, FALSE);
g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
g_return_val_if_fail (callback != NULL, FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
/* Skip D-Bus if we already have permissions */
if (priv->have_permissions) {
callback (settings, priv->permissions, NULL, user_data);
......@@ -421,7 +510,7 @@ check_permissions_cb (DBusGProxy *proxy, gpointer user_data)
/* Permissions need to be re-fetched */
priv->have_permissions = FALSE;
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CHECK_PERMISSIONS);
g_signal_emit (self, signals[CHECK_PERMISSIONS], 0);
}
static void
......@@ -441,12 +530,12 @@ properties_changed_cb (DBusGProxy *proxy,
if (!strcmp ((const char *) key, "Hostname")) {
g_free (priv->hostname);
priv->hostname = g_value_dup_string (value);
g_object_notify (G_OBJECT (self), NM_SETTINGS_INTERFACE_HOSTNAME);
g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_HOSTNAME);
}
if (!strcmp ((const char *) key, "CanModify")) {
priv->can_modify = g_value_get_boolean (value);
g_object_notify (G_OBJECT (self), NM_SETTINGS_INTERFACE_CAN_MODIFY);
g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_CAN_MODIFY);
}
}
}
......@@ -482,17 +571,6 @@ get_all_cb (DBusGProxy *proxy,
/****************************************************************/
static void
settings_interface_init (NMSettingsInterface *iface)
{
/* interface implementation */
iface->list_connections = list_connections;
iface->get_connection_by_path = get_connection_by_path;
iface->add_connection = add_connection;
iface->save_hostname = save_hostname;
iface->get_permissions = get_permissions;
}
/**
* nm_remote_settings_new:
* @bus: a valid and connected D-Bus connection
......@@ -682,10 +760,10 @@ get_property (GObject *object, guint prop_id,
case PROP_SERVICE_RUNNING:
g_value_set_boolean (value, priv->service_running);
break;
case NM_SETTINGS_INTERFACE_PROP_HOSTNAME:
case PROP_HOSTNAME:
g_value_set_string (value, priv->hostname);
break;
case NM_SETTINGS_INTERFACE_PROP_CAN_MODIFY:
case PROP_CAN_MODIFY:
g_value_set_boolean (value, priv->can_modify);
break;
default:
......@@ -724,13 +802,48 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class)
FALSE,
G_PARAM_READABLE));
g_object_class_override_property (object_class,
NM_SETTINGS_INTERFACE_PROP_HOSTNAME,
NM_SETTINGS_INTERFACE_HOSTNAME);
g_object_class_install_property
(object_class, PROP_HOSTNAME,
g_param_spec_string (NM_REMOTE_SETTINGS_HOSTNAME,
"Hostname",
"Persistent hostname",
NULL,
G_PARAM_READABLE));
g_object_class_override_property (object_class,
NM_SETTINGS_INTERFACE_PROP_CAN_MODIFY,
NM_SETTINGS_INTERFACE_CAN_MODIFY);
g_object_class_install_property
(object_class, PROP_CAN_MODIFY,
g_param_spec_boolean (NM_REMOTE_SETTINGS_CAN_MODIFY,
"CanModify",
"Can modify anything (hostname, connections, etc)",
FALSE,
G_PARAM_READABLE));
/* Signals */
signals[NEW_CONNECTION] =
g_signal_new (NM_REMOTE_SETTINGS_NEW_CONNECTION,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMRemoteSettingsClass, new_connection),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, G_TYPE_OBJECT);
signals[CONNECTIONS_READ] =
g_signal_new (NM_REMOTE_SETTINGS_CONNECTIONS_READ,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMRemoteSettingsClass, connections_read),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
signals[CHECK_PERMISSIONS] =
g_signal_new (NM_REMOTE_SETTINGS_CHECK_PERMISSIONS,
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMRemoteSettingsClass, check_permissions),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
......@@ -31,6 +31,15 @@
G_BEGIN_DECLS
// FIXME this is temporary, permissions format to be improved
typedef enum {
NM_SETTINGS_PERMISSION_NONE = 0x0,
NM_SETTINGS_PERMISSION_CONNECTION_MODIFY = 0x1,
NM_SETTINGS_PERMISSION_WIFI_SHARE_PROTECTED = 0x2,
NM_SETTINGS_PERMISSION_WIFI_SHARE_OPEN = 0x4,
NM_SETTINGS_PERMISSION_HOSTNAME_MODIFY = 0x8
} NMSettingsPermissions;
#define NM_TYPE_REMOTE_SETTINGS (nm_remote_settings_get_type ())
#define NM_REMOTE_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettings))
#define NM_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
......@@ -38,16 +47,48 @@ G_BEGIN_DECLS
#define NM_IS_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_REMOTE_SETTINGS))
#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_BUS "bus"
#define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
#define NM_REMOTE_SETTINGS_HOSTNAME "hostname"
#define NM_REMOTE_SETTINGS_CAN_MODIFY "can-modify"
#define NM_REMOTE_SETTINGS_NEW_CONNECTION "new-connection"
#define NM_REMOTE_SETTINGS_CONNECTIONS_READ "connections-read"
#define NM_REMOTE_SETTINGS_CHECK_PERMISSIONS "check-permissions"
typedef struct _NMRemoteSettings NMRemoteSettings;
typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass;
typedef void (*NMRemoteSettingsAddConnectionFunc) (NMRemoteSettings *settings,
GError *error,
gpointer user_data);
typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings,
GError *error,
gpointer user_data);
typedef void (*NMRemoteSettingsGetPermissionsFunc) (NMRemoteSettings *settings,
NMSettingsPermissions permissions,
GError *error,
gpointer user_data);
typedef struct {
struct _NMRemoteSettings {
GObject parent;
} NMRemoteSettings;
};
typedef struct {
struct _NMRemoteSettingsClass {
GObjectClass parent;
/* Signals */
void (*new_connection) (NMRemoteSettings *settings,
NMRemoteConnection *connection);
void (*connections_read) (NMRemoteSettings *settings);
void (*check_permissions) (NMRemoteSettings *settings);
/* Padding for future expansion */
void (*_reserved1) (void);
void (*_reserved2) (void);
......@@ -55,12 +96,31 @@ typedef struct {
void (*_reserved4) (void);
void (*_reserved5) (void);
void (*_reserved6) (void);
} NMRemoteSettingsClass;
};
GType nm_remote_settings_get_type (void);
NMRemoteSettings *nm_remote_settings_new (DBusGConnection *bus);
GSList * nm_remote_settings_list_connections (NMRemoteSettings *settings);
NMRemoteConnection * nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings,
const char *path);
gboolean nm_remote_settings_add_connection (NMRemoteSettings *self,
NMConnection *connection,
NMRemoteSettingsAddConnectionFunc callback,
gpointer user_data);
gboolean nm_remote_settings_save_hostname (NMRemoteSettings *settings,
const char *hostname,
NMRemoteSettingsSaveHostnameFunc callback,
gpointer user_data);
gboolean nm_remote_settings_get_permissions (NMRemoteSettings *settings,
NMRemoteSettingsGetPermissionsFunc callback,
gpointer user_data);
G_END_DECLS
#endif /* NM_REMOTE_SETTINGS_H */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager -- Network link manager
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
* Copyright (C) 2007 - 2010 Red Hat, Inc.
*/
#include "nm-settings-interface.h"
/**
* nm_settings_interface_error_quark:
*
* Setting error quark.
*
* Returns: the setting error quark
**/
GQuark
nm_settings_interface_error_quark (void)
{
static GQuark quark;
if (G_UNLIKELY (!quark))
quark = g_quark_from_static_string ("nm-settings-interface-error-quark");
return quark;
}
/* This should really be standard. */
#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
GType
nm_settings_interface_error_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GEnumValue values[] = {
/* The connection was invalid. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_INVALID_CONNECTION, "InvalidConnection"),
/* The connection is read-only; modifications are not allowed. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_READ_ONLY_CONNECTION, "ReadOnlyConnection"),
/* A bug in the settings service caused the error. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_INTERNAL_ERROR, "InternalError"),
/* Retrieval or request of secrets failed. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_SECRETS_UNAVAILABLE, "SecretsUnavailable"),
/* The request for secrets was canceled. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_SECRETS_REQUEST_CANCELED, "SecretsRequestCanceled"),
/* The request could not be completed because permission was denied. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_PERMISSION_DENIED, "PermissionDenied"),
/* The requested setting does not existing in this connection. */
ENUM_ENTRY (NM_SETTINGS_INTERFACE_ERROR_INVALID_SETTING, "InvalidSetting"),
{ 0, 0, 0 },