Commit 839eab55 authored by Dan Winship's avatar Dan Winship

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.
parent 0b57cc68
......@@ -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
......
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;
# -*- 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))
......@@ -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
......
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)
......
......@@ -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;
......@@ -169,6 +171,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;
......@@ -182,6 +185,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:
*;
......
......@@ -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);
}
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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,
......
......@@ -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 ())
......
......@@ -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);
}
......@@ -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,
......
......@@ -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;
......
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
......
......@@ -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:
*;
};
......@@ -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"),