core: build keyfile plugin into NetworkManager
authorDan Williams <dcbw@redhat.com>
Thu, 13 Jan 2011 00:12:23 +0000 (18:12 -0600)
committerDan Williams <dcbw@redhat.com>
Thu, 13 Jan 2011 00:12:23 +0000 (18:12 -0600)
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.

Makefile.am
src/settings/Makefile.am
src/settings/nm-settings.c
system-settings/plugins/keyfile/Makefile.am
system-settings/plugins/keyfile/plugin.c
system-settings/plugins/keyfile/plugin.h

index 64be5c8..c3eb4e1 100644 (file)
@@ -1,12 +1,12 @@
 SUBDIRS = \
        marshallers \
+       include \
        libnm-util \
        libnm-glib \
-       src \
-       include \
        introspection \
-       callouts \
        system-settings \
+       src \
+       callouts \
        cli \
        tools \
        policy \
index 0fc8b1f..927169c 100644 (file)
@@ -1,7 +1,6 @@
 INCLUDES = -I${top_srcdir} \
            -I${top_srcdir}/include \
            -I${top_srcdir}/libnm-util \
-           -I${top_srcdir}/libnm-glib \
            -I${top_srcdir}/src/logging \
            -I${top_srcdir}/src \
            -I${top_builddir}/marshallers
@@ -44,9 +43,9 @@ libsettings_la_CPPFLAGS = \
 
 libsettings_la_LIBADD = \
        $(top_builddir)/libnm-util/libnm-util.la \
-       $(top_builddir)/libnm-glib/libnm-glib.la \
        $(top_builddir)/marshallers/libmarshallers.la \
        $(top_builddir)/src/logging/libnm-logging.la \
+       $(top_builddir)/system-settings/plugins/keyfile/libnm-settings-plugin-keyfile.la \
        $(DBUS_LIBS) \
        $(GLIB_LIBS) \
        $(GMODULE_LIBS) \
@@ -54,7 +53,6 @@ libsettings_la_LIBADD = \
 
 libsettings_la_LDFLAGS = -rdynamic
 
-
 nm-settings-glue.h: $(top_srcdir)/introspection/nm-settings.xml
        $(AM_V_GEN) dbus-binding-tool --prefix=nm_settings --mode=glib-server --output=$@ $<
 
index 2f47b7a..2f299c8 100644 (file)
@@ -62,6 +62,7 @@
 #include "nm-dbus-manager.h"
 #include "nm-manager-auth.h"
 #include "nm-session-monitor.h"
+#include "system-settings/plugins/keyfile/plugin.h"
 
 #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 * (*factory_func) (void);
 
+               /* keyfile plugin built in now */
+               if (!strcmp (pname, "keyfile"))
+                       continue;
+
                /* ifcfg-fedora was renamed ifcfg-rh; handle old configs here */
                if (!strcmp (pname, "ifcfg-fedora"))
                        pname = "ifcfg-rh";
@@ -1328,11 +1333,12 @@ nm_settings_device_removed (NMSettings *self, NMDevice *device)
 
 NMSettings *
 nm_settings_new (const char *config_file,
-                           const char *plugins,
-                           GError **error)
+                 const char *plugins,
+                 GError **error)
 {
        NMSettings *self;
        NMSettingsPrivate *priv;
+       GObject *keyfile_plugin;
 
        self = g_object_new (NM_TYPE_SETTINGS, NULL);
        if (!self)
@@ -1353,6 +1359,11 @@ nm_settings_new (const char *config_file,
                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));
        return self;
 }
index ea2f18c..3b24214 100644 (file)
@@ -3,12 +3,13 @@ SUBDIRS=. tests
 INCLUDES = \
        -I$(top_srcdir)/src/settings \
        -I$(top_srcdir)/include \
-       -I$(top_srcdir)/libnm-util \
-       -I$(top_srcdir)/libnm-glib
+       -I$(top_srcdir)/libnm-util
 
-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 = \
        reader.c \
@@ -28,6 +29,8 @@ libkeyfile_io_la_CPPFLAGS = \
 
 libkeyfile_io_la_LIBADD = $(GLIB_LIBS)
 
+#####################################
+
 libnm_settings_plugin_keyfile_la_SOURCES = \
        nm-keyfile-connection.c \
        nm-keyfile-connection.h \
@@ -41,16 +44,16 @@ libnm_settings_plugin_keyfile_la_CPPFLAGS = \
        -DSYSCONFDIR=\"$(sysconfdir)\" \
        -DG_DISABLE_DEPRECATED
 
-libnm_settings_plugin_keyfile_la_LDFLAGS = -module -avoid-version
 libnm_settings_plugin_keyfile_la_LIBADD = \
        $(top_builddir)/libnm-util/libnm-util.la \
-       $(top_builddir)/libnm-glib/libnm-glib.la \
        libkeyfile-io.la \
        $(GLIB_LIBS) \
        $(GMODULE_LIBS) \
        $(DBUS_LIBS) \
        $(GIO_LIBS)
 
+libnm_settings_plugin_keyfile_la_LDFLAGS = -rdynamic
+
 keyfiledir=$(sysconfdir)/NetworkManager/system-connections
 
 install-data-hook:
index a1c6542..27ddb29 100644 (file)
@@ -662,8 +662,8 @@ system_config_interface_init (NMSystemConfigInterface *system_config_interface_c
        system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs;
 }
 
-G_MODULE_EXPORT GObject *
-nm_system_config_factory (void)
+GObject *
+nm_settings_keyfile_plugin_new (void)
 {
        static SCPluginKeyfile *singleton = NULL;
 
index 71496c0..af5147e 100644 (file)
@@ -43,4 +43,6 @@ GType sc_plugin_keyfile_get_type (void);
 
 GQuark keyfile_plugin_error_quark (void);
 
+GObject *nm_settings_keyfile_plugin_new (void);
+
 #endif /* _PLUGIN_H_ */