mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 20:40:21 +01:00
settings: rename NMSysconfigSettings to NMSettings
This commit is contained in:
parent
18f819d71d
commit
1ec6b67162
9 changed files with 271 additions and 279 deletions
|
|
@ -453,7 +453,7 @@ main (int argc, char *argv[])
|
|||
NMDBusManager *dbus_mgr = NULL;
|
||||
NMSupplicantManager *sup_mgr = NULL;
|
||||
NMDHCPManager *dhcp_mgr = NULL;
|
||||
NMSysconfigSettings *settings = NULL;
|
||||
NMSettings *settings = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean wrote_pidfile = FALSE;
|
||||
char *cfg_log_level = NULL, *cfg_log_domains = NULL;
|
||||
|
|
@ -673,7 +673,7 @@ main (int argc, char *argv[])
|
|||
goto done;
|
||||
}
|
||||
|
||||
settings = nm_sysconfig_settings_new (config, plugins, &error);
|
||||
settings = nm_settings_new (config, plugins, &error);
|
||||
if (!settings) {
|
||||
nm_log_err (LOGD_CORE, "failed to initialize settings storage.");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
#include "nm-hostname-provider.h"
|
||||
#include "nm-bluez-manager.h"
|
||||
#include "nm-bluez-common.h"
|
||||
#include "nm-sysconfig-settings.h"
|
||||
#include "nm-settings.h"
|
||||
#include "nm-sysconfig-connection.h"
|
||||
#include "nm-secrets-provider-interface.h"
|
||||
#include "nm-manager-auth.h"
|
||||
|
|
@ -200,7 +200,7 @@ typedef struct {
|
|||
NMUdevManager *udev_mgr;
|
||||
NMBluezManager *bluez_mgr;
|
||||
|
||||
NMSysconfigSettings *settings;
|
||||
NMSettings *settings;
|
||||
char *hostname;
|
||||
|
||||
GSList *secrets_calls;
|
||||
|
|
@ -485,7 +485,7 @@ remove_one_device (NMManager *manager,
|
|||
|
||||
g_signal_handlers_disconnect_by_func (device, manager_device_state_changed, manager);
|
||||
|
||||
nm_sysconfig_settings_device_removed (priv->settings, device);
|
||||
nm_settings_device_removed (priv->settings, device);
|
||||
g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
|
||||
g_object_unref (device);
|
||||
|
||||
|
|
@ -743,11 +743,11 @@ get_active_connections (NMManager *manager, NMConnection *filter)
|
|||
}
|
||||
|
||||
/*******************************************************************/
|
||||
/* Settings stuff via NMSysconfigSettings */
|
||||
/* Settings stuff via NMSettings */
|
||||
/*******************************************************************/
|
||||
|
||||
static void
|
||||
connections_changed (NMSysconfigSettings *settings,
|
||||
connections_changed (NMSettings *settings,
|
||||
NMSysconfigConnection *connection,
|
||||
NMManager *manager)
|
||||
{
|
||||
|
|
@ -755,15 +755,15 @@ connections_changed (NMSysconfigSettings *settings,
|
|||
}
|
||||
|
||||
static void
|
||||
system_unmanaged_devices_changed_cb (NMSysconfigSettings *sys_settings,
|
||||
system_unmanaged_devices_changed_cb (NMSettings *settings,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMManager *manager = NM_MANAGER (user_data);
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
||||
NMManager *self = NM_MANAGER (user_data);
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
const GSList *unmanaged_specs, *iter;
|
||||
|
||||
unmanaged_specs = nm_sysconfig_settings_get_unmanaged_specs (sys_settings);
|
||||
unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings);
|
||||
for (iter = priv->devices; iter; iter = g_slist_next (iter)) {
|
||||
NMDevice *device = NM_DEVICE (iter->data);
|
||||
gboolean managed;
|
||||
|
|
@ -772,30 +772,28 @@ system_unmanaged_devices_changed_cb (NMSysconfigSettings *sys_settings,
|
|||
nm_device_set_managed (device,
|
||||
managed,
|
||||
managed ? NM_DEVICE_STATE_REASON_NOW_MANAGED :
|
||||
NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
||||
NM_DEVICE_STATE_REASON_NOW_UNMANAGED);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
system_hostname_changed_cb (NMSysconfigSettings *sys_settings,
|
||||
system_hostname_changed_cb (NMSettings *settings,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMManager *manager = NM_MANAGER (user_data);
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
||||
NMManager *self = NM_MANAGER (user_data);
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
|
||||
char *hostname;
|
||||
|
||||
hostname = nm_sysconfig_settings_get_hostname (sys_settings);
|
||||
|
||||
hostname = nm_settings_get_hostname (priv->settings);
|
||||
if (!hostname && !priv->hostname)
|
||||
return;
|
||||
|
||||
if (hostname && priv->hostname && !strcmp (hostname, priv->hostname))
|
||||
return;
|
||||
|
||||
g_free (priv->hostname);
|
||||
priv->hostname = (hostname && strlen (hostname)) ? g_strdup (hostname) : NULL;
|
||||
g_object_notify (G_OBJECT (manager), NM_MANAGER_HOSTNAME);
|
||||
g_object_notify (G_OBJECT (self), NM_MANAGER_HOSTNAME);
|
||||
|
||||
g_free (hostname);
|
||||
}
|
||||
|
|
@ -945,7 +943,7 @@ manager_hidden_ap_found (NMDeviceInterface *device,
|
|||
|
||||
/* Look for this AP's BSSID in the seen-bssids list of a connection,
|
||||
* and if a match is found, copy over the SSID */
|
||||
connections = nm_sysconfig_settings_get_connections (priv->settings);
|
||||
connections = nm_settings_get_connections (priv->settings);
|
||||
|
||||
for (iter = connections; iter && !done; iter = g_slist_next (iter)) {
|
||||
NMConnection *connection = NM_CONNECTION (iter->data);
|
||||
|
|
@ -1330,7 +1328,7 @@ add_device (NMManager *self, NMDevice *device)
|
|||
if (nm_device_interface_can_assume_connections (NM_DEVICE_INTERFACE (device))) {
|
||||
GSList *connections = NULL;
|
||||
|
||||
connections = nm_sysconfig_settings_get_connections (priv->settings);
|
||||
connections = nm_settings_get_connections (priv->settings);
|
||||
existing = nm_device_interface_connection_match_config (NM_DEVICE_INTERFACE (device),
|
||||
(const GSList *) connections);
|
||||
g_slist_free (connections);
|
||||
|
|
@ -1346,7 +1344,7 @@ add_device (NMManager *self, NMDevice *device)
|
|||
}
|
||||
|
||||
/* Start the device if it's supposed to be managed */
|
||||
unmanaged_specs = nm_sysconfig_settings_get_unmanaged_specs (priv->settings);
|
||||
unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings);
|
||||
if ( !manager_sleeping (self)
|
||||
&& !nm_device_interface_spec_match_list (NM_DEVICE_INTERFACE (device), unmanaged_specs)) {
|
||||
nm_device_set_managed (device,
|
||||
|
|
@ -1356,7 +1354,7 @@ add_device (NMManager *self, NMDevice *device)
|
|||
managed = TRUE;
|
||||
}
|
||||
|
||||
nm_sysconfig_settings_device_added (priv->settings, device);
|
||||
nm_settings_device_added (priv->settings, device);
|
||||
g_signal_emit (self, signals[DEVICE_ADDED], 0, device);
|
||||
|
||||
/* If the device has a connection it can assume, do that now */
|
||||
|
|
@ -1415,7 +1413,7 @@ bluez_manager_find_connection (NMManager *manager,
|
|||
NMConnection *found = NULL;
|
||||
GSList *connections, *l;
|
||||
|
||||
connections = nm_sysconfig_settings_get_connections (priv->settings);
|
||||
connections = nm_settings_get_connections (priv->settings);
|
||||
|
||||
for (l = connections; l != NULL; l = l->next) {
|
||||
NMConnection *candidate = NM_CONNECTION (l->data);
|
||||
|
|
@ -1780,8 +1778,7 @@ system_get_secrets_idle_cb (gpointer user_data)
|
|||
|
||||
info->idle_id = 0;
|
||||
|
||||
connection = nm_sysconfig_settings_get_connection_by_path (priv->settings,
|
||||
info->connection_path);
|
||||
connection = nm_settings_get_connection_by_path (priv->settings, info->connection_path);
|
||||
if (!connection) {
|
||||
error = g_error_new_literal (NM_MANAGER_ERROR,
|
||||
NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
|
||||
|
|
@ -2040,8 +2037,7 @@ check_pending_ready (NMManager *self, PendingActivation *pending)
|
|||
|
||||
/* Ok, we're authorized */
|
||||
|
||||
connection = nm_sysconfig_settings_get_connection_by_path (priv->settings,
|
||||
pending->connection_path);
|
||||
connection = nm_settings_get_connection_by_path (priv->settings, pending->connection_path);
|
||||
if (!connection) {
|
||||
error = g_error_new_literal (NM_MANAGER_ERROR,
|
||||
NM_MANAGER_ERROR_UNKNOWN_CONNECTION,
|
||||
|
|
@ -2286,7 +2282,7 @@ do_sleep_wake (NMManager *self)
|
|||
} else {
|
||||
nm_log_info (LOGD_SUSPEND, "waking up and re-enabling...");
|
||||
|
||||
unmanaged_specs = nm_sysconfig_settings_get_unmanaged_specs (priv->settings);
|
||||
unmanaged_specs = nm_settings_get_unmanaged_specs (priv->settings);
|
||||
|
||||
/* Ensure rfkill state is up-to-date since we don't respond to state
|
||||
* changes during sleep.
|
||||
|
|
@ -3004,7 +3000,7 @@ out:
|
|||
}
|
||||
|
||||
NMManager *
|
||||
nm_manager_get (NMSysconfigSettings *settings,
|
||||
nm_manager_get (NMSettings *settings,
|
||||
const char *config_file,
|
||||
const char *plugins,
|
||||
const char *state_file,
|
||||
|
|
@ -3049,22 +3045,20 @@ nm_manager_get (NMSysconfigSettings *settings,
|
|||
priv->radio_states[RFKILL_TYPE_WLAN].user_enabled = initial_wifi_enabled;
|
||||
priv->radio_states[RFKILL_TYPE_WWAN].user_enabled = initial_wwan_enabled;
|
||||
|
||||
g_signal_connect (priv->settings, "notify::" NM_SYSCONFIG_SETTINGS_UNMANAGED_SPECS,
|
||||
g_signal_connect (priv->settings, "notify::" NM_SETTINGS_UNMANAGED_SPECS,
|
||||
G_CALLBACK (system_unmanaged_devices_changed_cb), singleton);
|
||||
g_signal_connect (priv->settings, "notify::" NM_SYSCONFIG_SETTINGS_HOSTNAME,
|
||||
g_signal_connect (priv->settings, "notify::" NM_SETTINGS_HOSTNAME,
|
||||
G_CALLBACK (system_hostname_changed_cb), singleton);
|
||||
g_signal_connect (priv->settings, NM_SYSCONFIG_SETTINGS_CONNECTION_ADDED,
|
||||
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_ADDED,
|
||||
G_CALLBACK (connections_changed), singleton);
|
||||
g_signal_connect (priv->settings, NM_SYSCONFIG_SETTINGS_CONNECTION_UPDATED,
|
||||
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_UPDATED,
|
||||
G_CALLBACK (connections_changed), singleton);
|
||||
g_signal_connect (priv->settings, NM_SYSCONFIG_SETTINGS_CONNECTION_REMOVED,
|
||||
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_REMOVED,
|
||||
G_CALLBACK (connections_changed), singleton);
|
||||
g_signal_connect (priv->settings, NM_SYSCONFIG_SETTINGS_CONNECTION_VISIBILITY_CHANGED,
|
||||
g_signal_connect (priv->settings, NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED,
|
||||
G_CALLBACK (connections_changed), singleton);
|
||||
|
||||
dbus_g_connection_register_g_object (nm_dbus_manager_get_connection (priv->dbus_mgr),
|
||||
NM_DBUS_PATH,
|
||||
G_OBJECT (singleton));
|
||||
dbus_g_connection_register_g_object (bus, NM_DBUS_PATH, G_OBJECT (singleton));
|
||||
|
||||
priv->udev_mgr = nm_udev_manager_new ();
|
||||
g_signal_connect (priv->udev_mgr,
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <dbus/dbus-glib.h>
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-interface.h"
|
||||
#include "nm-sysconfig-settings.h"
|
||||
#include "nm-settings.h"
|
||||
|
||||
#define NM_TYPE_MANAGER (nm_manager_get_type ())
|
||||
#define NM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MANAGER, NMManager))
|
||||
|
|
@ -65,7 +65,7 @@ typedef struct {
|
|||
|
||||
GType nm_manager_get_type (void);
|
||||
|
||||
NMManager *nm_manager_get (NMSysconfigSettings *settings,
|
||||
NMManager *nm_manager_get (NMSettings *settings,
|
||||
const char *config_file,
|
||||
const char *plugins,
|
||||
const char *state_file,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ struct NMPolicy {
|
|||
gulong vpn_activated_id;
|
||||
gulong vpn_deactivated_id;
|
||||
|
||||
NMSysconfigSettings *settings;
|
||||
NMSettings *settings;
|
||||
|
||||
NMDevice *default_device4;
|
||||
NMDevice *default_device6;
|
||||
|
|
@ -742,7 +742,7 @@ auto_activate_device (gpointer user_data)
|
|||
if (nm_device_get_act_request (data->device))
|
||||
goto out;
|
||||
|
||||
connections = nm_sysconfig_settings_get_connections (policy->settings);
|
||||
connections = nm_settings_get_connections (policy->settings);
|
||||
|
||||
/* Remove connections that are in the invalid list. */
|
||||
iter = connections;
|
||||
|
|
@ -834,7 +834,7 @@ sleeping_changed (NMManager *manager, GParamSpec *pspec, gpointer user_data)
|
|||
|
||||
/* Clear the invalid flag on all connections so they'll get retried on wakeup */
|
||||
if (sleeping || !enabled) {
|
||||
connections = nm_sysconfig_settings_get_connections (policy->settings);
|
||||
connections = nm_settings_get_connections (policy->settings);
|
||||
for (iter = connections; iter; iter = g_slist_next (iter))
|
||||
g_object_set_data (G_OBJECT (iter->data), INVALID_TAG, NULL);
|
||||
g_slist_free (connections);
|
||||
|
|
@ -1026,7 +1026,7 @@ schedule_activate_all (NMPolicy *policy)
|
|||
}
|
||||
|
||||
static void
|
||||
connection_added (NMSysconfigSettings *settings,
|
||||
connection_added (NMSettings *settings,
|
||||
NMConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
|
@ -1034,7 +1034,7 @@ connection_added (NMSysconfigSettings *settings,
|
|||
}
|
||||
|
||||
static void
|
||||
connection_updated (NMSysconfigSettings *settings,
|
||||
connection_updated (NMSettings *settings,
|
||||
NMConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
|
@ -1073,7 +1073,7 @@ _deactivate_if_active (NMManager *manager, NMConnection *connection)
|
|||
}
|
||||
|
||||
static void
|
||||
connection_removed (NMSysconfigSettings *settings,
|
||||
connection_removed (NMSettings *settings,
|
||||
NMConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
|
@ -1083,7 +1083,7 @@ connection_removed (NMSysconfigSettings *settings,
|
|||
}
|
||||
|
||||
static void
|
||||
connection_visibility_changed (NMSysconfigSettings *settings,
|
||||
connection_visibility_changed (NMSettings *settings,
|
||||
NMSysconfigConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
|
@ -1116,7 +1116,7 @@ _connect_settings_signal (NMPolicy *policy, const char *name, gpointer callback)
|
|||
NMPolicy *
|
||||
nm_policy_new (NMManager *manager,
|
||||
NMVPNManager *vpn_manager,
|
||||
NMSysconfigSettings *settings)
|
||||
NMSettings *settings)
|
||||
{
|
||||
NMPolicy *policy;
|
||||
static gboolean initialized = FALSE;
|
||||
|
|
@ -1154,11 +1154,11 @@ nm_policy_new (NMManager *manager,
|
|||
_connect_manager_signal (policy, "device-added", device_added);
|
||||
_connect_manager_signal (policy, "device-removed", device_removed);
|
||||
|
||||
_connect_settings_signal (policy, NM_SYSCONFIG_SETTINGS_CONNECTIONS_LOADED, connection_added);
|
||||
_connect_settings_signal (policy, NM_SYSCONFIG_SETTINGS_CONNECTION_ADDED, connection_added);
|
||||
_connect_settings_signal (policy, NM_SYSCONFIG_SETTINGS_CONNECTION_UPDATED, connection_updated);
|
||||
_connect_settings_signal (policy, NM_SYSCONFIG_SETTINGS_CONNECTION_REMOVED, connection_removed);
|
||||
_connect_settings_signal (policy, NM_SYSCONFIG_SETTINGS_CONNECTION_VISIBILITY_CHANGED,
|
||||
_connect_settings_signal (policy, NM_SETTINGS_CONNECTIONS_LOADED, connection_added);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_ADDED, connection_added);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_UPDATED, connection_updated);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_REMOVED, connection_removed);
|
||||
_connect_settings_signal (policy, NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED,
|
||||
connection_visibility_changed);
|
||||
return policy;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,18 +19,18 @@
|
|||
* Copyright (C) 2007 - 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NETWORK_MANAGER_POLICY_H
|
||||
#define NETWORK_MANAGER_POLICY_H
|
||||
#ifndef NM_POLICY_H
|
||||
#define NM_POLICY_H
|
||||
|
||||
#include "nm-manager.h"
|
||||
#include "nm-vpn-manager.h"
|
||||
#include "nm-sysconfig-settings.h"
|
||||
#include "nm-settings.h"
|
||||
|
||||
typedef struct NMPolicy NMPolicy;
|
||||
|
||||
NMPolicy *nm_policy_new (NMManager *manager,
|
||||
NMVPNManager *vpn_manager,
|
||||
NMSysconfigSettings *settings);
|
||||
NMSettings *settings);
|
||||
void nm_policy_destroy (NMPolicy *policy);
|
||||
|
||||
#endif /* NETWORK_MANAGER_POLICY_H */
|
||||
#endif /* NM_POLICY_H */
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ BUILT_SOURCES = \
|
|||
nm-sysconfig-connection-glue.h
|
||||
|
||||
libsystem_settings_la_SOURCES = \
|
||||
nm-sysconfig-settings.c \
|
||||
nm-sysconfig-settings.h \
|
||||
nm-settings.c \
|
||||
nm-settings.h \
|
||||
nm-inotify-helper.c \
|
||||
nm-inotify-helper.h \
|
||||
nm-polkit-helpers.h \
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include "../nm-device-ethernet.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-sysconfig-settings.h"
|
||||
#include "nm-settings.h"
|
||||
#include "nm-sysconfig-connection.h"
|
||||
#include "nm-polkit-helpers.h"
|
||||
#include "nm-system-config-error.h"
|
||||
|
|
@ -78,19 +78,19 @@ EXPORT(nm_sysconfig_connection_replace_settings)
|
|||
EXPORT(nm_sysconfig_connection_replace_and_commit)
|
||||
/* END LINKER CRACKROCK */
|
||||
|
||||
static void claim_connection (NMSysconfigSettings *self,
|
||||
static void claim_connection (NMSettings *self,
|
||||
NMSysconfigConnection *connection,
|
||||
gboolean do_export);
|
||||
|
||||
static gboolean impl_settings_list_connections (NMSysconfigSettings *self,
|
||||
static gboolean impl_settings_list_connections (NMSettings *self,
|
||||
GPtrArray **connections,
|
||||
GError **error);
|
||||
|
||||
static void impl_settings_add_connection (NMSysconfigSettings *self,
|
||||
static void impl_settings_add_connection (NMSettings *self,
|
||||
GHashTable *settings,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
static void impl_settings_save_hostname (NMSysconfigSettings *self,
|
||||
static void impl_settings_save_hostname (NMSettings *self,
|
||||
const char *hostname,
|
||||
DBusGMethodInvocation *context);
|
||||
|
||||
|
|
@ -112,11 +112,11 @@ typedef struct {
|
|||
gboolean connections_loaded;
|
||||
GHashTable *connections;
|
||||
GSList *unmanaged_specs;
|
||||
} NMSysconfigSettingsPrivate;
|
||||
} NMSettingsPrivate;
|
||||
|
||||
G_DEFINE_TYPE (NMSysconfigSettings, nm_sysconfig_settings, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE (NMSettings, nm_settings, G_TYPE_OBJECT)
|
||||
|
||||
#define NM_SYSCONFIG_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SYSCONFIG_SETTINGS, NMSysconfigSettingsPrivate))
|
||||
#define NM_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTINGS, NMSettingsPrivate))
|
||||
|
||||
enum {
|
||||
PROPERTIES_CHANGED,
|
||||
|
|
@ -142,9 +142,9 @@ enum {
|
|||
};
|
||||
|
||||
static void
|
||||
load_connections (NMSysconfigSettings *self)
|
||||
load_connections (NMSettings *self)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
if (priv->connections_loaded)
|
||||
|
|
@ -176,19 +176,19 @@ load_connections (NMSysconfigSettings *self)
|
|||
}
|
||||
|
||||
void
|
||||
nm_sysconfig_settings_for_each_connection (NMSysconfigSettings *self,
|
||||
NMSysconfigSettingsForEachFunc for_each_func,
|
||||
gpointer user_data)
|
||||
nm_settings_for_each_connection (NMSettings *self,
|
||||
NMSettingsForEachFunc for_each_func,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv;
|
||||
NMSettingsPrivate *priv;
|
||||
GHashTableIter iter;
|
||||
gpointer data;
|
||||
|
||||
g_return_if_fail (self != NULL);
|
||||
g_return_if_fail (NM_IS_SYSCONFIG_SETTINGS (self));
|
||||
g_return_if_fail (NM_IS_SETTINGS (self));
|
||||
g_return_if_fail (for_each_func != NULL);
|
||||
|
||||
priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
|
||||
|
|
@ -198,11 +198,11 @@ nm_sysconfig_settings_for_each_connection (NMSysconfigSettings *self,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
impl_settings_list_connections (NMSysconfigSettings *self,
|
||||
impl_settings_list_connections (NMSettings *self,
|
||||
GPtrArray **connections,
|
||||
GError **error)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
|
||||
|
|
@ -245,30 +245,30 @@ connection_sort (gconstpointer pa, gconstpointer pb)
|
|||
* unref the connections in the list and destroy the list.
|
||||
*/
|
||||
GSList *
|
||||
nm_sysconfig_settings_get_connections (NMSysconfigSettings *self)
|
||||
nm_settings_get_connections (NMSettings *self)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer data = NULL;
|
||||
GSList *list = NULL;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SYSCONFIG_SETTINGS (self), NULL);
|
||||
g_return_val_if_fail (NM_IS_SETTINGS (self), NULL);
|
||||
|
||||
g_hash_table_iter_init (&iter, NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self)->connections);
|
||||
g_hash_table_iter_init (&iter, NM_SETTINGS_GET_PRIVATE (self)->connections);
|
||||
while (g_hash_table_iter_next (&iter, NULL, &data))
|
||||
list = g_slist_insert_sorted (list, data, connection_sort);
|
||||
return g_slist_reverse (list);
|
||||
}
|
||||
|
||||
NMSysconfigConnection *
|
||||
nm_sysconfig_settings_get_connection_by_path (NMSysconfigSettings *self, const char *path)
|
||||
nm_settings_get_connection_by_path (NMSettings *self, const char *path)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv;
|
||||
NMSettingsPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
g_return_val_if_fail (NM_IS_SYSCONFIG_SETTINGS (self), NULL);
|
||||
g_return_val_if_fail (NM_IS_SETTINGS (self), NULL);
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
|
||||
priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
|
||||
|
|
@ -276,9 +276,9 @@ nm_sysconfig_settings_get_connection_by_path (NMSysconfigSettings *self, const c
|
|||
}
|
||||
|
||||
static void
|
||||
clear_unmanaged_specs (NMSysconfigSettings *self)
|
||||
clear_unmanaged_specs (NMSettings *self)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
g_slist_foreach (priv->unmanaged_specs, (GFunc) g_free, NULL);
|
||||
g_slist_free (priv->unmanaged_specs);
|
||||
|
|
@ -331,18 +331,18 @@ notify (GObject *object, GParamSpec *pspec)
|
|||
}
|
||||
|
||||
const GSList *
|
||||
nm_sysconfig_settings_get_unmanaged_specs (NMSysconfigSettings *self)
|
||||
nm_settings_get_unmanaged_specs (NMSettings *self)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
load_connections (self);
|
||||
return priv->unmanaged_specs;
|
||||
}
|
||||
|
||||
static NMSystemConfigInterface *
|
||||
get_plugin (NMSysconfigSettings *self, guint32 capability)
|
||||
get_plugin (NMSettings *self, guint32 capability)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
|
|
@ -361,9 +361,9 @@ get_plugin (NMSysconfigSettings *self, guint32 capability)
|
|||
|
||||
/* Returns an allocated string which the caller owns and must eventually free */
|
||||
char *
|
||||
nm_sysconfig_settings_get_hostname (NMSysconfigSettings *self)
|
||||
nm_settings_get_hostname (NMSettings *self)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
char *hostname = NULL;
|
||||
|
||||
|
|
@ -390,13 +390,13 @@ plugin_connection_added (NMSystemConfigInterface *config,
|
|||
NMSysconfigConnection *connection,
|
||||
gpointer user_data)
|
||||
{
|
||||
claim_connection (NM_SYSCONFIG_SETTINGS (user_data), connection, TRUE);
|
||||
claim_connection (NM_SETTINGS (user_data), connection, TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
find_unmanaged_device (NMSysconfigSettings *self, const char *needle)
|
||||
find_unmanaged_device (NMSettings *self, const char *needle)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
for (iter = priv->unmanaged_specs; iter; iter = g_slist_next (iter)) {
|
||||
|
|
@ -410,8 +410,8 @@ static void
|
|||
unmanaged_specs_changed (NMSystemConfigInterface *config,
|
||||
gpointer user_data)
|
||||
{
|
||||
NMSysconfigSettings *self = NM_SYSCONFIG_SETTINGS (user_data);
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettings *self = NM_SETTINGS (user_data);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
clear_unmanaged_specs (self);
|
||||
|
|
@ -431,7 +431,7 @@ unmanaged_specs_changed (NMSystemConfigInterface *config,
|
|||
g_slist_free (specs);
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (self), NM_SYSCONFIG_SETTINGS_UNMANAGED_SPECS);
|
||||
g_object_notify (G_OBJECT (self), NM_SETTINGS_UNMANAGED_SPECS);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -439,20 +439,20 @@ hostname_changed (NMSystemConfigInterface *config,
|
|||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_object_notify (G_OBJECT (user_data), NM_SYSCONFIG_SETTINGS_HOSTNAME);
|
||||
g_object_notify (G_OBJECT (user_data), NM_SETTINGS_HOSTNAME);
|
||||
}
|
||||
|
||||
static void
|
||||
add_plugin (NMSysconfigSettings *self, NMSystemConfigInterface *plugin)
|
||||
add_plugin (NMSettings *self, NMSystemConfigInterface *plugin)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv;
|
||||
NMSettingsPrivate *priv;
|
||||
char *pname = NULL;
|
||||
char *pinfo = NULL;
|
||||
|
||||
g_return_if_fail (NM_IS_SYSCONFIG_SETTINGS (self));
|
||||
g_return_if_fail (NM_IS_SETTINGS (self));
|
||||
g_return_if_fail (NM_IS_SYSTEM_CONFIG_INTERFACE (plugin));
|
||||
|
||||
priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
priv->plugins = g_slist_append (priv->plugins, g_object_ref (plugin));
|
||||
|
||||
|
|
@ -501,7 +501,7 @@ find_plugin (GSList *list, const char *pname)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
load_plugins (NMSysconfigSettings *self, const char *plugins, GError **error)
|
||||
load_plugins (NMSettings *self, const char *plugins, GError **error)
|
||||
{
|
||||
GSList *list = NULL;
|
||||
char **plist;
|
||||
|
|
@ -580,8 +580,8 @@ connection_removed (NMSysconfigConnection *connection, gpointer user_data)
|
|||
{
|
||||
g_object_ref (connection);
|
||||
|
||||
g_hash_table_remove (NM_SYSCONFIG_SETTINGS_GET_PRIVATE (user_data)->connections, connection);
|
||||
g_signal_emit (NM_SYSCONFIG_SETTINGS (user_data),
|
||||
g_hash_table_remove (NM_SETTINGS_GET_PRIVATE (user_data)->connections, connection);
|
||||
g_signal_emit (NM_SETTINGS (user_data),
|
||||
signals[CONNECTION_REMOVED],
|
||||
0,
|
||||
connection);
|
||||
|
|
@ -591,7 +591,7 @@ connection_removed (NMSysconfigConnection *connection, gpointer user_data)
|
|||
static void
|
||||
connection_updated (NMSysconfigConnection *connection, gpointer user_data)
|
||||
{
|
||||
g_signal_emit (NM_SYSCONFIG_SETTINGS (user_data),
|
||||
g_signal_emit (NM_SETTINGS (user_data),
|
||||
signals[CONNECTION_UPDATED],
|
||||
0,
|
||||
connection);
|
||||
|
|
@ -602,18 +602,18 @@ connection_visibility_changed (NMSysconfigConnection *connection,
|
|||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_signal_emit (NM_SYSCONFIG_SETTINGS (user_data),
|
||||
g_signal_emit (NM_SETTINGS (user_data),
|
||||
signals[CONNECTION_VISIBILITY_CHANGED],
|
||||
0,
|
||||
connection);
|
||||
}
|
||||
|
||||
static void
|
||||
claim_connection (NMSysconfigSettings *self,
|
||||
claim_connection (NMSettings *self,
|
||||
NMSysconfigConnection *connection,
|
||||
gboolean do_export)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
static guint32 ec_counter = 0;
|
||||
GError *error = NULL;
|
||||
GHashTableIter iter;
|
||||
|
|
@ -683,11 +683,11 @@ claim_connection (NMSysconfigSettings *self,
|
|||
// NMDefaultWiredConnection, and it probably needs to stay that way. So this
|
||||
// *needs* a better name!
|
||||
static void
|
||||
remove_default_wired_connection (NMSysconfigSettings *self,
|
||||
remove_default_wired_connection (NMSettings *self,
|
||||
NMSysconfigConnection *connection,
|
||||
gboolean do_signal)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
const char *path = nm_connection_get_path (NM_CONNECTION (connection));
|
||||
|
||||
if (g_hash_table_lookup (priv->connections, path)) {
|
||||
|
|
@ -697,7 +697,7 @@ remove_default_wired_connection (NMSysconfigSettings *self,
|
|||
}
|
||||
|
||||
typedef struct {
|
||||
NMSysconfigSettings *self;
|
||||
NMSettings *self;
|
||||
DBusGMethodInvocation *context;
|
||||
PolkitSubject *subject;
|
||||
GCancellable *cancellable;
|
||||
|
|
@ -712,7 +712,7 @@ typedef struct {
|
|||
#include "nm-dbus-manager.h"
|
||||
|
||||
static PolkitCall *
|
||||
polkit_call_new (NMSysconfigSettings *self,
|
||||
polkit_call_new (NMSettings *self,
|
||||
DBusGMethodInvocation *context,
|
||||
NMConnection *connection,
|
||||
const char *hostname)
|
||||
|
|
@ -751,11 +751,11 @@ polkit_call_free (PolkitCall *call)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
add_new_connection (NMSysconfigSettings *self,
|
||||
add_new_connection (NMSettings *self,
|
||||
NMConnection *connection,
|
||||
GError **error)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GError *tmp_error = NULL, *last_error = NULL;
|
||||
GSList *iter;
|
||||
gboolean success = FALSE;
|
||||
|
|
@ -764,7 +764,7 @@ add_new_connection (NMSysconfigSettings *self,
|
|||
1) plugin writes a connection.
|
||||
2) plugin notices that a new connection is available for reading.
|
||||
3) plugin reads the new connection (the one it wrote in 1) and emits 'connection-added' signal.
|
||||
4) NMSysconfigSettings receives the signal and adds it to it's connection list.
|
||||
4) NMSettings receives the signal and adds it to it's connection list.
|
||||
*/
|
||||
|
||||
for (iter = priv->plugins; iter && !success; iter = iter->next) {
|
||||
|
|
@ -787,12 +787,12 @@ static void
|
|||
pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
PolkitCall *call = user_data;
|
||||
NMSysconfigSettings *self = call->self;
|
||||
NMSysconfigSettingsPrivate *priv;
|
||||
NMSettings *self = call->self;
|
||||
NMSettingsPrivate *priv;
|
||||
PolkitAuthorizationResult *pk_result;
|
||||
GError *error = NULL, *add_error = NULL;
|
||||
|
||||
/* If NMSysconfigSettings is already gone, do nothing */
|
||||
/* If NMSettings is already gone, do nothing */
|
||||
if (call->disposed) {
|
||||
error = g_error_new_literal (NM_SYSCONFIG_SETTINGS_ERROR,
|
||||
NM_SYSCONFIG_SETTINGS_ERROR_GENERAL,
|
||||
|
|
@ -803,7 +803,7 @@ pk_add_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
priv->pk_calls = g_slist_remove (priv->pk_calls, call);
|
||||
|
||||
|
|
@ -845,11 +845,11 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_add_connection (NMSysconfigSettings *self,
|
||||
impl_settings_add_connection (NMSettings *self,
|
||||
GHashTable *settings,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
PolkitCall *call;
|
||||
NMConnection *connection;
|
||||
GError *error = NULL;
|
||||
|
|
@ -891,8 +891,8 @@ static void
|
|||
pk_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
||||
{
|
||||
PolkitCall *call = user_data;
|
||||
NMSysconfigSettings *self = call->self;
|
||||
NMSysconfigSettingsPrivate *priv;
|
||||
NMSettings *self = call->self;
|
||||
NMSettingsPrivate *priv;
|
||||
PolkitAuthorizationResult *pk_result;
|
||||
GError *error = NULL;
|
||||
GSList *iter;
|
||||
|
|
@ -909,7 +909,7 @@ pk_hostname_cb (GObject *object, GAsyncResult *result, gpointer user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
priv->pk_calls = g_slist_remove (priv->pk_calls, call);
|
||||
|
||||
|
|
@ -959,11 +959,11 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
impl_settings_save_hostname (NMSysconfigSettings *self,
|
||||
impl_settings_save_hostname (NMSettings *self,
|
||||
const char *hostname,
|
||||
DBusGMethodInvocation *context)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
PolkitCall *call;
|
||||
GError *error = NULL;
|
||||
|
||||
|
|
@ -991,9 +991,9 @@ impl_settings_save_hostname (NMSysconfigSettings *self,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
have_connection_for_device (NMSysconfigSettings *self, GByteArray *mac)
|
||||
have_connection_for_device (NMSettings *self, GByteArray *mac)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GHashTableIter iter;
|
||||
gpointer data;
|
||||
NMSettingConnection *s_con;
|
||||
|
|
@ -1001,7 +1001,7 @@ have_connection_for_device (NMSysconfigSettings *self, GByteArray *mac)
|
|||
const GByteArray *setting_mac;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SYSCONFIG_SETTINGS (self), FALSE);
|
||||
g_return_val_if_fail (NM_IS_SETTINGS (self), FALSE);
|
||||
g_return_val_if_fail (mac != NULL, FALSE);
|
||||
|
||||
/* Find a wired connection locked to the given MAC address, if any */
|
||||
|
|
@ -1044,9 +1044,9 @@ have_connection_for_device (NMSysconfigSettings *self, GByteArray *mac)
|
|||
|
||||
/* Search through the list of blacklisted MAC addresses in the config file. */
|
||||
static gboolean
|
||||
is_mac_auto_wired_blacklisted (NMSysconfigSettings *self, const GByteArray *mac)
|
||||
is_mac_auto_wired_blacklisted (NMSettings *self, const GByteArray *mac)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GKeyFile *config;
|
||||
char **list, **iter;
|
||||
gboolean found = FALSE;
|
||||
|
|
@ -1095,9 +1095,9 @@ out:
|
|||
static void
|
||||
default_wired_deleted (NMDefaultWiredConnection *wired,
|
||||
const GByteArray *mac,
|
||||
NMSysconfigSettings *self)
|
||||
NMSettings *self)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingConnection *s_con;
|
||||
char *tmp;
|
||||
GKeyFile *config;
|
||||
|
|
@ -1196,7 +1196,7 @@ delete_cb (NMSysconfigConnection *connection, GError *error, gpointer user_data)
|
|||
|
||||
static gboolean
|
||||
default_wired_try_update (NMDefaultWiredConnection *wired,
|
||||
NMSysconfigSettings *self)
|
||||
NMSettings *self)
|
||||
{
|
||||
GError *error = NULL;
|
||||
NMSettingConnection *s_con;
|
||||
|
|
@ -1239,7 +1239,7 @@ default_wired_try_update (NMDefaultWiredConnection *wired,
|
|||
}
|
||||
|
||||
void
|
||||
nm_sysconfig_settings_device_added (NMSysconfigSettings *self, NMDevice *device)
|
||||
nm_settings_device_added (NMSettings *self, NMDevice *device)
|
||||
{
|
||||
GByteArray *mac = NULL;
|
||||
struct ether_addr tmp;
|
||||
|
|
@ -1295,7 +1295,7 @@ ignore:
|
|||
}
|
||||
|
||||
void
|
||||
nm_sysconfig_settings_device_removed (NMSysconfigSettings *self, NMDevice *device)
|
||||
nm_settings_device_removed (NMSettings *self, NMDevice *device)
|
||||
{
|
||||
NMDefaultWiredConnection *connection;
|
||||
|
||||
|
|
@ -1309,20 +1309,19 @@ nm_sysconfig_settings_device_removed (NMSysconfigSettings *self, NMDevice *devic
|
|||
|
||||
/***************************************************************/
|
||||
|
||||
NMSysconfigSettings *
|
||||
nm_sysconfig_settings_new (const char *config_file,
|
||||
NMSettings *
|
||||
nm_settings_new (const char *config_file,
|
||||
const char *plugins,
|
||||
GError **error)
|
||||
{
|
||||
NMSysconfigSettings *self;
|
||||
NMSysconfigSettingsPrivate *priv;
|
||||
NMSettings *self;
|
||||
NMSettingsPrivate *priv;
|
||||
|
||||
self = g_object_new (NM_TYPE_SYSCONFIG_SETTINGS,
|
||||
NULL);
|
||||
self = g_object_new (NM_TYPE_SETTINGS, NULL);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
priv->config_file = g_strdup (config_file);
|
||||
priv->dbus_mgr = nm_dbus_manager_get ();
|
||||
|
|
@ -1344,8 +1343,8 @@ nm_sysconfig_settings_new (const char *config_file,
|
|||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMSysconfigSettings *self = NM_SYSCONFIG_SETTINGS (object);
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettings *self = NM_SETTINGS (object);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GSList *iter;
|
||||
|
||||
if (priv->auth_changed_id) {
|
||||
|
|
@ -1365,14 +1364,14 @@ dispose (GObject *object)
|
|||
|
||||
g_object_unref (priv->dbus_mgr);
|
||||
|
||||
G_OBJECT_CLASS (nm_sysconfig_settings_parent_class)->dispose (object);
|
||||
G_OBJECT_CLASS (nm_settings_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NMSysconfigSettings *self = NM_SYSCONFIG_SETTINGS (object);
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettings *self = NM_SETTINGS (object);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
|
||||
g_hash_table_destroy (priv->connections);
|
||||
|
||||
|
|
@ -1383,26 +1382,26 @@ finalize (GObject *object)
|
|||
|
||||
g_free (priv->config_file);
|
||||
|
||||
G_OBJECT_CLASS (nm_sysconfig_settings_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (nm_settings_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
NMSysconfigSettings *self = NM_SYSCONFIG_SETTINGS (object);
|
||||
NMSettings *self = NM_SETTINGS (object);
|
||||
const GSList *specs, *iter;
|
||||
GSList *copy = NULL;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_UNMANAGED_SPECS:
|
||||
specs = nm_sysconfig_settings_get_unmanaged_specs (self);
|
||||
specs = nm_settings_get_unmanaged_specs (self);
|
||||
for (iter = specs; iter; iter = g_slist_next (iter))
|
||||
copy = g_slist_append (copy, g_strdup (iter->data));
|
||||
g_value_take_boxed (value, copy);
|
||||
break;
|
||||
case PROP_HOSTNAME:
|
||||
g_value_take_string (value, nm_sysconfig_settings_get_hostname (self));
|
||||
g_value_take_string (value, nm_settings_get_hostname (self));
|
||||
|
||||
/* Don't ever pass NULL through D-Bus */
|
||||
if (!g_value_get_string (value))
|
||||
|
|
@ -1418,11 +1417,11 @@ get_property (GObject *object, guint prop_id,
|
|||
}
|
||||
|
||||
static void
|
||||
nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
|
||||
nm_settings_class_init (NMSettingsClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
g_type_class_add_private (class, sizeof (NMSysconfigSettingsPrivate));
|
||||
g_type_class_add_private (class, sizeof (NMSettingsPrivate));
|
||||
|
||||
/* virtual methods */
|
||||
object_class->notify = notify;
|
||||
|
|
@ -1434,7 +1433,7 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
|
|||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_UNMANAGED_SPECS,
|
||||
g_param_spec_boxed (NM_SYSCONFIG_SETTINGS_UNMANAGED_SPECS,
|
||||
g_param_spec_boxed (NM_SETTINGS_UNMANAGED_SPECS,
|
||||
"Unamanged device specs",
|
||||
"Unmanaged device specs",
|
||||
DBUS_TYPE_G_LIST_OF_STRING,
|
||||
|
|
@ -1442,7 +1441,7 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
|
|||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_HOSTNAME,
|
||||
g_param_spec_string (NM_SYSCONFIG_SETTINGS_HOSTNAME,
|
||||
g_param_spec_string (NM_SETTINGS_HOSTNAME,
|
||||
"Hostname",
|
||||
"Persistent hostname",
|
||||
NULL,
|
||||
|
|
@ -1450,7 +1449,7 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
|
|||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CAN_MODIFY,
|
||||
g_param_spec_boolean (NM_SYSCONFIG_SETTINGS_CAN_MODIFY,
|
||||
g_param_spec_boolean (NM_SETTINGS_CAN_MODIFY,
|
||||
"CanModify",
|
||||
"Can modify anything (hostname, connections, etc)",
|
||||
FALSE,
|
||||
|
|
@ -1461,51 +1460,51 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
|
|||
g_signal_new ("properties-changed",
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSysconfigSettingsClass, properties_changed),
|
||||
G_STRUCT_OFFSET (NMSettingsClass, properties_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__BOXED,
|
||||
G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT);
|
||||
signals[CONNECTION_ADDED] =
|
||||
g_signal_new (NM_SYSCONFIG_SETTINGS_CONNECTION_ADDED,
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_ADDED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSysconfigSettingsClass, connection_added),
|
||||
G_STRUCT_OFFSET (NMSettingsClass, connection_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
signals[CONNECTION_UPDATED] =
|
||||
g_signal_new (NM_SYSCONFIG_SETTINGS_CONNECTION_UPDATED,
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_UPDATED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSysconfigSettingsClass, connection_updated),
|
||||
G_STRUCT_OFFSET (NMSettingsClass, connection_updated),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
signals[CONNECTION_REMOVED] =
|
||||
g_signal_new (NM_SYSCONFIG_SETTINGS_CONNECTION_REMOVED,
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_REMOVED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSysconfigSettingsClass, connection_removed),
|
||||
G_STRUCT_OFFSET (NMSettingsClass, connection_removed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
signals[CONNECTION_VISIBILITY_CHANGED] =
|
||||
g_signal_new (NM_SYSCONFIG_SETTINGS_CONNECTION_VISIBILITY_CHANGED,
|
||||
g_signal_new (NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSysconfigSettingsClass, connection_visibility_changed),
|
||||
G_STRUCT_OFFSET (NMSettingsClass, connection_visibility_changed),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, G_TYPE_OBJECT);
|
||||
|
||||
signals[CONNECTIONS_LOADED] =
|
||||
g_signal_new (NM_SYSCONFIG_SETTINGS_CONNECTIONS_LOADED,
|
||||
g_signal_new (NM_SETTINGS_CONNECTIONS_LOADED,
|
||||
G_OBJECT_CLASS_TYPE (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (NMSysconfigSettingsClass, connections_loaded),
|
||||
G_STRUCT_OFFSET (NMSettingsClass, connections_loaded),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
|
@ -1540,15 +1539,14 @@ nm_sysconfig_settings_class_init (NMSysconfigSettingsClass *class)
|
|||
dbus_g_error_domain_register (NM_SETTING_WIRELESS_ERROR, NULL, NM_TYPE_SETTING_WIRELESS_ERROR);
|
||||
dbus_g_error_domain_register (NM_SETTING_ERROR, NULL, NM_TYPE_SETTING_ERROR);
|
||||
|
||||
dbus_g_object_type_install_info (NM_TYPE_SYSCONFIG_SETTINGS,
|
||||
&dbus_glib_nm_settings_object_info);
|
||||
dbus_g_object_type_install_info (NM_TYPE_SETTINGS, &dbus_glib_nm_settings_object_info);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
nm_sysconfig_settings_init (NMSysconfigSettings *self)
|
||||
nm_settings_init (NMSettings *self)
|
||||
{
|
||||
NMSysconfigSettingsPrivate *priv = NM_SYSCONFIG_SETTINGS_GET_PRIVATE (self);
|
||||
NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self);
|
||||
GError *error = NULL;
|
||||
|
||||
priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
|
||||
103
src/system-settings/nm-settings.h
Normal file
103
src/system-settings/nm-settings.h
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager system settings service
|
||||
*
|
||||
* Søren Sandmann <sandmann@daimi.au.dk>
|
||||
* Dan Williams <dcbw@redhat.com>
|
||||
* Tambet Ingo <tambet@gmail.com>
|
||||
*
|
||||
* 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 2007 - 2010 Red Hat, Inc.
|
||||
* (C) Copyright 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_SETTINGS_H__
|
||||
#define __NM_SETTINGS_H__
|
||||
|
||||
#include <nm-connection.h>
|
||||
|
||||
#include "nm-sysconfig-connection.h"
|
||||
#include "nm-system-config-interface.h"
|
||||
#include "nm-device.h"
|
||||
|
||||
#define NM_TYPE_SETTINGS (nm_settings_get_type ())
|
||||
#define NM_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS, NMSettings))
|
||||
#define NM_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTINGS, NMSettingsClass))
|
||||
#define NM_IS_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS))
|
||||
#define NM_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTINGS))
|
||||
#define NM_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTINGS, NMSettingsClass))
|
||||
|
||||
#define NM_SETTINGS_UNMANAGED_SPECS "unmanaged-specs"
|
||||
#define NM_SETTINGS_HOSTNAME "hostname"
|
||||
#define NM_SETTINGS_CAN_MODIFY "can-modify"
|
||||
|
||||
#define NM_SETTINGS_CONNECTION_ADDED "connection-added"
|
||||
#define NM_SETTINGS_CONNECTION_UPDATED "connection-updated"
|
||||
#define NM_SETTINGS_CONNECTION_REMOVED "connection-removed"
|
||||
#define NM_SETTINGS_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed"
|
||||
#define NM_SETTINGS_CONNECTIONS_LOADED "connections-loaded"
|
||||
|
||||
typedef struct {
|
||||
GObject parent_instance;
|
||||
} NMSettings;
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMSettings *self, GHashTable *properties);
|
||||
|
||||
void (*connection_added) (NMSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connection_updated) (NMSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connection_removed) (NMSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connection_visibility_changed) (NMSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connections_loaded) (NMSettings *self);
|
||||
} NMSettingsClass;
|
||||
|
||||
GType nm_settings_get_type (void);
|
||||
|
||||
NMSettings *nm_settings_new (const char *config_file,
|
||||
const char *plugins,
|
||||
GError **error);
|
||||
|
||||
typedef void (*NMSettingsForEachFunc) (NMSettings *settings,
|
||||
NMSysconfigConnection *connection,
|
||||
gpointer user_data);
|
||||
|
||||
void nm_settings_for_each_connection (NMSettings *settings,
|
||||
NMSettingsForEachFunc for_each_func,
|
||||
gpointer user_data);
|
||||
|
||||
/* Returns a list of NMSysconfigConnections. Caller must free the list with
|
||||
* g_slist_free().
|
||||
*/
|
||||
GSList *nm_settings_get_connections (NMSettings *settings);
|
||||
|
||||
NMSysconfigConnection *nm_settings_get_connection_by_path (NMSettings *settings,
|
||||
const char *path);
|
||||
|
||||
const GSList *nm_settings_get_unmanaged_specs (NMSettings *self);
|
||||
|
||||
char *nm_settings_get_hostname (NMSettings *self);
|
||||
|
||||
void nm_settings_device_added (NMSettings *self, NMDevice *device);
|
||||
|
||||
void nm_settings_device_removed (NMSettings *self, NMDevice *device);
|
||||
|
||||
#endif /* __NM_SETTINGS_H__ */
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
||||
/* NetworkManager system settings service
|
||||
*
|
||||
* Søren Sandmann <sandmann@daimi.au.dk>
|
||||
* Dan Williams <dcbw@redhat.com>
|
||||
* Tambet Ingo <tambet@gmail.com>
|
||||
*
|
||||
* 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 2007 - 2009 Red Hat, Inc.
|
||||
* (C) Copyright 2008 Novell, Inc.
|
||||
*/
|
||||
|
||||
#ifndef __NM_SYSCONFIG_SETTINGS_H__
|
||||
#define __NM_SYSCONFIG_SETTINGS_H__
|
||||
|
||||
#include <nm-connection.h>
|
||||
|
||||
#include "nm-sysconfig-connection.h"
|
||||
#include "nm-system-config-interface.h"
|
||||
#include "nm-device.h"
|
||||
|
||||
#define NM_TYPE_SYSCONFIG_SETTINGS (nm_sysconfig_settings_get_type ())
|
||||
#define NM_SYSCONFIG_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SYSCONFIG_SETTINGS, NMSysconfigSettings))
|
||||
#define NM_SYSCONFIG_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SYSCONFIG_SETTINGS, NMSysconfigSettingsClass))
|
||||
#define NM_IS_SYSCONFIG_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SYSCONFIG_SETTINGS))
|
||||
#define NM_IS_SYSCONFIG_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SYSCONFIG_SETTINGS))
|
||||
#define NM_SYSCONFIG_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SYSCONFIG_SETTINGS, NMSysconfigSettingsClass))
|
||||
|
||||
#define NM_SYSCONFIG_SETTINGS_UNMANAGED_SPECS "unmanaged-specs"
|
||||
#define NM_SYSCONFIG_SETTINGS_HOSTNAME "hostname"
|
||||
#define NM_SYSCONFIG_SETTINGS_CAN_MODIFY "can-modify"
|
||||
|
||||
#define NM_SYSCONFIG_SETTINGS_CONNECTION_ADDED "connection-added"
|
||||
#define NM_SYSCONFIG_SETTINGS_CONNECTION_UPDATED "connection-updated"
|
||||
#define NM_SYSCONFIG_SETTINGS_CONNECTION_REMOVED "connection-removed"
|
||||
#define NM_SYSCONFIG_SETTINGS_CONNECTION_VISIBILITY_CHANGED "connection-visibility-changed"
|
||||
#define NM_SYSCONFIG_SETTINGS_CONNECTIONS_LOADED "connections-loaded"
|
||||
|
||||
typedef struct {
|
||||
GObject parent_instance;
|
||||
} NMSysconfigSettings;
|
||||
|
||||
typedef struct {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* Signals */
|
||||
void (*properties_changed) (NMSysconfigSettings *self, GHashTable *properties);
|
||||
|
||||
void (*connection_added) (NMSysconfigSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connection_updated) (NMSysconfigSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connection_removed) (NMSysconfigSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connection_visibility_changed) (NMSysconfigSettings *self, NMConnection *connection);
|
||||
|
||||
void (*connections_loaded) (NMSysconfigSettings *self);
|
||||
} NMSysconfigSettingsClass;
|
||||
|
||||
GType nm_sysconfig_settings_get_type (void);
|
||||
|
||||
NMSysconfigSettings *nm_sysconfig_settings_new (const char *config_file,
|
||||
const char *plugins,
|
||||
GError **error);
|
||||
|
||||
typedef void (*NMSysconfigSettingsForEachFunc) (NMSysconfigSettings *settings,
|
||||
NMSysconfigConnection *connection,
|
||||
gpointer user_data);
|
||||
|
||||
void nm_sysconfig_settings_for_each_connection (NMSysconfigSettings *settings,
|
||||
NMSysconfigSettingsForEachFunc for_each_func,
|
||||
gpointer user_data);
|
||||
|
||||
/* Returns a list of NMSysconfigConnections. Caller must free the list with
|
||||
* g_slist_free().
|
||||
*/
|
||||
GSList *nm_sysconfig_settings_get_connections (NMSysconfigSettings *settings);
|
||||
|
||||
NMSysconfigConnection *nm_sysconfig_settings_get_connection_by_path (NMSysconfigSettings *settings,
|
||||
const char *path);
|
||||
|
||||
const GSList *nm_sysconfig_settings_get_unmanaged_specs (NMSysconfigSettings *self);
|
||||
|
||||
char *nm_sysconfig_settings_get_hostname (NMSysconfigSettings *self);
|
||||
|
||||
void nm_sysconfig_settings_device_added (NMSysconfigSettings *self, NMDevice *device);
|
||||
|
||||
void nm_sysconfig_settings_device_removed (NMSysconfigSettings *self, NMDevice *device);
|
||||
|
||||
#endif /* __NM_SYSCONFIG_SETTINGS_H__ */
|
||||
Loading…
Add table
Reference in a new issue