core: build keyfile plugin into NetworkManager

Since settings storage is now handled by NetworkManager, we must
have the ability to read/write all connection types at all times.
Since the 'keyfile' plugin is the only plugin that can handle all
connection types, build it into NetworkManager.
This commit is contained in:
Dan Williams
2011-01-12 18:12:23 -06:00
parent 8259b35ee5
commit b38f39cfc6
6 changed files with 30 additions and 16 deletions

View File

@@ -1,12 +1,12 @@
SUBDIRS = \ SUBDIRS = \
marshallers \ marshallers \
include \
libnm-util \ libnm-util \
libnm-glib \ libnm-glib \
src \
include \
introspection \ introspection \
callouts \
system-settings \ system-settings \
src \
callouts \
cli \ cli \
tools \ tools \
policy \ policy \

View File

@@ -1,7 +1,6 @@
INCLUDES = -I${top_srcdir} \ INCLUDES = -I${top_srcdir} \
-I${top_srcdir}/include \ -I${top_srcdir}/include \
-I${top_srcdir}/libnm-util \ -I${top_srcdir}/libnm-util \
-I${top_srcdir}/libnm-glib \
-I${top_srcdir}/src/logging \ -I${top_srcdir}/src/logging \
-I${top_srcdir}/src \ -I${top_srcdir}/src \
-I${top_builddir}/marshallers -I${top_builddir}/marshallers
@@ -44,9 +43,9 @@ libsettings_la_CPPFLAGS = \
libsettings_la_LIBADD = \ libsettings_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm-glib.la \
$(top_builddir)/marshallers/libmarshallers.la \ $(top_builddir)/marshallers/libmarshallers.la \
$(top_builddir)/src/logging/libnm-logging.la \ $(top_builddir)/src/logging/libnm-logging.la \
$(top_builddir)/system-settings/plugins/keyfile/libnm-settings-plugin-keyfile.la \
$(DBUS_LIBS) \ $(DBUS_LIBS) \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(GMODULE_LIBS) \ $(GMODULE_LIBS) \
@@ -54,7 +53,6 @@ libsettings_la_LIBADD = \
libsettings_la_LDFLAGS = -rdynamic libsettings_la_LDFLAGS = -rdynamic
nm-settings-glue.h: $(top_srcdir)/introspection/nm-settings.xml nm-settings-glue.h: $(top_srcdir)/introspection/nm-settings.xml
$(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-server --output=$@ $< $(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-server --output=$@ $<

View File

@@ -62,6 +62,7 @@
#include "nm-dbus-manager.h" #include "nm-dbus-manager.h"
#include "nm-manager-auth.h" #include "nm-manager-auth.h"
#include "nm-session-monitor.h" #include "nm-session-monitor.h"
#include "system-settings/plugins/keyfile/plugin.h"
#define CONFIG_KEY_NO_AUTO_DEFAULT "no-auto-default" #define CONFIG_KEY_NO_AUTO_DEFAULT "no-auto-default"
@@ -520,6 +521,10 @@ load_plugins (NMSettings *self, const char *plugins, GError **error)
GObject *obj; GObject *obj;
GObject * (*factory_func) (void); GObject * (*factory_func) (void);
/* keyfile plugin built in now */
if (!strcmp (pname, "keyfile"))
continue;
/* ifcfg-fedora was renamed ifcfg-rh; handle old configs here */ /* ifcfg-fedora was renamed ifcfg-rh; handle old configs here */
if (!strcmp (pname, "ifcfg-fedora")) if (!strcmp (pname, "ifcfg-fedora"))
pname = "ifcfg-rh"; pname = "ifcfg-rh";
@@ -1328,11 +1333,12 @@ nm_settings_device_removed (NMSettings *self, NMDevice *device)
NMSettings * NMSettings *
nm_settings_new (const char *config_file, nm_settings_new (const char *config_file,
const char *plugins, const char *plugins,
GError **error) GError **error)
{ {
NMSettings *self; NMSettings *self;
NMSettingsPrivate *priv; NMSettingsPrivate *priv;
GObject *keyfile_plugin;
self = g_object_new (NM_TYPE_SETTINGS, NULL); self = g_object_new (NM_TYPE_SETTINGS, NULL);
if (!self) if (!self)
@@ -1353,6 +1359,11 @@ nm_settings_new (const char *config_file,
unmanaged_specs_changed (NULL, self); unmanaged_specs_changed (NULL, self);
} }
/* Add the keyfile plugin last */
keyfile_plugin = nm_settings_keyfile_plugin_new ();
g_assert (keyfile_plugin);
add_plugin (self, NM_SYSTEM_CONFIG_INTERFACE (keyfile_plugin));
dbus_g_connection_register_g_object (priv->bus, NM_DBUS_PATH_SETTINGS, G_OBJECT (self)); dbus_g_connection_register_g_object (priv->bus, NM_DBUS_PATH_SETTINGS, G_OBJECT (self));
return self; return self;
} }

View File

@@ -3,12 +3,13 @@ SUBDIRS=. tests
INCLUDES = \ INCLUDES = \
-I$(top_srcdir)/src/settings \ -I$(top_srcdir)/src/settings \
-I$(top_srcdir)/include \ -I$(top_srcdir)/include \
-I$(top_srcdir)/libnm-util \ -I$(top_srcdir)/libnm-util
-I$(top_srcdir)/libnm-glib
pkglib_LTLIBRARIES = libnm-settings-plugin-keyfile.la noinst_LTLIBRARIES = \
libkeyfile-io.la \
libnm-settings-plugin-keyfile.la
noinst_LTLIBRARIES = libkeyfile-io.la ##### I/O library for testcases #####
libkeyfile_io_la_SOURCES = \ libkeyfile_io_la_SOURCES = \
reader.c \ reader.c \
@@ -28,6 +29,8 @@ libkeyfile_io_la_CPPFLAGS = \
libkeyfile_io_la_LIBADD = $(GLIB_LIBS) libkeyfile_io_la_LIBADD = $(GLIB_LIBS)
#####################################
libnm_settings_plugin_keyfile_la_SOURCES = \ libnm_settings_plugin_keyfile_la_SOURCES = \
nm-keyfile-connection.c \ nm-keyfile-connection.c \
nm-keyfile-connection.h \ nm-keyfile-connection.h \
@@ -41,16 +44,16 @@ libnm_settings_plugin_keyfile_la_CPPFLAGS = \
-DSYSCONFDIR=\"$(sysconfdir)\" \ -DSYSCONFDIR=\"$(sysconfdir)\" \
-DG_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED
libnm_settings_plugin_keyfile_la_LDFLAGS = -module -avoid-version
libnm_settings_plugin_keyfile_la_LIBADD = \ libnm_settings_plugin_keyfile_la_LIBADD = \
$(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-util/libnm-util.la \
$(top_builddir)/libnm-glib/libnm-glib.la \
libkeyfile-io.la \ libkeyfile-io.la \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(GMODULE_LIBS) \ $(GMODULE_LIBS) \
$(DBUS_LIBS) \ $(DBUS_LIBS) \
$(GIO_LIBS) $(GIO_LIBS)
libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic
keyfiledir=$(sysconfdir)/NetworkManager/system-connections keyfiledir=$(sysconfdir)/NetworkManager/system-connections
install-data-hook: install-data-hook:

View File

@@ -662,8 +662,8 @@ system_config_interface_init (NMSystemConfigInterface *system_config_interface_c
system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs; system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs;
} }
G_MODULE_EXPORT GObject * GObject *
nm_system_config_factory (void) nm_settings_keyfile_plugin_new (void)
{ {
static SCPluginKeyfile *singleton = NULL; static SCPluginKeyfile *singleton = NULL;

View File

@@ -43,4 +43,6 @@ GType sc_plugin_keyfile_get_type (void);
GQuark keyfile_plugin_error_quark (void); GQuark keyfile_plugin_error_quark (void);
GObject *nm_settings_keyfile_plugin_new (void);
#endif /* _PLUGIN_H_ */ #endif /* _PLUGIN_H_ */