Commit da6816a0 authored by Daniel Gnoutcheff's avatar Daniel Gnoutcheff

nm-glib/DBus: merge nm-settings{,-system} iface

Much as with nm-remote-settings and nm-remote-settings-system, the
removal of user settings services means there is no more need for
separate interfaces for user and system settings services.

In libnm-glib, this commit merges everything in
nm-settings-system-interface into nm-settings-interface.  Alongside with
that, we merge everything in the
org.freedesktop.NetworkManagerSettings.System DBus interface into
org.freedesktop.NetworkManagerSettings.
parent 4d1681ef
......@@ -51,7 +51,6 @@ IGNORE_HFILES= \
nm-ip6-config-bindings.h \
nm-settings-bindings.h \
nm-settings-glue.h \
nm-settings-system-bindings.h \
nm-vpn-connection-bindings.h \
nm-vpn-plugin-glue.h
......
......@@ -34,7 +34,6 @@
<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-settings-system-interface.xml"/>
<xi:include href="xml/nm-types.xml"/>
<xi:include href="xml/nm-vpn-connection.xml"/>
<xi:include href="xml/nm-vpn-plugin.xml"/>
......
......@@ -47,7 +47,6 @@
#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"
#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManagerSettings"
#define NM_DBUS_IFACE_SETTINGS_CONNECTION "org.freedesktop.NetworkManagerSettings.Connection"
......
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManagerSettings.System">
<tp:docstring>
Implemented by the system settings service to provide additional settings to NetworkManager.
</tp:docstring>
<method name="SaveHostname">
<tp:docstring>
Save the hostname to persistent configuration.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_save_hostname"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="hostname" type="s" direction="in">
<tp:docstring>
The hostname to save to persistent configuration. If blank, the persistent hostname is cleared.
</tp:docstring>
</arg>
</method>
<property name="Hostname" type="s" access="read">
<tp:docstring>
The machine hostname stored in persistent configuration.
</tp:docstring>
</property>
<property name="CanModify" type="b" access="read">
<tp:docstring>
If true, adding and modifying connections is supported.
</tp:docstring>
</property>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
<signal name="CheckPermissions">
<tp:docstring>
Emitted when system authorization details change, indicating that clients may wish to recheck permissions with GetPermissions.
</tp:docstring>
</signal>
<method name="GetPermissions">
<tp:docstring>
Returns a bitfield indicating certain operations the caller is permitted to perform. Some of these operations may require authorization by the user.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_get_permissions"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="permissions" type="u" direction="out" tp:type="NM_SETTINGS_SYSTEM_PERMISSIONS">
<tp:docstring>
A bitfield of permitted operations. Some of these operations may require the user to authorize via password entry or other means.
</tp:docstring>
</arg>
</method>
<tp:flags name="NM_SETTINGS_SYSTEM_PERMISSIONS" value-prefix="NM_SETTINGS_SYSTEM_PERMISSION" type="u">
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>No permissions.</tp:docstring>
</tp:flag>
<tp:flag suffix="CONNECTION_MODIFY" value="0x1">
<tp:docstring>Can modify/add/delete connections.</tp:docstring>
</tp:flag>
<tp:flag suffix="WIFI_SHARING_PROTECTED" value="0x2">
<tp:docstring>Can share connections via a encrypted user-created WiFi network.</tp:docstring>
</tp:flag>
<tp:flag suffix="WIFI_SHARING_OPEN" value="0x4">
<tp:docstring>Can share connections via a open/unencrypted user-created WiFi network.</tp:docstring>
</tp:flag>
<tp:flag suffix="HOSTNAME_MODIFY" value="0x8">
<tp:docstring>Can modify the persistent system hostname.</tp:docstring>
</tp:flag>
</tp:flags>
</interface>
</node>
......@@ -31,6 +31,58 @@
</arg>
</method>
<method name="SaveHostname">
<tp:docstring>
Save the hostname to persistent configuration.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_save_hostname"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="hostname" type="s" direction="in">
<tp:docstring>
The hostname to save to persistent configuration. If blank, the persistent hostname is cleared.
</tp:docstring>
</arg>
</method>
<method name="GetPermissions">
<tp:docstring>
Returns a bitfield indicating certain operations the caller is permitted to perform. Some of these operations may require authorization by the user.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_get_permissions"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="permissions" type="u" direction="out" tp:type="NM_SETTINGS_PERMISSIONS">
<tp:docstring>
A bitfield of permitted operations. Some of these operations may require the user to authorize via password entry or other means.
</tp:docstring>
</arg>
</method>
<property name="Hostname" type="s" access="read">
<tp:docstring>
The machine hostname stored in persistent configuration.
</tp:docstring>
</property>
<property name="CanModify" type="b" access="read">
<tp:docstring>
If true, adding and modifying connections is supported.
</tp:docstring>
</property>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
<signal name="CheckPermissions">
<tp:docstring>
Emitted when system authorization details change, indicating that clients may wish to recheck permissions with GetPermissions.
</tp:docstring>
</signal>
<signal name="NewConnection">
<tp:docstring>
Emitted when a new connection has been added.
......@@ -42,6 +94,24 @@
</arg>
</signal>
<tp:flags name="NM_SETTINGS_PERMISSIONS" value-prefix="NM_SETTINGS_PERMISSION" type="u">
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>No permissions.</tp:docstring>
</tp:flag>
<tp:flag suffix="CONNECTION_MODIFY" value="0x1">
<tp:docstring>Can modify/add/delete connections.</tp:docstring>
</tp:flag>
<tp:flag suffix="WIFI_SHARING_PROTECTED" value="0x2">
<tp:docstring>Can share connections via a encrypted user-created WiFi network.</tp:docstring>
</tp:flag>
<tp:flag suffix="WIFI_SHARING_OPEN" value="0x4">
<tp:docstring>Can share connections via a open/unencrypted user-created WiFi network.</tp:docstring>
</tp:flag>
<tp:flag suffix="HOSTNAME_MODIFY" value="0x8">
<tp:docstring>Can modify the persistent system hostname.</tp:docstring>
</tp:flag>
</tp:flags>
</interface>
</node>
......@@ -13,7 +13,6 @@ BUILT_SOURCES = \
nm-exported-connection-glue.h \
nm-exported-connection-bindings.h \
nm-settings-bindings.h \
nm-settings-system-bindings.h \
nm-vpn-connection-bindings.h \
nm-vpn-plugin-glue.h \
nm-active-connection-bindings.h \
......@@ -79,7 +78,6 @@ libnminclude_HEADERS = \
nm-dhcp6-config.h \
nm-remote-connection.h \
nm-settings-interface.h \
nm-settings-system-interface.h \
nm-remote-settings.h \
nm-settings-connection-interface.h \
nm-exported-connection.h
......@@ -112,7 +110,6 @@ libnm_glib_la_SOURCES = \
nm-remote-connection.c \
nm-remote-connection-private.h \
nm-settings-interface.c \
nm-settings-system-interface.c \
nm-remote-settings.c \
nm-settings-connection-interface.c \
nm-exported-connection.c
......@@ -164,9 +161,6 @@ nm-access-point-bindings.h: $(top_srcdir)/introspection/nm-access-point.xml
nm-settings-bindings.h: $(top_srcdir)/introspection/nm-settings.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-client --output=$@ $<
nm-settings-system-bindings.h: $(top_srcdir)/introspection/nm-settings-system.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings_system --mode=glib-client --output=$@ $<
nm-exported-connection-glue.h: $(top_srcdir)/introspection/nm-exported-connection.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_exported_connection --mode=glib-server --output=$@ $<
......
......@@ -137,10 +137,8 @@ global:
nm_settings_interface_get_connection_by_path;
nm_settings_interface_get_type;
nm_settings_interface_list_connections;
nm_settings_system_interface_get_type;
nm_settings_system_interface_add_connection;
nm_settings_system_interface_get_permissions;
nm_settings_system_interface_save_hostname;
nm_settings_interface_get_permissions;
nm_settings_interface_save_hostname;
nm_settings_error_quark;
nm_settings_get_type;
nm_settings_list_connections;
......
......@@ -30,16 +30,12 @@
#include "nm-remote-settings.h"
#include "nm-settings-bindings.h"
#include "nm-settings-interface.h"
#include "nm-settings-system-bindings.h"
#include "nm-settings-system-interface.h"
#include "nm-remote-connection-private.h"
static void settings_interface_init (NMSettingsInterface *class);
static void settings_system_interface_init (NMSettingsSystemInterface *class);
G_DEFINE_TYPE_EXTENDED (NMRemoteSettings, nm_remote_settings, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_INTERFACE, settings_interface_init)
G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_SYSTEM_INTERFACE, settings_system_interface_init))
G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_INTERFACE, settings_interface_init))
#define NM_REMOTE_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsPrivate))
......@@ -52,8 +48,7 @@ typedef struct {
gboolean service_running;
DBusGProxy *props_proxy;
DBusGProxy *sys_proxy;
NMSettingsSystemPermissions permissions;
NMSettingsPermissions permissions;
gboolean have_permissions;
char *hostname;
gboolean can_modify;
......@@ -296,8 +291,8 @@ remove_connections (gpointer user_data)
}
typedef struct {
NMSettingsSystemInterface *settings;
NMSettingsSystemSaveHostnameFunc callback;
NMSettingsInterface *settings;
NMSettingsSaveHostnameFunc callback;
gpointer callback_data;
} SaveHostnameInfo;
......@@ -315,9 +310,9 @@ save_hostname_cb (DBusGProxy *proxy,
}
static gboolean
save_hostname (NMSettingsSystemInterface *settings,
save_hostname (NMSettingsInterface *settings,
const char *hostname,
NMSettingsSystemSaveHostnameFunc callback,
NMSettingsSaveHostnameFunc callback,
gpointer user_data)
{
NMRemoteSettings *self = NM_REMOTE_SETTINGS (settings);
......@@ -329,7 +324,7 @@ save_hostname (NMSettingsSystemInterface *settings,
info->callback = callback;
info->callback_data = user_data;
dbus_g_proxy_begin_call (priv->sys_proxy, "SaveHostname",
dbus_g_proxy_begin_call (priv->proxy, "SaveHostname",
save_hostname_cb,
info,
g_free,
......@@ -339,8 +334,8 @@ save_hostname (NMSettingsSystemInterface *settings,
}
typedef struct {
NMSettingsSystemInterface *settings;
NMSettingsSystemGetPermissionsFunc callback;
NMSettingsInterface *settings;
NMSettingsGetPermissionsFunc callback;
gpointer callback_data;
} GetPermissionsInfo;
......@@ -352,7 +347,7 @@ get_permissions_cb (DBusGProxy *proxy,
GetPermissionsInfo *info = user_data;
NMRemoteSettings *self = NM_REMOTE_SETTINGS (info->settings);
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
NMSettingsSystemPermissions permissions = NM_SETTINGS_SYSTEM_PERMISSION_NONE;
NMSettingsPermissions permissions = NM_SETTINGS_PERMISSION_NONE;
GError *error = NULL;
dbus_g_proxy_end_call (proxy, call, &error,
......@@ -365,8 +360,8 @@ get_permissions_cb (DBusGProxy *proxy,
}
static gboolean
get_permissions (NMSettingsSystemInterface *settings,
NMSettingsSystemGetPermissionsFunc callback,
get_permissions (NMSettingsInterface *settings,
NMSettingsGetPermissionsFunc callback,
gpointer user_data)
{
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
......@@ -384,7 +379,7 @@ get_permissions (NMSettingsSystemInterface *settings,
info->callback = callback;
info->callback_data = user_data;
dbus_g_proxy_begin_call (priv->sys_proxy, "GetPermissions",
dbus_g_proxy_begin_call (priv->proxy, "GetPermissions",
get_permissions_cb,
info,
g_free,
......@@ -426,7 +421,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_SYSTEM_INTERFACE_CHECK_PERMISSIONS);
g_signal_emit_by_name (self, NM_SETTINGS_INTERFACE_CHECK_PERMISSIONS);
}
static void
......@@ -446,12 +441,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_SYSTEM_INTERFACE_HOSTNAME);
g_object_notify (G_OBJECT (self), NM_SETTINGS_INTERFACE_HOSTNAME);
}
if (!strcmp ((const char *) key, "CanModify")) {
priv->can_modify = g_value_get_boolean (value);
g_object_notify (G_OBJECT (self), NM_SETTINGS_SYSTEM_INTERFACE_CAN_MODIFY);
g_object_notify (G_OBJECT (self), NM_SETTINGS_INTERFACE_CAN_MODIFY);
}
}
}
......@@ -494,14 +489,8 @@ settings_interface_init (NMSettingsInterface *iface)
iface->list_connections = list_connections;
iface->get_connection_by_path = get_connection_by_path;
iface->add_connection = add_connection;
}
static void
settings_system_interface_init (NMSettingsSystemInterface *klass)
{
/* interface implementation */
klass->save_hostname = save_hostname;
klass->get_permissions = get_permissions;
iface->save_hostname = save_hostname;
iface->get_permissions = get_permissions;
}
/**
......@@ -603,29 +592,22 @@ constructor (GType type,
"org.freedesktop.DBus.Properties");
g_assert (priv->props_proxy);
/* System settings proxy */
priv->sys_proxy = dbus_g_proxy_new_for_name (priv->bus,
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
NM_DBUS_PATH_SETTINGS,
NM_DBUS_IFACE_SETTINGS_SYSTEM);
g_assert (priv->sys_proxy);
dbus_g_proxy_set_default_timeout (priv->sys_proxy, G_MAXINT);
/* Monitor properties */
dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
DBUS_TYPE_G_MAP_OF_VARIANT,
G_TYPE_INVALID);
dbus_g_proxy_add_signal (priv->sys_proxy, "PropertiesChanged",
dbus_g_proxy_add_signal (priv->proxy, "PropertiesChanged",
DBUS_TYPE_G_MAP_OF_VARIANT,
G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->sys_proxy, "PropertiesChanged",
dbus_g_proxy_connect_signal (priv->proxy, "PropertiesChanged",
G_CALLBACK (properties_changed_cb),
object,
NULL);
/* Monitor for permissions changes */
dbus_g_proxy_add_signal (priv->sys_proxy, "CheckPermissions", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->sys_proxy, "CheckPermissions",
dbus_g_proxy_add_signal (priv->proxy, "CheckPermissions", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (priv->proxy, "CheckPermissions",
G_CALLBACK (check_permissions_cb),
object,
NULL);
......@@ -635,7 +617,7 @@ constructor (GType type,
get_all_cb,
object,
NULL,
G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS_SYSTEM,
G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS,
G_TYPE_INVALID);
return object;
......@@ -700,10 +682,10 @@ get_property (GObject *object, guint prop_id,
case PROP_SERVICE_RUNNING:
g_value_set_boolean (value, priv->service_running);
break;
case NM_SETTINGS_SYSTEM_INTERFACE_PROP_HOSTNAME:
case NM_SETTINGS_INTERFACE_PROP_HOSTNAME:
g_value_set_string (value, priv->hostname);
break;
case NM_SETTINGS_SYSTEM_INTERFACE_PROP_CAN_MODIFY:
case NM_SETTINGS_INTERFACE_PROP_CAN_MODIFY:
g_value_set_boolean (value, priv->can_modify);
break;
default:
......@@ -743,12 +725,12 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class)
G_PARAM_READABLE));
g_object_class_override_property (object_class,
NM_SETTINGS_SYSTEM_INTERFACE_PROP_HOSTNAME,
NM_SETTINGS_SYSTEM_INTERFACE_HOSTNAME);
NM_SETTINGS_INTERFACE_PROP_HOSTNAME,
NM_SETTINGS_INTERFACE_HOSTNAME);
g_object_class_override_property (object_class,
NM_SETTINGS_SYSTEM_INTERFACE_PROP_CAN_MODIFY,
NM_SETTINGS_SYSTEM_INTERFACE_CAN_MODIFY);
NM_SETTINGS_INTERFACE_PROP_CAN_MODIFY,
NM_SETTINGS_INTERFACE_CAN_MODIFY);
}
......@@ -145,6 +145,65 @@ nm_settings_interface_add_connection (NMSettingsInterface *settings,
return FALSE;
}
/**
* nm_settings_interface_save_hostname:
* @settings: a object implementing %NMSettingsInterface
* @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_settings_interface_save_hostname (NMSettingsInterface *settings,
const char *hostname,
NMSettingsSaveHostnameFunc callback,
gpointer user_data)
{
g_return_val_if_fail (settings != NULL, FALSE);
g_return_val_if_fail (NM_IS_SETTINGS_INTERFACE (settings), FALSE);
g_return_val_if_fail (hostname != NULL, FALSE);
g_return_val_if_fail (callback != NULL, FALSE);
if (NM_SETTINGS_INTERFACE_GET_INTERFACE (settings)->save_hostname) {
return NM_SETTINGS_INTERFACE_GET_INTERFACE (settings)->save_hostname (settings,
hostname,
callback,
user_data);
}
return FALSE;
}
/**
* nm_settings_interface_get_permissions:
* @settings: a object implementing %NMSettingsInterface
* @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_settings_interface_get_permissions (NMSettingsInterface *settings,
NMSettingsGetPermissionsFunc callback,
gpointer user_data)
{
g_return_val_if_fail (settings != NULL, FALSE);
g_return_val_if_fail (NM_IS_SETTINGS_INTERFACE (settings), FALSE);
g_return_val_if_fail (callback != NULL, FALSE);
if (NM_SETTINGS_INTERFACE_GET_INTERFACE (settings)->get_permissions)
return NM_SETTINGS_INTERFACE_GET_INTERFACE (settings)->get_permissions (settings, callback, user_data);
return FALSE;
}
/*****************************************************************/
static void
......@@ -156,6 +215,23 @@ nm_settings_interface_init (gpointer g_iface)
if (initialized)
return;
/* Properties */
g_object_interface_install_property
(g_iface,
g_param_spec_string (NM_SETTINGS_INTERFACE_HOSTNAME,
"Hostname",
"Persistent hostname",
NULL,
G_PARAM_READABLE));
g_object_interface_install_property
(g_iface,
g_param_spec_boolean (NM_SETTINGS_INTERFACE_CAN_MODIFY,
"CanModify",
"Can modify anything (hostname, connections, etc)",
FALSE,
G_PARAM_READABLE));
/* Signals */
g_signal_new (NM_SETTINGS_INTERFACE_NEW_CONNECTION,
iface_type,
......@@ -173,6 +249,14 @@ nm_settings_interface_init (gpointer g_iface)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
g_signal_new (NM_SETTINGS_INTERFACE_CHECK_PERMISSIONS,
iface_type,
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMSettingsInterface, check_permissions),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
initialized = TRUE;
}
......
......@@ -47,13 +47,33 @@ GQuark nm_settings_interface_error_quark (void);
GType nm_settings_interface_error_get_type (void);
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_SETTINGS_INTERFACE (nm_settings_interface_get_type ())
#define NM_SETTINGS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS_INTERFACE, NMSettingsInterface))
#define NM_IS_SETTINGS_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS_INTERFACE))
#define NM_SETTINGS_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SETTINGS_INTERFACE, NMSettingsInterface))
#define NM_SETTINGS_INTERFACE_NEW_CONNECTION "new-connection"
#define NM_SETTINGS_INTERFACE_CONNECTIONS_READ "connections-read"
#define NM_SETTINGS_INTERFACE_NEW_CONNECTION "new-connection"
#define NM_SETTINGS_INTERFACE_CONNECTIONS_READ "connections-read"
#define NM_SETTINGS_INTERFACE_CHECK_PERMISSIONS "check-permissions"
#define NM_SETTINGS_INTERFACE_HOSTNAME "hostname"
#define NM_SETTINGS_INTERFACE_CAN_MODIFY "can-modify"
typedef enum {
NM_SETTINGS_INTERFACE_PROP_FIRST = 0x1000,
NM_SETTINGS_INTERFACE_PROP_HOSTNAME = NM_SETTINGS_INTERFACE_PROP_FIRST,
NM_SETTINGS_INTERFACE_PROP_CAN_MODIFY
} NMSettingsInterfaceProp;
typedef struct _NMSettingsInterface NMSettingsInterface;
......@@ -61,6 +81,15 @@ typedef void (*NMSettingsAddConnectionFunc) (NMSettingsInterface *settings,
GError *error,
gpointer user_data);
typedef void (*NMSettingsSaveHostnameFunc) (NMSettingsInterface *settings,
GError *error,
gpointer user_data);
typedef void (*NMSettingsGetPermissionsFunc) (NMSettingsInterface *settings,
NMSettingsPermissions permissions,
GError *error,
gpointer user_data);
struct _NMSettingsInterface {
GTypeInterface g_iface;
......@@ -75,6 +104,15 @@ struct _NMSettingsInterface {
NMConnection *connection,
NMSettingsAddConnectionFunc callback,
gpointer user_data);
gboolean (*save_hostname) (NMSettingsInterface *settings,
const char *hostname,
NMSettingsSaveHostnameFunc callback,
gpointer user_data);
gboolean (*get_permissions) (NMSettingsInterface *settings,
NMSettingsGetPermissionsFunc callback,
gpointer user_data);
/* Signals */
void (*new_connection) (NMSettingsInterface *settings,
......@@ -82,6 +120,8 @@ struct _NMSettingsInterface {
void (*connections_read) (NMSettingsInterface *settings);
void (*check_permissions) (NMSettingsInterface *settings);
/* Padding for future expansion */
void (*_reserved1) (void);
void (*_reserved2) (void);
......@@ -104,6 +144,15 @@ gboolean nm_settings_interface_add_connection (NMSettingsInterface *settings,
NMSettingsAddConnectionFunc callback,
gpointer user_data);
gboolean nm_settings_interface_save_hostname (NMSettingsInterface *settings,
const char *hostname,
NMSettingsSaveHostnameFunc callback,
gpointer user_data);
gboolean nm_settings_interface_get_permissions (NMSettingsInterface *settings,
NMSettingsGetPermissionsFunc callback,
gpointer user_data);
G_END_DECLS
#endif /* NM_SETTINGS_INTERFACE_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