[seed] [modules] Split DEFINE_ENUM_MEMBER into two parts, one which uses the enum member's C name, and one



commit 4a89fc578ed73092ec4c901374ec1a95a42dccb2
Author: Tim Horton <hortont svn gnome org>
Date:   Sat Jul 4 03:33:26 2009 -0400

    [modules] Split DEFINE_ENUM_MEMBER into two parts, one which uses the enum member's C name, and one which enables the user to override the name

 modules/gettext/gettext.c |   28 ++++++++++++++--------------
 modules/seed-module.h     |    7 ++++++-
 2 files changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/modules/gettext/gettext.c b/modules/gettext/gettext.c
index 41cbbb1..8149ff0 100644
--- a/modules/gettext/gettext.c
+++ b/modules/gettext/gettext.c
@@ -303,20 +303,20 @@ seed_module_init(SeedEngine *local_eng)
 
 	/* define enums for setlocale. Where to put them?  */
 	
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_CTYPE", LC_CTYPE);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_NUMERIC", LC_NUMERIC);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_TIME", LC_TIME);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_COLLATE", LC_COLLATE);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_MONETARY", LC_MONETARY);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_MESSAGES", LC_MESSAGES);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_ALL", LC_ALL);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_PAPER", LC_PAPER);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_NAME", LC_NAME);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_ADDRESS", LC_ADDRESS);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_TELEPHONE", LC_TELEPHONE);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_MEASUREMENT", LC_MEASUREMENT);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_IDENTIFICATION", LC_IDENTIFICATION);
-	DEFINE_ENUM_MEMBER(namespace_ref, "LC_CTYPE", LC_CTYPE);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_CTYPE);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_NUMERIC);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_TIME);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_COLLATE);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_MONETARY);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_MESSAGES);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_ALL);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_PAPER);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_NAME);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_ADDRESS);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_TELEPHONE);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_MEASUREMENT);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_IDENTIFICATION);
+	DEFINE_ENUM_MEMBER(namespace_ref, LC_CTYPE);
 
 	return namespace_ref;
 }
diff --git a/modules/seed-module.h b/modules/seed-module.h
index 42f2402..669d9e1 100644
--- a/modules/seed-module.h
+++ b/modules/seed-module.h
@@ -22,8 +22,13 @@
 		return seed_make_undefined (ctx); \
 	}
 
+// Defines a property on holder for the given enum member
+#define DEFINE_ENUM_MEMBER(holder, member) \
+	seed_object_set_property(ctx, holder, #member, \
+	                         seed_value_from_long(ctx, member, NULL))
+
 // Defines a property on holder for the given enum member, with the given name
-#define DEFINE_ENUM_MEMBER(holder, name, val) \
+#define DEFINE_ENUM_MEMBER_EXT(holder, name, val) \
 	seed_object_set_property(ctx, holder, name, \
 	                         seed_value_from_long(ctx, val, NULL))
 



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