diff options
Diffstat (limited to 'src/settings/nm-settings-plugin.h')
-rw-r--r-- | src/settings/nm-settings-plugin.h | 81 |
1 files changed, 41 insertions, 40 deletions
diff --git a/src/settings/nm-settings-plugin.h b/src/settings/nm-settings-plugin.h index 6fba25e7ab..fdd48f2bc9 100644 --- a/src/settings/nm-settings-plugin.h +++ b/src/settings/nm-settings-plugin.h @@ -15,53 +15,52 @@ * 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) 2007 - 2018 Red Hat, Inc. * Copyright (C) 2008 Novell, Inc. */ -#ifndef __NETWORKMANAGER_SETTINGS_PLUGIN_H__ -#define __NETWORKMANAGER_SETTINGS_PLUGIN_H__ +#ifndef __NM_SETTINGS_PLUGIN_H__ +#define __NM_SETTINGS_PLUGIN_H__ #include "nm-connection.h" -/* Plugin's factory function that returns a GObject that implements - * NMSettingsPlugin. - */ -GObject * nm_settings_plugin_factory (void); - #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_SETTINGS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPluginClass)) #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_IS_SETTINGS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTINGS_PLUGIN)) +#define NM_SETTINGS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTINGS_PLUGIN, NMSettingsPluginClass)) -#define NM_SETTINGS_PLUGIN_UNMANAGED_SPECS_CHANGED "unmanaged-specs-changed" +#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" +#define NM_SETTINGS_PLUGIN_CONNECTION_ADDED "connection-added" -typedef struct _NMSettingsPlugin NMSettingsPlugin; +typedef struct { + GObject parent; +} NMSettingsPlugin; typedef struct { - GTypeInterface g_iface; + GObjectClass parent; /* Called when the plugin is loaded to initialize it */ - void (*init) (NMSettingsPlugin *config); + void (*initialize) (NMSettingsPlugin *plugin); /* 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) (NMSettingsPlugin *config); + GSList * (*get_connections) (NMSettingsPlugin *plugin); /* Requests that the plugin load/reload a single connection, if it * recognizes the filename. Returns success or failure. */ - gboolean (*load_connection) (NMSettingsPlugin *config, + gboolean (*load_connection) (NMSettingsPlugin *plugin, 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) (NMSettingsPlugin *config); + void (*reload_connections) (NMSettingsPlugin *plugin); /* * Return a string list of specifications of devices which NetworkManager @@ -72,7 +71,7 @@ typedef struct { * Each string in the list must be in one of the formats recognized by * nm_device_spec_match_list(). */ - GSList * (*get_unmanaged_specs) (NMSettingsPlugin *config); + GSList * (*get_unmanaged_specs) (NMSettingsPlugin *plugin); /* * Return a string list of specifications of devices for which at least @@ -84,7 +83,7 @@ typedef struct { * Each string in the list must be in one of the formats recognized by * nm_device_spec_match_list(). */ - GSList * (*get_unrecognized_specs) (NMSettingsPlugin *config); + GSList * (*get_unrecognized_specs) (NMSettingsPlugin *plugin); /* * Initialize the plugin-specific connection and return a new @@ -93,40 +92,42 @@ typedef struct { * 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) (NMSettingsPlugin *config, + NMSettingsConnection * (*add_connection) (NMSettingsPlugin *plugin, NMConnection *connection, gboolean save_to_disk, GError **error); +} NMSettingsPluginClass; - /* Signals */ - - /* Emitted when a new connection has been found by the plugin */ - void (*connection_added) (NMSettingsPlugin *config, - NMSettingsConnection *connection); +GType nm_settings_plugin_get_type (void); - /* Emitted when the list of unmanaged device specifications changes */ - void (*unmanaged_specs_changed) (NMSettingsPlugin *config); +typedef NMSettingsPlugin *(*NMSettingsPluginFactoryFunc) (void); - /* Emitted when the list of devices with unrecognized connections changes */ - void (*unrecognized_specs_changed) (NMSettingsPlugin *config); -} NMSettingsPluginInterface; +/* Plugin's factory function that returns a #NMSettingsPlugin */ +NMSettingsPlugin *nm_settings_plugin_factory (void); -GType nm_settings_plugin_get_type (void); +void nm_settings_plugin_initialize (NMSettingsPlugin *config); -void nm_settings_plugin_init (NMSettingsPlugin *config); +GSList *nm_settings_plugin_get_connections (NMSettingsPlugin *plugin); -GSList *nm_settings_plugin_get_connections (NMSettingsPlugin *config); - -gboolean nm_settings_plugin_load_connection (NMSettingsPlugin *config, +gboolean nm_settings_plugin_load_connection (NMSettingsPlugin *plugin, const char *filename); -void nm_settings_plugin_reload_connections (NMSettingsPlugin *config); +void nm_settings_plugin_reload_connections (NMSettingsPlugin *plugin); -GSList *nm_settings_plugin_get_unmanaged_specs (NMSettingsPlugin *config); -GSList *nm_settings_plugin_get_unrecognized_specs (NMSettingsPlugin *config); +GSList *nm_settings_plugin_get_unmanaged_specs (NMSettingsPlugin *plugin); +GSList *nm_settings_plugin_get_unrecognized_specs (NMSettingsPlugin *plugin); -NMSettingsConnection *nm_settings_plugin_add_connection (NMSettingsPlugin *config, +NMSettingsConnection *nm_settings_plugin_add_connection (NMSettingsPlugin *plugin, NMConnection *connection, gboolean save_to_disk, GError **error); -#endif /* __NETWORKMANAGER_SETTINGS_PLUGIN_H__ */ +/* internal API */ + +void _nm_settings_plugin_emit_signal_connection_added (NMSettingsPlugin *plugin, + NMSettingsConnection *sett_conn); + +void _nm_settings_plugin_emit_signal_unmanaged_specs_changed (NMSettingsPlugin *plugin); + +void _nm_settings_plugin_emit_signal_unrecognized_specs_changed (NMSettingsPlugin *plugin); + +#endif /* __NM_SETTINGS_PLUGIN_H__ */ |