diff --git a/src/Makefile.am b/src/Makefile.am index 1e05ec2831..9101a3af6e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -266,10 +266,10 @@ libNetworkManager_la_SOURCES = \ settings/nm-secret-agent.h \ settings/nm-settings-connection.c \ settings/nm-settings-connection.h \ + settings/nm-settings-plugin.c \ + settings/nm-settings-plugin.h \ settings/nm-settings.c \ settings/nm-settings.h \ - settings/nm-system-config-interface.c \ - settings/nm-system-config-interface.h \ \ settings/plugins/keyfile/common.h \ settings/plugins/keyfile/nm-keyfile-connection.c \ diff --git a/src/devices/adsl/nm-atm-manager.c b/src/devices/adsl/nm-atm-manager.c index 6a33d21b1e..b29bc7b19a 100644 --- a/src/devices/adsl/nm-atm-manager.c +++ b/src/devices/adsl/nm-atm-manager.c @@ -39,7 +39,7 @@ typedef struct { static GType nm_atm_manager_get_type (void); -static void device_factory_interface_init (NMDeviceFactory *factory_iface); +static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface); G_DEFINE_TYPE_EXTENDED (NMAtmManager, nm_atm_manager, G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init)) @@ -220,7 +220,7 @@ nm_atm_manager_init (NMAtmManager *self) } static void -device_factory_interface_init (NMDeviceFactory *factory_iface) +device_factory_interface_init (NMDeviceFactoryInterface *factory_iface) { factory_iface->get_supported_types = get_supported_types; factory_iface->start = start; diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c index bd7c7cab33..db98d2808c 100644 --- a/src/devices/bluetooth/nm-bluez-manager.c +++ b/src/devices/bluetooth/nm-bluez-manager.c @@ -56,7 +56,7 @@ typedef struct { static GType nm_bluez_manager_get_type (void); -static void device_factory_interface_init (NMDeviceFactory *factory_iface); +static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface); G_DEFINE_TYPE_EXTENDED (NMBluezManager, nm_bluez_manager, G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init)) @@ -421,7 +421,7 @@ create_device (NMDeviceFactory *factory, } static void -device_factory_interface_init (NMDeviceFactory *factory_iface) +device_factory_interface_init (NMDeviceFactoryInterface *factory_iface) { factory_iface->get_supported_types = get_supported_types; factory_iface->create_device = create_device; diff --git a/src/devices/nm-device-factory.c b/src/devices/nm-device-factory.c index 0aea7a69e2..07804da758 100644 --- a/src/devices/nm-device-factory.c +++ b/src/devices/nm-device-factory.c @@ -33,6 +33,8 @@ const NMLinkType _nm_device_factory_no_default_links[] = { NM_LINK_TYPE_NONE }; const char *_nm_device_factory_no_default_settings[] = { NULL }; +G_DEFINE_INTERFACE (NMDeviceFactory, nm_device_factory, G_TYPE_OBJECT) + enum { DEVICE_ADDED, COMPONENT_ADDED, @@ -86,7 +88,7 @@ nm_device_factory_create_device (NMDeviceFactory *factory, gboolean *out_ignore, GError **error) { - NMDeviceFactory *interface; + NMDeviceFactoryInterface *interface; const NMLinkType *link_types = NULL; const char **setting_types = NULL; int i; @@ -188,7 +190,7 @@ nm_device_factory_get_virtual_iface_name (NMDeviceFactory *factory, /*******************************************************************/ static void -default_init (NMDeviceFactory *factory_iface) +nm_device_factory_default_init (NMDeviceFactoryInterface *factory_iface) { factory_iface->get_virtual_iface_name = get_virtual_iface_name; @@ -196,37 +198,18 @@ default_init (NMDeviceFactory *factory_iface) signals[DEVICE_ADDED] = g_signal_new (NM_DEVICE_FACTORY_DEVICE_ADDED, NM_TYPE_DEVICE_FACTORY, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMDeviceFactory, device_added), + G_STRUCT_OFFSET (NMDeviceFactoryInterface, device_added), NULL, NULL, NULL, G_TYPE_NONE, 1, NM_TYPE_DEVICE); signals[COMPONENT_ADDED] = g_signal_new (NM_DEVICE_FACTORY_COMPONENT_ADDED, NM_TYPE_DEVICE_FACTORY, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMDeviceFactory, component_added), + G_STRUCT_OFFSET (NMDeviceFactoryInterface, component_added), g_signal_accumulator_true_handled, NULL, NULL, G_TYPE_BOOLEAN, 1, G_TYPE_OBJECT); } -GType -nm_device_factory_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - if (g_once_init_enter (&g_define_type_id__volatile)) { - GType g_define_type_id = - g_type_register_static_simple (G_TYPE_INTERFACE, - g_intern_static_string ("NMDeviceFactory"), - sizeof (NMDeviceFactory), - (GClassInitFunc) default_init, - 0, - (GInstanceInitFunc) NULL, - (GTypeFlags) 0); - g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT); - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - return g_define_type_id__volatile; -} - /*******************************************************************/ static GSList *internal_types = NULL; diff --git a/src/devices/nm-device-factory.h b/src/devices/nm-device-factory.h index 1bee6b76cb..7568b0fdfb 100644 --- a/src/devices/nm-device-factory.h +++ b/src/devices/nm-device-factory.h @@ -53,13 +53,13 @@ typedef NMDeviceFactory * (*NMDeviceFactoryCreateFunc) (GError **error); #define NM_TYPE_DEVICE_FACTORY (nm_device_factory_get_type ()) #define NM_DEVICE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_FACTORY, NMDeviceFactory)) #define NM_IS_DEVICE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_FACTORY)) -#define NM_DEVICE_FACTORY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_DEVICE_FACTORY, NMDeviceFactory)) +#define NM_DEVICE_FACTORY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_DEVICE_FACTORY, NMDeviceFactoryInterface)) /* signals */ #define NM_DEVICE_FACTORY_COMPONENT_ADDED "component-added" #define NM_DEVICE_FACTORY_DEVICE_ADDED "device-added" -struct _NMDeviceFactory { +typedef struct { GTypeInterface g_iface; /** @@ -164,7 +164,7 @@ struct _NMDeviceFactory { * Returns: %TRUE if the component was claimed by a device, %FALSE if not */ gboolean (*component_added) (NMDeviceFactory *factory, GObject *component); -}; +} NMDeviceFactoryInterface; GType nm_device_factory_get_type (void); @@ -223,7 +223,7 @@ extern const char *_nm_device_factory_no_default_settings[]; typedef GObjectClass NM##mixed##FactoryClass; \ \ static GType nm_##lower##_factory_get_type (void); \ - static void device_factory_interface_init (NMDeviceFactory *factory_iface); \ + static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface); \ \ G_DEFINE_TYPE_EXTENDED (NM##mixed##Factory, nm_##lower##_factory, G_TYPE_OBJECT, 0, \ G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init) \ @@ -243,7 +243,7 @@ extern const char *_nm_device_factory_no_default_settings[]; NM_DEVICE_FACTORY_DECLARE_TYPES(st_code) \ \ static void \ - device_factory_interface_init (NMDeviceFactory *factory_iface) \ + device_factory_interface_init (NMDeviceFactoryInterface *factory_iface) \ { \ factory_iface->get_supported_types = get_supported_types; \ dfi_code \ diff --git a/src/devices/team/nm-team-factory.c b/src/devices/team/nm-team-factory.c index 8591782495..d30aa31747 100644 --- a/src/devices/team/nm-team-factory.c +++ b/src/devices/team/nm-team-factory.c @@ -32,7 +32,7 @@ static GType nm_team_factory_get_type (void); -static void device_factory_interface_init (NMDeviceFactory *factory_iface); +static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface); G_DEFINE_TYPE_EXTENDED (NMTeamFactory, nm_team_factory, G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init)) @@ -70,7 +70,7 @@ nm_team_factory_init (NMTeamFactory *self) } static void -device_factory_interface_init (NMDeviceFactory *factory_iface) +device_factory_interface_init (NMDeviceFactoryInterface *factory_iface) { factory_iface->create_device = create_device; factory_iface->get_supported_types = get_supported_types; diff --git a/src/devices/wifi/nm-wifi-factory.c b/src/devices/wifi/nm-wifi-factory.c index eca4e1de53..20b0a07508 100644 --- a/src/devices/wifi/nm-wifi-factory.c +++ b/src/devices/wifi/nm-wifi-factory.c @@ -43,7 +43,7 @@ typedef struct { static GType nm_wifi_factory_get_type (void); -static void device_factory_interface_init (NMDeviceFactory *factory_iface); +static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface); G_DEFINE_TYPE_EXTENDED (NMWifiFactory, nm_wifi_factory, G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init)) @@ -80,7 +80,7 @@ NM_DEVICE_FACTORY_DECLARE_TYPES ( ) static void -device_factory_interface_init (NMDeviceFactory *factory_iface) +device_factory_interface_init (NMDeviceFactoryInterface *factory_iface) { factory_iface->create_device = create_device; factory_iface->get_supported_types = get_supported_types; diff --git a/src/devices/wwan/nm-wwan-factory.c b/src/devices/wwan/nm-wwan-factory.c index 479b5a94cc..97ef4161c9 100644 --- a/src/devices/wwan/nm-wwan-factory.c +++ b/src/devices/wwan/nm-wwan-factory.c @@ -34,7 +34,7 @@ static GType nm_wwan_factory_get_type (void); -static void device_factory_interface_init (NMDeviceFactory *factory_iface); +static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface); G_DEFINE_TYPE_EXTENDED (NMWwanFactory, nm_wwan_factory, G_TYPE_OBJECT, 0, G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init)) @@ -128,7 +128,7 @@ nm_wwan_factory_init (NMWwanFactory *self) } static void -device_factory_interface_init (NMDeviceFactory *factory_iface) +device_factory_interface_init (NMDeviceFactoryInterface *factory_iface) { factory_iface->get_supported_types = get_supported_types; factory_iface->create_device = create_device; diff --git a/src/nm-connection-provider.c b/src/nm-connection-provider.c index 51caf400f1..8185b8c60f 100644 --- a/src/nm-connection-provider.c +++ b/src/nm-connection-provider.c @@ -18,6 +18,8 @@ #include "nm-connection-provider.h" #include "nm-utils.h" +G_DEFINE_INTERFACE (NMConnectionProvider, nm_connection_provider, G_TYPE_OBJECT) + GSList * nm_connection_provider_get_best_connections (NMConnectionProvider *self, guint max_requested, @@ -91,7 +93,7 @@ nm_connection_provider_get_connection_by_uuid (NMConnectionProvider *self, /*****************************************************************************/ static void -nm_connection_provider_init (gpointer g_iface) +nm_connection_provider_default_init (NMConnectionProviderInterface *g_iface) { GType iface_type = G_TYPE_FROM_INTERFACE (g_iface); static gboolean initialized = FALSE; @@ -104,7 +106,7 @@ nm_connection_provider_init (gpointer g_iface) g_signal_new (NM_CP_SIGNAL_CONNECTION_ADDED, iface_type, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionProvider, connection_added), + G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_added), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); @@ -112,7 +114,7 @@ nm_connection_provider_init (gpointer g_iface) g_signal_new (NM_CP_SIGNAL_CONNECTION_UPDATED, iface_type, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionProvider, connection_updated), + G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_updated), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); @@ -120,33 +122,8 @@ nm_connection_provider_init (gpointer g_iface) g_signal_new (NM_CP_SIGNAL_CONNECTION_REMOVED, iface_type, G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMConnectionProvider, connection_removed), + G_STRUCT_OFFSET (NMConnectionProviderInterface, connection_removed), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); } - -GType -nm_connection_provider_get_type (void) -{ - static GType cp_type = 0; - - if (!G_UNLIKELY (cp_type)) { - const GTypeInfo cp_info = { - sizeof (NMConnectionProvider), /* class_size */ - nm_connection_provider_init, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, /* n_preallocs */ - NULL - }; - - cp_type = g_type_register_static (G_TYPE_INTERFACE, "NMConnectionProvider", &cp_info, 0); - g_type_interface_add_prerequisite (cp_type, G_TYPE_OBJECT); - } - - return cp_type; -} diff --git a/src/nm-connection-provider.h b/src/nm-connection-provider.h index 1f15216447..2485c56f4f 100644 --- a/src/nm-connection-provider.h +++ b/src/nm-connection-provider.h @@ -20,10 +20,10 @@ #include "nm-default.h" -#define NM_TYPE_CONNECTION_PROVIDER (nm_connection_provider_get_type ()) -#define NM_CONNECTION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION_PROVIDER, NMConnectionProvider)) -#define NM_IS_CONNECTION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_PROVIDER)) -#define NM_CONNECTION_PROVIDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_CONNECTION_PROVIDER, NMConnectionProvider)) +#define NM_TYPE_CONNECTION_PROVIDER (nm_connection_provider_get_type ()) +#define NM_CONNECTION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CONNECTION_PROVIDER, NMConnectionProvider)) +#define NM_IS_CONNECTION_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CONNECTION_PROVIDER)) +#define NM_CONNECTION_PROVIDER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_CONNECTION_PROVIDER, NMConnectionProviderInterface)) #define NM_CP_SIGNAL_CONNECTION_ADDED "cp-connection-added" #define NM_CP_SIGNAL_CONNECTION_UPDATED "cp-connection-updated" @@ -43,7 +43,7 @@ typedef gboolean (*NMConnectionFilterFunc) (NMConnectionProvider *provider, gpointer func_data); -struct _NMConnectionProvider { +typedef struct { GTypeInterface g_iface; /* Methods */ @@ -71,7 +71,7 @@ struct _NMConnectionProvider { void (*connection_removed) (NMConnectionProvider *self, NMConnection *connection); -}; +} NMConnectionProviderInterface; GType nm_connection_provider_get_type (void); diff --git a/src/settings/nm-settings-plugin.c b/src/settings/nm-settings-plugin.c new file mode 100644 index 0000000000..0bce8957d0 --- /dev/null +++ b/src/settings/nm-settings-plugin.c @@ -0,0 +1,179 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* NetworkManager system settings service + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2007 - 2011 Red Hat, Inc. + * Copyright (C) 2008 Novell, Inc. + */ + +#include "config.h" + +#include "nm-settings-plugin.h" +#include "nm-settings-connection.h" + +G_DEFINE_INTERFACE (NMSettingsPlugin, nm_settings_plugin, G_TYPE_OBJECT) + +static void +nm_settings_plugin_default_init (NMSettingsPluginInterface *g_iface) +{ + GType iface_type = G_TYPE_FROM_INTERFACE (g_iface); + static gboolean initialized = FALSE; + + if (initialized) + return; + + /* Properties */ + g_object_interface_install_property + (g_iface, + g_param_spec_string (NM_SETTINGS_PLUGIN_NAME, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_interface_install_property + (g_iface, + g_param_spec_string (NM_SETTINGS_PLUGIN_INFO, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_interface_install_property + (g_iface, + g_param_spec_uint (NM_SETTINGS_PLUGIN_CAPABILITIES, "", "", + NM_SETTINGS_PLUGIN_CAP_NONE, + NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS, + NM_SETTINGS_PLUGIN_CAP_NONE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + /* Signals */ + g_signal_new (NM_SETTINGS_PLUGIN_CONNECTION_ADDED, + iface_type, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMSettingsPluginInterface, connection_added), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, 1, + NM_TYPE_SETTINGS_CONNECTION); + + g_signal_new (NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED, + iface_type, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMSettingsPluginInterface, unmanaged_specs_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + g_signal_new (NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED, + iface_type, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (NMSettingsPluginInterface, unrecognized_specs_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + initialized = TRUE; +} + +void +nm_settings_plugin_init (NMSettingsPlugin *config) +{ + g_return_if_fail (config != NULL); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->init) + NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->init (config); +} + +GSList * +nm_settings_plugin_get_connections (NMSettingsPlugin *config) +{ + g_return_val_if_fail (config != NULL, NULL); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->get_connections) + return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->get_connections (config); + return NULL; +} + +gboolean +nm_settings_plugin_load_connection (NMSettingsPlugin *config, + const char *filename) +{ + g_return_val_if_fail (config != NULL, FALSE); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->load_connection) + return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->load_connection (config, filename); + return FALSE; +} + +void +nm_settings_plugin_reload_connections (NMSettingsPlugin *config) +{ + g_return_if_fail (config != NULL); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->reload_connections) + NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->reload_connections (config); +} + +GSList * +nm_settings_plugin_get_unmanaged_specs (NMSettingsPlugin *config) +{ + g_return_val_if_fail (config != NULL, NULL); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->get_unmanaged_specs) + return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->get_unmanaged_specs (config); + return NULL; +} + +GSList * +nm_settings_plugin_get_unrecognized_specs (NMSettingsPlugin *config) +{ + g_return_val_if_fail (config != NULL, NULL); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->get_unrecognized_specs) + return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->get_unrecognized_specs (config); + return NULL; +} + +/** + * nm_settings_plugin_add_connection: + * @config: the #NMSettingsPlugin + * @connection: the source connection to create a plugin-specific + * #NMSettingsConnection from + * @save_to_disk: %TRUE to save the connection to disk immediately, %FALSE to + * not save to disk + * @error: on return, a location to store any errors that may occur + * + * Creates a new #NMSettingsConnection for the given source @connection. If the + * plugin cannot handle the given connection type, it should return %NULL and + * set @error. The plugin owns the returned object and the caller must reference + * the object if it wishes to continue using it. + * + * Returns: the new #NMSettingsConnection or %NULL + */ +NMSettingsConnection * +nm_settings_plugin_add_connection (NMSettingsPlugin *config, + NMConnection *connection, + gboolean save_to_disk, + GError **error) +{ + g_return_val_if_fail (config != NULL, NULL); + g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); + + if (NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->add_connection) + return NM_SETTINGS_PLUGIN_GET_INTERFACE (config)->add_connection (config, connection, save_to_disk, error); + + return NULL; +} diff --git a/src/settings/nm-system-config-interface.h b/src/settings/nm-settings-plugin.h similarity index 50% rename from src/settings/nm-system-config-interface.h rename to src/settings/nm-settings-plugin.h index 81a422d671..ab88e7c2b5 100644 --- a/src/settings/nm-system-config-interface.h +++ b/src/settings/nm-settings-plugin.h @@ -19,8 +19,8 @@ * Copyright (C) 2008 Novell, Inc. */ -#ifndef __NETWORKMANAGER_SYSTEM_CONFIG_INTERFACE_H__ -#define __NETWORKMANAGER_SYSTEM_CONFIG_INTERFACE_H__ +#ifndef __NETWORKMANAGER_SETTINGS_PLUGIN_H__ +#define __NETWORKMANAGER_SETTINGS_PLUGIN_H__ #include @@ -29,66 +29,66 @@ G_BEGIN_DECLS /* Plugin's factory function that returns a GObject that implements - * NMSystemConfigInterface. + * NMSettingsPlugin. */ -GObject * nm_system_config_factory (void); +GObject * nm_settings_plugin_factory (void); -#define NM_TYPE_SYSTEM_CONFIG_INTERFACE (nm_system_config_interface_get_type ()) -#define NM_SYSTEM_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE, NMSystemConfigInterface)) -#define NM_IS_SYSTEM_CONFIG_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE)) -#define NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SYSTEM_CONFIG_INTERFACE, NMSystemConfigInterface)) +#define NM_TYPE_SETTINGS_PLUGIN (nm_settings_plugin_get_type ()) +#define NM_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPlugin)) +#define NM_IS_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTINGS_PLUGIN)) +#define NM_SETTINGS_PLUGIN_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPluginInterface)) -#define NM_SYSTEM_CONFIG_INTERFACE_NAME "name" -#define NM_SYSTEM_CONFIG_INTERFACE_INFO "info" -#define NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES "capabilities" +#define NM_SETTINGS_PLUGIN_NAME "name" +#define NM_SETTINGS_PLUGIN_INFO "info" +#define NM_SETTINGS_PLUGIN_CAPABILITIES "capabilities" -#define NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED "unmanaged-specs-changed" -#define NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED "unrecognized-specs-changed" -#define NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED "connection-added" +#define NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED "unmanaged-specs-changed" +#define NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED "unrecognized-specs-changed" +#define NM_SETTINGS_PLUGIN_CONNECTION_ADDED "connection-added" typedef enum { - NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE = 0x00000000, - NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS = 0x00000001, + NM_SETTINGS_PLUGIN_CAP_NONE = 0x00000000, + NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS = 0x00000001, /* When adding more capabilities, be sure to update the "Capabilities" - * property max value in nm-system-config-interface.c. + * property max value in nm-settings-plugin.c. */ -} NMSystemConfigInterfaceCapabilities; +} NMSettingsPluginCapabilities; typedef enum { - NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST = 0x1000, + NM_SETTINGS_PLUGIN_PROP_FIRST = 0x1000, - NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME = NM_SYSTEM_CONFIG_INTERFACE_PROP_FIRST, - NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, - NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, -} NMSystemConfigInterfaceProp; + NM_SETTINGS_PLUGIN_PROP_NAME = NM_SETTINGS_PLUGIN_PROP_FIRST, + NM_SETTINGS_PLUGIN_PROP_INFO, + NM_SETTINGS_PLUGIN_PROP_CAPABILITIES, +} NMSettingsPluginProp; -typedef struct _NMSystemConfigInterface NMSystemConfigInterface; +typedef struct _NMSettingsPlugin NMSettingsPlugin; -struct _NMSystemConfigInterface { +typedef struct { GTypeInterface g_iface; /* Called when the plugin is loaded to initialize it */ - void (*init) (NMSystemConfigInterface *config); + void (*init) (NMSettingsPlugin *config); /* Returns a GSList of NMSettingsConnection objects that represent * connections the plugin knows about. The returned list is freed by the * system settings service. */ - GSList * (*get_connections) (NMSystemConfigInterface *config); + GSList * (*get_connections) (NMSettingsPlugin *config); /* Requests that the plugin load/reload a single connection, if it * recognizes the filename. Returns success or failure. */ - gboolean (*load_connection) (NMSystemConfigInterface *config, + gboolean (*load_connection) (NMSettingsPlugin *config, const char *filename); /* Requests that the plugin reload all connection files from disk, * and emit signals reflecting new, changed, and removed connections. */ - void (*reload_connections) (NMSystemConfigInterface *config); + void (*reload_connections) (NMSettingsPlugin *config); /* * Return a string list of specifications of devices which NetworkManager @@ -99,7 +99,7 @@ struct _NMSystemConfigInterface { * Each string in the list must be in one of the formats recognized by * nm_device_spec_match_list(). */ - GSList * (*get_unmanaged_specs) (NMSystemConfigInterface *config); + GSList * (*get_unmanaged_specs) (NMSettingsPlugin *config); /* * Return a string list of specifications of devices for which at least @@ -111,7 +111,7 @@ struct _NMSystemConfigInterface { * Each string in the list must be in one of the formats recognized by * nm_device_spec_match_list(). */ - GSList * (*get_unrecognized_specs) (NMSystemConfigInterface *config); + GSList * (*get_unrecognized_specs) (NMSettingsPlugin *config); /* * Initialize the plugin-specific connection and return a new @@ -120,7 +120,7 @@ struct _NMSystemConfigInterface { * storage if @save_to_disk is TRUE. The returned object is owned by the * plugin and must be referenced by the owner if necessary. */ - NMSettingsConnection * (*add_connection) (NMSystemConfigInterface *config, + NMSettingsConnection * (*add_connection) (NMSettingsPlugin *config, NMConnection *connection, gboolean save_to_disk, GError **error); @@ -128,35 +128,34 @@ struct _NMSystemConfigInterface { /* Signals */ /* Emitted when a new connection has been found by the plugin */ - void (*connection_added) (NMSystemConfigInterface *config, + void (*connection_added) (NMSettingsPlugin *config, NMSettingsConnection *connection); /* Emitted when the list of unmanaged device specifications changes */ - void (*unmanaged_specs_changed) (NMSystemConfigInterface *config); + void (*unmanaged_specs_changed) (NMSettingsPlugin *config); /* Emitted when the list of devices with unrecognized connections changes */ - void (*unrecognized_specs_changed) (NMSystemConfigInterface *config); -}; + void (*unrecognized_specs_changed) (NMSettingsPlugin *config); +} NMSettingsPluginInterface; -GType nm_system_config_interface_get_type (void); +GType nm_settings_plugin_get_type (void); -void nm_system_config_interface_init (NMSystemConfigInterface *config, - gpointer unused); +void nm_settings_plugin_init (NMSettingsPlugin *config); -GSList *nm_system_config_interface_get_connections (NMSystemConfigInterface *config); +GSList *nm_settings_plugin_get_connections (NMSettingsPlugin *config); -gboolean nm_system_config_interface_load_connection (NMSystemConfigInterface *config, - const char *filename); -void nm_system_config_interface_reload_connections (NMSystemConfigInterface *config); +gboolean nm_settings_plugin_load_connection (NMSettingsPlugin *config, + const char *filename); +void nm_settings_plugin_reload_connections (NMSettingsPlugin *config); -GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config); -GSList *nm_system_config_interface_get_unrecognized_specs (NMSystemConfigInterface *config); +GSList *nm_settings_plugin_get_unmanaged_specs (NMSettingsPlugin *config); +GSList *nm_settings_plugin_get_unrecognized_specs (NMSettingsPlugin *config); -NMSettingsConnection *nm_system_config_interface_add_connection (NMSystemConfigInterface *config, - NMConnection *connection, - gboolean save_to_disk, - GError **error); +NMSettingsConnection *nm_settings_plugin_add_connection (NMSettingsPlugin *config, + NMConnection *connection, + gboolean save_to_disk, + GError **error); G_END_DECLS -#endif /* NM_SYSTEM_CONFIG_INTERFACE_H */ +#endif /* NM_SETTINGS_PLUGIN_H */ diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c index afd926c53e..491ccf8de3 100644 --- a/src/settings/nm-settings.c +++ b/src/settings/nm-settings.c @@ -61,7 +61,7 @@ #include "nm-device-ethernet.h" #include "nm-settings.h" #include "nm-settings-connection.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-default.h" #include "nm-bus-manager.h" #include "nm-auth-utils.h" @@ -121,13 +121,13 @@ EXPORT(nm_settings_connection_replace_and_commit) static void claim_connection (NMSettings *self, NMSettingsConnection *connection); -static void unmanaged_specs_changed (NMSystemConfigInterface *config, gpointer user_data); -static void unrecognized_specs_changed (NMSystemConfigInterface *config, gpointer user_data); +static void unmanaged_specs_changed (NMSettingsPlugin *config, gpointer user_data); +static void unrecognized_specs_changed (NMSettingsPlugin *config, gpointer user_data); -static void connection_provider_init (NMConnectionProvider *cp_class); +static void connection_provider_iface_init (NMConnectionProviderInterface *cp_iface); G_DEFINE_TYPE_EXTENDED (NMSettings, nm_settings, NM_TYPE_EXPORTED_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION_PROVIDER, connection_provider_init)) + G_IMPLEMENT_INTERFACE (NM_TYPE_CONNECTION_PROVIDER, connection_provider_iface_init)) typedef struct { @@ -216,7 +216,7 @@ connection_ready_changed (NMSettingsConnection *conn, } static void -plugin_connection_added (NMSystemConfigInterface *config, +plugin_connection_added (NMSettingsPlugin *config, NMSettingsConnection *connection, gpointer user_data) { @@ -230,11 +230,11 @@ load_connections (NMSettings *self) GSList *iter; for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { - NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data); + NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); GSList *plugin_connections; GSList *elt; - plugin_connections = nm_system_config_interface_get_connections (plugin); + plugin_connections = nm_settings_plugin_get_connections (plugin); // FIXME: ensure connections from plugins loaded with a lower priority // get rejected when they conflict with connections from a higher @@ -245,11 +245,11 @@ load_connections (NMSettings *self) g_slist_free (plugin_connections); - g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, + g_signal_connect (plugin, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, G_CALLBACK (plugin_connection_added), self); - g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED, + g_signal_connect (plugin, NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED, G_CALLBACK (unmanaged_specs_changed), self); - g_signal_connect (plugin, NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED, + g_signal_connect (plugin, NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED, G_CALLBACK (unrecognized_specs_changed), self); } @@ -452,7 +452,7 @@ nm_settings_get_unmanaged_specs (NMSettings *self) return priv->unmanaged_specs; } -static NMSystemConfigInterface * +static NMSettingsPlugin * get_plugin (NMSettings *self, guint32 capability) { NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); @@ -462,11 +462,11 @@ get_plugin (NMSettings *self, guint32 capability) /* Do any of the plugins support the given capability? */ for (iter = priv->plugins; iter; iter = iter->next) { - NMSystemConfigInterfaceCapabilities caps = NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE; + NMSettingsPluginCapabilities caps = NM_SETTINGS_PLUGIN_CAP_NONE; - g_object_get (G_OBJECT (iter->data), NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES, &caps, NULL); + g_object_get (G_OBJECT (iter->data), NM_SETTINGS_PLUGIN_CAPABILITIES, &caps, NULL); if (NM_FLAGS_ALL (caps, capability)) - return NM_SYSTEM_CONFIG_INTERFACE (iter->data); + return NM_SETTINGS_PLUGIN (iter->data); } return NULL; @@ -579,7 +579,7 @@ find_spec (GSList *spec_list, const char *spec) static void update_specs (NMSettings *self, GSList **specs_ptr, - GSList * (*get_specs_func) (NMSystemConfigInterface *)) + GSList * (*get_specs_func) (NMSettingsPlugin *)) { NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); GSList *iter; @@ -590,7 +590,7 @@ update_specs (NMSettings *self, GSList **specs_ptr, for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { GSList *specs, *specs_iter; - specs = get_specs_func (NM_SYSTEM_CONFIG_INTERFACE (iter->data)); + specs = get_specs_func (NM_SETTINGS_PLUGIN (iter->data)); for (specs_iter = specs; specs_iter; specs_iter = specs_iter->next) { if (!find_spec (*specs_ptr, (const char *) specs_iter->data)) { *specs_ptr = g_slist_prepend (*specs_ptr, specs_iter->data); @@ -603,30 +603,30 @@ update_specs (NMSettings *self, GSList **specs_ptr, } static void -unmanaged_specs_changed (NMSystemConfigInterface *config, +unmanaged_specs_changed (NMSettingsPlugin *config, gpointer user_data) { NMSettings *self = NM_SETTINGS (user_data); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); update_specs (self, &priv->unmanaged_specs, - nm_system_config_interface_get_unmanaged_specs); + nm_settings_plugin_get_unmanaged_specs); g_object_notify (G_OBJECT (self), NM_SETTINGS_UNMANAGED_SPECS); } static void -unrecognized_specs_changed (NMSystemConfigInterface *config, +unrecognized_specs_changed (NMSettingsPlugin *config, gpointer user_data) { NMSettings *self = NM_SETTINGS (user_data); NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); update_specs (self, &priv->unrecognized_specs, - nm_system_config_interface_get_unrecognized_specs); + nm_settings_plugin_get_unrecognized_specs); } static gboolean -add_plugin (NMSettings *self, NMSystemConfigInterface *plugin) +add_plugin (NMSettings *self, NMSettingsPlugin *plugin) { NMSettingsPrivate *priv; char *pname = NULL; @@ -634,7 +634,7 @@ add_plugin (NMSettings *self, NMSystemConfigInterface *plugin) const char *path; g_return_val_if_fail (NM_IS_SETTINGS (self), FALSE); - g_return_val_if_fail (NM_IS_SYSTEM_CONFIG_INTERFACE (plugin), FALSE); + g_return_val_if_fail (NM_IS_SETTINGS_PLUGIN (plugin), FALSE); priv = NM_SETTINGS_GET_PRIVATE (self); @@ -644,11 +644,11 @@ add_plugin (NMSettings *self, NMSystemConfigInterface *plugin) } priv->plugins = g_slist_append (priv->plugins, g_object_ref (plugin)); - nm_system_config_interface_init (plugin, NULL); + nm_settings_plugin_init (plugin); g_object_get (G_OBJECT (plugin), - NM_SYSTEM_CONFIG_INTERFACE_NAME, &pname, - NM_SYSTEM_CONFIG_INTERFACE_INFO, &pinfo, + NM_SETTINGS_PLUGIN_NAME, &pname, + NM_SETTINGS_PLUGIN_INFO, &pinfo, NULL); path = g_object_get_data (G_OBJECT (plugin), PLUGIN_MODULE_PATH); @@ -670,11 +670,11 @@ find_plugin (GSList *list, const char *pname) g_return_val_if_fail (pname != NULL, NULL); for (iter = list; iter && !obj; iter = g_slist_next (iter)) { - NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data); + NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); char *list_pname = NULL; g_object_get (G_OBJECT (plugin), - NM_SYSTEM_CONFIG_INTERFACE_NAME, + NM_SETTINGS_PLUGIN_NAME, &list_pname, NULL); if (list_pname && !strcmp (pname, list_pname)) @@ -693,7 +693,7 @@ add_keyfile_plugin (NMSettings *self) keyfile_plugin = nm_settings_keyfile_plugin_new (); g_assert (keyfile_plugin); - if (!add_plugin (self, NM_SYSTEM_CONFIG_INTERFACE (keyfile_plugin))) + if (!add_plugin (self, NM_SETTINGS_PLUGIN (keyfile_plugin))) g_return_if_reached (); } @@ -793,7 +793,7 @@ load_plugin: /* errors after this point are fatal, because we loaded the shared library already. */ - if (!g_module_symbol (plugin, "nm_system_config_factory", (gpointer) (&factory_func))) { + if (!g_module_symbol (plugin, "nm_settings_plugin_factory", (gpointer) (&factory_func))) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED, "Could not find plugin '%s' factory function.", pname); @@ -803,7 +803,7 @@ load_plugin: } obj = (*factory_func) (); - if (!obj || !NM_IS_SYSTEM_CONFIG_INTERFACE (obj)) { + if (!obj || !NM_IS_SETTINGS_PLUGIN (obj)) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED, "Plugin '%s' returned invalid system config object.", pname); @@ -816,7 +816,7 @@ load_plugin: g_object_weak_ref (obj, (GWeakNotify) g_module_close, plugin); g_object_set_data_full (obj, PLUGIN_MODULE_PATH, path, g_free); path = NULL; - if (add_plugin (self, NM_SYSTEM_CONFIG_INTERFACE (obj))) + if (add_plugin (self, NM_SETTINGS_PLUGIN (obj))) list = g_slist_append (list, obj); else g_object_unref (obj); @@ -1108,10 +1108,10 @@ nm_settings_add_connection (NMSettings *self, * contain the same data as the connection it already knows about */ for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { - NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data); + NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); GError *add_error = NULL; - added = nm_system_config_interface_add_connection (plugin, connection, save_to_disk, &add_error); + added = nm_settings_plugin_add_connection (plugin, connection, save_to_disk, &add_error); if (added) { claim_connection (self, added); return added; @@ -1307,7 +1307,7 @@ nm_settings_add_connection_dbus (NMSettings *self, } /* Do any of the plugins support adding? */ - if (!get_plugin (self, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS)) { + if (!get_plugin (self, NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS)) { error = g_error_new_literal (NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_NOT_SUPPORTED, "None of the registered plugins support add."); @@ -1474,9 +1474,9 @@ impl_settings_load_connections (NMSettings *self, for (i = 0; filenames[i]; i++) { for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { - NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data); + NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); - if (nm_system_config_interface_load_connection (plugin, filenames[i])) + if (nm_settings_plugin_load_connection (plugin, filenames[i])) break; } @@ -1507,9 +1507,9 @@ impl_settings_reload_connections (NMSettings *self, return; for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { - NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data); + NMSettingsPlugin *plugin = NM_SETTINGS_PLUGIN (iter->data); - nm_system_config_interface_reload_connections (plugin); + nm_settings_plugin_reload_connections (plugin); } g_dbus_method_invocation_return_value (context, g_variant_new ("(b)", TRUE)); @@ -2152,12 +2152,12 @@ nm_settings_start (NMSettings *self, GError **error) } static void -connection_provider_init (NMConnectionProvider *cp_class) +connection_provider_iface_init (NMConnectionProviderInterface *cp_iface) { - cp_class->get_best_connections = get_best_connections; - cp_class->get_connections = get_connections; - cp_class->add_connection = _nm_connection_provider_add_connection; - cp_class->get_connection_by_uuid = cp_get_connection_by_uuid; + cp_iface->get_best_connections = get_best_connections; + cp_iface->get_connections = get_connections; + cp_iface->add_connection = _nm_connection_provider_add_connection; + cp_iface->get_connection_by_uuid = cp_get_connection_by_uuid; } static void @@ -2262,7 +2262,7 @@ get_property (GObject *object, guint prop_id, g_value_set_static_string (value, ""); break; case PROP_CAN_MODIFY: - g_value_set_boolean (value, !!get_plugin (self, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS)); + g_value_set_boolean (value, !!get_plugin (self, NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS)); break; case PROP_CONNECTIONS: array = g_ptr_array_sized_new (g_hash_table_size (priv->connections) + 1); diff --git a/src/settings/nm-system-config-interface.c b/src/settings/nm-system-config-interface.c deleted file mode 100644 index a2c4f70407..0000000000 --- a/src/settings/nm-system-config-interface.c +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* NetworkManager system settings service - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Copyright (C) 2007 - 2011 Red Hat, Inc. - * Copyright (C) 2008 Novell, Inc. - */ - -#include "config.h" - -#include "nm-system-config-interface.h" -#include "nm-settings-connection.h" - -static void -interface_init (gpointer g_iface) -{ - GType iface_type = G_TYPE_FROM_INTERFACE (g_iface); - static gboolean initialized = FALSE; - - if (initialized) - return; - - /* Properties */ - g_object_interface_install_property - (g_iface, - g_param_spec_string (NM_SYSTEM_CONFIG_INTERFACE_NAME, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_interface_install_property - (g_iface, - g_param_spec_string (NM_SYSTEM_CONFIG_INTERFACE_INFO, "", "", - NULL, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - g_object_interface_install_property - (g_iface, - g_param_spec_uint (NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES, "", "", - NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE, - NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS, - NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); - - /* Signals */ - g_signal_new (NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, - iface_type, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSystemConfigInterface, connection_added), - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, 1, - NM_TYPE_SETTINGS_CONNECTION); - - g_signal_new (NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED, - iface_type, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSystemConfigInterface, unmanaged_specs_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - g_signal_new (NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED, - iface_type, - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (NMSystemConfigInterface, unrecognized_specs_changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - initialized = TRUE; -} - - -GType -nm_system_config_interface_get_type (void) -{ - static GType system_config_interface_type = 0; - - if (!system_config_interface_type) { - const GTypeInfo system_config_interface_info = { - sizeof (NMSystemConfigInterface), /* class_size */ - interface_init, /* base_init */ - NULL, /* base_finalize */ - NULL, - NULL, /* class_finalize */ - NULL, /* class_data */ - 0, - 0, /* n_preallocs */ - NULL - }; - - system_config_interface_type = g_type_register_static (G_TYPE_INTERFACE, - "NMSystemConfigInterface", - &system_config_interface_info, - 0); - - g_type_interface_add_prerequisite (system_config_interface_type, G_TYPE_OBJECT); - } - - return system_config_interface_type; -} - -void -nm_system_config_interface_init (NMSystemConfigInterface *config, - gpointer unused) -{ - g_return_if_fail (config != NULL); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->init) - NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->init (config); -} - -GSList * -nm_system_config_interface_get_connections (NMSystemConfigInterface *config) -{ - g_return_val_if_fail (config != NULL, NULL); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_connections) - return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_connections (config); - return NULL; -} - -gboolean -nm_system_config_interface_load_connection (NMSystemConfigInterface *config, - const char *filename) -{ - g_return_val_if_fail (config != NULL, FALSE); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->load_connection) - return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->load_connection (config, filename); - return FALSE; -} - -void -nm_system_config_interface_reload_connections (NMSystemConfigInterface *config) -{ - g_return_if_fail (config != NULL); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->reload_connections) - NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->reload_connections (config); -} - -GSList * -nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config) -{ - g_return_val_if_fail (config != NULL, NULL); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_unmanaged_specs) - return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_unmanaged_specs (config); - return NULL; -} - -GSList * -nm_system_config_interface_get_unrecognized_specs (NMSystemConfigInterface *config) -{ - g_return_val_if_fail (config != NULL, NULL); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_unrecognized_specs) - return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->get_unrecognized_specs (config); - return NULL; -} - -/** - * nm_system_config_interface_add_connection: - * @config: the #NMSystemConfigInterface - * @connection: the source connection to create a plugin-specific - * #NMSettingsConnection from - * @save_to_disk: %TRUE to save the connection to disk immediately, %FALSE to - * not save to disk - * @error: on return, a location to store any errors that may occur - * - * Creates a new #NMSettingsConnection for the given source @connection. If the - * plugin cannot handle the given connection type, it should return %NULL and - * set @error. The plugin owns the returned object and the caller must reference - * the object if it wishes to continue using it. - * - * Returns: the new #NMSettingsConnection or %NULL - */ -NMSettingsConnection * -nm_system_config_interface_add_connection (NMSystemConfigInterface *config, - NMConnection *connection, - gboolean save_to_disk, - GError **error) -{ - g_return_val_if_fail (config != NULL, NULL); - g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); - - if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection) - return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, save_to_disk, error); - - return NULL; -} diff --git a/src/settings/plugins/README b/src/settings/plugins/README index da4fe9df84..307d0bb1ed 100644 --- a/src/settings/plugins/README +++ b/src/settings/plugins/README @@ -4,7 +4,7 @@ Plugins generally have three components: just objects wrapped around on-disk config data. The plugin handles requests to add new connections via the NM D-Bus API, and also watches config directories for changes to configuration data. Plugins implement the - NMSystemConfigInterface interface. See plugin.c. + NMSettingsPlugin interface. See plugin.c. 2) "connections": subclasses of NMSettingsConnection. They handle updates to configuration data, deletion, etc. See NMKeyfileConnection. @@ -16,16 +16,16 @@ Plugins generally have three components: out appropriate configuration data to disk. NM will first call the "factory" function that every module must provide, which -is nm_system_config_factory(). That function creates and returns a singleton -instance of the plugin's main object, which implements NMSystemConfigInterface. +is nm_settings_plugin_factory(). That function creates and returns a singleton +instance of the plugin's main object, which implements NMSettingsPlugin. That interface is implemented via the object definition in G_DEFINE_TYPE_EXTENDED in plugin.c, which registers the interface setup function -system_config_interface_init(), which when called actually sets up the vtables -for the functions defined by NMSystemConfigInterface. Thus there are two -entry points into the plugin: nm_system_config_factory() and -the NMSystemConfigInterface methods. +settings_plugin_interface_init(), which when called actually sets up the vtables +for the functions defined by NMSettingsPluginInterface. Thus there are two +entry points into the plugin: nm_settings_plugin_factory() and +the NMSettingsPluginInterface methods. -The plugin also emits various signals (defined by NMSystemConfigInterface) +The plugin also emits various signals (defined by NMSettingsPluginInterface) which NetworkManager listens for. These include notifications of new connections if they were created via changes to the on-disk files. The "connection" objects can also emit signals (defined by the NMSettingsConnection diff --git a/src/settings/plugins/ibft/plugin.c b/src/settings/plugins/ibft/plugin.c index e72efc888d..555725d1a3 100644 --- a/src/settings/plugins/ibft/plugin.c +++ b/src/settings/plugins/ibft/plugin.c @@ -29,34 +29,34 @@ #include #include "nm-default.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "NetworkManagerUtils.h" #include "plugin.h" #include "reader.h" #include "nm-ibft-connection.h" -static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class); +static void settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface); -G_DEFINE_TYPE_EXTENDED (SCPluginIbft, sc_plugin_ibft, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE, - system_config_interface_init)) +G_DEFINE_TYPE_EXTENDED (SettingsPluginIbft, settings_plugin_ibft, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_PLUGIN, + settings_plugin_interface_init)) -#define SC_PLUGIN_IBFT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SC_TYPE_PLUGIN_IBFT, SCPluginIbftPrivate)) +#define SETTINGS_PLUGIN_IBFT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SETTINGS_TYPE_PLUGIN_IBFT, SettingsPluginIbftPrivate)) typedef struct { GHashTable *connections; /* uuid::connection */ gboolean initialized; -} SCPluginIbftPrivate; +} SettingsPluginIbftPrivate; -static SCPluginIbft *sc_plugin_ibft_get (void); -NM_DEFINE_SINGLETON_GETTER (SCPluginIbft, sc_plugin_ibft_get, SC_TYPE_PLUGIN_IBFT); +static SettingsPluginIbft *settings_plugin_ibft_get (void); +NM_DEFINE_SINGLETON_GETTER (SettingsPluginIbft, settings_plugin_ibft_get, SETTINGS_TYPE_PLUGIN_IBFT); static void -read_connections (SCPluginIbft *self) +read_connections (SettingsPluginIbft *self) { - SCPluginIbftPrivate *priv = SC_PLUGIN_IBFT_GET_PRIVATE (self); + SettingsPluginIbftPrivate *priv = SETTINGS_PLUGIN_IBFT_GET_PRIVATE (self); GSList *blocks = NULL, *iter; GError *error = NULL; NMIbftConnection *connection; @@ -85,10 +85,10 @@ read_connections (SCPluginIbft *self) } static GSList * -get_connections (NMSystemConfigInterface *config) +get_connections (NMSettingsPlugin *config) { - SCPluginIbft *self = SC_PLUGIN_IBFT (config); - SCPluginIbftPrivate *priv = SC_PLUGIN_IBFT_GET_PRIVATE (self); + SettingsPluginIbft *self = SETTINGS_PLUGIN_IBFT (config); + SettingsPluginIbftPrivate *priv = SETTINGS_PLUGIN_IBFT_GET_PRIVATE (self); GSList *list = NULL; GHashTableIter iter; NMIbftConnection *connection; @@ -106,14 +106,14 @@ get_connections (NMSystemConfigInterface *config) } static void -init (NMSystemConfigInterface *config) +init (NMSettingsPlugin *config) { } static void -sc_plugin_ibft_init (SCPluginIbft *self) +settings_plugin_ibft_init (SettingsPluginIbft *self) { - SCPluginIbftPrivate *priv = SC_PLUGIN_IBFT_GET_PRIVATE (self); + SettingsPluginIbftPrivate *priv = SETTINGS_PLUGIN_IBFT_GET_PRIVATE (self); priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } @@ -121,15 +121,15 @@ sc_plugin_ibft_init (SCPluginIbft *self) static void dispose (GObject *object) { - SCPluginIbft *self = SC_PLUGIN_IBFT (object); - SCPluginIbftPrivate *priv = SC_PLUGIN_IBFT_GET_PRIVATE (self); + SettingsPluginIbft *self = SETTINGS_PLUGIN_IBFT (object); + SettingsPluginIbftPrivate *priv = SETTINGS_PLUGIN_IBFT_GET_PRIVATE (self); if (priv->connections) { g_hash_table_destroy (priv->connections); priv->connections = NULL; } - G_OBJECT_CLASS (sc_plugin_ibft_parent_class)->dispose (object); + G_OBJECT_CLASS (settings_plugin_ibft_parent_class)->dispose (object); } static void @@ -137,14 +137,14 @@ get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { - case NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME: + case NM_SETTINGS_PLUGIN_PROP_NAME: g_value_set_string (value, "iBFT"); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO: + case NM_SETTINGS_PLUGIN_PROP_INFO: g_value_set_string (value, "(c) 2014 Red Hat, Inc. To report bugs please use the NetworkManager mailing list."); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES: - g_value_set_uint (value, NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE); + case NM_SETTINGS_PLUGIN_PROP_CAPABILITIES: + g_value_set_uint (value, NM_SETTINGS_PLUGIN_CAP_NONE); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -160,39 +160,39 @@ set_property (GObject *object, guint prop_id, } static void -sc_plugin_ibft_class_init (SCPluginIbftClass *req_class) +settings_plugin_ibft_class_init (SettingsPluginIbftClass *req_class) { GObjectClass *object_class = G_OBJECT_CLASS (req_class); - g_type_class_add_private (req_class, sizeof (SCPluginIbftPrivate)); + g_type_class_add_private (req_class, sizeof (SettingsPluginIbftPrivate)); object_class->dispose = dispose; object_class->get_property = get_property; object_class->set_property = set_property; g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME, - NM_SYSTEM_CONFIG_INTERFACE_NAME); + NM_SETTINGS_PLUGIN_PROP_NAME, + NM_SETTINGS_PLUGIN_NAME); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, - NM_SYSTEM_CONFIG_INTERFACE_INFO); + NM_SETTINGS_PLUGIN_PROP_INFO, + NM_SETTINGS_PLUGIN_INFO); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, - NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES); + NM_SETTINGS_PLUGIN_PROP_CAPABILITIES, + NM_SETTINGS_PLUGIN_CAPABILITIES); } static void -system_config_interface_init (NMSystemConfigInterface *system_config_interface_class) +settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface) { /* interface implementation */ - system_config_interface_class->get_connections = get_connections; - system_config_interface_class->init = init; + plugin_iface->get_connections = get_connections; + plugin_iface->init = init; } G_MODULE_EXPORT GObject * -nm_system_config_factory (void) +nm_settings_plugin_factory (void) { - return g_object_ref (sc_plugin_ibft_get ()); + return g_object_ref (settings_plugin_ibft_get ()); } diff --git a/src/settings/plugins/ibft/plugin.h b/src/settings/plugins/ibft/plugin.h index d86b018466..3fc58c7f1d 100644 --- a/src/settings/plugins/ibft/plugin.h +++ b/src/settings/plugins/ibft/plugin.h @@ -23,25 +23,25 @@ #include "nm-default.h" -#define SC_TYPE_PLUGIN_IBFT (sc_plugin_ibft_get_type ()) -#define SC_PLUGIN_IBFT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IBFT, SCPluginIbft)) -#define SC_PLUGIN_IBFT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SC_TYPE_PLUGIN_IBFT, SCPluginIbftClass)) -#define SC_IS_PLUGIN_IBFT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_PLUGIN_IBFT)) -#define SC_IS_PLUGIN_IBFT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_PLUGIN_IBFT)) -#define SC_PLUGIN_IBFT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SC_TYPE_PLUGIN_IBFT, SCPluginIbftClass)) +#define SETTINGS_TYPE_PLUGIN_IBFT (settings_plugin_ibft_get_type ()) +#define SETTINGS_PLUGIN_IBFT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_IBFT, SettingsPluginIbft)) +#define SETTINGS_PLUGIN_IBFT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_IBFT, SettingsPluginIbftClass)) +#define SETTINGS_IS_PLUGIN_IBFT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_TYPE_PLUGIN_IBFT)) +#define SETTINGS_IS_PLUGIN_IBFT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_TYPE_PLUGIN_IBFT)) +#define SETTINGS_PLUGIN_IBFT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_TYPE_PLUGIN_IBFT, SettingsPluginIbftClass)) -typedef struct _SCPluginIbft SCPluginIbft; -typedef struct _SCPluginIbftClass SCPluginIbftClass; +typedef struct _SettingsPluginIbft SettingsPluginIbft; +typedef struct _SettingsPluginIbftClass SettingsPluginIbftClass; -struct _SCPluginIbft { +struct _SettingsPluginIbft { GObject parent; }; -struct _SCPluginIbftClass { +struct _SettingsPluginIbftClass { GObjectClass parent; }; -GType sc_plugin_ibft_get_type (void); +GType settings_plugin_ibft_get_type (void); #endif /* _PLUGIN_H_ */ diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c index 69dba207d2..70e06db9f7 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.c +++ b/src/settings/plugins/ifcfg-rh/plugin.c @@ -40,7 +40,7 @@ #include "nm-default.h" #include "common.h" #include "plugin.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-config.h" #include "NetworkManagerUtils.h" @@ -68,7 +68,7 @@ #define ERR_GET_MSG(err) (((err) && (err)->message) ? (err)->message : "(unknown)") -static NMIfcfgConnection *update_connection (SCPluginIfcfg *plugin, +static NMIfcfgConnection *update_connection (SettingsPluginIfcfg *plugin, NMConnection *source, const char *full_path, NMIfcfgConnection *connection, @@ -76,13 +76,13 @@ static NMIfcfgConnection *update_connection (SCPluginIfcfg *plugin, GHashTable *protected_connections, GError **error); -static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class); +static void settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface); -G_DEFINE_TYPE_EXTENDED (SCPluginIfcfg, sc_plugin_ifcfg, NM_TYPE_EXPORTED_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE, - system_config_interface_init)) +G_DEFINE_TYPE_EXTENDED (SettingsPluginIfcfg, settings_plugin_ifcfg, NM_TYPE_EXPORTED_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_PLUGIN, + settings_plugin_interface_init)) -#define SC_PLUGIN_IFCFG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SC_TYPE_PLUGIN_IFCFG, SCPluginIfcfgPrivate)) +#define SETTINGS_PLUGIN_IFCFG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SETTINGS_TYPE_PLUGIN_IFCFG, SettingsPluginIfcfgPrivate)) typedef struct { @@ -91,16 +91,16 @@ typedef struct { GFileMonitor *ifcfg_monitor; guint ifcfg_monitor_id; -} SCPluginIfcfgPrivate; +} SettingsPluginIfcfgPrivate; -static SCPluginIfcfg *sc_plugin_ifcfg_get (void); -NM_DEFINE_SINGLETON_GETTER (SCPluginIfcfg, sc_plugin_ifcfg_get, SC_TYPE_PLUGIN_IFCFG); +static SettingsPluginIfcfg *settings_plugin_ifcfg_get (void); +NM_DEFINE_SINGLETON_GETTER (SettingsPluginIfcfg, settings_plugin_ifcfg_get, SETTINGS_TYPE_PLUGIN_IFCFG); static void connection_ifcfg_changed (NMIfcfgConnection *connection, gpointer user_data) { - SCPluginIfcfg *self = SC_PLUGIN_IFCFG (user_data); - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); + SettingsPluginIfcfg *self = SETTINGS_PLUGIN_IFCFG (user_data); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (self); const char *path; path = nm_settings_connection_get_filename (NM_SETTINGS_CONNECTION (connection)); @@ -120,14 +120,14 @@ connection_ifcfg_changed (NMIfcfgConnection *connection, gpointer user_data) static void connection_removed_cb (NMSettingsConnection *obj, gpointer user_data) { - g_hash_table_remove (SC_PLUGIN_IFCFG_GET_PRIVATE (user_data)->connections, + g_hash_table_remove (SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (user_data)->connections, nm_connection_get_uuid (NM_CONNECTION (obj))); } static void -remove_connection (SCPluginIfcfg *self, NMIfcfgConnection *connection) +remove_connection (SettingsPluginIfcfg *self, NMIfcfgConnection *connection) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (self); gboolean unmanaged, unrecognized; g_return_if_fail (self != NULL); @@ -146,15 +146,15 @@ remove_connection (SCPluginIfcfg *self, NMIfcfgConnection *connection) /* Emit changes _after_ removing the connection */ if (unmanaged) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); if (unrecognized) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED); } static NMIfcfgConnection * -find_by_path (SCPluginIfcfg *self, const char *path) +find_by_path (SettingsPluginIfcfg *self, const char *path) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (self); GHashTableIter iter; NMSettingsConnection *candidate = NULL; @@ -169,7 +169,7 @@ find_by_path (SCPluginIfcfg *self, const char *path) } static NMIfcfgConnection * -update_connection (SCPluginIfcfg *self, +update_connection (SettingsPluginIfcfg *self, NMConnection *source, const char *full_path, NMIfcfgConnection *connection, @@ -177,7 +177,7 @@ update_connection (SCPluginIfcfg *self, GHashTable *protected_connections, GError **error) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (self); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (self); NMIfcfgConnection *connection_new; NMIfcfgConnection *connection_by_uuid; GError *local = NULL; @@ -324,18 +324,18 @@ update_connection (SCPluginIfcfg *self, if (old_unmanaged /* && !new_unmanaged */) { _LOGI ("Managing connection "NM_IFCFG_CONNECTION_LOG_FMT" and its device because NM_CONTROLLED was true.", NM_IFCFG_CONNECTION_LOG_ARG (connection_new)); - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, connection_by_uuid); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, connection_by_uuid); } else if (old_unrecognized /* && !new_unrecognized */) { _LOGI ("Managing connection "NM_IFCFG_CONNECTION_LOG_FMT" because it is now a recognized type.", NM_IFCFG_CONNECTION_LOG_ARG (connection_new)); - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, connection_by_uuid); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, connection_by_uuid); } } if (unmanaged_changed) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); if (unrecognized_changed) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED); } nm_settings_connection_set_filename (NM_SETTINGS_CONNECTION (connection_by_uuid), full_path); g_object_unref (connection_new); @@ -379,11 +379,11 @@ update_connection (SCPluginIfcfg *self, /* Only raise the signal if we were called without source, i.e. if we read the connection from file. * Otherwise, we were called by add_connection() which does not expect the signal. */ if (nm_ifcfg_connection_get_unmanaged_spec (connection_new)) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); else if (nm_ifcfg_connection_get_unrecognized_spec (connection_new)) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNRECOGNIZED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNRECOGNIZED_SPECS_CHANGED); else - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, connection_new); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, connection_new); } return connection_new; } @@ -396,7 +396,7 @@ ifcfg_dir_changed (GFileMonitor *monitor, GFileMonitorEvent event_type, gpointer user_data) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (user_data); + SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (user_data); char *path, *ifcfg_path; NMIfcfgConnection *connection; @@ -425,9 +425,9 @@ ifcfg_dir_changed (GFileMonitor *monitor, } static void -setup_ifcfg_monitoring (SCPluginIfcfg *plugin) +setup_ifcfg_monitoring (SettingsPluginIfcfg *plugin) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (plugin); GFile *file; GFileMonitor *monitor; @@ -480,9 +480,9 @@ _sort_paths (const char **f1, const char **f2, GHashTable *paths) } static void -read_connections (SCPluginIfcfg *plugin) +read_connections (SettingsPluginIfcfg *plugin) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (plugin); GDir *dir; GError *err = NULL; const char *item; @@ -552,10 +552,10 @@ read_connections (SCPluginIfcfg *plugin) } static GSList * -get_connections (NMSystemConfigInterface *config) +get_connections (NMSettingsPlugin *config) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config); - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (config); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (plugin); GSList *list = NULL; GHashTableIter iter; NMIfcfgConnection *connection; @@ -578,10 +578,10 @@ get_connections (NMSystemConfigInterface *config) } static gboolean -load_connection (NMSystemConfigInterface *config, +load_connection (NMSettingsPlugin *config, const char *filename) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config); + SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (config); NMIfcfgConnection *connection; int dir_len = strlen (IFCFG_DIR); char *ifcfg_path; @@ -607,18 +607,18 @@ load_connection (NMSystemConfigInterface *config, } static void -reload_connections (NMSystemConfigInterface *config) +reload_connections (NMSettingsPlugin *config) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config); + SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (config); read_connections (plugin); } static GSList * -get_unhandled_specs (NMSystemConfigInterface *config, +get_unhandled_specs (NMSettingsPlugin *config, const char *property) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (config); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (config); GSList *list = NULL, *list_iter; GHashTableIter iter; gpointer connection; @@ -646,24 +646,24 @@ get_unhandled_specs (NMSystemConfigInterface *config, } static GSList * -get_unmanaged_specs (NMSystemConfigInterface *config) +get_unmanaged_specs (NMSettingsPlugin *config) { return get_unhandled_specs (config, NM_IFCFG_CONNECTION_UNMANAGED_SPEC); } static GSList * -get_unrecognized_specs (NMSystemConfigInterface *config) +get_unrecognized_specs (NMSettingsPlugin *config) { return get_unhandled_specs (config, NM_IFCFG_CONNECTION_UNRECOGNIZED_SPEC); } static NMSettingsConnection * -add_connection (NMSystemConfigInterface *config, +add_connection (NMSettingsPlugin *config, NMConnection *connection, gboolean save_to_disk, GError **error) { - SCPluginIfcfg *self = SC_PLUGIN_IFCFG (config); + SettingsPluginIfcfg *self = SETTINGS_PLUGIN_IFCFG (config); gs_free char *path = NULL; /* Ensure we reject attempts to add the connection long before we're @@ -680,7 +680,7 @@ add_connection (NMSystemConfigInterface *config, } static void -impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin, +impl_ifcfgrh_get_ifcfg_details (SettingsPluginIfcfg *plugin, GDBusMethodInvocation *context, const char *in_ifcfg) { @@ -740,14 +740,14 @@ impl_ifcfgrh_get_ifcfg_details (SCPluginIfcfg *plugin, } static void -init (NMSystemConfigInterface *config) +init (NMSettingsPlugin *config) { } static void -sc_plugin_ifcfg_init (SCPluginIfcfg *plugin) +settings_plugin_ifcfg_init (SettingsPluginIfcfg *plugin) { - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (plugin); priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } @@ -755,7 +755,7 @@ sc_plugin_ifcfg_init (SCPluginIfcfg *plugin) static void constructed (GObject *object) { - SCPluginIfcfg *self = SC_PLUGIN_IFCFG (object); + SettingsPluginIfcfg *self = SETTINGS_PLUGIN_IFCFG (object); GError *error = NULL; GDBusConnection *bus; GVariant *ret; @@ -799,8 +799,8 @@ constructed (GObject *object) static void dispose (GObject *object) { - SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (object); - SCPluginIfcfgPrivate *priv = SC_PLUGIN_IFCFG_GET_PRIVATE (plugin); + SettingsPluginIfcfg *plugin = SETTINGS_PLUGIN_IFCFG (object); + SettingsPluginIfcfgPrivate *priv = SETTINGS_PLUGIN_IFCFG_GET_PRIVATE (plugin); if (priv->connections) { g_hash_table_destroy (priv->connections); @@ -815,7 +815,7 @@ dispose (GObject *object) g_object_unref (priv->ifcfg_monitor); } - G_OBJECT_CLASS (sc_plugin_ifcfg_parent_class)->dispose (object); + G_OBJECT_CLASS (settings_plugin_ifcfg_parent_class)->dispose (object); } static void @@ -823,14 +823,14 @@ get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { - case NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME: + case NM_SETTINGS_PLUGIN_PROP_NAME: g_value_set_string (value, IFCFG_PLUGIN_NAME); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO: + case NM_SETTINGS_PLUGIN_PROP_INFO: g_value_set_string (value, IFCFG_PLUGIN_INFO); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES: - g_value_set_uint (value, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS); + case NM_SETTINGS_PLUGIN_PROP_CAPABILITIES: + g_value_set_uint (value, NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -850,12 +850,12 @@ set_property (GObject *object, guint prop_id, } static void -sc_plugin_ifcfg_class_init (SCPluginIfcfgClass *req_class) +settings_plugin_ifcfg_class_init (SettingsPluginIfcfgClass *req_class) { GObjectClass *object_class = G_OBJECT_CLASS (req_class); NMExportedObjectClass *exported_object_class = NM_EXPORTED_OBJECT_CLASS (req_class); - g_type_class_add_private (req_class, sizeof (SCPluginIfcfgPrivate)); + g_type_class_add_private (req_class, sizeof (SettingsPluginIfcfgPrivate)); exported_object_class->export_path = IFCFGRH1_DBUS_OBJECT_PATH; @@ -865,16 +865,16 @@ sc_plugin_ifcfg_class_init (SCPluginIfcfgClass *req_class) object_class->set_property = set_property; g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME, - NM_SYSTEM_CONFIG_INTERFACE_NAME); + NM_SETTINGS_PLUGIN_PROP_NAME, + NM_SETTINGS_PLUGIN_NAME); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, - NM_SYSTEM_CONFIG_INTERFACE_INFO); + NM_SETTINGS_PLUGIN_PROP_INFO, + NM_SETTINGS_PLUGIN_INFO); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, - NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES); + NM_SETTINGS_PLUGIN_PROP_CAPABILITIES, + NM_SETTINGS_PLUGIN_CAPABILITIES); nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (req_class), NMDBUS_TYPE_IFCFGRH1_SKELETON, @@ -883,20 +883,20 @@ sc_plugin_ifcfg_class_init (SCPluginIfcfgClass *req_class) } static void -system_config_interface_init (NMSystemConfigInterface *system_config_interface_class) +settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface) { /* interface implementation */ - system_config_interface_class->get_connections = get_connections; - system_config_interface_class->add_connection = add_connection; - system_config_interface_class->load_connection = load_connection; - system_config_interface_class->reload_connections = reload_connections; - system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs; - system_config_interface_class->get_unrecognized_specs = get_unrecognized_specs; - system_config_interface_class->init = init; + plugin_iface->get_connections = get_connections; + plugin_iface->add_connection = add_connection; + plugin_iface->load_connection = load_connection; + plugin_iface->reload_connections = reload_connections; + plugin_iface->get_unmanaged_specs = get_unmanaged_specs; + plugin_iface->get_unrecognized_specs = get_unrecognized_specs; + plugin_iface->init = init; } G_MODULE_EXPORT GObject * -nm_system_config_factory (void) +nm_settings_plugin_factory (void) { - return g_object_ref (sc_plugin_ifcfg_get ()); + return g_object_ref (settings_plugin_ifcfg_get ()); } diff --git a/src/settings/plugins/ifcfg-rh/plugin.h b/src/settings/plugins/ifcfg-rh/plugin.h index 85eb1f7a8d..e2020ce6c7 100644 --- a/src/settings/plugins/ifcfg-rh/plugin.h +++ b/src/settings/plugins/ifcfg-rh/plugin.h @@ -26,25 +26,25 @@ #include "nm-exported-object.h" -#define SC_TYPE_PLUGIN_IFCFG (sc_plugin_ifcfg_get_type ()) -#define SC_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IFCFG, SCPluginIfcfg)) -#define SC_PLUGIN_IFCFG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SC_TYPE_PLUGIN_IFCFG, SCPluginIfcfgClass)) -#define SC_IS_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_PLUGIN_IFCFG)) -#define SC_IS_PLUGIN_IFCFG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_PLUGIN_IFCFG)) -#define SC_PLUGIN_IFCFG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SC_TYPE_PLUGIN_IFCFG, SCPluginIfcfgClass)) +#define SETTINGS_TYPE_PLUGIN_IFCFG (settings_plugin_ifcfg_get_type ()) +#define SETTINGS_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_IFCFG, SettingsPluginIfcfg)) +#define SETTINGS_PLUGIN_IFCFG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_IFCFG, SettingsPluginIfcfgClass)) +#define SETTINGS_IS_PLUGIN_IFCFG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_TYPE_PLUGIN_IFCFG)) +#define SETTINGS_IS_PLUGIN_IFCFG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_TYPE_PLUGIN_IFCFG)) +#define SETTINGS_PLUGIN_IFCFG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_TYPE_PLUGIN_IFCFG, SettingsPluginIfcfgClass)) -typedef struct _SCPluginIfcfg SCPluginIfcfg; -typedef struct _SCPluginIfcfgClass SCPluginIfcfgClass; +typedef struct _SettingsPluginIfcfg SettingsPluginIfcfg; +typedef struct _SettingsPluginIfcfgClass SettingsPluginIfcfgClass; -struct _SCPluginIfcfg { +struct _SettingsPluginIfcfg { NMExportedObject parent; }; -struct _SCPluginIfcfgClass { +struct _SettingsPluginIfcfgClass { NMExportedObjectClass parent; }; -GType sc_plugin_ifcfg_get_type (void); +GType settings_plugin_ifcfg_get_type (void); #endif /* _PLUGIN_H_ */ diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c index 437629c58c..51ff9da6a9 100644 --- a/src/settings/plugins/ifnet/connection_parser.c +++ b/src/settings/plugins/ifnet/connection_parser.c @@ -26,7 +26,7 @@ #include #include -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-default.h" #include "nm-core-internal.h" #include "NetworkManagerUtils.h" diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c index 81ea04314e..ee66ff53d9 100644 --- a/src/settings/plugins/ifnet/net_parser.c +++ b/src/settings/plugins/ifnet/net_parser.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include "nm-default.h" #include "plugin.h" diff --git a/src/settings/plugins/ifnet/net_utils.c b/src/settings/plugins/ifnet/net_utils.c index c653dd0f10..1c72e0b275 100644 --- a/src/settings/plugins/ifnet/net_utils.c +++ b/src/settings/plugins/ifnet/net_utils.c @@ -27,7 +27,7 @@ #include #include #include "NetworkManagerUtils.h" -#include +#include #include "nm-config.h" #include "nm-default.h" #include "net_utils.h" diff --git a/src/settings/plugins/ifnet/net_utils.h b/src/settings/plugins/ifnet/net_utils.h index c1422f6505..459693692b 100644 --- a/src/settings/plugins/ifnet/net_utils.h +++ b/src/settings/plugins/ifnet/net_utils.h @@ -21,7 +21,7 @@ #ifndef _IFNET_UTILS_H #define _IFNET_UTILS_H -#define IFNET_PLUGIN_NAME "SCPlugin-Ifnet" +#define IFNET_PLUGIN_NAME "SettingsPlugin-Ifnet" #include #include #include diff --git a/src/settings/plugins/ifnet/nm-ifnet-connection.c b/src/settings/plugins/ifnet/nm-ifnet-connection.c index 7edb03256b..450fe93179 100644 --- a/src/settings/plugins/ifnet/nm-ifnet-connection.c +++ b/src/settings/plugins/ifnet/nm-ifnet-connection.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include "nm-default.h" #include "nm-ifnet-connection.h" #include "connection_parser.h" @@ -50,7 +50,7 @@ static guint signals[IFNET_LAST_SIGNAL] = { 0 }; typedef struct { gchar *conn_name; - NMSystemConfigInterface *config; + NMSettingsPlugin *config; } NMIfnetConnectionPrivate; NMIfnetConnection * diff --git a/src/settings/plugins/ifnet/plugin.c b/src/settings/plugins/ifnet/plugin.c index d99e445972..b670cdac72 100644 --- a/src/settings/plugins/ifnet/plugin.c +++ b/src/settings/plugins/ifnet/plugin.c @@ -31,7 +31,7 @@ #include "nm-default.h" #include "nm-dbus-interface.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-ifnet-connection.h" #include "nm-config.h" #include "NetworkManagerUtils.h" @@ -53,7 +53,7 @@ typedef struct { GFileMonitor *net_monitor; GFileMonitor *wpa_monitor; -} SCPluginIfnetPrivate; +} SettingsPluginIfnetPrivate; typedef void (*FileChangedFn) (gpointer user_data); @@ -62,16 +62,17 @@ typedef struct { gpointer user_data; } FileMonitorInfo; -static void system_config_interface_init (NMSystemConfigInterface *class); +static void settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface); -static void reload_connections (NMSystemConfigInterface *config); +static void reload_connections (NMSettingsPlugin *config); -G_DEFINE_TYPE_EXTENDED (SCPluginIfnet, sc_plugin_ifnet, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE, system_config_interface_init)) -#define SC_PLUGIN_IFNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SC_TYPE_PLUGIN_IFNET, SCPluginIfnetPrivate)) +G_DEFINE_TYPE_EXTENDED (SettingsPluginIfnet, settings_plugin_ifnet, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_PLUGIN, + settings_plugin_interface_init)) +#define SETTINGS_PLUGIN_IFNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SETTINGS_TYPE_PLUGIN_IFNET, SettingsPluginIfnetPrivate)) -static SCPluginIfnet *sc_plugin_ifnet_get (void); -NM_DEFINE_SINGLETON_GETTER (SCPluginIfnet, sc_plugin_ifnet_get, SC_TYPE_PLUGIN_IFNET); +static SettingsPluginIfnet *settings_plugin_ifnet_get (void); +NM_DEFINE_SINGLETON_GETTER (SettingsPluginIfnet, settings_plugin_ifnet_get, SETTINGS_TYPE_PLUGIN_IFNET); static gboolean is_managed_plugin (void) @@ -133,8 +134,8 @@ monitor_file_changes (const char *filename, static void setup_monitors (NMIfnetConnection * connection, gpointer user_data) { - SCPluginIfnet *self = SC_PLUGIN_IFNET (user_data); - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (self); + SettingsPluginIfnet *self = SETTINGS_PLUGIN_IFNET (user_data); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (self); if (nm_config_get_monitor_connection_files (nm_config_get ())) { priv->net_monitor = @@ -149,8 +150,8 @@ setup_monitors (NMIfnetConnection * connection, gpointer user_data) static void cancel_monitors (NMIfnetConnection * connection, gpointer user_data) { - SCPluginIfnet *self = SC_PLUGIN_IFNET (user_data); - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (self); + SettingsPluginIfnet *self = SETTINGS_PLUGIN_IFNET (user_data); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (self); if (priv->net_monitor) { g_file_monitor_cancel (priv->net_monitor); @@ -165,14 +166,14 @@ cancel_monitors (NMIfnetConnection * connection, gpointer user_data) static void connection_removed_cb (NMSettingsConnection *obj, gpointer user_data) { - g_hash_table_remove (SC_PLUGIN_IFNET_GET_PRIVATE (user_data)->connections, + g_hash_table_remove (SETTINGS_PLUGIN_IFNET_GET_PRIVATE (user_data)->connections, nm_connection_get_uuid (NM_CONNECTION (obj))); } static void -track_new_connection (SCPluginIfnet *self, NMIfnetConnection *connection) +track_new_connection (SettingsPluginIfnet *self, NMIfnetConnection *connection) { - g_hash_table_insert (SC_PLUGIN_IFNET_GET_PRIVATE (self)->connections, + g_hash_table_insert (SETTINGS_PLUGIN_IFNET_GET_PRIVATE (self)->connections, g_strdup (nm_connection_get_uuid (NM_CONNECTION (connection))), g_object_ref (connection)); g_signal_connect (connection, NM_SETTINGS_CONNECTION_REMOVED, @@ -181,10 +182,10 @@ track_new_connection (SCPluginIfnet *self, NMIfnetConnection *connection) } static void -reload_connections (NMSystemConfigInterface *config) +reload_connections (NMSettingsPlugin *config) { - SCPluginIfnet *self = SC_PLUGIN_IFNET (config); - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (self); + SettingsPluginIfnet *self = SETTINGS_PLUGIN_IFNET (config); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (self); GList *conn_names = NULL, *n_iter = NULL; gboolean auto_refresh; GError *error = NULL; @@ -242,7 +243,7 @@ reload_connections (NMSystemConfigInterface *config) nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (old)); track_new_connection (self, new); if (is_managed_plugin () && is_managed (conn_name)) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, new); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, new); } } else { /* Update existing connection with new settings */ @@ -259,11 +260,11 @@ reload_connections (NMSystemConfigInterface *config) nm_log_info (LOGD_SETTINGS, "Connection %s updated", nm_connection_get_id (NM_CONNECTION (new))); } - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); } else if (new) { track_new_connection (self, new); if (is_managed_plugin () && is_managed (conn_name)) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, new); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, new); } /* Track all valid connections so we can remove deleted ones later */ @@ -290,12 +291,12 @@ reload_connections (NMSystemConfigInterface *config) } static NMSettingsConnection * -add_connection (NMSystemConfigInterface *config, +add_connection (NMSettingsPlugin *config, NMConnection *source, gboolean save_to_disk, GError **error) { - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (config); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (config); NMIfnetConnection *new = NULL; /* Ensure we reject attempts to add the connection long before we're @@ -312,7 +313,7 @@ add_connection (NMSystemConfigInterface *config, } else { new = nm_ifnet_connection_new (source, NULL); if (new) { - track_new_connection (SC_PLUGIN_IFNET (config), new); + track_new_connection (SETTINGS_PLUGIN_IFNET (config), new); /* track_new_connection refs 'new' */ g_object_unref (new); } @@ -355,9 +356,9 @@ check_unmanaged (gpointer key, gpointer data, gpointer user_data) } static GSList * -get_unmanaged_specs (NMSystemConfigInterface * config) +get_unmanaged_specs (NMSettingsPlugin * config) { - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (config); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (config); GSList *list = NULL; nm_log_info (LOGD_SETTINGS, "getting unmanaged specs..."); @@ -366,10 +367,10 @@ get_unmanaged_specs (NMSystemConfigInterface * config) } static void -init (NMSystemConfigInterface *config) +init (NMSettingsPlugin *config) { - SCPluginIfnet *self = SC_PLUGIN_IFNET (config); - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (self); + SettingsPluginIfnet *self = SETTINGS_PLUGIN_IFNET (config); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (self); nm_log_info (LOGD_SETTINGS, "Initializing!"); @@ -385,9 +386,9 @@ init (NMSystemConfigInterface *config) } static GSList * -get_connections (NMSystemConfigInterface *config) +get_connections (NMSettingsPlugin *config) { - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (config); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (config); GSList *connections = NULL; GHashTableIter iter; NMIfnetConnection *connection; @@ -407,17 +408,17 @@ get_connections (NMSystemConfigInterface *config) } static void -system_config_interface_init (NMSystemConfigInterface *class) +settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface) { - class->init = init; - class->get_connections = get_connections; - class->get_unmanaged_specs = get_unmanaged_specs; - class->add_connection = add_connection; - class->reload_connections = reload_connections; + plugin_iface->init = init; + plugin_iface->get_connections = get_connections; + plugin_iface->get_unmanaged_specs = get_unmanaged_specs; + plugin_iface->add_connection = add_connection; + plugin_iface->reload_connections = reload_connections; } static void -sc_plugin_ifnet_init (SCPluginIfnet * plugin) +settings_plugin_ifnet_init (SettingsPluginIfnet * plugin) { } @@ -426,15 +427,15 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { switch (prop_id) { - case NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME: + case NM_SETTINGS_PLUGIN_PROP_NAME: g_value_set_string (value, IFNET_PLUGIN_NAME_PRINT); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO: + case NM_SETTINGS_PLUGIN_PROP_INFO: g_value_set_string (value, IFNET_PLUGIN_INFO); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES: + case NM_SETTINGS_PLUGIN_PROP_CAPABILITIES: g_value_set_uint (value, - NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS); + NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -456,8 +457,8 @@ set_property (GObject * object, guint prop_id, const GValue * value, static void dispose (GObject * object) { - SCPluginIfnet *plugin = SC_PLUGIN_IFNET (object); - SCPluginIfnetPrivate *priv = SC_PLUGIN_IFNET_GET_PRIVATE (plugin); + SettingsPluginIfnet *plugin = SETTINGS_PLUGIN_IFNET (object); + SettingsPluginIfnetPrivate *priv = SETTINGS_PLUGIN_IFNET_GET_PRIVATE (plugin); cancel_monitors (NULL, object); if (priv->connections) { @@ -467,35 +468,35 @@ dispose (GObject * object) ifnet_destroy (); wpa_parser_destroy (); - G_OBJECT_CLASS (sc_plugin_ifnet_parent_class)->dispose (object); + G_OBJECT_CLASS (settings_plugin_ifnet_parent_class)->dispose (object); } static void -sc_plugin_ifnet_class_init (SCPluginIfnetClass * req_class) +settings_plugin_ifnet_class_init (SettingsPluginIfnetClass * req_class) { GObjectClass *object_class = G_OBJECT_CLASS (req_class); - g_type_class_add_private (req_class, sizeof (SCPluginIfnetPrivate)); + g_type_class_add_private (req_class, sizeof (SettingsPluginIfnetPrivate)); object_class->dispose = dispose; object_class->get_property = get_property; object_class->set_property = set_property; g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME, - NM_SYSTEM_CONFIG_INTERFACE_NAME); + NM_SETTINGS_PLUGIN_PROP_NAME, + NM_SETTINGS_PLUGIN_NAME); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, - NM_SYSTEM_CONFIG_INTERFACE_INFO); + NM_SETTINGS_PLUGIN_PROP_INFO, + NM_SETTINGS_PLUGIN_INFO); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, - NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES); + NM_SETTINGS_PLUGIN_PROP_CAPABILITIES, + NM_SETTINGS_PLUGIN_CAPABILITIES); } G_MODULE_EXPORT GObject * -nm_system_config_factory (void) +nm_settings_plugin_factory (void) { - return g_object_ref (sc_plugin_ifnet_get ()); + return g_object_ref (settings_plugin_ifnet_get ()); } diff --git a/src/settings/plugins/ifnet/plugin.h b/src/settings/plugins/ifnet/plugin.h index cb8767bd96..33dcc2017f 100644 --- a/src/settings/plugins/ifnet/plugin.h +++ b/src/settings/plugins/ifnet/plugin.h @@ -25,23 +25,23 @@ #include "nm-default.h" -#define SC_TYPE_PLUGIN_IFNET (sc_plugin_ifnet_get_type ()) -#define SC_PLUGIN_IFNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IFNET, SCPluginIfnet)) -#define SC_PLUGIN_IFNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SC_TYPE_PLUGIN_IFNET, SCPluginIfnetClass)) -#define SC_IS_PLUGIN_IFNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_PLUGIN_IFNET)) -#define SC_IS_PLUGIN_IFNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_PLUGIN_IFNET)) -#define SC_PLUGIN_IFNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SC_TYPE_PLUGIN_IFNET, SCPluginIfnetClass)) +#define SETTINGS_TYPE_PLUGIN_IFNET (settings_plugin_ifnet_get_type ()) +#define SETTINGS_PLUGIN_IFNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_IFNET, SettingsPluginIfnet)) +#define SETTINGS_PLUGIN_IFNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_IFNET, SettingsPluginIfnetClass)) +#define SETTINGS_IS_PLUGIN_IFNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_TYPE_PLUGIN_IFNET)) +#define SETTINGS_IS_PLUGIN_IFNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_TYPE_PLUGIN_IFNET)) +#define SETTINGS_PLUGIN_IFNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_TYPE_PLUGIN_IFNET, SettingsPluginIfnetClass)) -typedef struct _SCPluginIfnet SCPluginIfnet; -typedef struct _SCPluginIfnetClass SCPluginIfnetClass; +typedef struct _SettingsPluginIfnet SettingsPluginIfnet; +typedef struct _SettingsPluginIfnetClass SettingsPluginIfnetClass; -struct _SCPluginIfnet { +struct _SettingsPluginIfnet { GObject parent; }; -struct _SCPluginIfnetClass { +struct _SettingsPluginIfnetClass { GObjectClass parent; }; -GType sc_plugin_ifnet_get_type (void); +GType settings_plugin_ifnet_get_type (void); #endif diff --git a/src/settings/plugins/ifnet/wpa_parser.c b/src/settings/plugins/ifnet/wpa_parser.c index 51474ee433..9f228d0b70 100644 --- a/src/settings/plugins/ifnet/wpa_parser.c +++ b/src/settings/plugins/ifnet/wpa_parser.c @@ -23,7 +23,7 @@ #include #include -#include +#include #include "nm-default.h" #include "wpa_parser.h" #include "net_parser.h" diff --git a/src/settings/plugins/ifupdown/nm-ifupdown-connection.c b/src/settings/plugins/ifupdown/nm-ifupdown-connection.c index d66789abca..2c8504b00c 100644 --- a/src/settings/plugins/ifupdown/nm-ifupdown-connection.c +++ b/src/settings/plugins/ifupdown/nm-ifupdown-connection.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "nm-default.h" #include "nm-ifupdown-connection.h" #include "parser.h" diff --git a/src/settings/plugins/ifupdown/parser.c b/src/settings/plugins/ifupdown/parser.c index 1f9553def8..8a3d4551da 100644 --- a/src/settings/plugins/ifupdown/parser.c +++ b/src/settings/plugins/ifupdown/parser.c @@ -30,7 +30,7 @@ #include #include "nm-core-internal.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-default.h" #include "parser.h" diff --git a/src/settings/plugins/ifupdown/plugin.c b/src/settings/plugins/ifupdown/plugin.c index 3196e75db9..fc361de5c1 100644 --- a/src/settings/plugins/ifupdown/plugin.c +++ b/src/settings/plugins/ifupdown/plugin.c @@ -33,7 +33,7 @@ #include "interface_parser.h" #include "nm-dbus-interface.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-setting-ip4-config.h" #include "nm-setting-wireless.h" #include "nm-setting-wired.h" @@ -78,31 +78,31 @@ typedef struct { GHashTable *kernel_ifaces; gboolean unmanage_well_known; -} SCPluginIfupdownPrivate; +} SettingsPluginIfupdownPrivate; static void -system_config_interface_init (NMSystemConfigInterface *system_config_interface_class); +settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface); -G_DEFINE_TYPE_EXTENDED (SCPluginIfupdown, sc_plugin_ifupdown, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE, - system_config_interface_init)) +G_DEFINE_TYPE_EXTENDED (SettingsPluginIfupdown, settings_plugin_ifupdown, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_PLUGIN, + settings_plugin_interface_init)) -#define SC_PLUGIN_IFUPDOWN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SC_TYPE_PLUGIN_IFUPDOWN, SCPluginIfupdownPrivate)) +#define SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SETTINGS_TYPE_PLUGIN_IFUPDOWN, SettingsPluginIfupdownPrivate)) -static SCPluginIfupdown *sc_plugin_ifupdown_get (void); -NM_DEFINE_SINGLETON_GETTER (SCPluginIfupdown, sc_plugin_ifupdown_get, SC_TYPE_PLUGIN_IFUPDOWN); +static SettingsPluginIfupdown *settings_plugin_ifupdown_get (void); +NM_DEFINE_SINGLETON_GETTER (SettingsPluginIfupdown, settings_plugin_ifupdown_get, SETTINGS_TYPE_PLUGIN_IFUPDOWN); static void -sc_plugin_ifupdown_class_init (SCPluginIfupdownClass *req_class); +settings_plugin_ifupdown_class_init (SettingsPluginIfupdownClass *req_class); static void -SCPluginIfupdown_init (NMSystemConfigInterface *config); +SettingsPluginIfupdown_init (NMSettingsPlugin *config); /* Returns the plugins currently known list of connections. The returned * list is freed by the system settings service. */ static GSList* -SCPluginIfupdown_get_connections (NMSystemConfigInterface *config); +SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config); /* * Return a list of device specifications which NetworkManager should not @@ -110,7 +110,7 @@ SCPluginIfupdown_get_connections (NMSystemConfigInterface *config); * each element must be allocated using g_malloc() or its variants. */ static GSList* -SCPluginIfupdown_get_unmanaged_specs (NMSystemConfigInterface *config); +SettingsPluginIfupdown_get_unmanaged_specs (NMSettingsPlugin *config); /* GObject */ @@ -126,39 +126,39 @@ static void GObject__dispose (GObject *object); static void -system_config_interface_init (NMSystemConfigInterface *system_config_interface_class) +settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface) { - system_config_interface_class->init = SCPluginIfupdown_init; - system_config_interface_class->get_connections = SCPluginIfupdown_get_connections; - system_config_interface_class->get_unmanaged_specs = SCPluginIfupdown_get_unmanaged_specs; + plugin_iface->init = SettingsPluginIfupdown_init; + plugin_iface->get_connections = SettingsPluginIfupdown_get_connections; + plugin_iface->get_unmanaged_specs = SettingsPluginIfupdown_get_unmanaged_specs; } static void -sc_plugin_ifupdown_class_init (SCPluginIfupdownClass *req_class) +settings_plugin_ifupdown_class_init (SettingsPluginIfupdownClass *req_class) { GObjectClass *object_class = G_OBJECT_CLASS (req_class); - g_type_class_add_private (req_class, sizeof (SCPluginIfupdownPrivate)); + g_type_class_add_private (req_class, sizeof (SettingsPluginIfupdownPrivate)); object_class->dispose = GObject__dispose; object_class->get_property = GObject__get_property; object_class->set_property = GObject__set_property; g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME, - NM_SYSTEM_CONFIG_INTERFACE_NAME); + NM_SETTINGS_PLUGIN_PROP_NAME, + NM_SETTINGS_PLUGIN_NAME); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, - NM_SYSTEM_CONFIG_INTERFACE_INFO); + NM_SETTINGS_PLUGIN_PROP_INFO, + NM_SETTINGS_PLUGIN_INFO); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, - NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES); + NM_SETTINGS_PLUGIN_PROP_CAPABILITIES, + NM_SETTINGS_PLUGIN_CAPABILITIES); } static void -bind_device_to_connection (SCPluginIfupdown *self, +bind_device_to_connection (SettingsPluginIfupdown *self, GUdevDevice *device, NMIfupdownConnection *exported) { @@ -198,9 +198,9 @@ bind_device_to_connection (SCPluginIfupdown *self, } static void -udev_device_added (SCPluginIfupdown *self, GUdevDevice *device) +udev_device_added (SettingsPluginIfupdown *self, GUdevDevice *device) { - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (self); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self); const char *iface, *path; NMIfupdownConnection *exported; @@ -227,13 +227,13 @@ udev_device_added (SCPluginIfupdown *self, GUdevDevice *device) bind_device_to_connection (self, device, exported); if (ALWAYS_UNMANAGE || priv->unmanage_well_known) - g_signal_emit_by_name (G_OBJECT (self), NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (G_OBJECT (self), NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); } static void -udev_device_removed (SCPluginIfupdown *self, GUdevDevice *device) +udev_device_removed (SettingsPluginIfupdown *self, GUdevDevice *device) { - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (self); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self); const char *iface, *path; iface = g_udev_device_get_name (device); @@ -247,13 +247,13 @@ udev_device_removed (SCPluginIfupdown *self, GUdevDevice *device) return; if (ALWAYS_UNMANAGE || priv->unmanage_well_known) - g_signal_emit_by_name (G_OBJECT (self), NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (G_OBJECT (self), NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); } static void -udev_device_changed (SCPluginIfupdown *self, GUdevDevice *device) +udev_device_changed (SettingsPluginIfupdown *self, GUdevDevice *device) { - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (self); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self); const char *iface, *path; iface = g_udev_device_get_name (device); @@ -267,7 +267,7 @@ udev_device_changed (SCPluginIfupdown *self, GUdevDevice *device) return; if (ALWAYS_UNMANAGE || priv->unmanage_well_known) - g_signal_emit_by_name (G_OBJECT (self), NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (G_OBJECT (self), NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); } static void @@ -276,7 +276,7 @@ handle_uevent (GUdevClient *client, GUdevDevice *device, gpointer user_data) { - SCPluginIfupdown *self = SC_PLUGIN_IFUPDOWN (user_data); + SettingsPluginIfupdown *self = SETTINGS_PLUGIN_IFUPDOWN (user_data); const char *subsys; g_return_if_fail (action != NULL); @@ -295,10 +295,10 @@ handle_uevent (GUdevClient *client, } static void -SCPluginIfupdown_init (NMSystemConfigInterface *config) +SettingsPluginIfupdown_init (NMSettingsPlugin *config) { - SCPluginIfupdown *self = SC_PLUGIN_IFUPDOWN (config); - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (self); + SettingsPluginIfupdown *self = SETTINGS_PLUGIN_IFUPDOWN (config); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (self); GHashTable *auto_ifaces; if_block *block = NULL; GList *keys, *iter; @@ -436,7 +436,7 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config) for (cl_iter = con_list; cl_iter; cl_iter = g_list_next (cl_iter)) { g_signal_emit_by_name (self, - NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, + NM_SETTINGS_PLUGIN_CONNECTION_ADDED, NM_SETTINGS_CONNECTION (cl_iter->data)); } g_list_free (con_list); @@ -450,9 +450,9 @@ SCPluginIfupdown_init (NMSystemConfigInterface *config) * list is freed by the system settings service. */ static GSList* -SCPluginIfupdown_get_connections (NMSystemConfigInterface *config) +SettingsPluginIfupdown_get_connections (NMSettingsPlugin *config) { - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (config); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (config); GSList *connections; nm_log_info (LOGD_SETTINGS, "(%d) ... get_connections.", GPOINTER_TO_UINT(config)); @@ -474,9 +474,9 @@ SCPluginIfupdown_get_connections (NMSystemConfigInterface *config) * each element must be allocated using g_malloc() or its variants. */ static GSList* -SCPluginIfupdown_get_unmanaged_specs (NMSystemConfigInterface *config) +SettingsPluginIfupdown_get_unmanaged_specs (NMSettingsPlugin *config) { - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (config); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (config); GSList *specs = NULL; GHashTableIter iter; GUdevDevice *device; @@ -502,7 +502,7 @@ SCPluginIfupdown_get_unmanaged_specs (NMSystemConfigInterface *config) } static void -sc_plugin_ifupdown_init (SCPluginIfupdown *plugin) +settings_plugin_ifupdown_init (SettingsPluginIfupdown *plugin) { } @@ -511,14 +511,14 @@ GObject__get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { - case NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME: + case NM_SETTINGS_PLUGIN_PROP_NAME: g_value_set_string (value, IFUPDOWN_PLUGIN_NAME); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO: + case NM_SETTINGS_PLUGIN_PROP_INFO: g_value_set_string (value, IFUPDOWN_PLUGIN_INFO); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES: - g_value_set_uint (value, NM_SYSTEM_CONFIG_INTERFACE_CAP_NONE); + case NM_SETTINGS_PLUGIN_PROP_CAPABILITIES: + g_value_set_uint (value, NM_SETTINGS_PLUGIN_CAP_NONE); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -540,8 +540,8 @@ GObject__set_property (GObject *object, guint prop_id, static void GObject__dispose (GObject *object) { - SCPluginIfupdown *plugin = SC_PLUGIN_IFUPDOWN (object); - SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (plugin); + SettingsPluginIfupdown *plugin = SETTINGS_PLUGIN_IFUPDOWN (object); + SettingsPluginIfupdownPrivate *priv = SETTINGS_PLUGIN_IFUPDOWN_GET_PRIVATE (plugin); if (priv->kernel_ifaces) g_hash_table_destroy(priv->kernel_ifaces); @@ -553,12 +553,12 @@ GObject__dispose (GObject *object) g_object_unref (priv->client); - G_OBJECT_CLASS (sc_plugin_ifupdown_parent_class)->dispose (object); + G_OBJECT_CLASS (settings_plugin_ifupdown_parent_class)->dispose (object); } G_MODULE_EXPORT GObject * -nm_system_config_factory (void) +nm_settings_plugin_factory (void) { - return g_object_ref (sc_plugin_ifupdown_get ()); + return g_object_ref (settings_plugin_ifupdown_get ()); } diff --git a/src/settings/plugins/ifupdown/plugin.h b/src/settings/plugins/ifupdown/plugin.h index 8eab4f2ffa..090178f2b4 100644 --- a/src/settings/plugins/ifupdown/plugin.h +++ b/src/settings/plugins/ifupdown/plugin.h @@ -28,24 +28,24 @@ #define PLUGIN_NAME "ifupdown" -#define SC_TYPE_PLUGIN_IFUPDOWN (sc_plugin_ifupdown_get_type ()) -#define SC_PLUGIN_IFUPDOWN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_IFUPDOWN, SCPluginIfupdown)) -#define SC_PLUGIN_IFUPDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SC_TYPE_PLUGIN_IFUPDOWN, SCPluginIfupdownClass)) -#define SC_IS_PLUGIN_IFUPDOWN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_PLUGIN_IFUPDOWN)) -#define SC_IS_PLUGIN_IFUPDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_PLUGIN_IFUPDOWN)) -#define SC_PLUGIN_IFUPDOWN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SC_TYPE_PLUGIN_IFUPDOWN, SCPluginIfupdownClass)) +#define SETTINGS_TYPE_PLUGIN_IFUPDOWN (settings_plugin_ifupdown_get_type ()) +#define SETTINGS_PLUGIN_IFUPDOWN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_IFUPDOWN, SettingsPluginIfupdown)) +#define SETTINGS_PLUGIN_IFUPDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_IFUPDOWN, SettingsPluginIfupdownClass)) +#define SETTINGS_IS_PLUGIN_IFUPDOWN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_TYPE_PLUGIN_IFUPDOWN)) +#define SETTINGS_IS_PLUGIN_IFUPDOWN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_TYPE_PLUGIN_IFUPDOWN)) +#define SETTINGS_PLUGIN_IFUPDOWN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_TYPE_PLUGIN_IFUPDOWN, SettingsPluginIfupdownClass)) -typedef struct _SCPluginIfupdown SCPluginIfupdown; -typedef struct _SCPluginIfupdownClass SCPluginIfupdownClass; +typedef struct _SettingsPluginIfupdown SettingsPluginIfupdown; +typedef struct _SettingsPluginIfupdownClass SettingsPluginIfupdownClass; -struct _SCPluginIfupdown { +struct _SettingsPluginIfupdown { GObject parent; }; -struct _SCPluginIfupdownClass { +struct _SettingsPluginIfupdownClass { GObjectClass parent; }; -GType sc_plugin_ifupdown_get_type (void); +GType settings_plugin_ifupdown_get_type (void); #endif /* _PLUGIN_H_ */ diff --git a/src/settings/plugins/keyfile/nm-keyfile-connection.c b/src/settings/plugins/keyfile/nm-keyfile-connection.c index 9504df72f4..5f0a5517b9 100644 --- a/src/settings/plugins/keyfile/nm-keyfile-connection.c +++ b/src/settings/plugins/keyfile/nm-keyfile-connection.c @@ -28,7 +28,7 @@ #include #include "nm-default.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-keyfile-connection.h" #include "reader.h" #include "writer.h" diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c index 559d6a6f53..b6c0080a4b 100644 --- a/src/settings/plugins/keyfile/plugin.c +++ b/src/settings/plugins/keyfile/plugin.c @@ -38,19 +38,19 @@ #include "nm-core-internal.h" #include "plugin.h" -#include "nm-system-config-interface.h" +#include "nm-settings-plugin.h" #include "nm-keyfile-connection.h" #include "writer.h" #include "common.h" #include "utils.h" -static void system_config_interface_init (NMSystemConfigInterface *system_config_interface_class); +static void settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface); -G_DEFINE_TYPE_EXTENDED (SCPluginKeyfile, sc_plugin_keyfile, G_TYPE_OBJECT, 0, - G_IMPLEMENT_INTERFACE (NM_TYPE_SYSTEM_CONFIG_INTERFACE, - system_config_interface_init)) +G_DEFINE_TYPE_EXTENDED (SettingsPluginKeyfile, settings_plugin_keyfile, G_TYPE_OBJECT, 0, + G_IMPLEMENT_INTERFACE (NM_TYPE_SETTINGS_PLUGIN, + settings_plugin_interface_init)) -#define SC_PLUGIN_KEYFILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SC_TYPE_PLUGIN_KEYFILE, SCPluginKeyfilePrivate)) +#define SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfilePrivate)) typedef struct { GHashTable *connections; /* uuid::connection */ @@ -60,19 +60,19 @@ typedef struct { guint monitor_id; NMConfig *config; -} SCPluginKeyfilePrivate; +} SettingsPluginKeyfilePrivate; static void connection_removed_cb (NMSettingsConnection *obj, gpointer user_data) { - g_hash_table_remove (SC_PLUGIN_KEYFILE_GET_PRIVATE (user_data)->connections, + g_hash_table_remove (SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (user_data)->connections, nm_connection_get_uuid (NM_CONNECTION (obj))); } /* Monitoring */ static void -remove_connection (SCPluginKeyfile *self, NMKeyfileConnection *connection) +remove_connection (SettingsPluginKeyfile *self, NMKeyfileConnection *connection) { gboolean removed; @@ -83,7 +83,7 @@ remove_connection (SCPluginKeyfile *self, NMKeyfileConnection *connection) /* Removing from the hash table should drop the last reference */ g_object_ref (connection); g_signal_handlers_disconnect_by_func (connection, connection_removed_cb, self); - removed = g_hash_table_remove (SC_PLUGIN_KEYFILE_GET_PRIVATE (self)->connections, + removed = g_hash_table_remove (SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (self)->connections, nm_connection_get_uuid (NM_CONNECTION (connection))); nm_settings_connection_signal_remove (NM_SETTINGS_CONNECTION (connection)); g_object_unref (connection); @@ -92,9 +92,9 @@ remove_connection (SCPluginKeyfile *self, NMKeyfileConnection *connection) } static NMKeyfileConnection * -find_by_path (SCPluginKeyfile *self, const char *path) +find_by_path (SettingsPluginKeyfile *self, const char *path) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (self); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (self); GHashTableIter iter; NMSettingsConnection *candidate = NULL; @@ -140,7 +140,7 @@ find_by_path (SCPluginKeyfile *self, const char *path) * Returns: the updated connection. * */ static NMKeyfileConnection * -update_connection (SCPluginKeyfile *self, +update_connection (SettingsPluginKeyfile *self, NMConnection *source, const char *full_path, NMKeyfileConnection *connection, @@ -148,7 +148,7 @@ update_connection (SCPluginKeyfile *self, GHashTable *protected_connections, GError **error) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (self); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (self); NMKeyfileConnection *connection_new; NMKeyfileConnection *connection_by_uuid; GError *local = NULL; @@ -264,7 +264,7 @@ update_connection (SCPluginKeyfile *self, if (!source) { /* Only raise the signal if we were called without source, i.e. if we read the connection from file. * Otherwise, we were called by add_connection() which does not expect the signal. */ - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_CONNECTION_ADDED, connection_new); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_CONNECTION_ADDED, connection_new); } return connection_new; } @@ -277,8 +277,8 @@ dir_changed (GFileMonitor *monitor, GFileMonitorEvent event_type, gpointer user_data) { - NMSystemConfigInterface *config = NM_SYSTEM_CONFIG_INTERFACE (user_data); - SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config); + NMSettingsPlugin *config = NM_SETTINGS_PLUGIN (user_data); + SettingsPluginKeyfile *self = SETTINGS_PLUGIN_KEYFILE (config); NMKeyfileConnection *connection; char *full_path; gboolean exists; @@ -297,12 +297,12 @@ dir_changed (GFileMonitor *monitor, switch (event_type) { case G_FILE_MONITOR_EVENT_DELETED: if (!exists && connection) - remove_connection (SC_PLUGIN_KEYFILE (config), connection); + remove_connection (SETTINGS_PLUGIN_KEYFILE (config), connection); break; case G_FILE_MONITOR_EVENT_CREATED: case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: if (exists) - update_connection (SC_PLUGIN_KEYFILE (config), NULL, full_path, connection, TRUE, NULL, NULL); + update_connection (SETTINGS_PLUGIN_KEYFILE (config), NULL, full_path, connection, TRUE, NULL, NULL); break; default: break; @@ -316,7 +316,7 @@ config_changed_cb (NMConfig *config, NMConfigData *config_data, NMConfigChangeFlags changes, NMConfigData *old_data, - SCPluginKeyfile *self) + SettingsPluginKeyfile *self) { gs_free char *old_value = NULL, *new_value = NULL; @@ -324,13 +324,13 @@ config_changed_cb (NMConfig *config, new_value = nm_config_data_get_value (config_data, NM_CONFIG_KEYFILE_GROUP_KEYFILE, "unmanaged-devices", NM_CONFIG_GET_VALUE_TYPE_SPEC); if (g_strcmp0 (old_value, new_value) != 0) - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); + g_signal_emit_by_name (self, NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED); } static void -setup_monitoring (NMSystemConfigInterface *config) +setup_monitoring (NMSettingsPlugin *config) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (config); GFile *file; GFileMonitor *monitor; @@ -389,10 +389,10 @@ _sort_paths (const char **f1, const char **f2, GHashTable *paths) } static void -read_connections (NMSystemConfigInterface *config) +read_connections (NMSettingsPlugin *config) { - SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config); - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (self); + SettingsPluginKeyfile *self = SETTINGS_PLUGIN_KEYFILE (config); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (self); GDir *dir; GError *error = NULL; const char *item; @@ -462,9 +462,9 @@ read_connections (NMSystemConfigInterface *config) /* Plugin */ static GSList * -get_connections (NMSystemConfigInterface *config) +get_connections (NMSettingsPlugin *config) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (config); if (!priv->initialized) { setup_monitoring (config); @@ -475,10 +475,10 @@ get_connections (NMSystemConfigInterface *config) } static gboolean -load_connection (NMSystemConfigInterface *config, +load_connection (NMSettingsPlugin *config, const char *filename) { - SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config); + SettingsPluginKeyfile *self = SETTINGS_PLUGIN_KEYFILE (config); NMKeyfileConnection *connection; int dir_len = strlen (KEYFILE_DIR); @@ -496,18 +496,18 @@ load_connection (NMSystemConfigInterface *config, } static void -reload_connections (NMSystemConfigInterface *config) +reload_connections (NMSettingsPlugin *config) { read_connections (config); } static NMSettingsConnection * -add_connection (NMSystemConfigInterface *config, +add_connection (NMSettingsPlugin *config, NMConnection *connection, gboolean save_to_disk, GError **error) { - SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config); + SettingsPluginKeyfile *self = SETTINGS_PLUGIN_KEYFILE (config); gs_free char *path = NULL; if (save_to_disk) { @@ -518,9 +518,9 @@ add_connection (NMSystemConfigInterface *config, } static GSList * -get_unmanaged_specs (NMSystemConfigInterface *config) +get_unmanaged_specs (NMSettingsPlugin *config) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (config); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (config); gs_free char *value = NULL; value = nm_config_data_get_value (nm_config_get_data (priv->config), NM_CONFIG_KEYFILE_GROUP_KEYFILE, "unmanaged-devices", NM_CONFIG_GET_VALUE_TYPE_SPEC); @@ -530,9 +530,9 @@ get_unmanaged_specs (NMSystemConfigInterface *config) /* GObject */ static void -sc_plugin_keyfile_init (SCPluginKeyfile *plugin) +settings_plugin_keyfile_init (SettingsPluginKeyfile *plugin) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (plugin); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (plugin); priv->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); } @@ -542,14 +542,14 @@ get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { switch (prop_id) { - case NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME: + case NM_SETTINGS_PLUGIN_PROP_NAME: g_value_set_string (value, KEYFILE_PLUGIN_NAME); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO: + case NM_SETTINGS_PLUGIN_PROP_INFO: g_value_set_string (value, KEYFILE_PLUGIN_INFO); break; - case NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES: - g_value_set_uint (value, NM_SYSTEM_CONFIG_INTERFACE_CAP_MODIFY_CONNECTIONS); + case NM_SETTINGS_PLUGIN_PROP_CAPABILITIES: + g_value_set_uint (value, NM_SETTINGS_PLUGIN_CAP_MODIFY_CONNECTIONS); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -571,7 +571,7 @@ set_property (GObject *object, guint prop_id, static void constructed (GObject *object) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (object); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (object); priv->config = g_object_ref (nm_config_get ()); if (nm_config_data_has_value (nm_config_get_data_orig (priv->config), @@ -583,7 +583,7 @@ constructed (GObject *object) static void dispose (GObject *object) { - SCPluginKeyfilePrivate *priv = SC_PLUGIN_KEYFILE_GET_PRIVATE (object); + SettingsPluginKeyfilePrivate *priv = SETTINGS_PLUGIN_KEYFILE_GET_PRIVATE (object); if (priv->monitor) { if (priv->monitor_id) { @@ -605,15 +605,15 @@ dispose (GObject *object) g_clear_object (&priv->config); } - G_OBJECT_CLASS (sc_plugin_keyfile_parent_class)->dispose (object); + G_OBJECT_CLASS (settings_plugin_keyfile_parent_class)->dispose (object); } static void -sc_plugin_keyfile_class_init (SCPluginKeyfileClass *req_class) +settings_plugin_keyfile_class_init (SettingsPluginKeyfileClass *req_class) { GObjectClass *object_class = G_OBJECT_CLASS (req_class); - g_type_class_add_private (req_class, sizeof (SCPluginKeyfilePrivate)); + g_type_class_add_private (req_class, sizeof (SettingsPluginKeyfilePrivate)); object_class->constructed = constructed; object_class->dispose = dispose; @@ -621,31 +621,31 @@ sc_plugin_keyfile_class_init (SCPluginKeyfileClass *req_class) object_class->set_property = set_property; g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_NAME, - NM_SYSTEM_CONFIG_INTERFACE_NAME); + NM_SETTINGS_PLUGIN_PROP_NAME, + NM_SETTINGS_PLUGIN_NAME); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_INFO, - NM_SYSTEM_CONFIG_INTERFACE_INFO); + NM_SETTINGS_PLUGIN_PROP_INFO, + NM_SETTINGS_PLUGIN_INFO); g_object_class_override_property (object_class, - NM_SYSTEM_CONFIG_INTERFACE_PROP_CAPABILITIES, - NM_SYSTEM_CONFIG_INTERFACE_CAPABILITIES); + NM_SETTINGS_PLUGIN_PROP_CAPABILITIES, + NM_SETTINGS_PLUGIN_CAPABILITIES); } static void -system_config_interface_init (NMSystemConfigInterface *system_config_interface_class) +settings_plugin_interface_init (NMSettingsPluginInterface *plugin_iface) { /* interface implementation */ - system_config_interface_class->get_connections = get_connections; - system_config_interface_class->load_connection = load_connection; - system_config_interface_class->reload_connections = reload_connections; - system_config_interface_class->add_connection = add_connection; - system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs; + plugin_iface->get_connections = get_connections; + plugin_iface->load_connection = load_connection; + plugin_iface->reload_connections = reload_connections; + plugin_iface->add_connection = add_connection; + plugin_iface->get_unmanaged_specs = get_unmanaged_specs; } GObject * nm_settings_keyfile_plugin_new (void) { - return g_object_new (SC_TYPE_PLUGIN_KEYFILE, NULL); + return g_object_new (SETTINGS_TYPE_PLUGIN_KEYFILE, NULL); } diff --git a/src/settings/plugins/keyfile/plugin.h b/src/settings/plugins/keyfile/plugin.h index 143fead522..07403270ba 100644 --- a/src/settings/plugins/keyfile/plugin.h +++ b/src/settings/plugins/keyfile/plugin.h @@ -24,22 +24,22 @@ #include "nm-default.h" -#define SC_TYPE_PLUGIN_KEYFILE (sc_plugin_keyfile_get_type ()) -#define SC_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SC_TYPE_PLUGIN_KEYFILE, SCPluginKeyfile)) -#define SC_PLUGIN_KEYFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SC_TYPE_PLUGIN_KEYFILE, SCPluginKeyfileClass)) -#define SC_IS_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SC_TYPE_PLUGIN_KEYFILE)) -#define SC_IS_PLUGIN_KEYFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SC_TYPE_PLUGIN_KEYFILE)) -#define SC_PLUGIN_KEYFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SC_TYPE_PLUGIN_KEYFILE, SCPluginKeyfileClass)) +#define SETTINGS_TYPE_PLUGIN_KEYFILE (settings_plugin_keyfile_get_type ()) +#define SETTINGS_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfile)) +#define SETTINGS_PLUGIN_KEYFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfileClass)) +#define SETTINGS_IS_PLUGIN_KEYFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SETTINGS_TYPE_PLUGIN_KEYFILE)) +#define SETTINGS_IS_PLUGIN_KEYFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SETTINGS_TYPE_PLUGIN_KEYFILE)) +#define SETTINGS_PLUGIN_KEYFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SETTINGS_TYPE_PLUGIN_KEYFILE, SettingsPluginKeyfileClass)) typedef struct { GObject parent; -} SCPluginKeyfile; +} SettingsPluginKeyfile; typedef struct { GObjectClass parent; -} SCPluginKeyfileClass; +} SettingsPluginKeyfileClass; -GType sc_plugin_keyfile_get_type (void); +GType settings_plugin_keyfile_get_type (void); GObject *nm_settings_keyfile_plugin_new (void);