use glib-mkenums, drop more code...



OK, this makes NM use glib-mkenums, with various side effects:

    - Since it requires very very recent glib-mkenums features and bug
      fixes, we have to import our own copy of glib-mkenums for now

    - Rather than adding glib-mkenums rules to the Makefiles by hand,
      I'm having us beta-test "Makefile.glib" from
      https://bugzilla.gnome.org/show_bug.cgi?id=654395

    - Since glib-mkenums sucks up everything in sight, we're now
      registering a bunch of enum types that we weren't before, which
      I assume is fine. (Note changes to libnm-util.ver and
      libnm-glib.ver.)

    - Rather than run glib-mkenums in every subdirectory of src/ that
      has enums, I just added a new src/generated/ directory with
      libnm-generated.la, and register all of the enum types for the
      whole daemon there.

    - Since Makefile.glib also makes glib-genmarshal easier, I split
      up marshallers/ and now generate libnm-glib's marshallers in
      libnm-glib/, and the daemon's marshallers in src/generated/.
      (For future reference, with Makefile.glib's genmarshal handling,
      you no longer have to maintain a .list file by hand; it scans
      all the source files to see what marshallers are needed, so you
      can just refer to _nm_marshal_VOID__OBJECT_STRING_ENUM_BANANA
      somewhere, and then run make in src/generated/, and that
      marshaller will now exist.)

>From 05e406dc54a809c98bca79624182764c5731c824 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw gnome org>
Date: Wed, 8 Feb 2012 12:56:52 -0500
Subject: [PATCH] Use glib-mkenums to generate enum types

Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
---
 .gitignore                                         |    5 +-
 Makefile.am                                        |    8 +-
 Makefile.glib                                      |  169 ++++++
 configure.ac                                       |    6 +-
 libnm-glib/Makefile.am                             |   32 +-
 libnm-glib/libnm-glib.ver                          |    4 +
 libnm-glib/nm-client.c                             |    4 +-
 libnm-glib/nm-device-modem.c                       |    2 +-
 libnm-glib/nm-device.c                             |    6 +-
 libnm-glib/nm-remote-settings.c                    |   24 +-
 libnm-glib/nm-remote-settings.h                    |    3 -
 libnm-glib/nm-secret-agent.c                       |   33 +-
 libnm-glib/nm-secret-agent.h                       |    2 -
 libnm-glib/nm-types.h                              |    2 +
 libnm-glib/nm-vpn-connection.c                     |    6 +-
 libnm-glib/nm-vpn-plugin.c                         |   28 +-
 libnm-glib/nm-vpn-plugin.h                         |    1 -
 libnm-util/Makefile.am                             |   10 +
 libnm-util/libnm-util.ver                          |   10 +
 libnm-util/nm-connection.c                         |   21 -
 libnm-util/nm-connection.h                         |    3 -
 libnm-util/nm-setting-8021x.c                      |   24 -
 libnm-util/nm-setting-8021x.h                      |    9 +-
 libnm-util/nm-setting-bluetooth.c                  |   21 -
 libnm-util/nm-setting-bluetooth.h                  |    3 -
 libnm-util/nm-setting-bond.c                       |   25 -
 libnm-util/nm-setting-bond.h                       |    3 -
 libnm-util/nm-setting-cdma.c                       |   25 -
 libnm-util/nm-setting-cdma.h                       |    3 -
 libnm-util/nm-setting-connection.c                 |   22 -
 libnm-util/nm-setting-connection.h                 |    3 -
 libnm-util/nm-setting-gsm.c                        |   25 -
 libnm-util/nm-setting-gsm.h                        |    3 -
 libnm-util/nm-setting-infiniband.c                 |   23 -
 libnm-util/nm-setting-infiniband.h                 |    3 -
 libnm-util/nm-setting-ip4-config.c                 |   25 -
 libnm-util/nm-setting-ip4-config.h                 |    3 -
 libnm-util/nm-setting-ip6-config.c                 |   25 -
 libnm-util/nm-setting-ip6-config.h                 |    3 -
 libnm-util/nm-setting-olpc-mesh.c                  |   23 -
 libnm-util/nm-setting-olpc-mesh.h                  |    3 -
 libnm-util/nm-setting-ppp.c                        |   25 -
 libnm-util/nm-setting-ppp.h                        |    3 -
 libnm-util/nm-setting-pppoe.c                      |   25 -
 libnm-util/nm-setting-pppoe.h                      |    3 -
 libnm-util/nm-setting-serial.c                     |   25 -
 libnm-util/nm-setting-serial.h                     |    3 -
 libnm-util/nm-setting-vpn.c                        |   23 -
 libnm-util/nm-setting-vpn.h                        |    3 -
 libnm-util/nm-setting-wimax.c                      |   23 -
 libnm-util/nm-setting-wimax.h                      |    3 -
 libnm-util/nm-setting-wired.c                      |   23 -
 libnm-util/nm-setting-wired.h                      |    3 -
 libnm-util/nm-setting-wireless-security.c          |   31 --
 libnm-util/nm-setting-wireless-security.h          |    3 -
 libnm-util/nm-setting-wireless.c                   |   27 -
 libnm-util/nm-setting-wireless.h                   |    3 -
 libnm-util/nm-setting.c                            |   21 -
 libnm-util/nm-setting.h                            |    3 -
 libnm-util/nm-utils.h                              |    1 +
 marshallers/Makefile.am                            |   27 -
 marshallers/nm-marshal-main.c                      |    2 -
 marshallers/nm-marshal.list                        |   30 -
 src/Makefile.am                                    |    7 +-
 src/bluez-manager/Makefile.am                      |    6 +-
 src/dhcp-manager/Makefile.am                       |    4 +-
 src/dhcp-manager/nm-dhcp-manager.c                 |   18 -
 src/dhcp-manager/nm-dhcp-manager.h                 |    6 +-
 src/firewall-manager/Makefile.am                   |    4 +-
 src/generated/Makefile.am                          |   75 +++
 src/ip6-manager/Makefile.am                        |    4 +-
 src/logging/Makefile.am                            |    2 +
 src/logging/nm-logging.c                           |   23 -
 src/logging/nm-logging.h                           |    7 +-
 src/modem-manager/Makefile.am                      |    8 +-
 src/modem-manager/nm-modem-cdma.c                  |   31 +-
 src/modem-manager/nm-modem-cdma.h                  |    6 +
 src/modem-manager/nm-modem-gsm.c                   |   32 +--
 src/modem-manager/nm-modem-gsm.h                   |    6 +
 src/nm-config.c                                    |   19 -
 src/nm-config.h                                    |    2 -
 src/nm-device-bt.c                                 |   32 +--
 src/nm-device-bt.h                                 |    6 +
 src/nm-device-ethernet.c                           |   32 +--
 src/nm-device-ethernet.h                           |    7 +
 src/nm-device-infiniband.c                         |   32 +--
 src/nm-device-infiniband.h                         |    6 +
 src/nm-device-olpc-mesh.c                          |   32 +--
 src/nm-device-olpc-mesh.h                          |    7 +
 src/nm-device-wifi.c                               |   34 +--
 src/nm-device-wifi.h                               |    6 +
 src/nm-device.c                                    |   31 +-
 src/nm-device.h                                    |    6 +
 src/nm-manager.c                                   |   50 +--
 src/nm-manager.h                                   |   12 +
 src/nm-session-utils.c                             |   25 -
 src/ppp-manager/Makefile.am                        |    6 +-
 src/settings/Makefile.am                           |    6 +-
 src/settings/nm-agent-manager.c                    |   43 +--
 src/settings/nm-agent-manager.h                    |   10 +
 src/settings/nm-settings-error.c                   |   50 --
 src/settings/nm-settings-error.h                   |    4 +-
 src/settings/plugins/ifcfg-rh/Makefile.am          |    4 +-
 src/supplicant-manager/Makefile.am                 |    5 +-
 .../nm-supplicant-settings-verify.h                |    2 +-
 src/vpn-manager/Makefile.am                        |    4 +-
 src/vpn-manager/nm-vpn-manager.c                   |   26 +-
 src/vpn-manager/nm-vpn-manager.h                   |    1 -
 src/wimax/Makefile.am                              |    6 +-
 src/wimax/nm-device-wimax.c                        |   35 +--
 src/wimax/nm-device-wimax.h                        |    8 +
 tools/Makefile.am                                  |    2 +-
 tools/glib-mkenums                                 |  570 ++++++++++++++++++++
 113 files changed, 1034 insertions(+), 1289 deletions(-)
 create mode 100644 Makefile.glib
 delete mode 100644 marshallers/Makefile.am
 delete mode 100644 marshallers/nm-marshal-main.c
 delete mode 100644 marshallers/nm-marshal.list
 create mode 100644 src/generated/Makefile.am
 create mode 100755 tools/glib-mkenums

diff --git a/.gitignore b/.gitignore
index a1fcced..ce867c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,8 @@
 *.bz2
 *.gir
 *.typelib
+*.stamp
+*-enum-types.[ch]
 Makefile
 Makefile.in*
 configure
@@ -143,11 +145,12 @@ initscript/*/[Nn]etwork[Mm]anager
 
 *-glue.h
 *-bindings.h
-nm-marshal.[ch]
 callouts/tests/test-dispatcher-envp
 libnm-glib/libnm-glib-test
+libnm-glib/nm-glib-marshal.*
 src/NetworkManager
 src/nm-crash-logger
+src/generated/nm-marshal.*
 src/supplicant-manager/tests/test-supplicant-config
 system-settings/src
 test/libnm-glib-test
diff --git a/Makefile.am b/Makefile.am
index 912ded3..e407d38 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
+include $(GLIB_MAKEFILE)
+
 SUBDIRS = \
-	marshallers \
 	include \
 	libnm-util \
 	libnm-glib \
@@ -22,7 +23,8 @@ EXTRA_DIST = \
 	NetworkManager.pc.in \
 	intltool-extract.in \
 	intltool-merge.in \
-	intltool-update.in		
+	intltool-update.in \
+	Makefile.glib
 
 DISTCHECK_CONFIGURE_FLAGS = \
 	--with-tests=yes \
@@ -42,4 +44,4 @@ CLEANFILES = cscope.in.out cscope.out cscope.po.out
 
 .PHONY: cscope
 cscope:
-	cscope -b -q -R -Iinclude -ssrc -slibnm-glib -slibnm-util -smarshallers -scli/src;
+	cscope -b -q -R -Iinclude -ssrc -slibnm-glib -slibnm-util -scli/src;
diff --git a/Makefile.glib b/Makefile.glib
new file mode 100644
index 0000000..ac7f4e9
--- /dev/null
+++ b/Makefile.glib
@@ -0,0 +1,169 @@
+# -*- Mode: makefile -*-
+#
+# Work-in-progress...
+# See https://bugzilla.gnome.org/show_bug.cgi?id=654395
+
+_GLIB_CLEANFILES =
+_GLIB_DISTCLEANFILES =
+
+_GLIB_V_GEN = $(_glib_v_gen_$(V))
+_glib_v_gen_ = $(_glib_v_gen_$(AM_DEFAULT_VERBOSITY))
+_glib_v_gen_0 = @echo "  GEN   " $(subst .stamp,,$@);
+
+
+# glib-genmarshal
+
+_GLIB_MARSHAL_GENERATED = $(subst .h,,$(filter %marshal.h,$(GLIB_GENERATED)))
+
+_glib_marshal_prefix = $(subst marshal,,$(subst _marshal,,$(subst -,_,$(notdir $(1)))))_marshal
+_glib_marshal_sources_var = $(subst -,_,$(notdir $(1)))_sources
+_glib_marshal_sources = $(filter-out %.h,$(filter-out $(GLIB_GENERATED),$($(_glib_marshal_sources_var))))
+
+define _glib_make_genmarshal_rules
+$(if $(_glib_marshal_sources),,$(error Need to define $(_glib_marshal_sources_var) for $(1).[ch]))
+
+$(1).list.stamp: $(_glib_marshal_sources)
+	$$(_GLIB_V_GEN) sed -ne 's/.*_$(_glib_marshal_prefix)_\([_A-Z]*\).*/\1/p' $$^ | sort -u | sed -e 's/__/:/' -e 's/_/,/g' > $(1).list.tmp && \
+	(cmp -s $(1).list.tmp $(1).list || cp $(1).list.tmp $(1).list) && \
+	rm -f $(1).list.tmp && \
+	echo timestamp > $$@
+
+$(1).list: $(1).list.stamp
+	@true
+
+$(1).h: $(1).list
+	$$(_GLIB_V_GEN) $$(GLIB_GENMARSHAL) \
+		--prefix=_$(_glib_marshal_prefix) --header \
+		$$(GLIB_GENMARSHAL_H_FLAGS) \
+		$$($(_glib_marshal_prefix)_GENMARSHAL_H_FLAGS) \
+		$$< > $$@.tmp && \
+	mv $$@.tmp $$@
+
+$(1).c: $(1).list
+	$$(_GLIB_V_GEN) (echo "#include \"$$(subst .c,.h,$$(@F))\""; $$(GLIB_GENMARSHAL) \
+		--prefix=_$(_glib_marshal_prefix) --body \
+		$$(GLIB_GENMARSHAL_C_FLAGS) \
+		$$($(_glib_marshal_prefix)_GENMARSHAL_C_FLAGS) \
+		$$< ) > $$@.tmp && \
+	mv $$@.tmp $$@
+
+_GLIB_CLEANFILES += $(1).list.stamp $(1).list
+_GLIB_DISTCLEANFILES += $(1).h $(1).c
+endef
+
+$(foreach f,$(_GLIB_MARSHAL_GENERATED),$(eval $(call _glib_make_genmarshal_rules,$f)))
+
+
+# glib-mkenums
+
+_GLIB_ENUM_TYPES_GENERATED = $(subst .h,,$(filter %enum-types.h %enumtypes.h,$(GLIB_GENERATED)))
+
+_glib_enum_types_prefix = $(subst -,_,$(notdir $(1)))
+_glib_enum_types_guard = __$(shell echo $(_glib_enum_types_prefix) | tr 'a-z' 'A-Z')_H__
+_glib_enum_types_sources_var = $(_glib_enum_types_prefix)_sources
+_glib_enum_types_sources = $(filter-out $(GLIB_GENERATED),$($(_glib_enum_types_sources_var)))
+_glib_enum_types_h_sources = $(filter %.h,$(_glib_enum_types_sources))
+
+define _glib_make_mkenums_rules
+$(if $(_glib_enum_types_sources),,$(error Need to define $(_glib_enum_types_sources_var) for $(1).[ch]))
+
+$(1).h.stamp: $(_glib_enum_types_h_sources)
+	$$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
+		--fhead "/* Generated by glib-mkenums. Do not edit */\n\n#ifndef $(_glib_enum_types_guard)\n#define $(_glib_enum_types_guard)\n\n" \
+		$$(GLIB_MKENUMS_H_FLAGS) \
+		$$($(_glib_enum_types_prefix)_MKENUMS_H_FLAGS) \
+		--fhead "#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+		--vhead "GType @enum_name@_get_type (void) G_GNUC_CONST;\n#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())\n" \
+		--ftail "G_END_DECLS\n\n#endif /* $(_glib_enum_types_guard) */" \
+		$$^ > $(1).h.tmp && \
+	(cmp -s $(1).h.tmp $(1).h || cp $(1).h.tmp $(1).h) && \
+	rm -f $(1).h.tmp && \
+	echo timestamp > $$@
+
+$(1).h: $(1).h.stamp
+	@true
+
+$(1).c.stamp: $(_glib_enum_types_h_sources)
+	$$(_GLIB_V_GEN) $$(GLIB_MKENUMS) \
+		--fhead "/* Generated by glib-mkenums. Do not edit */\n\n#include \"$(notdir $(1)).h\"\n" \
+		$$(GLIB_MKENUMS_C_FLAGS) \
+		$$($(_glib_enum_types_prefix)_MKENUMS_C_FLAGS) \
+		--fhead "$$(foreach f,$$(^F),\n#include \"$$(f)\")\n\n" \
+		--vhead "GType\n@enum_name@_get_type (void)\n{\n  static volatile gsize g_define_type_id__volatile = 0;\n\n  if (g_once_init_enter (&g_define_type_id__volatile))\n    {\n      static const G@Type@Value values[] = {\n" \
+		--vprod "        { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },\n" \
+		--vtail "        { 0, NULL, NULL }\n      };\n      GType g_define_type_id =\n        g_@type@_register_static (g_intern_static_string (\"@EnumName@\"), values);\n      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);\n    }\n\n  return g_define_type_id__volatile;\n}\n" \
+		$$^ > $(1).c.tmp && \
+	(cmp -s $(1).c.tmp $(1).c || cp $(1).c.tmp $(1).c) && \
+	rm -f $(1).c.tmp && \
+	echo timestamp > $$@
+
+$(1).c: $(1).c.stamp
+	@true
+
+_GLIB_CLEANFILES += $(1).h.stamp $(1).c.stamp
+_GLIB_DISTCLEANFILES += $(1).h $(1).c $(1).h.stamp $(1).c.stamp
+endef
+
+$(foreach f,$(_GLIB_ENUM_TYPES_GENERATED),$(eval $(call _glib_make_mkenums_rules,$f)))
+
+
+# glib-compile-schemas
+
+_GLIB_ENUMS_XML_GENERATED = $(filter %.enums.xml,$(GLIB_GENERATED))
+_GLIB_GSETTINGS_SCHEMA_FILES = $(filter %.gschema.xml,$(gsettingsschema_DATA))
+_GLIB_GSETTINGS_VALID_FILES = $(subst .xml,.valid,$(_GLIB_GSETTINGS_SCHEMA_FILES))
+
+_glib_enums_xml_prefix = $(subst .,_,$(notdir $(1)))
+_glib_enums_xml_sources_var = $(_glib_enums_xml_prefix)_sources
+_glib_enums_xml_sources = $(filter-out $(GLIB_GENERATED),$($(_glib_enums_xml_sources_var)))
+_glib_enums_xml_namespace = $(subst .enums.xml,,$(notdir $(1)))
+
+define _glib_make_enums_xml_rule
+$(if $(_glib_enums_xml_sources),,$(error Need to define $(_glib_enums_xml_sources_var) for $(1)))
+
+$(1): $(_glib_enums_xml_sources)
+	$$(_GLIB_V_GEN) $$(GLIB_MKENUMS) --comments '<!-- @comment@ -->' --fhead "<schemalist>" --vhead "  <@type@ id='$(_glib_enums_xml_namespace).@EnumName@'>" --vprod "    <value nick='@valuenick@' value='@valuenum@'/>" --vtail "  </@type@>" --ftail "</schemalist>" $$^ > $$@.tmp && mv $$@.tmp $$@
+endef
+
+_GLIB_V_CHECK = $(_glib_v_check_$(V))
+_glib_v_check_ = $(_glib_v_check_$(AM_DEFAULT_VERBOSITY))
+_glib_v_check_0 = @echo "  CHECK " $(subst .valid,.xml,$@);
+
+define _glib_make_schema_validate_rule
+$(subst .xml,.valid,$(1)): $(_GLIB_ENUMS_XML_GENERATED) $(1)
+	$$(_GLIB_V_CHECK) $$(GLIB_COMPILE_SCHEMAS) --strict --dry-run $$(addprefix --schema-file=,$$^) && touch $$@
+endef
+
+define _glib_make_schema_rules
+all-am: $(_GLIB_GSETTINGS_VALID_FILES)
+
+install-data-am: glib-install-schemas-hook
+
+glib-install-schemas-hook: install-gsettingsschemaDATA
+	@test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || (echo $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir))
+
+uninstall-am: glib-uninstall-schemas-hook
+
+glib-uninstall-schemas-hook: uninstall-gsettingsschemaDATA
+	@test -n "$(GSETTINGS_DISABLE_SCHEMAS_COMPILE)$(DESTDIR)" || (echo $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir); $(GLIB_COMPILE_SCHEMAS) $(gsettingsschemadir))
+
+.PHONY: glib-install-schemas-hook glib-uninstall-schemas-hook
+endef
+
+_GLIB_CLEANFILES += $(_GLIB_ENUMS_XML_GENERATED) $(_GLIB_GSETTINGS_VALID_FILES)
+
+$(foreach f,$(_GLIB_ENUMS_XML_GENERATED),$(eval $(call _glib_make_enums_xml_rule,$f)))
+$(foreach f,$(_GLIB_GSETTINGS_SCHEMA_FILES),$(eval $(call _glib_make_schema_validate_rule,$f)))
+$(if $(_GLIB_GSETTINGS_SCHEMA_FILES),$(eval $(_glib_make_schema_rules)))
+
+
+# Cleanup
+.PHONY: clean-glib distclean-glib
+
+clean-am: clean-glib
+clean-glib:
+	$(if $(strip $(_GLIB_CLEANFILES)),-rm -f $(_GLIB_CLEANFILES))
+
+distclean-am: distclean-glib
+distclean-glib:
+	$(if $(strip $(_GLIB_DISTCLEANFILES)),-rm -f $(_GLIB_DISTCLEANFILES))
diff --git a/configure.ac b/configure.ac
index 1cbf37c..8d82bed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -467,8 +467,12 @@ if test x"$ac_nss" = xno -a x"$ac_gnutls" = xno; then
   AC_MSG_ERROR([Could not find required development headers and libraries for '$ac_crypto'])
 fi
 
+GLIB_MAKEFILE='$(top_srcdir)/Makefile.glib'
+AC_SUBST(GLIB_MAKEFILE)
 GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
 AC_SUBST(GLIB_GENMARSHAL)
+GLIB_MKENUMS='$(top_srcdir)/tools/glib-mkenums'
+AC_SUBST(GLIB_MKENUMS)
 
 AC_ARG_WITH(dbus-sys-dir, AS_HELP_STRING([--with-dbus-sys-dir=DIR], [where D-BUS system.d directory is]))
 
@@ -677,7 +681,7 @@ include/Makefile
 include/nm-version.h
 src/Makefile
 src/tests/Makefile
-marshallers/Makefile
+src/generated/Makefile
 src/logging/Makefile
 src/dns-manager/Makefile
 src/vpn-manager/Makefile
diff --git a/libnm-glib/Makefile.am b/libnm-glib/Makefile.am
index 6be78e1..0e9c0bd 100644
--- a/libnm-glib/Makefile.am
+++ b/libnm-glib/Makefile.am
@@ -1,3 +1,5 @@
+include $(GLIB_MAKEFILE)
+
 SUBDIRS=. tests
 
 INCLUDES = \
@@ -71,12 +73,14 @@ libnminclude_HEADERS = \
 	nm-remote-settings.h \
 	nm-secret-agent.h \
 	nm-device-wimax.h \
-	nm-wimax-nsp.h
+	nm-wimax-nsp.h \
+	nm-glib-enum-types.h
 
 libnmvpn_HEADERS = \
 	nm-vpn-plugin.h \
 	nm-vpn-plugin-ui-interface.h \
-	nm-vpn-plugin-utils.h
+	nm-vpn-plugin-utils.h \
+	nm-vpn-enum-types.h
 
 libnm_glib_la_csources = \
 	nm-object.c \
@@ -100,22 +104,32 @@ libnm_glib_la_csources = \
 	nm-remote-settings.c \
 	nm-secret-agent.c \
 	nm-device-wimax.c \
-	nm-wimax-nsp.c
+	nm-wimax-nsp.c \
+	nm-glib-enum-types.c \
+	nm-glib-marshal.c
 
 libnm_glib_la_private_headers = \
 	nm-object-private.h \
 	nm-device-private.h \
 	nm-types-private.h \
 	nm-object-cache.h \
-	nm-remote-connection-private.h
+	nm-remote-connection-private.h \
+	nm-glib-marshal.h
 
 libnm_glib_la_SOURCES = \
 	$(libnm_glib_la_csources) \
 	$(libnm_glib_la_private_headers)
 
+GLIB_GENERATED = nm-glib-enum-types.h nm-glib-enum-types.c
+nm_glib_enum_types_sources = $(libnminclude_HEADERS)
+GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
+GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
+
+GLIB_GENERATED += nm-glib-marshal.h nm-glib-marshal.c
+nm_glib_marshal_sources = $(libnm_glib_la_SOURCES)
+
 libnm_glib_la_LIBADD = \
 	$(top_builddir)/libnm-util/libnm-util.la \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	$(builddir)/libdeprecated-nm-glib.la \
 	$(GIO_LIBS) \
 	$(DBUS_LIBS) \
@@ -136,12 +150,17 @@ libnm_glib_test_LDADD = libnm-glib.la $(top_builddir)/libnm-util/libnm-util.la $
 libnm_glib_vpn_la_SOURCES = \
 	nm-vpn-plugin.c \
 	nm-vpn-plugin-ui-interface.c \
-	nm-vpn-plugin-utils.c
+	nm-vpn-plugin-utils.c \
+	nm-vpn-enum-types.c
+GLIB_GENERATED += nm-vpn-enum-types.h nm-vpn-enum-types.c
+nm_vpn_enum_types_sources = $(libnmvpn_HEADERS)
 libnm_glib_vpn_la_CFLAGS = $(GIO_CFLAGS) $(DBUS_CFLAGS)
 libnm_glib_vpn_la_LIBADD = $(top_builddir)/libnm-util/libnm-util.la $(GIO_LIBS) $(DBUS_LIBS)
 libnm_glib_vpn_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-glib-vpn.ver \
 	-version-info "2:0:1"
 
+BUILT_SOURCES += $(GLIB_GENERATED)
+
 #####################################################
 # Test libnm-glib stuff
 #####################################################
@@ -158,7 +177,6 @@ libnm_glib_test_la_SOURCES = \
 
 libnm_glib_test_la_LIBADD = \
 	$(top_builddir)/libnm-util/libnm-util.la \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	$(GIO_LIBS) \
 	$(DBUS_LIBS) \
 	$(GUDEV_LIBS)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index 5c84df3..1592b4d 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -46,6 +46,8 @@ global:
 	nm_client_new;
 	nm_client_new_async;
 	nm_client_new_finish;
+	nm_client_permission_get_type;
+	nm_client_permission_result_get_type;
 	nm_client_sleep;
 	nm_client_wimax_get_enabled;
 	nm_client_wimax_hardware_get_enabled;
@@ -168,6 +170,7 @@ global:
 	nm_secret_agent_register;
 	nm_secret_agent_save_secrets;
 	nm_secret_agent_unregister;
+	nm_secret_agent_get_secrets_flags_get_type;
 	nm_ssid_get_type;
 	nm_string_array_get_type;
 	nm_uint_array_get_type;
@@ -181,6 +184,7 @@ global:
 	nm_wimax_nsp_get_network_type;
 	nm_wimax_nsp_get_signal_quality;
 	nm_wimax_nsp_get_type;
+	nm_wimax_nsp_network_type_get_type;
 	nm_wimax_nsp_new;
 local:
 	*;
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index 811b739..437210e 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -29,7 +29,7 @@
 #include "nm-device-ethernet.h"
 #include "nm-device-wifi.h"
 #include "nm-device-private.h"
-#include "nm-marshal.h"
+#include "nm-glib-marshal.h"
 #include "nm-types-private.h"
 #include "nm-object-private.h"
 #include "nm-active-connection.h"
@@ -1739,7 +1739,7 @@ nm_client_class_init (NMClientClass *client_class)
 					  G_OBJECT_CLASS_TYPE (object_class),
 					  G_SIGNAL_RUN_FIRST,
 					  0, NULL, NULL,
-					  _nm_marshal_VOID__UINT_UINT,
+					  _nm_glib_marshal_VOID__UINT_UINT,
 					  G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
 }
 
diff --git a/libnm-glib/nm-device-modem.c b/libnm-glib/nm-device-modem.c
index dd43d3d..05dab43 100644
--- a/libnm-glib/nm-device-modem.c
+++ b/libnm-glib/nm-device-modem.c
@@ -31,7 +31,7 @@
 #include "nm-device-modem.h"
 #include "nm-device-private.h"
 #include "nm-object-private.h"
-#include "nm-marshal.h"
+#include "nm-glib-marshal.h"
 
 G_DEFINE_TYPE (NMDeviceModem, nm_device_modem, NM_TYPE_DEVICE)
 
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index 35b678f..d43e4fe 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -36,7 +36,7 @@
 #include "nm-device-private.h"
 #include "nm-object-private.h"
 #include "nm-object-cache.h"
-#include "nm-marshal.h"
+#include "nm-glib-marshal.h"
 #include "nm-dbus-glib-types.h"
 #include "nm-glib-compat.h"
 
@@ -202,7 +202,7 @@ constructed (GObject *object)
 
 	register_properties (NM_DEVICE (object));
 
-	dbus_g_object_register_marshaller (_nm_marshal_VOID__UINT_UINT_UINT,
+	dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__UINT_UINT_UINT,
 									   G_TYPE_NONE,
 									   G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT,
 									   G_TYPE_INVALID);
@@ -612,7 +612,7 @@ nm_device_class_init (NMDeviceClass *device_class)
 				    G_SIGNAL_RUN_FIRST,
 				    G_STRUCT_OFFSET (NMDeviceClass, state_changed),
 				    NULL, NULL,
-				    _nm_marshal_VOID__UINT_UINT_UINT,
+				    _nm_glib_marshal_VOID__UINT_UINT_UINT,
 				    G_TYPE_NONE, 3,
 				    G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
 }
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index 588c120..e4ed782 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -25,7 +25,7 @@
 #include <NetworkManager.h>
 #include <nm-connection.h>
 
-#include "nm-marshal.h"
+#include "nm-glib-marshal.h"
 #include "nm-dbus-glib-types.h"
 #include "nm-remote-settings.h"
 #include "nm-remote-connection-private.h"
@@ -102,26 +102,6 @@ nm_remote_settings_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_remote_settings_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_REMOTE_SETTINGS_ERROR_UNKNOWN, "UnknownError"),
-			ENUM_ENTRY (NM_REMOTE_SETTINGS_ERROR_CONNECTION_REMOVED, "ConnectionRemoved"),
-			ENUM_ENTRY (NM_REMOTE_SETTINGS_ERROR_CONNECTION_UNAVAILABLE, "ConnectionUnavailable"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMRemoteSettingsError", values);
-	}
-	return etype;
-}
-
 /**********************************************************************/
 
 typedef struct {
@@ -812,7 +792,7 @@ constructed (GObject *object)
 	                                              "org.freedesktop.DBus");
 	g_assert (priv->dbus_proxy);
 
-	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_STRING_STRING,
+	dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__STRING_STRING_STRING,
 	                                   G_TYPE_NONE,
 	                                   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
 	                                   G_TYPE_INVALID);
diff --git a/libnm-glib/nm-remote-settings.h b/libnm-glib/nm-remote-settings.h
index 6eb8ae5..510c954 100644
--- a/libnm-glib/nm-remote-settings.h
+++ b/libnm-glib/nm-remote-settings.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_REMOTE_SETTINGS_ERROR_CONNECTION_UNAVAILABLE,
 } NMRemoteSettingsError;
 
-#define NM_TYPE_REMOTE_SETTINGS_ERROR (nm_remote_settings_error_get_type ()) 
-GType nm_remote_settings_error_get_type (void);
-
 #define NM_REMOTE_SETTINGS_ERROR nm_remote_settings_error_quark ()
 GQuark nm_remote_settings_error_quark (void);
 
diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c
index 4d0a825..d6a15f9 100644
--- a/libnm-glib/nm-secret-agent.c
+++ b/libnm-glib/nm-secret-agent.c
@@ -25,7 +25,8 @@
 #include <dbus/dbus-glib-lowlevel.h>
 
 #include "nm-secret-agent.h"
-#include "nm-marshal.h"
+#include "nm-glib-enum-types.h"
+#include "nm-glib-marshal.h"
 #include "NetworkManager.h"
 
 static void impl_secret_agent_get_secrets (NMSecretAgent *self,
@@ -111,34 +112,6 @@ nm_secret_agent_error_quark (void)
 	return ret;
 }
 
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_secret_agent_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Sender is not authorized to make this request */
-			ENUM_ENTRY (NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED, "NotAuthorized"),
-			/* Given connection details do not make a valid connection */
-			ENUM_ENTRY (NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, "InvalidConnection"),
-			/* The request was canceled explicitly by the user */
-			ENUM_ENTRY (NM_SECRET_AGENT_ERROR_USER_CANCELED, "UserCanceled"),
-			/* The request was canceled, but not by the user */
-			ENUM_ENTRY (NM_SECRET_AGENT_ERROR_AGENT_CANCELED, "AgentCanceled"),
-			/* Some internal error prevented returning secrets */
-			ENUM_ENTRY (NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, "InternalError"),
-			/* No secrets could be found to fulfill the request */
-			ENUM_ENTRY (NM_SECRET_AGENT_ERROR_NO_SECRETS, "NoSecrets"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSecretAgentError", values);
-	}
-	return etype;
-}
-
 /*************************************************************/
 
 static const char *
@@ -806,7 +779,7 @@ nm_secret_agent_init (NMSecretAgent *self)
 		return;
 	}
 
-	dbus_g_object_register_marshaller (_nm_marshal_VOID__STRING_STRING_STRING,
+	dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__STRING_STRING_STRING,
 	                                   G_TYPE_NONE,
 	                                   G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
 	                                   G_TYPE_INVALID);
diff --git a/libnm-glib/nm-secret-agent.h b/libnm-glib/nm-secret-agent.h
index 33ef228..6a513ba 100644
--- a/libnm-glib/nm-secret-agent.h
+++ b/libnm-glib/nm-secret-agent.h
@@ -26,10 +26,8 @@
 G_BEGIN_DECLS
 
 #define NM_SECRET_AGENT_ERROR         (nm_secret_agent_error_quark ())
-#define NM_TYPE_SECRET_AGENT_ERROR    (nm_secret_agent_error_get_type ())
 
 GQuark nm_secret_agent_error_quark (void);
-GType nm_secret_agent_error_get_type (void);
 
 typedef enum {
 	NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED = 0,
diff --git a/libnm-glib/nm-types.h b/libnm-glib/nm-types.h
index cb1bf87..adccafb 100644
--- a/libnm-glib/nm-types.h
+++ b/libnm-glib/nm-types.h
@@ -26,6 +26,8 @@
 #include <glib.h>
 #include <glib-object.h>
 
+#include <nm-glib-enum-types.h>
+
 G_BEGIN_DECLS
 
 #define NM_TYPE_SSID  (nm_ssid_get_type ())
diff --git a/libnm-glib/nm-vpn-connection.c b/libnm-glib/nm-vpn-connection.c
index 652206b..5393421 100644
--- a/libnm-glib/nm-vpn-connection.c
+++ b/libnm-glib/nm-vpn-connection.c
@@ -25,7 +25,7 @@
 #include "nm-vpn-connection.h"
 #include "NetworkManager.h"
 #include "nm-utils.h"
-#include "nm-marshal.h"
+#include "nm-glib-marshal.h"
 #include "nm-object-private.h"
 #include "nm-active-connection.h"
 
@@ -178,7 +178,7 @@ constructed (GObject *object)
 									 nm_object_get_path (NM_OBJECT (object)),
 									 NM_DBUS_INTERFACE_VPN_CONNECTION);
 
-	dbus_g_object_register_marshaller (_nm_marshal_VOID__UINT_UINT,
+	dbus_g_object_register_marshaller (_nm_glib_marshal_VOID__UINT_UINT,
 	                                   G_TYPE_NONE,
 	                                   G_TYPE_UINT, G_TYPE_UINT,
 	                                   G_TYPE_INVALID);
@@ -271,7 +271,7 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
 				    G_SIGNAL_RUN_FIRST,
 				    G_STRUCT_OFFSET (NMVPNConnectionClass, vpn_state_changed),
 				    NULL, NULL,
-				    _nm_marshal_VOID__UINT_UINT,
+				    _nm_glib_marshal_VOID__UINT_UINT,
 				    G_TYPE_NONE, 2,
 				    G_TYPE_UINT, G_TYPE_UINT);
 }
diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c
index 4c3813e..2368538 100644
--- a/libnm-glib/nm-vpn-plugin.c
+++ b/libnm-glib/nm-vpn-plugin.c
@@ -24,6 +24,7 @@
 #include <signal.h>
 #include "nm-glib-compat.h"
 #include "nm-vpn-plugin.h"
+#include "nm-vpn-enum-types.h"
 #include "nm-utils.h"
 #include "nm-connection.h"
 #include "nm-dbus-glib-types.h"
@@ -107,33 +108,6 @@ nm_vpn_plugin_error_quark (void)
 	return quark;
 }
 
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_vpn_plugin_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_GENERAL,              "General"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_STARTING_IN_PROGRESS, "StartingInProgress"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_ALREADY_STARTED,      "AlreadyStarted"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_STOPPING_IN_PROGRESS, "StoppingInProgress"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_ALREADY_STOPPED,      "AlreadyStopped"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_WRONG_STATE,          "WrongState"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_BAD_ARGUMENTS,        "BadArguments"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,        "LaunchFailed"),
-			ENUM_ENTRY (NM_VPN_PLUGIN_ERROR_CONNECTION_INVALID,   "ConnectionInvalid"),
-			{ 0, 0, 0 }
-		};
-
-		etype = g_enum_register_static ("NMVPNPluginError", values);
-	}
-
-	return etype;
-}
-
 
 static void
 nm_vpn_plugin_set_connection (NMVPNPlugin *plugin,
diff --git a/libnm-glib/nm-vpn-plugin.h b/libnm-glib/nm-vpn-plugin.h
index 8a3c2f1..d80a3fc 100644
--- a/libnm-glib/nm-vpn-plugin.h
+++ b/libnm-glib/nm-vpn-plugin.h
@@ -55,7 +55,6 @@ typedef enum {
 } NMVPNPluginError;
 
 #define NM_VPN_PLUGIN_ERROR      (nm_vpn_plugin_error_quark ())
-#define NM_TYPE_VPN_PLUGIN_ERROR (nm_vpn_plugin_error_get_type ()) 
 
 typedef struct {
 	GObject parent;
diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am
index 1ccb5a6..2ccf1bd 100644
--- a/libnm-util/Makefile.am
+++ b/libnm-util/Makefile.am
@@ -1,3 +1,5 @@
+include $(GLIB_MAKEFILE)
+
 SUBDIRS=. tests
 
 INCLUDES = -I${top_srcdir} -I${top_srcdir}/include -I${top_builddir}/include
@@ -31,6 +33,7 @@ libnm_util_include_HEADERS = 		\
 	nm-setting-wireless.h		\
 	nm-setting-wireless-security.h	\
 	nm-setting-vpn.h		\
+	nm-utils-enum-types.h		\
 	nm-utils.h
 
 libnm_util_la_private_headers = \
@@ -62,12 +65,19 @@ libnm_util_la_csources = \
 	nm-setting-wireless.c		\
 	nm-setting-wireless-security.c	\
 	nm-setting-vpn.c		\
+	nm-utils-enum-types.c		\
 	nm-utils.c
 
 libnm_util_la_SOURCES = \
 	$(libnm_util_la_csources) \
 	$(libnm_util_la_private_headers)
 
+GLIB_GENERATED = nm-utils-enum-types.h nm-utils-enum-types.c
+BUILT_SOURCES = $(GLIB_GENERATED)
+nm_utils_enum_types_sources = $(libnm_util_include_HEADERS)
+GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
+GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
+
 libnm_util_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) $(UUID_LIBS)
 
 SYMBOL_VIS_FILE=$(srcdir)/libnm-util.ver
diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver
index cd676fe..7b835aa 100644
--- a/libnm-util/libnm-util.ver
+++ b/libnm-util/libnm-util.ver
@@ -103,6 +103,8 @@ global:
 	nm_setting_802_1x_add_altsubject_match;
 	nm_setting_802_1x_add_eap_method;
 	nm_setting_802_1x_add_phase2_altsubject_match;
+	nm_setting_802_1x_ck_format_get_type;
+	nm_setting_802_1x_ck_scheme_get_type;
 	nm_setting_802_1x_clear_altsubject_matches;
 	nm_setting_802_1x_clear_eap_methods;
 	nm_setting_802_1x_clear_phase2_altsubject_matches;
@@ -196,6 +198,7 @@ global:
 	nm_setting_clear_secrets;
 	nm_setting_clear_secrets_with_flags;
 	nm_setting_compare;
+	nm_setting_compare_flags_get_type;
 	nm_setting_connection_add_permission;
 	nm_setting_connection_error_get_type;
 	nm_setting_connection_error_quark;
@@ -216,6 +219,7 @@ global:
 	nm_setting_connection_permissions_user_allowed;
 	nm_setting_connection_remove_permission;
 	nm_setting_diff;
+	nm_setting_diff_result_get_type;
 	nm_setting_duplicate;
 	nm_setting_enumerate_values;
 	nm_setting_error_get_type;
@@ -238,7 +242,10 @@ global:
 	nm_setting_gsm_get_pin_flags;
 	nm_setting_gsm_get_type;
 	nm_setting_gsm_get_username;
+	nm_setting_gsm_network_band_get_type;
+	nm_setting_gsm_network_type_get_type;
 	nm_setting_gsm_new;
+	nm_setting_hash_flags_get_type;
 	nm_setting_infiniband_error_get_type;
 	nm_setting_infiniband_error_quark;
 	nm_setting_infiniband_get_mac_address;
@@ -346,6 +353,7 @@ global:
 	nm_setting_pppoe_get_type;
 	nm_setting_pppoe_get_username;
 	nm_setting_pppoe_new;
+	nm_setting_secret_flags_get_type;
 	nm_setting_serial_error_get_type;
 	nm_setting_serial_error_quark;
 	nm_setting_serial_get_baud;
@@ -477,6 +485,7 @@ global:
 	nm_utils_is_empty_ssid;
 	nm_utils_rsa_key_encrypt;
 	nm_utils_same_ssid;
+	nm_utils_security_type_get_type;
 	nm_utils_security_valid;
 	nm_utils_slist_free;
 	nm_utils_ssid_to_utf8;
@@ -486,6 +495,7 @@ global:
 	nm_utils_wifi_find_next_channel;
 	nm_utils_wifi_freq_to_channel;
 	nm_utils_wifi_is_channel_valid;
+	nm_wep_key_type_get_type;
 local:
 	*;
 };
diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c
index a63050e..b4b6f9d 100644
--- a/libnm-util/nm-connection.c
+++ b/libnm-util/nm-connection.c
@@ -89,27 +89,6 @@ nm_connection_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_connection_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_CONNECTION_ERROR_UNKNOWN, "UnknownError"),
-			ENUM_ENTRY (NM_CONNECTION_ERROR_CONNECTION_SETTING_NOT_FOUND, "ConnectionSettingNotFound"),
-			ENUM_ENTRY (NM_CONNECTION_ERROR_CONNECTION_TYPE_INVALID, "ConnectionTypeInvalid"),
-			ENUM_ENTRY (NM_CONNECTION_ERROR_SETTING_NOT_FOUND, "SettingNotFound"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMConnectionError", values);
-	}
-	return etype;
-}
-
 typedef struct {
 	GHashTable *settings;
 
diff --git a/libnm-util/nm-connection.h b/libnm-util/nm-connection.h
index 28dce12..77f59ea 100644
--- a/libnm-util/nm-connection.h
+++ b/libnm-util/nm-connection.h
@@ -83,9 +83,6 @@ typedef enum
 	NM_CONNECTION_ERROR_SETTING_NOT_FOUND
 } NMConnectionError;
 
-#define NM_TYPE_CONNECTION_ERROR (nm_connection_error_get_type ()) 
-GType nm_connection_error_get_type (void);
-
 #define NM_CONNECTION_ERROR nm_connection_error_quark ()
 GQuark nm_connection_error_quark (void);
 
diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c
index 3d745c0..28c0d3f 100644
--- a/libnm-util/nm-setting-8021x.c
+++ b/libnm-util/nm-setting-8021x.c
@@ -82,30 +82,6 @@ nm_setting_802_1x_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_802_1x_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_802_1X_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_802_1X_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_802_1X_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSetting8021xError", values);
-	}
-	return etype;
-}
-
-
 G_DEFINE_TYPE (NMSetting8021x, nm_setting_802_1x, NM_TYPE_SETTING)
 
 #define NM_SETTING_802_1X_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_802_1X, NMSetting8021xPrivate))
diff --git a/libnm-util/nm-setting-8021x.h b/libnm-util/nm-setting-8021x.h
index cf9bd76..fa70863 100644
--- a/libnm-util/nm-setting-8021x.h
+++ b/libnm-util/nm-setting-8021x.h
@@ -42,7 +42,7 @@ G_BEGIN_DECLS
  * #NMSetting8021xCKFormat values indicate the general type of a certificate
  * or private key
  */
-typedef enum {
+typedef enum { /*< underscore_name=nm_setting_802_1x_ck_format >*/
 	NM_SETTING_802_1X_CK_FORMAT_UNKNOWN = 0,
 	NM_SETTING_802_1X_CK_FORMAT_X509,
 	NM_SETTING_802_1X_CK_FORMAT_RAW_KEY,
@@ -62,7 +62,7 @@ typedef enum {
  * stored in the setting properties, either as a blob of the item's data, or as
  * a path to a certificate or private key file on the filesystem
  */
-typedef enum {
+typedef enum { /*< underscore_name=nm_setting_802_1x_ck_scheme >*/
 	NM_SETTING_802_1X_CK_SCHEME_UNKNOWN = 0,
 	NM_SETTING_802_1X_CK_SCHEME_BLOB,
 	NM_SETTING_802_1X_CK_SCHEME_PATH
@@ -85,15 +85,12 @@ typedef enum {
  * @NM_SETTING_802_1X_ERROR_MISSING_PROPERTY: the property was missing and is
  * required
  */
-typedef enum {
+typedef enum { /*< underscore_name=nm_setting_802_1x_error >*/
 	NM_SETTING_802_1X_ERROR_UNKNOWN = 0,
 	NM_SETTING_802_1X_ERROR_INVALID_PROPERTY,
 	NM_SETTING_802_1X_ERROR_MISSING_PROPERTY
 } NMSetting8021xError;
 
-#define NM_TYPE_SETTING_802_1X_ERROR (nm_setting_802_1x_error_get_type ()) 
-GType nm_setting_802_1x_error_get_type (void);
-
 #define NM_SETTING_802_1X_ERROR nm_setting_802_1x_error_quark ()
 GQuark nm_setting_802_1x_error_quark (void);
 
diff --git a/libnm-util/nm-setting-bluetooth.c b/libnm-util/nm-setting-bluetooth.c
index 1b1178b..6a2fed7 100644
--- a/libnm-util/nm-setting-bluetooth.c
+++ b/libnm-util/nm-setting-bluetooth.c
@@ -62,27 +62,6 @@ nm_setting_bluetooth_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_bluetooth_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_SETTING_BLUETOOTH_ERROR_UNKNOWN, "UnknownError"),
-			ENUM_ENTRY (NM_SETTING_BLUETOOTH_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			ENUM_ENTRY (NM_SETTING_BLUETOOTH_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			ENUM_ENTRY (NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND, "TypeSettingNotFound"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingBluetoothError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingBluetooth, nm_setting_bluetooth, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-bluetooth.h b/libnm-util/nm-setting-bluetooth.h
index a17a72b..1dd679f 100644
--- a/libnm-util/nm-setting-bluetooth.h
+++ b/libnm-util/nm-setting-bluetooth.h
@@ -57,9 +57,6 @@ typedef enum {
 	NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND,
 } NMSettingBluetoothError;
 
-#define NM_TYPE_SETTING_BLUETOOTH_ERROR (nm_setting_bluetooth_error_get_type ()) 
-GType nm_setting_bluetooth_error_get_type (void);
-
 #define NM_SETTING_BLUETOOTH_ERROR nm_setting_bluetooth_error_quark ()
 GQuark nm_setting_bluetooth_error_quark (void);
 
diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c
index 3aa9cf3..7c1c233 100644
--- a/libnm-util/nm-setting-bond.c
+++ b/libnm-util/nm-setting-bond.c
@@ -57,31 +57,6 @@ nm_setting_bond_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_bond_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_BOND_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_BOND_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_BOND_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-
-		etype = g_enum_register_static ("NMSettingBondError", values);
-	}
-
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingBond, nm_setting_bond, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-bond.h b/libnm-util/nm-setting-bond.h
index 6ef6992..c868737 100644
--- a/libnm-util/nm-setting-bond.h
+++ b/libnm-util/nm-setting-bond.h
@@ -50,9 +50,6 @@ typedef enum {
 	NM_SETTING_BOND_ERROR_MISSING_PROPERTY,
 } NMSettingBondError;
 
-#define NM_TYPE_SETTING_BOND_ERROR (nm_setting_bond_error_get_type ()) 
-GType nm_setting_bond_error_get_type (void);
-
 #define NM_SETTING_BOND_ERROR nm_setting_bond_error_quark ()
 GQuark nm_setting_bond_error_quark (void);
 
diff --git a/libnm-util/nm-setting-cdma.c b/libnm-util/nm-setting-cdma.c
index cb5b27e..43bf93b 100644
--- a/libnm-util/nm-setting-cdma.c
+++ b/libnm-util/nm-setting-cdma.c
@@ -53,31 +53,6 @@ nm_setting_cdma_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_cdma_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_CDMA_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_CDMA_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_CDMA_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The required serial setting is missing (DEPRECATED) */
-			ENUM_ENTRY (NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING, "MissingSerialSetting"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingCdmaError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingCdma, nm_setting_cdma, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-cdma.h b/libnm-util/nm-setting-cdma.h
index d0a5de4..229bb32 100644
--- a/libnm-util/nm-setting-cdma.h
+++ b/libnm-util/nm-setting-cdma.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
 } NMSettingCdmaError;
 
-#define NM_TYPE_SETTING_CDMA_ERROR (nm_setting_cdma_error_get_type ()) 
-GType nm_setting_cdma_error_get_type (void);
-
 #define NM_SETTING_CDMA_ERROR nm_setting_cdma_error_quark ()
 GQuark nm_setting_cdma_error_quark (void);
 
diff --git a/libnm-util/nm-setting-connection.c b/libnm-util/nm-setting-connection.c
index 6c8b8b2..94ca911 100644
--- a/libnm-util/nm-setting-connection.c
+++ b/libnm-util/nm-setting-connection.c
@@ -58,28 +58,6 @@ nm_setting_connection_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_connection_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_SETTING_CONNECTION_ERROR_UNKNOWN, "UnknownError"),
-			ENUM_ENTRY (NM_SETTING_CONNECTION_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			ENUM_ENTRY (NM_SETTING_CONNECTION_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			ENUM_ENTRY (NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND, "TypeSettingNotFound"),
-			ENUM_ENTRY (NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED, "IpConfigNotAllowed"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingConnectionError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingConnection, nm_setting_connection, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-connection.h b/libnm-util/nm-setting-connection.h
index 5397635..da9c03a 100644
--- a/libnm-util/nm-setting-connection.h
+++ b/libnm-util/nm-setting-connection.h
@@ -65,9 +65,6 @@ typedef enum
 	NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED,
 } NMSettingConnectionError;
 
-#define NM_TYPE_SETTING_CONNECTION_ERROR (nm_setting_connection_error_get_type ()) 
-GType nm_setting_connection_error_get_type (void);
-
 #define NM_SETTING_CONNECTION_ERROR nm_setting_connection_error_quark ()
 GQuark nm_setting_connection_error_quark (void);
 
diff --git a/libnm-util/nm-setting-gsm.c b/libnm-util/nm-setting-gsm.c
index c23e8b0..2264d00 100644
--- a/libnm-util/nm-setting-gsm.c
+++ b/libnm-util/nm-setting-gsm.c
@@ -56,31 +56,6 @@ nm_setting_gsm_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_gsm_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_GSM_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_GSM_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_GSM_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The required serial setting is missing (DEPRECATED) */
-			ENUM_ENTRY (NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING, "MissingSerialSetting"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingGsmError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingGsm, nm_setting_gsm, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-gsm.h b/libnm-util/nm-setting-gsm.h
index 6459a4a..69183d4 100644
--- a/libnm-util/nm-setting-gsm.h
+++ b/libnm-util/nm-setting-gsm.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
 } NMSettingGsmError;
 
-#define NM_TYPE_SETTING_GSM_ERROR (nm_setting_gsm_error_get_type ()) 
-GType nm_setting_gsm_error_get_type (void);
-
 #define NM_SETTING_GSM_ERROR nm_setting_gsm_error_quark ()
 GQuark nm_setting_gsm_error_quark (void);
 
diff --git a/libnm-util/nm-setting-infiniband.c b/libnm-util/nm-setting-infiniband.c
index 9e8ec9a..d0eef24 100644
--- a/libnm-util/nm-setting-infiniband.c
+++ b/libnm-util/nm-setting-infiniband.c
@@ -52,29 +52,6 @@ nm_setting_infiniband_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_infiniband_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_INFINIBAND_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_INFINIBAND_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_INFINIBAND_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingInfinibandError", values);
-	}
-	return etype;
-}
-
 G_DEFINE_TYPE (NMSettingInfiniband, nm_setting_infiniband, NM_TYPE_SETTING)
 
 #define NM_SETTING_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_INFINIBAND, NMSettingInfinibandPrivate))
diff --git a/libnm-util/nm-setting-infiniband.h b/libnm-util/nm-setting-infiniband.h
index 8d1831b..90cd6ed 100644
--- a/libnm-util/nm-setting-infiniband.h
+++ b/libnm-util/nm-setting-infiniband.h
@@ -48,9 +48,6 @@ typedef enum {
 	NM_SETTING_INFINIBAND_ERROR_MISSING_PROPERTY
 } NMSettingInfinibandError;
 
-#define NM_TYPE_SETTING_INFINIBAND_ERROR (nm_setting_infiniband_error_get_type ())
-GType nm_setting_infiniband_error_get_type (void);
-
 #define NM_SETTING_INFINIBAND_ERROR nm_setting_infiniband_error_quark ()
 GQuark nm_setting_infiniband_error_quark (void);
 
diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c
index 6b164ea..db5a531 100644
--- a/libnm-util/nm-setting-ip4-config.c
+++ b/libnm-util/nm-setting-ip4-config.c
@@ -57,31 +57,6 @@ nm_setting_ip4_config_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_ip4_config_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The specified property was not allowed in combination with the current 'method' */
-			ENUM_ENTRY (NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD, "NotAllowedForMethod"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingIP4ConfigError", values);
-	}
-	return etype;
-}
-
 #if GLIB_CHECK_VERSION(2,26,0)
 G_DEFINE_BOXED_TYPE (NMIP4Address, nm_ip4_address, nm_ip4_address_dup, nm_ip4_address_unref)
 G_DEFINE_BOXED_TYPE (NMIP4Route, nm_ip4_route, nm_ip4_route_dup, nm_ip4_route_unref)
diff --git a/libnm-util/nm-setting-ip4-config.h b/libnm-util/nm-setting-ip4-config.h
index 76dcf37..2db34ee 100644
--- a/libnm-util/nm-setting-ip4-config.h
+++ b/libnm-util/nm-setting-ip4-config.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD
 } NMSettingIP4ConfigError;
 
-#define NM_TYPE_SETTING_IP4_CONFIG_ERROR (nm_setting_ip4_config_error_get_type ()) 
-GType nm_setting_ip4_config_error_get_type (void);
-
 #define NM_SETTING_IP4_CONFIG_ERROR nm_setting_ip4_config_error_quark ()
 GQuark nm_setting_ip4_config_error_quark (void);
 
diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c
index 4dc8f46..8901177 100644
--- a/libnm-util/nm-setting-ip6-config.c
+++ b/libnm-util/nm-setting-ip6-config.c
@@ -56,31 +56,6 @@ nm_setting_ip6_config_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_ip6_config_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_IP6_CONFIG_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_IP6_CONFIG_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_IP6_CONFIG_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The specified property was not allowed in combination with the current 'method' */
-			ENUM_ENTRY (NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD, "NotAllowedForMethod"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingIP6ConfigError", values);
-	}
-	return etype;
-}
-
 #if GLIB_CHECK_VERSION(2,26,0)
 G_DEFINE_BOXED_TYPE (NMIP6Address, nm_ip6_address, nm_ip6_address_dup, nm_ip6_address_unref)
 G_DEFINE_BOXED_TYPE (NMIP6Route, nm_ip6_route, nm_ip6_route_dup, nm_ip6_route_unref)
diff --git a/libnm-util/nm-setting-ip6-config.h b/libnm-util/nm-setting-ip6-config.h
index 6b8fe5c..01425af 100644
--- a/libnm-util/nm-setting-ip6-config.h
+++ b/libnm-util/nm-setting-ip6-config.h
@@ -56,9 +56,6 @@ typedef enum {
 	NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD
 } NMSettingIP6ConfigError;
 
-#define NM_TYPE_SETTING_IP6_CONFIG_ERROR (nm_setting_ip6_config_error_get_type ()) 
-GType nm_setting_ip6_config_error_get_type (void);
-
 #define NM_SETTING_IP6_CONFIG_ERROR nm_setting_ip6_config_error_quark ()
 GQuark nm_setting_ip6_config_error_quark (void);
 
diff --git a/libnm-util/nm-setting-olpc-mesh.c b/libnm-util/nm-setting-olpc-mesh.c
index 1653bb0..96770e4 100644
--- a/libnm-util/nm-setting-olpc-mesh.c
+++ b/libnm-util/nm-setting-olpc-mesh.c
@@ -46,29 +46,6 @@ nm_setting_olpc_mesh_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_olpc_mesh_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_OLPC_MESH_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_OLPC_MESH_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_OLPC_MESH_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingOlpcMeshError", values);
-	}
-	return etype;
-}
-
 static void nm_setting_olpc_mesh_init (NMSettingOlpcMesh *setting);
 
 G_DEFINE_TYPE (NMSettingOlpcMesh, nm_setting_olpc_mesh, NM_TYPE_SETTING)
diff --git a/libnm-util/nm-setting-olpc-mesh.h b/libnm-util/nm-setting-olpc-mesh.h
index 84abd12..c693610 100644
--- a/libnm-util/nm-setting-olpc-mesh.h
+++ b/libnm-util/nm-setting-olpc-mesh.h
@@ -48,9 +48,6 @@ typedef enum
 	NM_SETTING_OLPC_MESH_ERROR_MISSING_PROPERTY
 } NMSettingOlpcMeshError;
 
-#define NM_TYPE_SETTING_OLPC_MESH_ERROR (nm_setting_olpc_mesh_error_get_type ()) 
-GType nm_setting_olpc_mesh_error_get_type (void);
-
 #define NM_SETTING_OLPC_MESH_ERROR nm_setting_olpc_mesh_error_quark ()
 GQuark nm_setting_olpc_mesh_error_quark (void);
 
diff --git a/libnm-util/nm-setting-ppp.c b/libnm-util/nm-setting-ppp.c
index 8933813..6b1fd5a 100644
--- a/libnm-util/nm-setting-ppp.c
+++ b/libnm-util/nm-setting-ppp.c
@@ -53,31 +53,6 @@ nm_setting_ppp_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_ppp_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_PPP_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_PPP_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_PPP_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The 'require-mppe' option is not allowed in conjunction with the specified authentication. */
-			ENUM_ENTRY (NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED, "RequireMPPENotAllowed"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingPPPError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingPPP, nm_setting_ppp, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-ppp.h b/libnm-util/nm-setting-ppp.h
index 7a6e4e4..5dcdf90 100644
--- a/libnm-util/nm-setting-ppp.h
+++ b/libnm-util/nm-setting-ppp.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
 } NMSettingPPPError;
 
-#define NM_TYPE_SETTING_PPP_ERROR (nm_setting_ppp_error_get_type ()) 
-GType nm_setting_ppp_error_get_type (void);
-
 #define NM_SETTING_PPP_ERROR nm_setting_ppp_error_quark ()
 GQuark nm_setting_ppp_error_quark (void);
 
diff --git a/libnm-util/nm-setting-pppoe.c b/libnm-util/nm-setting-pppoe.c
index 4a9b8a2..e25c092 100644
--- a/libnm-util/nm-setting-pppoe.c
+++ b/libnm-util/nm-setting-pppoe.c
@@ -55,31 +55,6 @@ nm_setting_pppoe_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_pppoe_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_PPPOE_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_PPPOE_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_PPPOE_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The required PPP setting is missing */
-			ENUM_ENTRY (NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING, "MissingPPPSetting"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingPPPOEError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingPPPOE, nm_setting_pppoe, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-pppoe.h b/libnm-util/nm-setting-pppoe.h
index aef6bd6..6ec1376 100644
--- a/libnm-util/nm-setting-pppoe.h
+++ b/libnm-util/nm-setting-pppoe.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
 } NMSettingPPPOEError;
 
-#define NM_TYPE_SETTING_PPPOE_ERROR (nm_setting_pppoe_error_get_type ()) 
-GType nm_setting_pppoe_error_get_type (void);
-
 #define NM_SETTING_PPPOE_ERROR nm_setting_pppoe_error_quark ()
 GQuark nm_setting_pppoe_error_quark (void);
 
diff --git a/libnm-util/nm-setting-serial.c b/libnm-util/nm-setting-serial.c
index 24e6253..44f1498 100644
--- a/libnm-util/nm-setting-serial.c
+++ b/libnm-util/nm-setting-serial.c
@@ -56,31 +56,6 @@ nm_setting_serial_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_serial_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_SERIAL_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_SERIAL_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_SERIAL_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The required PPP setting is missing (DEPRECATED) */
-			ENUM_ENTRY (NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING, "MissingPPPSetting"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingSerialError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingSerial, nm_setting_serial, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-serial.h b/libnm-util/nm-setting-serial.h
index 9562950..b1fa7bc 100644
--- a/libnm-util/nm-setting-serial.h
+++ b/libnm-util/nm-setting-serial.h
@@ -55,9 +55,6 @@ typedef enum {
 	NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
 } NMSettingSerialError;
 
-#define NM_TYPE_SETTING_SERIAL_ERROR (nm_setting_serial_error_get_type ()) 
-GType nm_setting_serial_error_get_type (void);
-
 #define NM_SETTING_SERIAL_ERROR nm_setting_serial_error_quark ()
 GQuark nm_setting_serial_error_quark (void);
 
diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c
index 04b8fce..d1fc8b7 100644
--- a/libnm-util/nm-setting-vpn.c
+++ b/libnm-util/nm-setting-vpn.c
@@ -63,29 +63,6 @@ nm_setting_vpn_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_vpn_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_VPN_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_VPN_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_VPN_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingVpnError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingVPN, nm_setting_vpn, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-vpn.h b/libnm-util/nm-setting-vpn.h
index 7179baa..bfd2ac5 100644
--- a/libnm-util/nm-setting-vpn.h
+++ b/libnm-util/nm-setting-vpn.h
@@ -52,9 +52,6 @@ typedef enum {
 	NM_SETTING_VPN_ERROR_MISSING_PROPERTY,
 } NMSettingVpnError;
 
-#define NM_TYPE_SETTING_VPN_ERROR (nm_setting_vpn_error_get_type ()) 
-GType nm_setting_vpn_error_get_type (void);
-
 #define NM_SETTING_VPN_ERROR nm_setting_vpn_error_quark ()
 GQuark nm_setting_vpn_error_quark (void);
 
diff --git a/libnm-util/nm-setting-wimax.c b/libnm-util/nm-setting-wimax.c
index 38a442f..a099cad 100644
--- a/libnm-util/nm-setting-wimax.c
+++ b/libnm-util/nm-setting-wimax.c
@@ -53,29 +53,6 @@ nm_setting_wimax_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_wimax_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_WIMAX_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_WIMAX_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_WIMAX_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingWimaxError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingWimax, nm_setting_wimax, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-wimax.h b/libnm-util/nm-setting-wimax.h
index 2462ac0..6991b8e 100644
--- a/libnm-util/nm-setting-wimax.h
+++ b/libnm-util/nm-setting-wimax.h
@@ -48,9 +48,6 @@ typedef enum {
 	NM_SETTING_WIMAX_ERROR_MISSING_PROPERTY
 } NMSettingWimaxError;
 
-#define NM_TYPE_SETTING_WIMAX_ERROR (nm_setting_wimax_error_get_type ()) 
-GType nm_setting_wimax_error_get_type (void);
-
 #define NM_SETTING_WIMAX_ERROR nm_setting_wimax_error_quark ()
 GQuark nm_setting_wimax_error_quark (void);
 
diff --git a/libnm-util/nm-setting-wired.c b/libnm-util/nm-setting-wired.c
index d4e52e0..fb21711 100644
--- a/libnm-util/nm-setting-wired.c
+++ b/libnm-util/nm-setting-wired.c
@@ -61,29 +61,6 @@ nm_setting_wired_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_wired_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_WIRED_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_WIRED_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_WIRED_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingWiredError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingWired, nm_setting_wired, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-wired.h b/libnm-util/nm-setting-wired.h
index 36799fb..9eae7f2 100644
--- a/libnm-util/nm-setting-wired.h
+++ b/libnm-util/nm-setting-wired.h
@@ -52,9 +52,6 @@ typedef enum {
 	NM_SETTING_WIRED_ERROR_MISSING_PROPERTY
 } NMSettingWiredError;
 
-#define NM_TYPE_SETTING_WIRED_ERROR (nm_setting_wired_error_get_type ()) 
-GType nm_setting_wired_error_get_type (void);
-
 #define NM_SETTING_WIRED_ERROR nm_setting_wired_error_quark ()
 GQuark nm_setting_wired_error_quark (void);
 
diff --git a/libnm-util/nm-setting-wireless-security.c b/libnm-util/nm-setting-wireless-security.c
index cb9a608..9847312 100644
--- a/libnm-util/nm-setting-wireless-security.c
+++ b/libnm-util/nm-setting-wireless-security.c
@@ -75,37 +75,6 @@ nm_setting_wireless_security_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_wireless_security_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The required 802.1x setting is missing */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING, "Missing8021xSetting"),
-			/* The LEAP authentication algorithm requires use of 802.1x key management. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X, "LEAPRequires8021x"),
-			/* The LEAP authentication algorithm requires a username. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME, "LEAPRequiresUsername"),
-			/* Shared Key authentication can only be used with WEP encryption. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP, "SharedKeyRequiresWEP"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingWirelessSecurityError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingWirelessSecurity, nm_setting_wireless_security, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-wireless-security.h b/libnm-util/nm-setting-wireless-security.h
index 5f23893..0240b03 100644
--- a/libnm-util/nm-setting-wireless-security.h
+++ b/libnm-util/nm-setting-wireless-security.h
@@ -65,9 +65,6 @@ typedef enum {
 	NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP
 } NMSettingWirelessSecurityError;
 
-#define NM_TYPE_SETTING_WIRELESS_SECURITY_ERROR (nm_setting_wireless_security_error_get_type ()) 
-GType nm_setting_wireless_security_error_get_type (void);
-
 #define NM_SETTING_WIRELESS_SECURITY_ERROR nm_setting_wireless_security_error_quark ()
 GQuark nm_setting_wireless_security_error_quark (void);
 
diff --git a/libnm-util/nm-setting-wireless.c b/libnm-util/nm-setting-wireless.c
index 13fda9f..3188251 100644
--- a/libnm-util/nm-setting-wireless.c
+++ b/libnm-util/nm-setting-wireless.c
@@ -61,33 +61,6 @@ nm_setting_wireless_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_wireless_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unknown error. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_ERROR_UNKNOWN, "UnknownError"),
-			/* The specified property was invalid. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_ERROR_INVALID_PROPERTY, "InvalidProperty"),
-			/* The specified property was missing and is required. */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_ERROR_MISSING_PROPERTY, "MissingProperty"),
-			/* The required security setting is missing */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING, "MissingSecuritySetting"),
-			/* The 'channel' property requires a valid 'band' */
-			ENUM_ENTRY (NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND, "ChannelRequiresBand"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingWirelessError", values);
-	}
-	return etype;
-}
-
 
 G_DEFINE_TYPE (NMSettingWireless, nm_setting_wireless, NM_TYPE_SETTING)
 
diff --git a/libnm-util/nm-setting-wireless.h b/libnm-util/nm-setting-wireless.h
index 746466b..76d539a 100644
--- a/libnm-util/nm-setting-wireless.h
+++ b/libnm-util/nm-setting-wireless.h
@@ -60,9 +60,6 @@ typedef enum {
 	NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND
 } NMSettingWirelessError;
 
-#define NM_TYPE_SETTING_WIRELESS_ERROR (nm_setting_wireless_error_get_type ()) 
-GType nm_setting_wireless_error_get_type (void);
-
 #define NM_SETTING_WIRELESS_ERROR nm_setting_wireless_error_quark ()
 GQuark nm_setting_wireless_error_quark (void);
 
diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c
index 6144f18..21dab0b 100644
--- a/libnm-util/nm-setting.c
+++ b/libnm-util/nm-setting.c
@@ -60,27 +60,6 @@ nm_setting_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_setting_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_SETTING_ERROR_UNKNOWN, "UnknownError"),
-			ENUM_ENTRY (NM_SETTING_ERROR_PROPERTY_NOT_FOUND, "PropertyNotFound"),
-			ENUM_ENTRY (NM_SETTING_ERROR_PROPERTY_NOT_SECRET, "PropertyNotSecret"),
-			ENUM_ENTRY (NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH, "PropertyTypeMismatch"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMSettingError", values);
-	}
-	return etype;
-}
-
 G_DEFINE_ABSTRACT_TYPE (NMSetting, nm_setting, G_TYPE_OBJECT)
 
 #define NM_SETTING_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING, NMSettingPrivate))
diff --git a/libnm-util/nm-setting.h b/libnm-util/nm-setting.h
index 843b791..3a90925 100644
--- a/libnm-util/nm-setting.h
+++ b/libnm-util/nm-setting.h
@@ -60,9 +60,6 @@ typedef enum
 	NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH
 } NMSettingError;
 
-#define NM_TYPE_SETTING_ERROR (nm_setting_error_get_type ()) 
-GType nm_setting_error_get_type (void);
-
 #define NM_SETTING_ERROR nm_setting_error_quark ()
 GQuark nm_setting_error_quark (void);
 
diff --git a/libnm-util/nm-utils.h b/libnm-util/nm-utils.h
index 7684ed6..7bc536a 100644
--- a/libnm-util/nm-utils.h
+++ b/libnm-util/nm-utils.h
@@ -29,6 +29,7 @@
 #include <glib.h>
 
 #include "nm-connection.h"
+#include "nm-utils-enum-types.h"
 
 G_BEGIN_DECLS
 
diff --git a/marshallers/Makefile.am b/marshallers/Makefile.am
deleted file mode 100644
index 357029d..0000000
--- a/marshallers/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-noinst_LTLIBRARIES = libmarshallers.la
-
-BUILT_SOURCES = \
-	nm-marshal.h \
-	nm-marshal.c
-
-libmarshallers_la_SOURCES = \
-	nm-marshal-main.c
-
-libmarshallers_la_CPPFLAGS = \
-	$(GLIB_CFLAGS) \
-	-DG_DISABLE_DEPRECATED
-
-
-libmarshallers_la_LIBADD = $(GLIB_LIBS)
-
-EXTRA_DIST = nm-marshal.list
-CLEANFILES = $(BUILT_SOURCES)
-
-nm-marshal.h: nm-marshal.list
-	$(GLIB_GENMARSHAL) $< --prefix=_nm_marshal --header > $@
-
-nm-marshal.c: nm-marshal.list
-	$(GLIB_GENMARSHAL) $< --prefix=_nm_marshal --body > $@
-
-nm-marshal-main.c: nm-marshal.c nm-marshal.h
-
diff --git a/marshallers/nm-marshal-main.c b/marshallers/nm-marshal-main.c
deleted file mode 100644
index 7c20913..0000000
--- a/marshallers/nm-marshal-main.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "nm-marshal.h"
-#include "nm-marshal.c"
diff --git a/marshallers/nm-marshal.list b/marshallers/nm-marshal.list
deleted file mode 100644
index 6296e74..0000000
--- a/marshallers/nm-marshal.list
+++ /dev/null
@@ -1,30 +0,0 @@
-VOID:OBJECT
-VOID:OBJECT,STRING
-VOID:OBJECT,STRING,UINT
-VOID:OBJECT,UINT
-VOID:OBJECT,POINTER
-VOID:OBJECT,POINTER,UINT
-VOID:POINTER
-VOID:STRING,STRING,STRING
-VOID:UINT,UINT
-VOID:UINT,UINT,UINT
-VOID:STRING,STRING
-VOID:STRING,UCHAR
-VOID:STRING,OBJECT
-VOID:POINTER,POINTER
-VOID:STRING,STRING,STRING,UINT
-VOID:OBJECT,UINT,UINT
-VOID:STRING,INT
-VOID:INT,UINT
-VOID:INT,UINT,BOOLEAN
-VOID:OBJECT,OBJECT,ENUM
-VOID:POINTER,STRING
-VOID:STRING,BOXED
-BOOLEAN:POINTER,STRING,BOOLEAN,UINT,STRING,STRING
-VOID:STRING,BOOLEAN,UINT,STRING,STRING
-BOOLEAN:VOID
-VOID:STRING,BOOLEAN
-VOID:STRING,OBJECT,POINTER
-VOID:BOOLEAN,UINT
-UINT:STRING,STRING,POINTER,POINTER
-VOID:POINTER,POINTER,POINTER,POINTER,INT
diff --git a/src/Makefile.am b/src/Makefile.am
index 4a9b6a3..ec7f556 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,5 @@
 SUBDIRS= \
+	generated \
 	logging \
 	dns-manager \
 	vpn-manager \
@@ -22,7 +23,7 @@ SUBDIRS += . tests
 INCLUDES = -I${top_srcdir} \
            -I${top_srcdir}/include \
            -I${top_builddir}/include \
-           -I${top_builddir}/marshallers \
+           -I${top_srcdir}/src/generated \
            -I${top_srcdir}/src/logging \
            -I${top_srcdir}/src/dns-manager \
            -I${top_srcdir}/src/vpn-manager \
@@ -62,7 +63,7 @@ libtest_dhcp_la_CPPFLAGS = \
 	$(LIBNL_CFLAGS)
 
 libtest_dhcp_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/libnm-util/libnm-util.la \
 	$(GLIB_LIBS) \
 	$(DBUS_LIBS) \
@@ -276,7 +277,7 @@ NetworkManager_CPPFLAGS = \
 	-DARP_DEBUG
 
 NetworkManager_LDADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	./generated/libnm-generated.la \
 	./logging/libnm-logging.la \
 	./dns-manager/libdns-manager.la \
 	./vpn-manager/libvpn-manager.la \
diff --git a/src/bluez-manager/Makefile.am b/src/bluez-manager/Makefile.am
index c720b01..7bf00bd 100644
--- a/src/bluez-manager/Makefile.am
+++ b/src/bluez-manager/Makefile.am
@@ -4,8 +4,8 @@ INCLUDES = \
 	-I${top_builddir}/include \
 	-I${top_srcdir}/libnm-util \
 	-I${top_srcdir}/src \
-	-I${top_srcdir}/src/logging \
-	-I${top_builddir}/marshallers
+	-I${top_srcdir}/src/generated \
+	-I${top_srcdir}/src/logging
 
 noinst_LTLIBRARIES = libbluez-manager.la
 
@@ -30,7 +30,7 @@ libbluez_manager_la_CPPFLAGS = \
 	-DLOCALSTATEDIR=\"$(localstatedir)\"
 
 libbluez_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS) \
diff --git a/src/dhcp-manager/Makefile.am b/src/dhcp-manager/Makefile.am
index 849b8ef..fcea82e 100644
--- a/src/dhcp-manager/Makefile.am
+++ b/src/dhcp-manager/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES = \
 	-I${top_srcdir} \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
-	-I${top_builddir}/marshallers \
+	-I${top_srcdir}/src/generated \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/libnm-util \
 	-I${top_srcdir}/src
@@ -30,7 +30,6 @@ libdhcp_dhclient_la_CPPFLAGS = \
 	-DDHCLIENT_V$(DHCLIENT_VERSION)
 
 libdhcp_dhclient_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(top_builddir)/libnm-util/libnm-util.la \
 	$(DBUS_LIBS) \
@@ -56,7 +55,6 @@ libdhcp_manager_la_CPPFLAGS = \
 	-DDHCPCD_PATH=\"$(DHCPCD_PATH)\"
 
 libdhcp_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(builddir)/libdhcp-dhclient.la \
 	$(DBUS_LIBS) \
diff --git a/src/dhcp-manager/nm-dhcp-manager.c b/src/dhcp-manager/nm-dhcp-manager.c
index e65f693..1af1b16 100644
--- a/src/dhcp-manager/nm-dhcp-manager.c
+++ b/src/dhcp-manager/nm-dhcp-manager.c
@@ -44,8 +44,6 @@
 #include "nm-dbus-glib-types.h"
 #include "nm-glib-compat.h"
 
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
 GQuark
 nm_dhcp_manager_error_quark (void)
 {
@@ -57,22 +55,6 @@ nm_dhcp_manager_error_quark (void)
     return ret;
 }
 
-GType
-nm_dhcp_manager_error_get_type (void)
-{
-    static GType etype = 0;
-
-    if (etype == 0) {
-        static const GEnumValue values[] = {
-            ENUM_ENTRY (NM_DHCP_MANAGER_ERROR_BAD_CLIENT, "BadClient"),
-            ENUM_ENTRY (NM_DHCP_MANAGER_ERROR_INTERNAL,   "InternalError"),
-            { 0, 0, 0 }
-        };
-        etype = g_enum_register_static ("NMDhcpManagerError", values);
-    }
-    return etype;
-}
-
 #define NM_DHCP_CLIENT_DBUS_SERVICE "org.freedesktop.nm_dhcp_client"
 #define NM_DHCP_CLIENT_DBUS_IFACE   "org.freedesktop.nm_dhcp_client"
 
diff --git a/src/dhcp-manager/nm-dhcp-manager.h b/src/dhcp-manager/nm-dhcp-manager.h
index 9d83d09..a5cfb04 100644
--- a/src/dhcp-manager/nm-dhcp-manager.h
+++ b/src/dhcp-manager/nm-dhcp-manager.h
@@ -33,16 +33,14 @@
 #include "nm-dhcp4-config.h"
 #include "nm-hostname-provider.h"
 
-enum {
+typedef enum {
     NM_DHCP_MANAGER_ERROR_BAD_CLIENT = 0,
     NM_DHCP_MANAGER_ERROR_INTERNAL = 1,
-};
+} NMDHCPManagerError;
 
 #define NM_DHCP_MANAGER_ERROR (nm_dhcp_manager_error_quark ())
-#define NN_TYPE_DHCP_MANAGER_ERROR (nm_dhcp_manager_error_get_type ())
 
 GQuark nm_dhcp_manager_error_quark    (void);
-GType  nm_dhcp_manager_error_get_type (void);
 
 
 #define NM_TYPE_DHCP_MANAGER            (nm_dhcp_manager_get_type ())
diff --git a/src/firewall-manager/Makefile.am b/src/firewall-manager/Makefile.am
index 1b98d6a..2cfe32d 100644
--- a/src/firewall-manager/Makefile.am
+++ b/src/firewall-manager/Makefile.am
@@ -2,8 +2,7 @@ INCLUDES = \
 	-I${top_srcdir}/src \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/include \
-	-I${top_srcdir}/libnm-util \
-	-I${top_builddir}/marshallers
+	-I${top_srcdir}/libnm-util
 
 noinst_LTLIBRARIES = libfirewall-manager.la
 
@@ -18,7 +17,6 @@ libfirewall_manager_la_CPPFLAGS = \
 	-DNM_LOCALSTATEDIR=\"$(localstatedir)\"
 
 libfirewall_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS)
diff --git a/src/generated/Makefile.am b/src/generated/Makefile.am
new file mode 100644
index 0000000..29e1525
--- /dev/null
+++ b/src/generated/Makefile.am
@@ -0,0 +1,75 @@
+include $(GLIB_MAKEFILE)
+
+noinst_LTLIBRARIES = libnm-generated.la
+
+libnm_generated_la_SOURCES = \
+	nm-enum-types.c \
+	nm-enum-types.h \
+	nm-marshal.c \
+	nm-marshal.h
+
+nm_daemon_all_sources = \
+	$(top_srcdir)/src/*.[ch] \
+	$(top_srcdir)/src/logging/*.[ch] \
+	$(top_srcdir)/src/dns-manager/*.[ch] \
+	$(top_srcdir)/src/vpn-manager/*.[ch] \
+	$(top_srcdir)/src/dhcp-manager/*.[ch] \
+	$(top_srcdir)/src/ip6-manager/*.[ch] \
+	$(top_srcdir)/src/supplicant-manager/*.[ch] \
+	$(top_srcdir)/src/backends/*.[ch] \
+	$(top_srcdir)/src/ppp-manager/*.[ch] \
+	$(top_srcdir)/src/dnsmasq-manager/*.[ch] \
+	$(top_srcdir)/src/modem-manager/*.[ch] \
+	$(top_srcdir)/src/bluez-manager/*.[ch] \
+	$(top_srcdir)/src/firewall-manager/*.[ch] \
+	$(top_srcdir)/src/settings/*.[ch]
+
+if WITH_WIMAX
+nm_daemon_all_sources += $(top_srcdir)/src/wimax/*.[ch]
+endif
+
+nm_daemon_sources = \
+	$(filter-out %-glue.h %-bindings.h, $(wildcard $(nm_daemon_all_sources)))
+
+GLIB_GENERATED = nm-enum-types.h nm-enum-types.c
+nm_enum_types_sources = $(nm_daemon_sources)
+GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
+GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
+
+GLIB_GENERATED += nm-marshal.h nm-marshal.c
+nm_marshal_sources = $(nm_daemon_sources)
+
+INCLUDES = \
+	-I${top_srcdir}/include \
+	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/logging \
+	-I${top_srcdir}/src/dns-manager \
+	-I${top_srcdir}/src/vpn-manager \
+	-I${top_srcdir}/src/dhcp-manager \
+	-I${top_srcdir}/src/ip6-manager \
+	-I${top_srcdir}/src/supplicant-manager \
+	-I${top_srcdir}/src/backends \
+	-I${top_srcdir}/src/ppp-manager \
+	-I${top_srcdir}/src/dnsmasq-manager \
+	-I${top_srcdir}/src/modem-manager \
+	-I$(top_srcdir)/src/bluez-manager \
+	-I$(top_srcdir)/src/firewall-manager \
+	-I$(top_srcdir)/src/settings \
+	-I$(top_srcdir)/src/wimax \
+	-I$(top_srcdir)/libnm-util
+
+libnm_generated_la_CPPFLAGS = \
+	$(DBUS_CFLAGS) \
+	$(GLIB_CFLAGS) \
+	$(GUDEV_CFLAGS) \
+	$(LIBNL_CFLAGS) \
+	$(GMODULE_CFLAGS) \
+	$(POLKIT_CFLAGS) \
+	$(SYSTEMD_CFLAGS) \
+	$(IWMX_SDK_CFLAGS)
+
+libnm_generated_la_LIBADD = \
+	$(GLIB_LIBS)
+
+BUILT_SOURCES = $(GLIB_GENERATED)
+
diff --git a/src/ip6-manager/Makefile.am b/src/ip6-manager/Makefile.am
index c88a9cc..fd3e929 100644
--- a/src/ip6-manager/Makefile.am
+++ b/src/ip6-manager/Makefile.am
@@ -2,8 +2,8 @@ INCLUDES = \
 	-I${top_srcdir} \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
-	-I${top_builddir}/marshallers \
 	-I${top_srcdir}/libnm-util \
+	-I${top_srcdir}/src/generated \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/src
 
@@ -20,7 +20,7 @@ libip6_manager_la_CPPFLAGS = \
 	-DG_DISABLE_DEPRECATED
 
 libip6_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(LIBNL_LIBS) \
 	$(DBUS_LIBS) \
diff --git a/src/logging/Makefile.am b/src/logging/Makefile.am
index 51a6b25..2c308f1 100644
--- a/src/logging/Makefile.am
+++ b/src/logging/Makefile.am
@@ -1,3 +1,5 @@
+include $(GLIB_MAKEFILE)
+
 noinst_LTLIBRARIES = libnm-logging.la
 
 libnm_logging_la_SOURCES = \
diff --git a/src/logging/nm-logging.c b/src/logging/nm-logging.c
index 26c8670..a2b0eba 100644
--- a/src/logging/nm-logging.c
+++ b/src/logging/nm-logging.c
@@ -94,13 +94,6 @@ static const LogDesc domain_descs[] = {
 
 /************************************************************************/
 
-enum {
-    NM_LOGGING_ERROR_UNKNOWN_LEVEL = 0,
-    NM_LOGGING_ERROR_UNKNOWN_DOMAIN = 1,
-};
-
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
 GQuark
 nm_logging_error_quark (void)
 {
@@ -111,22 +104,6 @@ nm_logging_error_quark (void)
     return ret;
 }
 
-GType
-nm_logging_error_get_type (void)
-{
-    static GType etype = 0;
-
-    if (etype == 0) {
-        static const GEnumValue values[] = {
-            ENUM_ENTRY (NM_LOGGING_ERROR_UNKNOWN_LEVEL,  "UnknownLevel"),
-            ENUM_ENTRY (NM_LOGGING_ERROR_UNKNOWN_DOMAIN, "UnknownDomain"),
-            { 0, 0, 0 }
-        };
-        etype = g_enum_register_static ("NMLoggingError", values);
-    }
-    return etype;
-}
-
 /************************************************************************/
 
 gboolean
diff --git a/src/logging/nm-logging.h b/src/logging/nm-logging.h
index 68866c6..5567698 100644
--- a/src/logging/nm-logging.h
+++ b/src/logging/nm-logging.h
@@ -66,10 +66,13 @@ enum {
 	LOGL_DEBUG = 0x00000008
 };
 
+typedef enum {
+    NM_LOGGING_ERROR_UNKNOWN_LEVEL = 0,
+    NM_LOGGING_ERROR_UNKNOWN_DOMAIN = 1,
+} NMLoggingError;
+
 #define NM_LOGGING_ERROR (nm_logging_error_quark ())
-#define NM_TYPE_LOGGING_ERROR (nm_logging_error_get_type ())
 GQuark nm_logging_error_quark    (void);
-GType  nm_logging_error_get_type (void);
 
 
 #define nm_log_err(domain, ...) \
diff --git a/src/modem-manager/Makefile.am b/src/modem-manager/Makefile.am
index 2060866..ad83e03 100644
--- a/src/modem-manager/Makefile.am
+++ b/src/modem-manager/Makefile.am
@@ -1,10 +1,12 @@
+include $(GLIB_MAKEFILE)
+
 INCLUDES = \
 	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/generated \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
-	-I${top_srcdir}/libnm-util \
-	-I${top_builddir}/marshallers
+	-I${top_srcdir}/libnm-util
 
 noinst_LTLIBRARIES = libmodem-manager.la
 
@@ -24,7 +26,7 @@ libmodem_manager_la_CPPFLAGS = \
 	$(DBUS_CFLAGS)
 
 libmodem_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(LIBNL_LIBS) \
 	$(DBUS_LIBS)
diff --git a/src/modem-manager/nm-modem-cdma.c b/src/modem-manager/nm-modem-cdma.c
index c822d35..fa19a34 100644
--- a/src/modem-manager/nm-modem-cdma.c
+++ b/src/modem-manager/nm-modem-cdma.c
@@ -27,6 +27,7 @@
 #include "nm-dbus-glib-types.h"
 #include "nm-modem-cdma.h"
 #include "nm-modem-types.h"
+#include "nm-enum-types.h"
 #include "nm-device.h"
 #include "nm-device-private.h"
 #include "nm-dbus-manager.h"
@@ -47,14 +48,7 @@ typedef struct {
 } NMModemCdmaPrivate;
 
 
-typedef enum {
-	NM_CDMA_ERROR_CONNECTION_NOT_CDMA = 0,
-	NM_CDMA_ERROR_CONNECTION_INVALID,
-	NM_CDMA_ERROR_CONNECTION_INCOMPATIBLE,
-} NMCdmaError;
-
 #define NM_CDMA_ERROR (nm_cdma_error_quark ())
-#define NM_TYPE_CDMA_ERROR (nm_cdma_error_get_type ())
 
 static GQuark
 nm_cdma_error_quark (void)
@@ -65,29 +59,6 @@ nm_cdma_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_cdma_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a CDMA connection. */
-			ENUM_ENTRY (NM_CDMA_ERROR_CONNECTION_NOT_CDMA, "ConnectionNotCdma"),
-			/* Connection was not a valid CDMA connection. */
-			ENUM_ENTRY (NM_CDMA_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_CDMA_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMCdmaError", values);
-	}
-	return etype;
-}
-
 
 NMModem *
 nm_modem_cdma_new (const char *path,
diff --git a/src/modem-manager/nm-modem-cdma.h b/src/modem-manager/nm-modem-cdma.h
index 0abe4e0..8882dac 100644
--- a/src/modem-manager/nm-modem-cdma.h
+++ b/src/modem-manager/nm-modem-cdma.h
@@ -33,6 +33,12 @@ G_BEGIN_DECLS
 #define NM_IS_MODEM_CDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_MODEM_CDMA))
 #define NM_MODEM_CDMA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_MODEM_CDMA, NMModemCdmaClass))
 
+typedef enum {
+	NM_CDMA_ERROR_CONNECTION_NOT_CDMA = 0,
+	NM_CDMA_ERROR_CONNECTION_INVALID,
+	NM_CDMA_ERROR_CONNECTION_INCOMPATIBLE,
+} NMCdmaError;
+
 typedef struct {
 	NMModem parent;
 } NMModemCdma;
diff --git a/src/modem-manager/nm-modem-gsm.c b/src/modem-manager/nm-modem-gsm.c
index dce55d6..66b7ad9 100644
--- a/src/modem-manager/nm-modem-gsm.c
+++ b/src/modem-manager/nm-modem-gsm.c
@@ -32,6 +32,7 @@
 #include "nm-setting-gsm.h"
 #include "nm-setting-ppp.h"
 #include "nm-modem-types.h"
+#include "nm-enum-types.h"
 #include "nm-logging.h"
 #include "NetworkManagerUtils.h"
 
@@ -76,14 +77,7 @@ typedef struct {
 } NMModemGsmPrivate;
 
 
-typedef enum {
-	NM_GSM_ERROR_CONNECTION_NOT_GSM = 0,
-	NM_GSM_ERROR_CONNECTION_INVALID,
-	NM_GSM_ERROR_CONNECTION_INCOMPATIBLE,
-} NMGsmError;
-
 #define NM_GSM_ERROR (nm_gsm_error_quark ())
-#define NM_TYPE_GSM_ERROR (nm_gsm_error_get_type ())
 
 static GQuark
 nm_gsm_error_quark (void)
@@ -94,30 +88,6 @@ nm_gsm_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_gsm_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a GSM connection. */
-			ENUM_ENTRY (NM_GSM_ERROR_CONNECTION_NOT_GSM, "ConnectionNotGsm"),
-			/* Connection was not a valid GSM connection. */
-			ENUM_ENTRY (NM_GSM_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_GSM_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMGsmError", values);
-	}
-	return etype;
-}
-
-
 NMModem *
 nm_modem_gsm_new (const char *path,
                   const char *device,
diff --git a/src/modem-manager/nm-modem-gsm.h b/src/modem-manager/nm-modem-gsm.h
index f481bdb..d3a1150 100644
--- a/src/modem-manager/nm-modem-gsm.h
+++ b/src/modem-manager/nm-modem-gsm.h
@@ -33,6 +33,12 @@ G_BEGIN_DECLS
 #define NM_IS_MODEM_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),	 NM_TYPE_MODEM_GSM))
 #define NM_MODEM_GSM_GET_CLASS(obj)	 (G_TYPE_INSTANCE_GET_CLASS ((obj),	 NM_TYPE_MODEM_GSM, NMModemGsmClass))
 
+typedef enum {
+	NM_GSM_ERROR_CONNECTION_NOT_GSM = 0,
+	NM_GSM_ERROR_CONNECTION_INVALID,
+	NM_GSM_ERROR_CONNECTION_INCOMPATIBLE,
+} NMGsmError;
+
 typedef struct {
 	NMModem parent;
 } NMModemGsm;
diff --git a/src/nm-config.c b/src/nm-config.c
index a19d9d9..aa89b17 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -47,25 +47,6 @@ nm_config_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_config_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Not enough memory to parse the config file. */
-			ENUM_ENTRY (NM_CONFIG_ERROR_NO_MEMORY, "NoMemory"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMConfigError", values);
-	}
-	return etype;
-}
-
 /************************************************************************/
 
 const char *
diff --git a/src/nm-config.h b/src/nm-config.h
index fae344f..9abff58 100644
--- a/src/nm-config.h
+++ b/src/nm-config.h
@@ -32,8 +32,6 @@ typedef enum {
 
 #define NM_CONFIG_ERROR (nm_config_error_quark ())
 GQuark nm_config_error_quark (void);
-#define NM_TYPE_CONFIG_ERROR (nm_config_error_get_type ())
-GType nm_config_error_get_type (void);
 
 
 NMConfig *nm_config_new (const char *cli_config_path,
diff --git a/src/nm-device-bt.c b/src/nm-device-bt.c
index 7a43e10..cc16642 100644
--- a/src/nm-device-bt.c
+++ b/src/nm-device-bt.c
@@ -44,6 +44,7 @@
 #include "nm-setting-ppp.h"
 #include "nm-device-bt-glue.h"
 #include "NetworkManagerUtils.h"
+#include "nm-enum-types.h"
 
 #define BLUETOOTH_DUN_UUID "dun"
 #define BLUETOOTH_NAP_UUID "nap"
@@ -90,14 +91,7 @@ enum {
 static guint signals[LAST_SIGNAL] = { 0 };
 
 
-typedef enum {
-	NM_BT_ERROR_CONNECTION_NOT_BT = 0,
-	NM_BT_ERROR_CONNECTION_INVALID,
-	NM_BT_ERROR_CONNECTION_INCOMPATIBLE,
-} NMBtError;
-
 #define NM_BT_ERROR (nm_bt_error_quark ())
-#define NM_TYPE_BT_ERROR (nm_bt_error_get_type ())
 
 static GQuark
 nm_bt_error_quark (void)
@@ -108,30 +102,6 @@ nm_bt_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_bt_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a BT connection. */
-			ENUM_ENTRY (NM_BT_ERROR_CONNECTION_NOT_BT, "ConnectionNotBt"),
-			/* Connection was not a valid BT connection. */
-			ENUM_ENTRY (NM_BT_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_BT_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMBtError", values);
-	}
-	return etype;
-}
-
-
 guint32 nm_device_bt_get_capabilities (NMDeviceBt *self)
 {
 	g_return_val_if_fail (self != NULL, NM_BT_CAPABILITY_NONE);
diff --git a/src/nm-device-bt.h b/src/nm-device-bt.h
index d9a865f..d6a3875 100644
--- a/src/nm-device-bt.h
+++ b/src/nm-device-bt.h
@@ -33,6 +33,12 @@ G_BEGIN_DECLS
 #define NM_IS_DEVICE_BT_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE_BT))
 #define NM_DEVICE_BT_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE_BT, NMDeviceBtClass))
 
+typedef enum {
+	NM_BT_ERROR_CONNECTION_NOT_BT = 0,
+	NM_BT_ERROR_CONNECTION_INVALID,
+	NM_BT_ERROR_CONNECTION_INCOMPATIBLE,
+} NMBtError;
+
 #define NM_DEVICE_BT_HW_ADDRESS   "hw-address"
 #define NM_DEVICE_BT_NAME         "name"
 #define NM_DEVICE_BT_CAPABILITIES "bt-capabilities"
diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c
index e88e09d..589f7ec 100644
--- a/src/nm-device-ethernet.c
+++ b/src/nm-device-ethernet.c
@@ -53,6 +53,7 @@
 #include "nm-logging.h"
 #include "nm-properties-changed-signal.h"
 #include "nm-utils.h"
+#include "nm-enum-types.h"
 
 #include "nm-device-ethernet-glue.h"
 
@@ -63,15 +64,7 @@ G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE_WIRED)
 
 #define WIRED_SECRETS_TRIES "wired-secrets-tries"
 
-typedef enum
-{
-	NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED = 0,
-	NM_ETHERNET_ERROR_CONNECTION_INVALID,
-	NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
-} NMEthernetError;
-
 #define NM_ETHERNET_ERROR (nm_ethernet_error_quark ())
-#define NM_TYPE_ETHERNET_ERROR (nm_ethernet_error_get_type ()) 
 
 typedef enum
 {
@@ -143,29 +136,6 @@ nm_ethernet_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_ethernet_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a wired connection. */
-			ENUM_ENTRY (NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED, "ConnectionNotWired"),
-			/* Connection was not a valid wired connection. */
-			ENUM_ENTRY (NM_ETHERNET_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMEthernetError", values);
-	}
-	return etype;
-}
-
 static void
 _update_s390_subchannels (NMDeviceEthernet *self)
 {
diff --git a/src/nm-device-ethernet.h b/src/nm-device-ethernet.h
index 51993db..b3e058f 100644
--- a/src/nm-device-ethernet.h
+++ b/src/nm-device-ethernet.h
@@ -35,6 +35,13 @@ G_BEGIN_DECLS
 #define NM_IS_DEVICE_ETHERNET_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE_ETHERNET))
 #define NM_DEVICE_ETHERNET_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass))
 
+typedef enum
+{
+	NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED = 0,
+	NM_ETHERNET_ERROR_CONNECTION_INVALID,
+	NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE,
+} NMEthernetError;
+
 #define NM_DEVICE_ETHERNET_HW_ADDRESS "hw-address"
 #define NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS "perm-hw-address"
 #define NM_DEVICE_ETHERNET_SPEED "speed"
diff --git a/src/nm-device-infiniband.c b/src/nm-device-infiniband.c
index 0aa1da5..5dd6697 100644
--- a/src/nm-device-infiniband.c
+++ b/src/nm-device-infiniband.c
@@ -32,6 +32,7 @@
 #include "nm-utils.h"
 #include "NetworkManagerUtils.h"
 #include "nm-device-private.h"
+#include "nm-enum-types.h"
 
 #include "nm-device-infiniband-glue.h"
 
@@ -40,15 +41,7 @@ G_DEFINE_TYPE (NMDeviceInfiniband, nm_device_infiniband, NM_TYPE_DEVICE_WIRED)
 
 #define NM_DEVICE_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandPrivate))
 
-typedef enum
-{
-	NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND = 0,
-	NM_INFINIBAND_ERROR_CONNECTION_INVALID,
-	NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE,
-} NMInfinibandError;
-
 #define NM_INFINIBAND_ERROR (nm_infiniband_error_quark ())
-#define NM_TYPE_INFINIBAND_ERROR (nm_infiniband_error_get_type ())
 
 typedef struct {
 	int dummy;
@@ -79,29 +72,6 @@ nm_infiniband_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_infiniband_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a wired connection. */
-			ENUM_ENTRY (NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND, "ConnectionNotInfiniband"),
-			/* Connection was not a valid wired connection. */
-			ENUM_ENTRY (NM_INFINIBAND_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMInfinibandError", values);
-	}
-	return etype;
-}
-
 static GObject*
 constructor (GType type,
 			 guint n_construct_params,
diff --git a/src/nm-device-infiniband.h b/src/nm-device-infiniband.h
index d70abd9..d4c78b4 100644
--- a/src/nm-device-infiniband.h
+++ b/src/nm-device-infiniband.h
@@ -34,6 +34,12 @@ G_BEGIN_DECLS
 #define NM_IS_DEVICE_INFINIBAND_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE_INFINIBAND))
 #define NM_DEVICE_INFINIBAND_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandClass))
 
+typedef enum {
+	NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND = 0,
+	NM_INFINIBAND_ERROR_CONNECTION_INVALID,
+	NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE,
+} NMInfinibandError;
+
 #define NM_DEVICE_INFINIBAND_HW_ADDRESS "hw-address"
 #define NM_DEVICE_INFINIBAND_CARRIER "carrier"
 
diff --git a/src/nm-device-olpc-mesh.c b/src/nm-device-olpc-mesh.c
index 983031d..f6390c1 100644
--- a/src/nm-device-olpc-mesh.c
+++ b/src/nm-device-olpc-mesh.c
@@ -53,6 +53,7 @@
 #include "nm-setting-olpc-mesh.h"
 #include "nm-system.h"
 #include "nm-manager.h"
+#include "nm-enum-types.h"
 #include "wifi-utils.h"
 
 /* This is a bug; but we can't really change API now... */
@@ -83,15 +84,7 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-typedef enum
-{
-	NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH = 0,
-	NM_OLPC_MESH_ERROR_CONNECTION_INVALID,
-	NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE,
-} NMOlpcMeshError;
-
 #define NM_OLPC_MESH_ERROR (nm_olpc_mesh_error_quark ())
-#define NM_TYPE_OLPC_MESH_ERROR (nm_olpc_mesh_error_get_type ())
 
 
 struct _NMDeviceOlpcMeshPrivate
@@ -120,29 +113,6 @@ nm_olpc_mesh_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_olpc_mesh_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a wireless connection. */
-			ENUM_ENTRY (NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH, "ConnectionNotMesh"),
-			/* Connection was not a valid wireless connection. */
-			ENUM_ENTRY (NM_OLPC_MESH_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMOlpcMeshError", values);
-	}
-	return etype;
-}
-
 static guint32
 real_get_generic_capabilities (NMDevice *dev)
 {
diff --git a/src/nm-device-olpc-mesh.h b/src/nm-device-olpc-mesh.h
index bcc03e5..cf3b695 100644
--- a/src/nm-device-olpc-mesh.h
+++ b/src/nm-device-olpc-mesh.h
@@ -42,6 +42,13 @@ G_BEGIN_DECLS
 #define NM_IS_DEVICE_OLPC_MESH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE_OLPC_MESH))
 #define NM_DEVICE_OLPC_MESH_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE_OLPC_MESH, NMDeviceOlpcMeshClass))
 
+typedef enum
+{
+	NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH = 0,
+	NM_OLPC_MESH_ERROR_CONNECTION_INVALID,
+	NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE,
+} NMOlpcMeshError;
+
 #define NM_DEVICE_OLPC_MESH_HW_ADDRESS     "hw-address"
 #define NM_DEVICE_OLPC_MESH_COMPANION      "companion"
 #define NM_DEVICE_OLPC_MESH_BITRATE        "bitrate"
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index f89b8fd..79361cc 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -57,6 +57,7 @@
 #include "nm-setting-ip6-config.h"
 #include "nm-system.h"
 #include "nm-settings-connection.h"
+#include "nm-enum-types.h"
 #include "wifi-utils.h"
 
 static gboolean impl_device_get_access_points (NMDeviceWifi *device,
@@ -183,15 +184,7 @@ static void cull_scan_list (NMDeviceWifi *self);
 
 /*****************************************************************/
 
-typedef enum {
-	NM_WIFI_ERROR_CONNECTION_NOT_WIRELESS = 0,
-	NM_WIFI_ERROR_CONNECTION_INVALID,
-	NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE,
-	NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND,
-} NMWifiError;
-
 #define NM_WIFI_ERROR (nm_wifi_error_quark ())
-#define NM_TYPE_WIFI_ERROR (nm_wifi_error_get_type ())
 
 static GQuark
 nm_wifi_error_quark (void)
@@ -202,31 +195,6 @@ nm_wifi_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_wifi_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a wireless connection. */
-			ENUM_ENTRY (NM_WIFI_ERROR_CONNECTION_NOT_WIRELESS, "ConnectionNotWireless"),
-			/* Connection was not a valid wireless connection. */
-			ENUM_ENTRY (NM_WIFI_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			/* Given access point was not in this device's scan list. */
-			ENUM_ENTRY (NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND, "AccessPointNotFound"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMWifiError", values);
-	}
-	return etype;
-}
-
 /*****************************************************************/
 
 /* IPW rfkill handling (until 2.6.33) */
diff --git a/src/nm-device-wifi.h b/src/nm-device-wifi.h
index 402dac0..73a554f 100644
--- a/src/nm-device-wifi.h
+++ b/src/nm-device-wifi.h
@@ -41,6 +41,12 @@ G_BEGIN_DECLS
 #define NM_IS_DEVICE_WIFI_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE_WIFI))
 #define NM_DEVICE_WIFI_GET_CLASS(obj)	(G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE_WIFI, NMDeviceWifiClass))
 
+typedef enum {
+	NM_WIFI_ERROR_CONNECTION_NOT_WIRELESS = 0,
+	NM_WIFI_ERROR_CONNECTION_INVALID,
+	NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE,
+	NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND,
+} NMWifiError;
 
 #define NM_DEVICE_WIFI_HW_ADDRESS          "hw-address"
 #define NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS "perm-hw-address"
diff --git a/src/nm-device.c b/src/nm-device.c
index 7789054..f3e011c 100644
--- a/src/nm-device.c
+++ b/src/nm-device.c
@@ -58,6 +58,7 @@
 #include "nm-rfkill.h"
 #include "nm-firewall-manager.h"
 #include "nm-properties-changed-signal.h"
+#include "nm-enum-types.h"
 
 static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context);
 
@@ -69,14 +70,7 @@ static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *con
 #define DBUS_G_TYPE_UINT_STRUCT (dbus_g_type_get_struct ("GValueArray", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID))
 
 /***********************************************************/
-typedef enum {
-	NM_DEVICE_ERROR_CONNECTION_ACTIVATING = 0,
-	NM_DEVICE_ERROR_CONNECTION_INVALID,
-	NM_DEVICE_ERROR_NOT_ACTIVE,
-} NMDeviceError;
-
 #define NM_DEVICE_ERROR (nm_device_error_quark ())
-#define NM_TYPE_DEVICE_ERROR (nm_device_error_get_type ())
 
 static GQuark
 nm_device_error_quark (void)
@@ -87,29 +81,6 @@ nm_device_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_device_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection is already activating. */
-			ENUM_ENTRY (NM_DEVICE_ERROR_CONNECTION_ACTIVATING, "ConnectionActivating"),
-			/* Connection is invalid for this device. */
-			ENUM_ENTRY (NM_DEVICE_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Operation could not be performed because the device is not active. */
-			ENUM_ENTRY (NM_DEVICE_ERROR_NOT_ACTIVE, "NotActive"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMDeviceError", values);
-	}
-	return etype;
-}
-
 /***********************************************************/
 
 enum {
diff --git a/src/nm-device.h b/src/nm-device.h
index e69b989..e770238 100644
--- a/src/nm-device.h
+++ b/src/nm-device.h
@@ -71,6 +71,12 @@ G_BEGIN_DECLS
 
 typedef enum NMActStageReturn NMActStageReturn;
 
+typedef enum {
+	NM_DEVICE_ERROR_CONNECTION_ACTIVATING = 0,
+	NM_DEVICE_ERROR_CONNECTION_INVALID,
+	NM_DEVICE_ERROR_NOT_ACTIVE,
+} NMDeviceError;
+
 typedef struct {
 	GObject parent;
 } NMDevice;
diff --git a/src/nm-manager.c b/src/nm-manager.c
index a53dab8..87885f2 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -63,6 +63,8 @@
 #include "nm-utils.h"
 #include "nm-device-factory.h"
 #include "wifi-utils.h"
+#include "nm-enum-types.h"
+#include "nm-logging-enum-types.h"
 
 #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd"
 #define NM_AUTOIP_DBUS_IFACE   "org.freedesktop.nm_avahi_autoipd"
@@ -270,20 +272,7 @@ enum {
 
 /************************************************************************/
 
-typedef enum {
-	NM_MANAGER_ERROR_UNKNOWN_CONNECTION = 0,
-	NM_MANAGER_ERROR_UNKNOWN_DEVICE,
-	NM_MANAGER_ERROR_UNMANAGED_DEVICE,
-	NM_MANAGER_ERROR_SYSTEM_CONNECTION,
-	NM_MANAGER_ERROR_PERMISSION_DENIED,
-	NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE,
-	NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE,
-	NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED,
-	NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE,
-} NMManagerError;
-
 #define NM_MANAGER_ERROR (nm_manager_error_quark ())
-#define NM_TYPE_MANAGER_ERROR (nm_manager_error_get_type ()) 
 
 static GQuark
 nm_manager_error_quark (void)
@@ -294,41 +283,6 @@ nm_manager_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_manager_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not provided by any known settings service. */
-			ENUM_ENTRY (NM_MANAGER_ERROR_UNKNOWN_CONNECTION, "UnknownConnection"),
-			/* Unknown device. */
-			ENUM_ENTRY (NM_MANAGER_ERROR_UNKNOWN_DEVICE, "UnknownDevice"),
-			/* Unmanaged device. */
-			ENUM_ENTRY (NM_MANAGER_ERROR_UNMANAGED_DEVICE, "UnmanagedDevice"),
-			/* Connection was superceded by a system connection. */
-			ENUM_ENTRY (NM_MANAGER_ERROR_SYSTEM_CONNECTION, "SystemConnection"),
-			/* User does not have the permission to activate this connection. */
-			ENUM_ENTRY (NM_MANAGER_ERROR_PERMISSION_DENIED, "PermissionDenied"),
-			/* The connection was not active. */
-			ENUM_ENTRY (NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE, "ConnectionNotActive"),
-			/* The manager is already in the requested sleep state */
-			ENUM_ENTRY (NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE, "AlreadyAsleepOrAwake"),
-			/* The manager is already in the requested enabled/disabled state */
-			ENUM_ENTRY (NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED, "AlreadyEnabledOrDisabled"),
-			/* The requested operation is unsupported for this type of connection */
-			ENUM_ENTRY (NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE, "UnsupportedConnectionType"),
-			{ 0, 0, 0 },
-		};
-		etype = g_enum_register_static ("NMManagerError", values);
-	}
-	return etype;
-}
-
 /************************************************************************/
 
 static NMDevice *
diff --git a/src/nm-manager.h b/src/nm-manager.h
index f2c0e5b..c3c08e4 100644
--- a/src/nm-manager.h
+++ b/src/nm-manager.h
@@ -35,6 +35,18 @@
 #define NM_IS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_MANAGER))
 #define NM_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_MANAGER, NMManagerClass))
 
+typedef enum {
+	NM_MANAGER_ERROR_UNKNOWN_CONNECTION = 0,
+	NM_MANAGER_ERROR_UNKNOWN_DEVICE,
+	NM_MANAGER_ERROR_UNMANAGED_DEVICE,
+	NM_MANAGER_ERROR_SYSTEM_CONNECTION,
+	NM_MANAGER_ERROR_PERMISSION_DENIED,
+	NM_MANAGER_ERROR_CONNECTION_NOT_ACTIVE,
+	NM_MANAGER_ERROR_ALREADY_ASLEEP_OR_AWAKE,
+	NM_MANAGER_ERROR_ALREADY_ENABLED_OR_DISABLED,
+	NM_MANAGER_ERROR_UNSUPPORTED_CONNECTION_TYPE,
+} NMManagerError;
+
 #define NM_MANAGER_VERSION "version"
 #define NM_MANAGER_STATE "state"
 #define NM_MANAGER_NETWORKING_ENABLED "networking-enabled"
diff --git a/src/nm-session-utils.c b/src/nm-session-utils.c
index 5776d41..269e2f8 100644
--- a/src/nm-session-utils.c
+++ b/src/nm-session-utils.c
@@ -34,31 +34,6 @@ nm_session_monitor_error_quark (void)
 	return ret;
 }
 
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_session_monitor_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Some I/O operation on the CK database failed */
-			ENUM_ENTRY (NM_SESSION_MONITOR_ERROR_IO_ERROR, "IOError"),
-			/* Error parsing the CK database */
-			ENUM_ENTRY (NM_SESSION_MONITOR_ERROR_MALFORMED_DATABASE, "MalformedDatabase"),
-			/* Username or UID could could not be found */
-			ENUM_ENTRY (NM_SESSION_MONITOR_ERROR_UNKNOWN_USER, "UnknownUser"),
-			/* No ConsoleKit database */
-			ENUM_ENTRY (NM_SESSION_MONITOR_ERROR_NO_DATABASE, "NoDatabase"),
-			{ 0, 0, 0 }
-		};
-
-		etype = g_enum_register_static ("NMSessionMonitorError", values);
-	}
-	return etype;
-}
-
 /********************************************************************/
 
 gboolean
diff --git a/src/ppp-manager/Makefile.am b/src/ppp-manager/Makefile.am
index 22deb41..6eb77ef 100644
--- a/src/ppp-manager/Makefile.am
+++ b/src/ppp-manager/Makefile.am
@@ -4,8 +4,8 @@ INCLUDES = \
 	-I${top_builddir}/include \
 	-I${top_srcdir}/libnm-util \
 	-I${top_srcdir}/src \
-	-I${top_srcdir}/src/logging \
-	-I${top_builddir}/marshallers
+	-I${top_srcdir}/src/generated \
+	-I${top_srcdir}/src/logging
 
 noinst_LTLIBRARIES = libppp-manager.la
 
@@ -29,7 +29,7 @@ libppp_manager_la_CPPFLAGS = \
 	-DPLUGINDIR=\"$(PPPD_PLUGIN_DIR)\"
 
 libppp_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS)
diff --git a/src/settings/Makefile.am b/src/settings/Makefile.am
index d87f713..8094ac1 100644
--- a/src/settings/Makefile.am
+++ b/src/settings/Makefile.am
@@ -4,9 +4,9 @@ INCLUDES = -I${top_srcdir} \
            -I${top_srcdir}/include \
            -I${top_builddir}/include \
            -I${top_srcdir}/libnm-util \
+           -I${top_srcdir}/src/generated \
            -I${top_srcdir}/src/logging \
-           -I${top_srcdir}/src \
-           -I${top_builddir}/marshallers
+           -I${top_srcdir}/src
 
 noinst_LTLIBRARIES = libsettings.la libtest-settings-utils.la
 
@@ -65,7 +65,7 @@ libsettings_la_CPPFLAGS = \
 
 libsettings_la_LIBADD = \
 	$(top_builddir)/libnm-util/libnm-util.la \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(builddir)/plugins/keyfile/libnm-settings-plugin-keyfile.la \
 	$(DBUS_LIBS) \
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index bd08fc2..b705740 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -36,6 +36,7 @@
 #include "nm-manager-auth.h"
 #include "nm-setting-vpn.h"
 #include "nm-setting-connection.h"
+#include "nm-enum-types.h"
 
 G_DEFINE_TYPE (NMAgentManager, nm_agent_manager, G_TYPE_OBJECT)
 
@@ -88,17 +89,6 @@ static void impl_agent_manager_unregister (NMAgentManager *self,
 /********************************************************************/
 
 #define NM_AGENT_MANAGER_ERROR         (nm_agent_manager_error_quark ())
-#define NM_TYPE_AGENT_MANAGER_ERROR    (nm_agent_manager_error_get_type ())
-
-typedef enum {
-	NM_AGENT_MANAGER_ERROR_SENDER_UNKNOWN = 0,
-	NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED,
-	NM_AGENT_MANAGER_ERROR_SESSION_NOT_FOUND,
-	NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER,
-	NM_AGENT_MANAGER_ERROR_NOT_REGISTERED,
-	NM_AGENT_MANAGER_ERROR_INTERNAL_ERROR,
-	NM_AGENT_MANAGER_ERROR_NO_SECRETS
-} NMAgentManagerError;
 
 static GQuark
 nm_agent_manager_error_quark (void)
@@ -110,37 +100,6 @@ nm_agent_manager_error_quark (void)
 	return ret;
 }
 
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_agent_manager_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Unable to determine caller's sender or UID */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_SENDER_UNKNOWN, "SenderUnknown"),
-			/* Permission for some operation was denied */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED, "PermissionDenied"),
-			/* The caller's session could not be determined */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_SESSION_NOT_FOUND, "SessionNotFound"),
-			/* The identifier was invalid */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER, "InvalidIdentifier"),
-			/* Request was not from a registered agent */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_NOT_REGISTERED, "NotRegistered"),
-			/* Some internal error occurred */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_INTERNAL_ERROR, "InternalError"),
-			/* No secrets were available */
-			ENUM_ENTRY (NM_AGENT_MANAGER_ERROR_NO_SECRETS, "NoSecrets"),
-			{ 0, 0, 0 }
-		};
-
-		etype = g_enum_register_static ("NMAgentManagerError", values);
-	}
-	return etype;
-}
-
 /*************************************************************/
 
 static gboolean
diff --git a/src/settings/nm-agent-manager.h b/src/settings/nm-agent-manager.h
index e49f579..99af11e 100644
--- a/src/settings/nm-agent-manager.h
+++ b/src/settings/nm-agent-manager.h
@@ -34,6 +34,16 @@
 #define NM_IS_AGENT_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_AGENT_MANAGER))
 #define NM_AGENT_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_AGENT_MANAGER, NMAgentManagerClass))
 
+typedef enum {
+	NM_AGENT_MANAGER_ERROR_SENDER_UNKNOWN = 0,
+	NM_AGENT_MANAGER_ERROR_PERMISSION_DENIED,
+	NM_AGENT_MANAGER_ERROR_SESSION_NOT_FOUND,
+	NM_AGENT_MANAGER_ERROR_INVALID_IDENTIFIER,
+	NM_AGENT_MANAGER_ERROR_NOT_REGISTERED,
+	NM_AGENT_MANAGER_ERROR_INTERNAL_ERROR,
+	NM_AGENT_MANAGER_ERROR_NO_SECRETS
+} NMAgentManagerError;
+
 typedef struct {
 	GObject parent;
 } NMAgentManager;
diff --git a/src/settings/nm-settings-error.c b/src/settings/nm-settings-error.c
index 7e24fb7..fd4eca3 100644
--- a/src/settings/nm-settings-error.c
+++ b/src/settings/nm-settings-error.c
@@ -31,53 +31,3 @@ nm_settings_error_quark (void)
 
 	return ret;
 }
-
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_settings_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			ENUM_ENTRY (NM_SETTINGS_ERROR_GENERAL, "GeneralError"),
-
-			/* The connection was invalid. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_INVALID_CONNECTION, "InvalidConnection"),
-			/* The connection is read-only; modifications are not allowed. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_READ_ONLY_CONNECTION, "ReadOnlyConnection"),
-			/* A bug in the settings service caused the error. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_INTERNAL_ERROR, "InternalError"),
-			/* Retrieval or request of secrets failed. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_SECRETS_UNAVAILABLE, "SecretsUnavailable"),
-			/* The request for secrets was canceled. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_SECRETS_REQUEST_CANCELED, "SecretsRequestCanceled"),
-			/* The request could not be completed because permission was denied. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_PERMISSION_DENIED, "PermissionDenied"),
-			/* The requested setting does not existing in this connection. */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_INVALID_SETTING, "InvalidSetting"),
-			/* The caller does not have permission to perform this operation */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_NOT_PRIVILEGED, "NotPrivileged"),
-			/* No plugin supports adding new connections */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_ADD_NOT_SUPPORTED, "AddNotSupported"),
-			/* The plugin providing this connection does not support updating it */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_UPDATE_NOT_SUPPORTED, "UpdateNotSupported"),
-			/* The plugin providing this connection does not support deleting it */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_DELETE_NOT_SUPPORTED, "DeleteNotSupported"),
-			/* Failed to add the connection */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_ADD_FAILED, "AddFailed"),
-			/* No plugin supports modifying the system hostname */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED, "SaveHostnameNotSupported"),
-			/* Saving the system hostname failed */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED, "SaveHostnameFailed"),
-			/* A connection with this UUID already exists */
-			ENUM_ENTRY (NM_SETTINGS_ERROR_UUID_EXISTS, "UuidExists"),
-			{ 0, 0, 0 }
-		};
-
-		etype = g_enum_register_static ("NMSettingsError", values);
-	}
-
-	return etype;
-}
diff --git a/src/settings/nm-settings-error.h b/src/settings/nm-settings-error.h
index b782a77..cdc076d 100644
--- a/src/settings/nm-settings-error.h
+++ b/src/settings/nm-settings-error.h
@@ -25,7 +25,7 @@
 #include <glib.h>
 #include <glib-object.h>
 
-enum {
+typedef enum {
 	NM_SETTINGS_ERROR_GENERAL = 0,
 	NM_SETTINGS_ERROR_INVALID_CONNECTION,
 	NM_SETTINGS_ERROR_READ_ONLY_CONNECTION,
@@ -42,7 +42,7 @@ enum {
 	NM_SETTINGS_ERROR_SAVE_HOSTNAME_NOT_SUPPORTED,
 	NM_SETTINGS_ERROR_SAVE_HOSTNAME_FAILED,
 	NM_SETTINGS_ERROR_UUID_EXISTS,
-};
+} NMSettingsError;
 
 #define NM_SETTINGS_ERROR (nm_settings_error_quark ())
 GQuark nm_settings_error_quark (void);
diff --git a/src/settings/plugins/ifcfg-rh/Makefile.am b/src/settings/plugins/ifcfg-rh/Makefile.am
index 0bf8d19..d9008bd 100644
--- a/src/settings/plugins/ifcfg-rh/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/Makefile.am
@@ -27,8 +27,7 @@ INCLUDES = \
 	-I$(top_srcdir)/include \
 	-I$(top_builddir)/include \
 	-I$(top_srcdir)/libnm-glib \
-	-I$(top_srcdir)/libnm-util \
-	-I$(top_builddir)/marshallers
+	-I$(top_srcdir)/libnm-util
 
 libifcfg_rh_io_la_CPPFLAGS = \
 	$(GLIB_CFLAGS) \
@@ -60,7 +59,6 @@ libnm_settings_plugin_ifcfg_rh_la_LDFLAGS = -module -avoid-version
 libnm_settings_plugin_ifcfg_rh_la_LIBADD = \
 	$(top_builddir)/libnm-util/libnm-util.la \
 	$(top_builddir)/libnm-glib/libnm-glib.la \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	libifcfg-rh-io.la \
 	$(GLIB_LIBS) \
 	$(GMODULE_LIBS) \
diff --git a/src/supplicant-manager/Makefile.am b/src/supplicant-manager/Makefile.am
index 58c174d..1c887b1 100644
--- a/src/supplicant-manager/Makefile.am
+++ b/src/supplicant-manager/Makefile.am
@@ -2,11 +2,11 @@ SUBDIRS=. tests
 
 INCLUDES = \
 	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/generated \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
-	-I${top_srcdir}/libnm-util \
-	-I${top_builddir}/marshallers
+	-I${top_srcdir}/libnm-util
 
 noinst_LTLIBRARIES = libsupplicant-manager.la
 
@@ -28,7 +28,6 @@ libsupplicant_manager_la_CPPFLAGS = \
 	-DNM_LOCALSTATEDIR=\"$(localstatedir)\"
 
 libsupplicant_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS)
diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.h b/src/supplicant-manager/nm-supplicant-settings-verify.h
index 4527a9e..eb213e0 100644
--- a/src/supplicant-manager/nm-supplicant-settings-verify.h
+++ b/src/supplicant-manager/nm-supplicant-settings-verify.h
@@ -21,7 +21,7 @@
 #ifndef NM_SUPPLICANT_SETTINGS_VERIFY_H
 #define NM_SUPPLICANT_SETTINGS_VERIFY_H
 
-typedef enum OptType {
+typedef enum {
 	TYPE_INVALID = 0,
 	TYPE_INT,
 	TYPE_BYTES,
diff --git a/src/vpn-manager/Makefile.am b/src/vpn-manager/Makefile.am
index c4c7b3e..acfcd0d 100644
--- a/src/vpn-manager/Makefile.am
+++ b/src/vpn-manager/Makefile.am
@@ -3,9 +3,9 @@ INCLUDES = \
 	-I${top_srcdir}/include \
 	-I${top_builddir}/include \
 	-I${top_srcdir}/libnm-util \
+	-I${top_srcdir}/src/generated \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/src \
-	-I${top_builddir}/marshallers \
 	-I${top_srcdir}/src/dns-manager \
 	-DVPN_NAME_FILES_DIR=\""$(sysconfdir)/NetworkManager/VPN"\"
 
@@ -29,7 +29,7 @@ libvpn_manager_la_CPPFLAGS =	\
 	-DG_DISABLE_DEPRECATED
 
 libvpn_manager_la_LIBADD = \
-	$(top_builddir)/marshallers/libmarshallers.la \
+	$(top_builddir)/src/generated/libnm-generated.la \
 	$(top_builddir)/src/logging/libnm-logging.la \
 	$(top_builddir)/libnm-util/libnm-util.la \
 	$(LIBNL_LIBS) \
diff --git a/src/vpn-manager/nm-vpn-manager.c b/src/vpn-manager/nm-vpn-manager.c
index c359a39..4e27e22 100644
--- a/src/vpn-manager/nm-vpn-manager.c
+++ b/src/vpn-manager/nm-vpn-manager.c
@@ -29,6 +29,7 @@
 #include "nm-dbus-manager.h"
 #include "NetworkManagerVPN.h"
 #include "nm-marshal.h"
+#include "nm-enum-types.h"
 #include "nm-logging.h"
 
 G_DEFINE_TYPE (NMVPNManager, nm_vpn_manager, G_TYPE_OBJECT)
@@ -61,31 +62,6 @@ nm_vpn_manager_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-GType
-nm_vpn_manager_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* The base device for the VPN connection is not active. */
-			ENUM_ENTRY (NM_VPN_MANAGER_ERROR_DEVICE_NOT_ACTIVE, "BaseDeviceNotActive"),
-			/* The requested VPN connection was invalid. */
-			ENUM_ENTRY (NM_VPN_MANAGER_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* The VPN service required by this VPN connection did not exist or was invalid. */
-			ENUM_ENTRY (NM_VPN_MANAGER_ERROR_SERVICE_INVALID, "ServiceInvalid"),
-			/* The VPN service required by this VPN connection could not be started. */
-			ENUM_ENTRY (NM_VPN_MANAGER_ERROR_SERVICE_START_FAILED, "ServiceStartFailed"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMVPNManagerError", values);
-	}
-	return etype;
-}
-
 
 static NMVPNService *
 get_service_by_namefile (NMVPNManager *self, const char *namefile)
diff --git a/src/vpn-manager/nm-vpn-manager.h b/src/vpn-manager/nm-vpn-manager.h
index 78a5220..4919ca3 100644
--- a/src/vpn-manager/nm-vpn-manager.h
+++ b/src/vpn-manager/nm-vpn-manager.h
@@ -42,7 +42,6 @@ typedef enum
 } NMVPNManagerError;
 
 #define NM_VPN_MANAGER_ERROR (nm_vpn_manager_error_quark ())
-#define NM_TYPE_VPN_MANAGER_ERROR (nm_vpn_manager_error_get_type ()) 
 
 GQuark nm_vpn_manager_error_quark (void);
 GType nm_vpn_manager_error_get_type (void);
diff --git a/src/wimax/Makefile.am b/src/wimax/Makefile.am
index 7d9f61d..63c95dc 100644
--- a/src/wimax/Makefile.am
+++ b/src/wimax/Makefile.am
@@ -1,9 +1,9 @@
 INCLUDES = \
 	-I${top_srcdir}/src \
+	-I${top_srcdir}/src/generated \
 	-I${top_srcdir}/src/logging \
 	-I${top_srcdir}/include \
-	-I${top_srcdir}/libnm-util \
-	-I${top_builddir}/marshallers
+	-I${top_srcdir}/libnm-util
 
 pkglib_LTLIBRARIES = libnm-device-plugin-wimax.la
 
@@ -30,7 +30,7 @@ libnm_device_plugin_wimax_la_LIBADD = \
 	$(DBUS_LIBS) \
 	$(IWMX_SDK_LIBS) \
 	$(GUDEV_LIBS) \
-	$(top_builddir)/marshallers/libmarshallers.la
+	$(top_builddir)/src/generated/libnm-generated.la
 
 nm-wimax-nsp-glue.h: $(top_srcdir)/introspection/nm-wimax-nsp.xml
 	dbus-binding-tool --prefix=nm_wimax_nsp --mode=glib-server --output=$@ $<
diff --git a/src/wimax/nm-device-wimax.c b/src/wimax/nm-device-wimax.c
index 3cf6508..a4623ea 100644
--- a/src/wimax/nm-device-wimax.c
+++ b/src/wimax/nm-device-wimax.c
@@ -43,6 +43,7 @@
 #include "nm-utils.h"
 #include "nm-rfkill.h"
 #include "iwmxsdk.h"
+#include "nm-enum-types.h"
 
 static gboolean impl_device_get_nsp_list (NMDeviceWimax *device, GPtrArray **list, GError **error);
 
@@ -110,16 +111,7 @@ typedef struct {
 
 /***********************************************************/
 
-typedef enum
-{
-	NM_WIMAX_ERROR_CONNECTION_NOT_WIMAX = 0,
-	NM_WIMAX_ERROR_CONNECTION_INVALID,
-	NM_WIMAX_ERROR_CONNECTION_INCOMPATIBLE,
-	NM_WIMAX_ERROR_NSP_NOT_FOUND,
-} NMWimaxError;
-
 #define NM_WIMAX_ERROR (nm_wimax_error_quark ())
-#define NM_TYPE_WIMAX_ERROR (nm_wimax_error_get_type ()) 
 
 static GQuark
 nm_wimax_error_quark (void)
@@ -130,31 +122,6 @@ nm_wimax_error_quark (void)
 	return quark;
 }
 
-/* This should really be standard. */
-#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
-
-static GType
-nm_wimax_error_get_type (void)
-{
-	static GType etype = 0;
-
-	if (etype == 0) {
-		static const GEnumValue values[] = {
-			/* Connection was not a wired connection. */
-			ENUM_ENTRY (NM_WIMAX_ERROR_CONNECTION_NOT_WIMAX, "ConnectionNotWimax"),
-			/* Connection was not a valid wired connection. */
-			ENUM_ENTRY (NM_WIMAX_ERROR_CONNECTION_INVALID, "ConnectionInvalid"),
-			/* Connection does not apply to this device. */
-			ENUM_ENTRY (NM_WIMAX_ERROR_CONNECTION_INCOMPATIBLE, "ConnectionIncompatible"),
-			/* NSP not found in the scan list. */
-			ENUM_ENTRY (NM_WIMAX_ERROR_NSP_NOT_FOUND, "NspNotFound"),
-			{ 0, 0, 0 }
-		};
-		etype = g_enum_register_static ("NMWimaxError", values);
-	}
-	return etype;
-}
-
 /***********************************************************/
 
 void
diff --git a/src/wimax/nm-device-wimax.h b/src/wimax/nm-device-wimax.h
index d70380a..06a4fd4 100644
--- a/src/wimax/nm-device-wimax.h
+++ b/src/wimax/nm-device-wimax.h
@@ -35,6 +35,14 @@ G_BEGIN_DECLS
 #define NM_IS_DEVICE_WIMAX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  NM_TYPE_DEVICE_WIMAX))
 #define NM_DEVICE_WIMAX_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxClass))
 
+typedef enum
+{
+	NM_WIMAX_ERROR_CONNECTION_NOT_WIMAX = 0,
+	NM_WIMAX_ERROR_CONNECTION_INVALID,
+	NM_WIMAX_ERROR_CONNECTION_INCOMPATIBLE,
+	NM_WIMAX_ERROR_NSP_NOT_FOUND,
+} NMWimaxError;
+
 #define NM_DEVICE_WIMAX_HW_ADDRESS       "hw-address"
 #define NM_DEVICE_WIMAX_ACTIVE_NSP       "active-nsp"
 #define NM_DEVICE_WIMAX_CENTER_FREQUENCY "center-frequency"
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 09a3f0e..dbbe18c 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1 +1 @@
-EXTRA_DIST = doc-generator.xsl check-exports.sh
+EXTRA_DIST = doc-generator.xsl check-exports.sh glib-mkenums
diff --git a/tools/glib-mkenums b/tools/glib-mkenums
new file mode 100755
index 0000000..470f093
--- /dev/null
+++ b/tools/glib-mkenums
@@ -0,0 +1,570 @@
+#! /usr/bin/perl
+
+# This is glib-mkenums from glib 2.31.17, which adds the
+# --identifier-prefix and --symbol-prefix arguments which
+# are needed to correctly parse NM's enum names. It can
+# go away when NetworkManager depends on glib >= 2.32
+
+use warnings;
+use File::Basename;
+use Safe;
+
+# glib-mkenums.pl 
+# Information about the current enumeration
+my $flags;			# Is enumeration a bitmask?
+my $option_underscore_name;	# Overriden underscore variant of the enum name
+				# for example to fix the cases we don't get the
+				# mixed-case -> underscorized transform right.
+my $option_lowercase_name;	# DEPRECATED.  A lower case name to use as part
+				# of the *_get_type() function, instead of the
+				# one that we guess. For instance, when an enum
+				# uses abnormal capitalization and we can not
+				# guess where to put the underscores.
+my $seenbitshift;		# Have we seen bitshift operators?
+my $enum_prefix;		# Prefix for this enumeration
+my $enumname;			# Name for this enumeration
+my $enumshort;			# $enumname without prefix
+my $enumname_prefix;		# prefix of $enumname
+my $enumindex = 0;		# Global enum counter
+my $firstenum = 1;		# Is this the first enumeration per file?
+my @entries;			# [ $name, $val ] for each entry
+my $sandbox = Safe->new;        # sandbox for safe evaluation of expressions
+
+sub parse_trigraph {
+    my $opts = shift;
+    my @opts;
+
+    for $opt (split /\s*,\s*/, $opts) {
+	$opt =~ s/^\s*//;
+	$opt =~ s/\s*$//;
+        my ($key,$val) = $opt =~ /(\w+)(?:=(.+))?/;
+	defined $val or $val = 1;
+	push @opts, $key, $val;
+    }
+    @opts;
+}
+sub parse_entries {
+    my $file = shift;
+    my $file_name = shift;
+    my $looking_for_name = 0;
+    
+    while (<$file>) {
+	# read lines until we have no open comments
+	while (m@/\*([^*]|\*(?!/))*$@) {
+	    my $new;
+	    defined ($new = <$file>) || die "Unmatched comment in $ARGV";
+	    $_ .= $new;
+	}
+	# strip comments w/o options
+	s@/\*(?!<)
+	    ([^*]+|\*(?!/))*
+	   \*/@@gx;
+	
+	# strip newlines
+	s@\n@ @;
+	
+	# skip empty lines
+	next if m@^\s*$@;
+	
+	if ($looking_for_name) {
+	    if (/^\s*(\w+)/) {
+		$enumname = $1;
+		return 1;
+	    }
+	}
+	
+	# Handle include files
+	if (/^\#include\s*<([^>]*)>/ ) {
+            my $file= "../$1";
+	    open NEWFILE, $file or die "Cannot open include file $file: $!\n";
+	    
+	    if (parse_entries (\*NEWFILE, $NEWFILE)) {
+		return 1;
+	    } else {
+		next;
+	    }
+	}
+	
+	if (/^\s*\}\s*(\w+)/) {
+	    $enumname = $1;
+	    $enumindex++;
+	    return 1;
+	}
+	
+	if (/^\s*\}/) {
+	    $enumindex++;
+	    $looking_for_name = 1;
+	    next;
+	}
+
+        if (m@^\s*
+              (\w+)\s*                   # name
+              (?:=(                      # value
+		   \s*\w+\s*\(.*\)\s*       # macro with multiple args
+		   |                        # OR
+                   (?:[^,/]|/(?!\*))*       # anything but a comma or comment
+                  ))?,?\s*
+              (?:/\*<                    # options
+                (([^*]|\*(?!/))*)
+               >\s*\*/)?,?
+              \s*$
+             @x) {
+            my ($name, $value, $options) = ($1,$2,$3);
+
+	    if (!defined $flags && defined $value && $value =~ /<</) {
+		$seenbitshift = 1;
+	    }
+
+	    if (defined $options) {
+		my %options = parse_trigraph($options);
+		if (!defined $options{skip}) {
+		    push @entries, [ $name, $value, $options{nick} ];
+		}
+	    } else {
+		push @entries, [ $name, $value ];
+	    }
+	} elsif (m@^\s*\#@) {
+	    # ignore preprocessor directives
+	} else {
+	    print STDERR "$0: $file_name:$.: Failed to parse `$_'\n";
+	}
+    }
+
+    return 0;
+}
+
+sub version {
+    print "glib-mkenums version glib-2.31.17\n";
+    print "glib-mkenums comes with ABSOLUTELY NO WARRANTY.\n";
+    print "You may redistribute copies of glib-mkenums under the terms of\n";
+    print "the GNU General Public License which can be found in the\n";
+    print "GLib source package. Sources, examples and contact\n";
+    print "information are available at http://www.gtk.org\n";;
+    exit 0;
+}
+sub usage {
+    print "Usage:\n";
+    print "  glib-mkenums [OPTION...] [FILES...]\n\n";
+    print "Help Options:\n";
+    print "  -h, --help            Show this help message\n\n";
+    print "Utility Options:\n";
+    print "  --identifier-prefix <text>   Identifier prefix\n";
+    print "  --symbol-prefix <text>       Symbol prefix\n";
+    print "  --fhead <text>               Output file header\n";
+    print "  --fprod <text>               Per input file production\n";
+    print "  --ftail <text>               Output file trailer\n";
+    print "  --eprod <text>               Per enum text (produced prior to value itarations)\n";
+    print "  --vhead <text>               Value header, produced before iterating over enum values\n";
+    print "  --vprod <text>               Value text, produced for each enum value\n";
+    print "  --vtail <text>               Value tail, produced after iterating over enum values\n";
+    print "  --comments <text>            Comment structure\n";
+    print "  --template file              Template file\n";
+    print "  -v, --version                Print version informations\n\n";
+    print "Production text substitutions:\n";
+    print "  \@EnumName\@            PrefixTheXEnum\n";
+    print "  \@enum_name\@           prefix_the_xenum\n";
+    print "  \@ENUMNAME\@            PREFIX_THE_XENUM\n";
+    print "  \@ENUMSHORT\@           THE_XENUM\n";
+    print "  \@ENUMPREFIX\@          PREFIX\n";
+    print "  \@VALUENAME\@           PREFIX_THE_XVALUE\n";
+    print "  \@valuenick\@           the-xvalue\n";
+    print "  \@valuenum\@            the integer value (limited support, Since: 2.26)\n";
+    print "  \@type\@                either enum or flags\n";
+    print "  \@Type\@                either Enum or Flags\n";
+    print "  \@TYPE\@                either ENUM or FLAGS\n";
+    print "  \@filename\@            name of current input file\n";
+    print "  \@basename\@            base name of the current input file (Since: 2.22)\n";
+    exit 0;
+}
+
+# production variables:
+my $idprefix = "";    # "G", "Gtk", etc
+my $symprefix = "";   # "g", "gtk", etc, if not just lc($idprefix)
+my $fhead = "";   # output file header
+my $fprod = "";   # per input file production
+my $ftail = "";   # output file trailer
+my $eprod = "";   # per enum text (produced prior to value itarations)
+my $vhead = "";   # value header, produced before iterating over enum values
+my $vprod = "";   # value text, produced for each enum value
+my $vtail = "";   # value tail, produced after iterating over enum values
+my $comment_tmpl = "";   # comment template
+
+sub read_template_file {
+  my ($file) = @_;
+  my %tmpl = ('file-header', $fhead, 
+	      'file-production', $fprod, 
+	      'file-tail', $ftail, 
+	      'enumeration-production', $eprod,
+	      'value-header', $vhead,
+	      'value-production', $vprod,
+	      'value-tail', $vtail,
+	      'comment', $comment_tmpl);
+  my $in = 'junk';
+  open (FILE, $file) || die "Can't open $file: $!\n";
+  while (<FILE>) {
+    if (/^\/\*\*\*\s+(BEGIN|END)\s+([\w-]+)\s+\*\*\*\//) {
+      if (($in eq 'junk') && ($1 eq 'BEGIN') && (exists($tmpl{$2}))) {
+	$in = $2;
+	next;
+      }
+      elsif (($in eq $2) && ($1 eq 'END') && (exists($tmpl{$2}))) {
+	$in = 'junk';
+	next;
+      } else {
+	  die "Malformed template file $file\n";
+      }
+    }
+    if (!($in eq 'junk')) {
+	$tmpl{$in} .= $_;
+    }
+  }
+  close (FILE);
+  if (!($in eq 'junk')) {
+      die "Malformed template file $file\n";
+  }
+  $fhead = $tmpl{'file-header'};
+  $fprod = $tmpl{'file-production'};
+  $ftail = $tmpl{'file-tail'};
+  $eprod = $tmpl{'enumeration-production'};
+  $vhead = $tmpl{'value-header'};
+  $vprod = $tmpl{'value-production'};
+  $vtail = $tmpl{'value-tail'};
+  $comment_tmpl = $tmpl{'comment'};
+
+  # default to C-style comments
+  $comment_tmpl = "/* \@comment\@ */" if $comment_tmpl eq "";
+}
+
+if (!defined $ARGV[0]) {
+    usage;
+}
+while ($_=$ARGV[0],/^-/) {
+    shift;
+    last if /^--$/;
+    if (/^--template$/)                      { read_template_file (shift); }
+    elsif (/^--identifier-prefix$/)          { $idprefix = shift }
+    elsif (/^--symbol-prefix$/)              { $symprefix = shift }
+    elsif (/^--fhead$/)                      { $fhead = $fhead . shift }
+    elsif (/^--fprod$/)                      { $fprod = $fprod . shift }
+    elsif (/^--ftail$/)                      { $ftail = $ftail . shift }
+    elsif (/^--eprod$/)                      { $eprod = $eprod . shift }
+    elsif (/^--vhead$/)                      { $vhead = $vhead . shift }
+    elsif (/^--vprod$/)                      { $vprod = $vprod . shift }
+    elsif (/^--vtail$/)                      { $vtail = $vtail . shift }
+    elsif (/^--comments$/)                   { $comment_tmpl = shift }
+    elsif (/^--help$/ || /^-h$/ || /^-\?$/)  { usage; }
+    elsif (/^--version$/ || /^-v$/)          { version; }
+    else { usage; }
+    last if not defined($ARGV[0]);
+}
+
+# put auto-generation comment
+{
+    my $comment = $comment_tmpl;
+    $comment =~ s/\@comment\@/Generated data (by glib-mkenums)/;
+    print "\n" . $comment . "\n\n";
+}
+
+if (length($fhead)) {
+    my $prod = $fhead;
+    my $base = basename ($ARGV[0]);
+
+    $prod =~ s/\@filename\@/$ARGV[0]/g;
+    $prod =~ s/\@basename\@/$base/g;
+    $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+    $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+    chomp ($prod);
+		
+    print "$prod\n";
+}
+
+while (<>) {
+    if (eof) {
+	close (ARGV);		# reset line numbering
+	$firstenum = 1;		# Flag to print filename at next enum
+    }
+
+    # read lines until we have no open comments
+    while (m@/\*([^*]|\*(?!/))*$@) {
+	my $new;
+	defined ($new = <>) || die "Unmatched comment in $ARGV";
+	$_ .= $new;
+    }
+    # strip comments w/o options
+    s@/\*(?!<)
+       ([^*]+|\*(?!/))*
+       \*/@@gx;
+	
+    # ignore forward declarations
+    next if /^\s*typedef\s+enum.*;/;
+
+    if (m@^\s*typedef\s+enum\s*
+           ({)?\s*
+           (?:/\*<
+             (([^*]|\*(?!/))*)
+            >\s*\*/)?
+           \s*({)?
+         @x) {
+	if (defined $2) {
+	    my %options = parse_trigraph ($2);
+	    next if defined $options{skip};
+	    $enum_prefix = $options{prefix};
+	    $flags = $options{flags};
+	    $option_lowercase_name = $options{lowercase_name};
+	    $option_underscore_name = $options{underscore_name};
+	} else {
+	    $enum_prefix = undef;
+	    $flags = undef;
+	    $option_lowercase_name = undef;
+	    $option_underscore_name = undef;
+	}
+	if (defined $option_lowercase_name) {
+	    if (defined $option_underscore_name) {
+		print STDERR "$0: $ARGV:$.: lowercase_name overriden with underscore_name\n";
+		$option_lowercase_name = undef;
+	    } else {
+		print STDERR "$0: $ARGV:$.: lowercase_name is deprecated, use underscore_name\n";
+	    }
+	}
+	# Didn't have trailing '{' look on next lines
+	if (!defined $1 && !defined $4) {
+	    while (<>) {
+		if (eof) {
+		    die "Hit end of file while parsing enum in $ARGV";
+		}
+		if (s/^\s*\{//) {
+		    last;
+		}
+	    }
+	}
+
+	$seenbitshift = 0;
+	@entries = ();
+
+	# Now parse the entries
+	parse_entries (\*ARGV, $ARGV);
+
+	# figure out if this was a flags or enums enumeration
+	if (!defined $flags) {
+	    $flags = $seenbitshift;
+	}
+
+	# Autogenerate a prefix
+	if (!defined $enum_prefix) {
+	    for (@entries) {
+		my $nick = $_->[2];
+		if (!defined $nick) {
+		    my $name = $_->[0];
+		    if (defined $enum_prefix) {
+			my $tmp = ~ ($name ^ $enum_prefix);
+			($tmp) = $tmp =~ /(^\xff*)/;
+			$enum_prefix = $enum_prefix & $tmp;
+		    } else {
+			$enum_prefix = $name;
+		    }
+		}
+	    }
+	    if (!defined $enum_prefix) {
+		$enum_prefix = "";
+	    } else {
+		# Trim so that it ends in an underscore
+		$enum_prefix =~ s/_[^_]*$/_/;
+	    }
+	} else {
+	    # canonicalize user defined prefixes
+	    $enum_prefix = uc($enum_prefix);
+	    $enum_prefix =~ s/-/_/g;
+	    $enum_prefix =~ s/(.*)([^_])$/$1$2_/;
+	}
+	
+	for $entry (@entries) {
+	    my ($name,$num,$nick) = @{$entry};
+            if (!defined $nick) {
+ 	        ($nick = $name) =~ s/^$enum_prefix//;
+	        $nick =~ tr/_/-/;
+	        $nick = lc($nick);
+	        @{$entry} = ($name, $num, $nick);
+            }
+	}
+	
+
+	# Spit out the output
+	if (defined $option_underscore_name) {
+	    $enumlong = uc $option_underscore_name;
+	    $enumsym = lc $option_underscore_name;
+	    $enumshort = $enumlong;
+	    $enumshort =~ s/^[A-Z][A-Z0-9]*_//;
+
+	    $enumname_prefix = $enumlong;
+	    $enumname_prefix =~ s/_$enumshort$//;
+	} elsif (!$symprefix && !$idprefix) {
+	    # enumname is e.g. GMatchType
+	    $enspace = $enumname;
+	    $enspace =~ s/^([A-Z][a-z]*).*$/$1/;
+
+	    $enumshort = $enumname;
+	    $enumshort =~ s/^[A-Z][a-z]*//;
+	    $enumshort =~ s/([^A-Z])([A-Z])/$1_$2/g;
+	    $enumshort =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
+	    $enumshort = uc($enumshort);
+
+	    $enumname_prefix = $enumname;
+	    $enumname_prefix =~ s/^([A-Z][a-z]*).*$/$1/;
+	    $enumname_prefix = uc($enumname_prefix);
+
+	    $enumlong = uc($enspace) . "_" . $enumshort;
+	    $enumsym = lc($enspace) . "_" . lc($enumshort);
+
+	    if (defined($option_lowercase_name)) {
+		$enumsym = $option_lowercase_name;
+	    }
+	} else {
+	    $enumshort = $enumname;
+	    if ($idprefix) {
+		$enumshort =~ s/^${idprefix}//;
+	    } else {
+		$enumshort =~ s/^[A-Z][a-z]*//;
+	    }
+	    $enumshort =~ s/([^A-Z])([A-Z])/$1_$2/g;
+	    $enumshort =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
+	    $enumshort = uc($enumshort);
+
+	    $enumname_prefix = $symprefix && uc($symprefix) || uc($idprefix);
+
+	    $enumlong = $enumname_prefix . "_" . $enumshort;
+	    $enumsym = lc($enumlong);
+	}
+
+	if ($firstenum) {
+	    $firstenum = 0;
+	    
+	    if (length($fprod)) {
+		my $prod = $fprod;
+		my $base = basename ($ARGV);
+
+		$prod =~ s/\@filename\@/$ARGV/g;
+		$prod =~ s/\@basename\@/$base/g;
+		$prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+		$prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+	        chomp ($prod);
+		
+		print "$prod\n";
+	    }
+	}
+	
+	if (length($eprod)) {
+	    my $prod = $eprod;
+
+	    $prod =~ s/\@enum_name\@/$enumsym/g;
+	    $prod =~ s/\@EnumName\@/$enumname/g;
+	    $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
+	    $prod =~ s/\@ENUMNAME\@/$enumlong/g;
+	    $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
+	    if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
+	    if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
+	    if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
+	    $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+	    $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+            chomp ($prod);
+
+	    print "$prod\n";
+	}
+
+	if (length($vhead)) {
+	    my $prod = $vhead;
+
+	    $prod =~ s/\@enum_name\@/$enumsym/g;
+            $prod =~ s/\@EnumName\@/$enumname/g;
+            $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
+            $prod =~ s/\@ENUMNAME\@/$enumlong/g;
+	    $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
+	    if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
+	    if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
+	    if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
+            $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+            $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+            chomp ($prod);
+	    
+            print "$prod\n";
+	}
+
+	if (length($vprod)) {
+	    my $prod = $vprod;
+            my $next_num = 0;
+	    
+	    $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+	    $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+	    for (@entries) {
+		my ($name,$num,$nick) = @{$_};
+		my $tmp_prod = $prod;
+
+                if ($prod =~ /\@valuenum\@/) {
+                    # only attempt to eval the value if it is requested
+                    # this prevents us from throwing errors otherwise
+                    if (defined $num) {
+                        # use sandboxed perl evaluation as a reasonable
+                        # approximation to C constant folding
+                        $num = $sandbox->reval ($num);
+
+                        # make sure it parsed to an integer
+                        if (!defined $num or $num !~ /^-?\d+$/) {
+                            die "Unable to parse enum value '$num'";
+                        }
+                    } else {
+                        $num = $next_num;
+                    }
+
+                    $tmp_prod =~ s/\@valuenum\@/$num/g;
+                    $next_num = $num + 1;
+                }
+
+		$tmp_prod =~ s/\@VALUENAME\@/$name/g;
+		$tmp_prod =~ s/\@valuenick\@/$nick/g;
+		if ($flags) { $tmp_prod =~ s/\@type\@/flags/g; } else { $tmp_prod =~ s/\@type\@/enum/g; }
+		if ($flags) { $tmp_prod =~ s/\@Type\@/Flags/g; } else { $tmp_prod =~ s/\@Type\@/Enum/g; }
+		if ($flags) { $tmp_prod =~ s/\@TYPE\@/FLAGS/g; } else { $tmp_prod =~ s/\@TYPE\@/ENUM/g; }
+		chomp ($tmp_prod);
+
+		print "$tmp_prod\n";
+	    }
+	}
+
+	if (length($vtail)) {
+	    my $prod = $vtail;
+
+	    $prod =~ s/\@enum_name\@/$enumsym/g;
+            $prod =~ s/\@EnumName\@/$enumname/g;
+            $prod =~ s/\@ENUMSHORT\@/$enumshort/g;
+            $prod =~ s/\@ENUMNAME\@/$enumlong/g;
+	    $prod =~ s/\@ENUMPREFIX\@/$enumname_prefix/g;
+	    if ($flags) { $prod =~ s/\@type\@/flags/g; } else { $prod =~ s/\@type\@/enum/g; }
+	    if ($flags) { $prod =~ s/\@Type\@/Flags/g; } else { $prod =~ s/\@Type\@/Enum/g; }
+	    if ($flags) { $prod =~ s/\@TYPE\@/FLAGS/g; } else { $prod =~ s/\@TYPE\@/ENUM/g; }
+            $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+            $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+            chomp ($prod);
+	    
+            print "$prod\n";
+	}
+    }
+}
+
+if (length($ftail)) {
+    my $prod = $ftail;
+    my $base = basename ($ARGV);
+
+    $prod =~ s/\@filename\@/$ARGV/g;
+    $prod =~ s/\@basename\@/$base/g;
+    $prod =~ s/\\a/\a/g; $prod =~ s/\\b/\b/g; $prod =~ s/\\t/\t/g; $prod =~ s/\\n/\n/g;
+    $prod =~ s/\\f/\f/g; $prod =~ s/\\r/\r/g;
+    chomp ($prod);
+		
+    print "$prod\n";
+}
+
+# put auto-generation comment
+{
+    my $comment = $comment_tmpl;
+    $comment =~ s/\@comment\@/Generated data ends here/;
+    print "\n" . $comment . "\n\n";
+}
-- 
1.7.7.6



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]