grim/guifications3

moved all of our enum junk to use glib-mkenums.
org.guifications.gf3
2009-10-10, Gary Kramlich
0b5513f16fc8
Parents 585fda4a5151
Children 41860efea77a
moved all of our enum junk to use glib-mkenums.

This has cleaned up a bunch of duplicated crap as well as gotten me to finally document the enums.

Also, due to the way glib-mkenums works, we had to change the GEnumValue member we use for i18n support from the name to the nick.
--- a/gflib/configure.ac Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/configure.ac Sat Oct 10 18:24:48 2009 -0500
@@ -154,6 +154,9 @@
GLIB_GENMARSHAL=`pkg-config --variable=glib_genmarshal glib-2.0`
AC_SUBST(GLIB_GENMARSHAL)
+GLIB_MKENUMS=`pkg-config --variable=glib_mkenums glib-2.0`
+AC_SUBST(GLIB_MKENUMS)
+
PKG_CHECK_MODULES(GMODULE, [gmodule-2.0 >= 2.16.0])
AC_SUBST(GMODULE_CFLAGS)
AC_SUBST(GMODULE_LIBS)
--- a/gflib/gflib/Makefile.am Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/Makefile.am Sat Oct 10 18:24:48 2009 -0500
@@ -114,11 +114,34 @@
$(GLIB_CFLAGS) \
$(GMODULE_CFLAGS)
-MARSHALSOURCES=gf_marshallers.c gf_marshallers.h
+MARSHALSOURCES = gf_marshallers.c gf_marshallers.h
+ENUMSOURCES = gf_enum.c gf_enum.h
+
+CLEANFILES = \
+ $(ENUMSOURCES) \
+ $(MARSHALSOURCES) \
+ gf_lib.h
+
+DISTCLEANFILES =
-CLEANFILES=$(MARSHALSOURCES)
+enum_headers = \
+ gf_connection.h \
+ gf_log.h \
+ gf_object.h \
+ gf_plugin.h \
+ gf_preference_engine.h
-DISTCLEANFILES=gf_lib.h
+gf_enum.c: $(enum_headers) gf_enum.c.template
+ @echo "Generating $@ ... "
+ $(GLIB_MKENUMS) --template $@.template $(enum_headers) > $@.tmp && mv $@.tmp $@
+
+gf_enum.h: $(enum_headers) gf_enum.h.template
+ @echo "Generating $@ ... "
+ $(GLIB_MKENUMS) --template $@.template $(enum_headers) > $@.tmp && mv $@.tmp $@
+
+gf_lib.h: gflib-genheader $(gfinc_HEADERS)
+ @echo "Generating gf_lib.h ... "
+ ./gflib-genheader -s GF_LIB_H -d gflib $(gfinc_HEADERS) > gf_lib.h
gf_marshallers.h: gf_marshallers.list
@echo "Generating gf_marshallers.h ..."
@@ -128,11 +151,7 @@
@echo "Generating gf_marshallers.c ..."
$(GLIB_GENMARSHAL) --prefix=gf_marshal gf_marshallers.list --body > gf_marshallers.c
-gf_lib.h: gflib-genheader $(gfinc_HEADERS)
- @echo "Generating gf_lib.h ... "
- ./gflib-genheader -s GF_LIB_H -d gflib $(gfinc_HEADERS) > gf_lib.h
-
-BUILT_SOURCES = gf_marshallers.h gf_marshallers.c gf_lib.h
+BUILT_SOURCES = gf_enum.c gf_enum.h gf_lib.h gf_marshallers.c gf_marshallers.h
install-exec-hook:
@if [ `id -u` == 0 ] ; then echo -n "Running ldconfig... "; ldconfig; echo "done"; else echo "Not running ldconfig since you are not root."; fi
--- a/gflib/gflib/gf_connection.c Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_connection.c Sat Oct 10 18:24:48 2009 -0500
@@ -474,30 +474,3 @@
g_signal_emit_by_name(connection, "preference-engine-set", engine);
}
-/******************************************************************************
- * ConnectionState API
- *****************************************************************************/
-GType
-gf_connection_state_get_type(void) {
- static GType type = 0;
-
- if(type == 0) {
- static const GEnumValue values[] = {
- { GF_CONNECTION_STATE_UNKNOWN, N_("Unknown"), N_("Unknown") },
- { GF_CONNECTION_STATE_DISCONNECTED, N_("Disconnected"),
- N_("Disconnected")
- },
- { GF_CONNECTION_STATE_CONNECTING, N_("Connecting"),
- N_("Connecting")
- },
- { GF_CONNECTION_STATE_CONNECTED, N_("Connected"), N_("Connected") },
- { GF_CONNECTION_STATES, N_("States"), N_("States") },
- { 0, NULL, NULL },
- };
-
- type = g_enum_register_static("GfConnectionState", values);
- }
-
- return type;
-}
-
--- a/gflib/gflib/gf_connection.h Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_connection.h Sat Oct 10 18:24:48 2009 -0500
@@ -64,13 +64,24 @@
#define GF_TYPE_CONNECTION_STATE (gf_connection_state_get_type())
-typedef enum _GfConnectionState {
- GF_CONNECTION_STATE_UNKNOWN = -1,
- GF_CONNECTION_STATE_DISCONNECTING = 0,
- GF_CONNECTION_STATE_DISCONNECTED,
- GF_CONNECTION_STATE_CONNECTING,
- GF_CONNECTION_STATE_CONNECTED,
- GF_CONNECTION_STATES
+/**
+ * GfConnectionState:
+ * @GF_CONNECTION_STATE_UNKNOWN: The connection is in an unknown state.
+ * @GF_CONNECTION_STATE_DISCONNECTING: The connection is disconnecting.
+ * @GF_CONNECTION_STATE_DISCONNECTED: The connection is disconnected.
+ * @GF_CONNECTION_STATE_CONNECTING: The connection is connecting.
+ * @GF_CONNECTION_STATE_CONNECTED: The connection is connected.
+ * @GF_CONNECTION_STATES: The number of connection states.
+ *
+ * The possible states for a #GfConnection.
+ */
+typedef enum {
+ GF_CONNECTION_STATE_UNKNOWN = -1, /*< skip >*/
+ GF_CONNECTION_STATE_DISCONNECTING = 0, /*< nick=Disconnecting >*/
+ GF_CONNECTION_STATE_DISCONNECTED, /*< nick=Disconnected >*/
+ GF_CONNECTION_STATE_CONNECTING, /*< nick=Connecting >*/
+ GF_CONNECTION_STATE_CONNECTED, /*< nick=Connected >*/
+ GF_CONNECTION_STATES /*< skip >*/
} GfConnectionState;
G_BEGIN_DECLS
@@ -89,7 +100,6 @@
GfPreferenceEngine *gf_connection_get_preference_engine(const GfConnection *connection);
void gf_connection_set_preference_engine(GfConnection *connection, GfPreferenceEngine *engine);
-GType gf_connection_state_get_type(void);
#define gf_connection_state_from_string(str) \
gf_enum_from_string(GF_TYPE_CONNECTION_STATE, (str))
#define gf_connection_state_to_string(state, i18n) \
--- a/gflib/gflib/gf_enum.c Sat Oct 10 16:48:47 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <gflib/gf_enum.h>
-#include <gflib/gf_intl.h>
-
-/**
- * gf_enum_from_string:
- * @type : The #GType of the #GfEnum.
- * @str : The string.
- *
- * Gets the value of a #GfEnum from @str.
- *
- * Note: @str MUST be the untranslated string!
- *
- * Return Value: The value.
- */
-gint
-gf_enum_from_string(GType type, const gchar *str) {
- GEnumClass *klass;
- GEnumValue *value;
- gint ret = -1;
-
- g_return_val_if_fail(g_type_is_a(type, G_TYPE_ENUM), -1);
-
- /* we ref here just to be safe.. */
- klass = g_type_class_ref(type);
- value = g_enum_get_value_by_name(klass, str);
-
- if(value)
- ret = value->value;
-
- g_type_class_unref(klass);
-
- return ret;
-}
-
-/**
- * gf_enum_to_string:
- * @type : The GType of the #GfEnum.
- * @value : The value of the #GfEnum.
- * @i18n : TRUE for the translated version, FALSE of the untranslated version.
- *
- * Converts a #GfEnum into a string.
- *
- * Return Value: @value as a string.
- */
-const gchar *
-gf_enum_to_string(GType type, gint val, gboolean i18n) {
- GEnumClass *klass;
- GEnumValue *value;
- const gchar *ret = NULL;
-
- g_return_val_if_fail(g_type_is_a(type, G_TYPE_ENUM), _("Unknown"));
-
- /* we again ref here just to be safe... */
- klass = g_type_class_ref(type);
- value = g_enum_get_value(klass, val);
-
- if(value)
- ret = (i18n) ? _(value->value_name) : value->value_name;
- else
- ret = _("Unknown");
-
- g_type_class_unref(klass);
-
- return ret;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib/gflib/gf_enum.c.template Sat Oct 10 18:24:48 2009 -0500
@@ -0,0 +1,126 @@
+/*** BEGIN file-header ***/
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif /* HAVE_CONFIG_H */
+
+#include <gflib/gf_enum.h>
+#include <gflib/gf_intl.h>
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+#include "@filename@"
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type(void) {
+ static volatile gsize g_define_type_id__volatile = 0;
+
+ if(g_once_init_enter(&g_define_type_id__volatile)) {
+ static const G@Type@Value values [] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", N_("@valuenick@") },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+
+ GType g_define_type_id =
+ g_@type@_register_static(g_intern_static_string("@EnumName@"), values);
+ g_once_init_leave(&g_define_type_id__volatile, g_define_type_id);
+ }
+
+ return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
+
+/*** BEGIN file-tail ***/
+/**
+ * gf_enum_from_string:
+ * @type : The #GType of the #GfEnum.
+ * @str : The string.
+ *
+ * Gets the value of a #GfEnum from @str.
+ *
+ * Note: @str MUST be the untranslated string!
+ *
+ * Return Value: The value.
+ */
+gint
+gf_enum_from_string(GType type, const gchar *str) {
+ GEnumClass *klass;
+ GEnumValue *value;
+ gint ret = -1;
+
+ g_return_val_if_fail(g_type_is_a(type, G_TYPE_ENUM), -1);
+
+ /* we ref here just to be safe.. */
+ klass = g_type_class_ref(type);
+ value = g_enum_get_value_by_nick(klass, str);
+
+ if(value)
+ ret = value->value;
+
+ g_type_class_unref(klass);
+
+ return ret;
+}
+
+/**
+ * gf_enum_to_string:
+ * @type : The GType of the #GfEnum.
+ * @value : The value of the #GfEnum.
+ * @i18n : TRUE for the translated version, FALSE of the untranslated version.
+ *
+ * Converts a #GfEnum into a string.
+ *
+ * Return Value: @value as a string.
+ */
+const gchar *
+gf_enum_to_string(GType type, gint val, gboolean i18n) {
+ GEnumClass *klass;
+ GEnumValue *value;
+ const gchar *ret = NULL;
+
+ g_return_val_if_fail(g_type_is_a(type, G_TYPE_ENUM), _("Unknown"));
+
+ /* we again ref here just to be safe... */
+ klass = g_type_class_ref(type);
+ value = g_enum_get_value(klass, val);
+
+ if(value)
+ ret = (i18n) ? _(value->value_nick) : value->value_nick;
+ else
+ ret = _("Unknown");
+
+ g_type_class_unref(klass);
+
+ return ret;
+}
+/*** END file-tail ***/
+
--- a/gflib/gflib/gf_enum.h Sat Oct 10 16:48:47 2009 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * Guifications - The end-all, be-all notification framework
- * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef GF_ENUM_H
-#define GF_ENUM_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-gint gf_enum_from_string(GType type, const gchar *str);
-const gchar *gf_enum_to_string(GType type, gint value, gboolean i18n);
-
-G_END_DECLS
-
-#endif /* GF_ENUM_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gflib/gflib/gf_enum.h.template Sat Oct 10 18:24:48 2009 -0500
@@ -0,0 +1,46 @@
+/*** BEGIN file-header ***/
+/*
+ * Guifications - The end-all, be-all notification framework
+ * Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef GF_ENUM_H
+#define GF_ENUM_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type(void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+/*** END value-header ***/
+
+/*** BEGIN file-tail ***/
+
+/* normal api */
+gint gf_enum_from_string(GType type, const gchar *str);
+const gchar *gf_enum_to_string(GType type, gint value, gboolean i18n);
+
+G_END_DECLS
+
+#endif /* GF_ENUM_H */
+/*** END file-tail ***/
--- a/gflib/gflib/gf_log.c Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_log.c Sat Oct 10 18:24:48 2009 -0500
@@ -378,28 +378,3 @@
gf_logv(level, domain, "%s\n", message);
}
-/******************************************************************************
- * GfLogLevel API
- *****************************************************************************/
-GType
-gf_log_level_get_type(void) {
- static GType type = 0;
-
- if(type == 0) {
- static const GEnumValue values[] = {
- { GF_LOG_LEVEL_UNKNOWN, N_("Unknown"), N_("Unknown") },
- { GF_LOG_LEVEL_VERBOSE, N_("Verbose"), N_("Verbose") },
- { GF_LOG_LEVEL_INFO, N_("Info"), N_("Info") },
- { GF_LOG_LEVEL_EVENT, N_("Event"), N_("Event") },
- { GF_LOG_LEVEL_WARNING, N_("Warning"), N_("Warning") },
- { GF_LOG_LEVEL_CRITICAL, N_("Critical"), N_("Critical") },
- { GF_LOG_LEVELS, N_("Levels"), N_("Levels") },
- { 0, NULL, NULL },
- };
-
- type = g_enum_register_static("GfLogLevel", values);
- }
-
- return type;
-}
-
--- a/gflib/gflib/gf_log.h Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_log.h Sat Oct 10 18:24:48 2009 -0500
@@ -26,14 +26,29 @@
#define GF_TYPE_LOG_LEVEL (gf_log_level_get_type())
-typedef enum _GfLogLevel {
- GF_LOG_LEVEL_UNKNOWN = -1,
- GF_LOG_LEVEL_VERBOSE = 0,
- GF_LOG_LEVEL_INFO,
- GF_LOG_LEVEL_EVENT,
- GF_LOG_LEVEL_WARNING,
- GF_LOG_LEVEL_CRITICAL,
- GF_LOG_LEVELS
+/**
+ * GfLogLevel:
+ * @GF_LOG_LEVEL_UNKNOWN: Unknown log level
+ * @GF_LOG_LEVEL_VERBOSE: Log everything
+ * @GF_LOG_LEVEL_INFO: Log info and up
+ * @GF_LOG_LEVEL_EVENT: Log events and up
+ * @GF_LOG_LEVEL_WARNING: Log warnings and up
+ * @GF_LOG_LEVEL_CRITICAL: Only log critical messages
+ * @GF_LOG_LEVELS: The number of log levels
+ *
+ * The different levels of logging.
+ *
+ * Log levels stack. What I mean is, verbose will show you everything, but
+ * event will only show you event, warning, and critical messages.
+ */
+typedef enum {
+ GF_LOG_LEVEL_UNKNOWN = -1, /*< skip >*/
+ GF_LOG_LEVEL_VERBOSE = 0, /*< nick=Verbose >*/
+ GF_LOG_LEVEL_INFO, /*< nick=Info >*/
+ GF_LOG_LEVEL_EVENT, /*< nick=Event >*/
+ GF_LOG_LEVEL_WARNING, /*< nick=Warning >*/
+ GF_LOG_LEVEL_CRITICAL, /*< nick=Critical >*/
+ GF_LOG_LEVELS /*< skip >*/
} GfLogLevel;
#include <gflib/gf_logger.h>
@@ -68,7 +83,6 @@
void gf_log_g_log_handler(const gchar *domain, GLogLevelFlags flags, const gchar *message, gpointer data);
-GType gf_log_level_get_type(void);
#define gf_log_level_from_string(str) \
gf_enum_from_string(GF_TYPE_LOG_LEVEL, (str))
#define gf_log_level_to_string(level, i18n) \
--- a/gflib/gflib/gf_object.c Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_object.c Sat Oct 10 18:24:48 2009 -0500
@@ -117,26 +117,4 @@
g_object_run_dispose(G_OBJECT(obj));
}
-/******************************************************************************
- * GfObject Flags API
- *****************************************************************************/
-GType
-gf_object_flags_get_type(void) {
- static GType type = 0;
- if(type == 0) {
- static const GEnumValue values[] = {
- { GF_OBJECT_DESTROYING, N_("Destroying"), N_("Destroying") },
- { GF_OBJECT_RESERVED_1, N_("Reserved 1"), N_("Reserved 1") },
- { GF_OBJECT_RESERVED_2, N_("Reserved 2"), N_("Reserved 2") },
- { GF_OBJECT_RESERVED_3, N_("Reserved 3"), N_("Reserved 3") },
- { GF_OBJECT_RESERVED_4, N_("Reserved 4"), N_("Reserved 4") },
- { 0, NULL, NULL },
- };
-
- type = g_enum_register_static("GfObjectFlags", values);
- }
-
- return type;
-}
-
--- a/gflib/gflib/gf_object.h Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_object.h Sat Oct 10 18:24:48 2009 -0500
@@ -39,13 +39,19 @@
typedef struct _GfObject GfObject;
typedef struct _GfObjectClass GfObjectClass;
-typedef enum _GfObjectFlags {
- GF_OBJECT_DESTROYING = 1 << 0,
+/**
+ * GfObjectFlags:
+ * @GF_OBJECT_DESTROYING: The object is being destroyed
+ *
+ * Flags that #GfObject's may use.
+ */
+typedef enum { /*< flags >*/
+ GF_OBJECT_DESTROYING = 1 << 0, /*< nick=Destroying >*/
- GF_OBJECT_RESERVED_1 = 1 << 1,
- GF_OBJECT_RESERVED_2 = 1 << 2,
- GF_OBJECT_RESERVED_3 = 1 << 3,
- GF_OBJECT_RESERVED_4 = 1 << 4
+ GF_OBJECT_RESERVED_1 = 1 << 1, /*< skip >*/
+ GF_OBJECT_RESERVED_2 = 1 << 2, /*< skip >*/
+ GF_OBJECT_RESERVED_3 = 1 << 3, /*< skip >*/
+ GF_OBJECT_RESERVED_4 = 1 << 4 /*< skip >*/
} GfObjectFlags;
struct _GfObject {
@@ -75,7 +81,6 @@
GType gf_object_get_type(void);
void gf_object_destroy(GfObject *obj);
-GType gf_object_flags_get_type(void);
#define gf_object_flags_from_string(str) \
gf_enum_from_string(GF_TYPE_OBJECT_FLAGS, (str))
#define gf_object_flags_to_string(flags, i18n) \
--- a/gflib/gflib/gf_plugin.c Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_plugin.c Sat Oct 10 18:24:48 2009 -0500
@@ -275,29 +275,3 @@
g_object_notify(G_OBJECT(plugin), "state");
}
-/******************************************************************************
- * GfPluginState API
- *****************************************************************************/
-GType
-gf_plugin_state_get_type(void) {
- static GType type = 0;
-
- if(type == 0) {
- static const GEnumValue values[] = {
- { GF_PLUGIN_STATE_UNKNOWN, N_("Unknown"), N_("Unknown") },
- { GF_PLUGIN_STATE_ERROR, N_("Error"), N_("Error") },
- { GF_PLUGIN_STATE_LOADED, N_("Loaded"), N_("Loaded") },
- { GF_PLUGIN_STATE_LOAD_FAILED, N_("Load Failed"),
- N_("Load Failed")
- },
- { GF_PLUGIN_STATE_NOT_LOADED, N_("Not Loaded"), N_("Not Loaded") },
- { GF_PLUGIN_STATES, N_("States"), N_("States") },
- { 0, NULL, NULL },
- };
-
- type = g_enum_register_static("GfPluginState", values);
- }
-
- return type;
-}
-
--- a/gflib/gflib/gf_plugin.h Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_plugin.h Sat Oct 10 18:24:48 2009 -0500
@@ -34,13 +34,22 @@
#define GF_TYPE_PLUGIN_STATE (gf_plugin_state_get_type())
+/**
+ * GfPluginState:
+ * @GF_PLUGIN_STATE_ERROR: The plugin is in an error'd state.
+ * @GF_PLUGIN_STATE_LOADED: The plugin has been loaded.
+ * @GF_PLUGIN_STATE_LOAD_FAILED: The plugin failed to load.
+ * @GF_PLUGIN_STATE_NOT_LOADED: The plugin is not loaded.
+ *
+ * The possible states that a plugin can be in.
+ */
typedef enum {
- GF_PLUGIN_STATE_UNKNOWN = -1,
- GF_PLUGIN_STATE_ERROR = 0,
- GF_PLUGIN_STATE_LOADED,
- GF_PLUGIN_STATE_LOAD_FAILED,
- GF_PLUGIN_STATE_NOT_LOADED,
- GF_PLUGIN_STATES
+ GF_PLUGIN_STATE_UNKNOWN = -1, /*< skip >*/
+ GF_PLUGIN_STATE_ERROR = 0, /*< nick=Error >*/
+ GF_PLUGIN_STATE_LOADED, /*< nick=Loaded >*/
+ GF_PLUGIN_STATE_LOAD_FAILED, /*< nick=Load Failed >*/
+ GF_PLUGIN_STATE_NOT_LOADED, /*< nick=Not Loaded >*/
+ GF_PLUGIN_STATES /*< skip >*/
} GfPluginState;
struct _GfPlugin {
@@ -70,8 +79,6 @@
GfPluginInfo *gf_plugin_get_info(GfPlugin *plugin);
GfPluginState gf_plugin_get_state(GfPlugin *plugin);
-GType gf_plugin_state_get_type(void);
-
#define gf_plugin_state_from_string(str) \
gf_enum_from_string(GF_TYPE_PLUGIN_STATE, (str))
#define gf_plugin_state_to_string(state, i18n) \
--- a/gflib/gflib/gf_preference_engine.c Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_preference_engine.c Sat Oct 10 18:24:48 2009 -0500
@@ -571,30 +571,6 @@
}
/******************************************************************************
- * GfPrefernceType API
- *****************************************************************************/
-GType
-gf_preference_type_get_type(void) {
- static GType type = 0;
-
- if(type == 0) {
- static const GEnumValue values[] = {
- { GF_PREFERENCE_TYPE_UNKNOWN, N_("Unknown"), N_("Unknown") },
- { GF_PREFERENCE_TYPE_SECTION, N_("Section"), N_("Section") },
- { GF_PREFERENCE_TYPE_STRING, N_("String"), N_("String") },
- { GF_PREFERENCE_TYPE_INT, N_("Integer"), N_("Integer") },
- { GF_PREFERENCE_TYPE_BOOL, N_("Boolean"), N_("Boolean") },
- { GF_PREFERENCE_TYPES, N_("Types"), N_("Types") },
- { 0, NULL, NULL },
- };
-
- type = g_enum_register_static("GfPreferenceType", values);
- }
-
- return type;
-}
-
-/******************************************************************************
* GfPrefernce API
*****************************************************************************/
GType
--- a/gflib/gflib/gf_preference_engine.h Sat Oct 10 16:48:47 2009 -0500
+++ b/gflib/gflib/gf_preference_engine.h Sat Oct 10 18:24:48 2009 -0500
@@ -37,13 +37,24 @@
#include <gflib/gf_enum.h>
#include <gflib/gf_named_object.h>
-typedef enum _GfPreferenceType {
- GF_PREFERENCE_TYPE_UNKNOWN = -1,
- GF_PREFERENCE_TYPE_SECTION = 0,
- GF_PREFERENCE_TYPE_STRING,
- GF_PREFERENCE_TYPE_INT,
- GF_PREFERENCE_TYPE_BOOL,
- GF_PREFERENCE_TYPES
+/**
+ * GfPreference:
+ * @GF_PREFERENCE_TYPE_UNKNOWN: The preference has an unknown type.
+ * @GF_PREFERENCE_TYPE_SECTION: The prefernce is a section.
+ * @GF_PREFERENCE_TYPE_STRING: The preference is a string.
+ * @GF_PREFERENCE_TYPE_INT: The preference is an integer.
+ * @GF_PREFERENCE_TYPE_BOOL: The preference is a boolean.
+ * @GF_PREFERENCE_TYPES: The number of preferences.
+ *
+ * The different types that a #GfPreference can be.
+ */
+typedef enum {
+ GF_PREFERENCE_TYPE_UNKNOWN = -1, /*< skip >*/
+ GF_PREFERENCE_TYPE_SECTION = 0, /*< nick=Section >*/
+ GF_PREFERENCE_TYPE_STRING, /*< nick=String >*/
+ GF_PREFERENCE_TYPE_INT, /*< nick=Integer >*/
+ GF_PREFERENCE_TYPE_BOOL, /*< nick=Boolean >*/
+ GF_PREFERENCE_TYPES /*< skip >*/
} GfPreferenceType;
struct _GfPreference {
@@ -129,7 +140,6 @@
GfPreferenceType gf_preference_engine_get_type(GfPreferenceEngine *engine, const gchar *path);
-GType gf_preference_type_get_type(void);
#define gf_preference_type_from_string(str) \
gf_enum_from_string(GF_TYPE_PREFERENCE_TYPE, (str))
#define gf_preference_type_to_string(type, i18n) \