Eitan Isaacson has proposed merging lp:~eeejay/indicator-applet/gtypified into 
lp:indicator-applet.

Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)

This adds some touches that make all types in the API gtypes. This makes 
bindings much easier to create.
-- 
https://code.launchpad.net/~eeejay/indicator-applet/gtypified/+merge/5431
Your team Indicator Applet Developers is subscribed to branch 
lp:indicator-applet.
=== modified file 'libindicate/Makefile.am'
--- libindicate/Makefile.am	2009-04-03 17:27:31 +0000
+++ libindicate/Makefile.am	2009-04-08 11:25:50 +0000
@@ -1,3 +1,6 @@
+MARSHAL_PREFIX = indicate_marshal
+MARSHAL_FILE = indicate-marshal
+ENUM_FILE = indicate-enum-types
 
 INCLUDES= \
 	-DG_LOG_DOMAIN=\"libindicate\"
@@ -14,7 +17,9 @@
 	dbus-listener-server.h \
 	dbus-listener-client.h \
 	listener-marshal.c \
-	listener-marshal.h
+	listener-marshal.h \
+	$(ENUM_FILE).h \
+	$(ENUM_FILE).c
 
 lib_LTLIBRARIES = \
 	libindicate.la
@@ -26,7 +31,8 @@
 	indicator-message.h \
 	listener.h \
 	server.h \
-	interests.h
+	interests.h \
+	$(ENUM_FILE).h
 
 libindicateinclude_HEADERS = \
 	$(indicate_headers)
@@ -37,6 +43,7 @@
 	dbus-indicate-client.h \
 	dbus-listener-server.h \
 	dbus-listener-client.h \
+	indicate-enum-types.c \
 	server.c \
 	listener.c \
 	listener-marshal.c \
@@ -97,6 +104,39 @@
 pkgconfig_DATA = indicate.pc
 pkgconfigdir = $(libdir)/pkgconfig
 
+$(ENUM_FILE).h: s-enum-types-h
+	@true
+s-enum-types-h: $(indicate_headers) Makefile
+	( cd $(srcdir) && glib-mkenums \
+			--fhead "#ifndef _INDICATE_ENUM_TYPES_H_\n#define _INDICATE_ENUM_TYPES_H_\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+			--fprod "/* enumerations from \"@filen...@\" */\n" \
+			--vhead "GType @enum_n...@_get_type(void);\n#define indicate_ty...@enumshort@ (@enum_n...@_get_type())\n"	\
+			--ftail "G_END_DECLS\n\n#endif /* _INDICATE_ENUM_TYPES_H_ */" \
+		interests.h ) > tmp-$(ENUM_FILE).h \
+	&& (cmp -s tmp-$(ENUM_FILE).h $(ENUM_FILE).h || cp tmp-$(ENUM_FILE).h $(ENUM_FILE).h ) \
+	&& rm -f tmp-$(ENUM_FILE).h	\
+	&& echo timestamp > $(@F)
+
+$(ENUM_FILE).c: s-enum-types-c
+	@true
+s-enum-types-c: $(indicate_headers) Makefile
+	( cd $(srcdir) && glib-mkenums \
+			--fhead "#include <libindicate/interests.h>\n#include <glib-object.h>" \
+			--fprod "\n/* enumerations from \"@filen...@\" */" \
+			--vhead "gtyp...@enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const g...@type@Value values[] = {" 	\
+			--vprod "      { @VALUENAME@, \"@valuen...@\", \"@valuen...@\" }," \
+			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g...@type@_register_static (\"@enumn...@\", values);\n  }\n  return etype;\n}\n" \
+		interests.h ) > tmp-$(ENUM_FILE).c \
+	&& (cmp -s tmp-$(ENUM_FILE).c $(ENUM_FILE).c || cp tmp-$(ENUM_FILE).c $(ENUM_FILE).c ) \
+	&& rm -f tmp-$(ENUM_FILE).c \
+	&& echo timestamp > $(@F)
+
+CLEANFILES = \
+	$(ENUM_FILE).c \
+	$(ENUM_FILE).h \
+	s-enum-types-c \
+	s-enum-types-h
+
 if USE_GIR
 
 gobjectintrospection_gir_DATA = \

=== modified file 'libindicate/interests.h'
--- libindicate/interests.h	2009-04-02 18:34:40 +0000
+++ libindicate/interests.h	2009-04-08 11:25:50 +0000
@@ -34,8 +34,7 @@
 
 G_BEGIN_DECLS
 
-typedef enum _IndicateInterests IndicateInterests;
-enum _IndicateInterests {
+typedef enum {
 	INDICATE_INTEREST_NONE,              /**< We're of no interest */
 	INDICATE_INTEREST_SERVER_DISPLAY,    /**< Displays the server's existance to the user */
 	INDICATE_INTEREST_SERVER_SIGNAL,     /**< Will send signals to the server to be displayed */
@@ -43,7 +42,7 @@
 	INDICATE_INTEREST_INDICATOR_SIGNAL,  /**< Will return signals based on individual indicators being responded to */
 	INDICATE_INTEREST_INDICATOR_COUNT,   /**< Only displays a count of the indicators */
 	INDICATE_INTEREST_LAST               /**< Makes merges and counting easier */
-};
+} IndicateInterests;
 
 G_END_DECLS
 

=== modified file 'libindicate/listener.c'
--- libindicate/listener.c	2009-04-07 15:14:00 +0000
+++ libindicate/listener.c	2009-04-10 10:16:39 +0000
@@ -154,35 +154,35 @@
 	                                        G_STRUCT_OFFSET (IndicateListenerClass, indicator_added),
 	                                        NULL, NULL,
 	                                        _indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
-	                                        G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING);
+	                                        G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
 	signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED,
 	                                        G_TYPE_FROM_CLASS (class),
 	                                        G_SIGNAL_RUN_LAST,
 	                                        G_STRUCT_OFFSET (IndicateListenerClass, indicator_removed),
 	                                        NULL, NULL,
 	                                        _indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
-	                                        G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING);
+	                                        G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
 	signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED,
 	                                        G_TYPE_FROM_CLASS (class),
 	                                        G_SIGNAL_RUN_LAST,
 	                                        G_STRUCT_OFFSET (IndicateListenerClass, indicator_modified),
 	                                        NULL, NULL,
 	                                        _indicate_listener_marshal_VOID__POINTER_POINTER_STRING_STRING,
-	                                        G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
+	                                        G_TYPE_NONE, 4, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING, G_TYPE_STRING);
 	signals[SERVER_ADDED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_ADDED,
 	                                        G_TYPE_FROM_CLASS (class),
 	                                        G_SIGNAL_RUN_LAST,
 	                                        G_STRUCT_OFFSET (IndicateListenerClass, server_added),
 	                                        NULL, NULL,
 	                                        _indicate_listener_marshal_VOID__POINTER_STRING,
-	                                        G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
+	                                        G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
 	signals[SERVER_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_REMOVED,
 	                                        G_TYPE_FROM_CLASS (class),
 	                                        G_SIGNAL_RUN_LAST,
 	                                        G_STRUCT_OFFSET (IndicateListenerClass, server_removed),
 	                                        NULL, NULL,
 	                                        _indicate_listener_marshal_VOID__POINTER_STRING,
-	                                        G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
+	                                        G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
 
 	dbus_g_object_register_marshaller(_indicate_listener_marshal_VOID__UINT_STRING,
 	                                  G_TYPE_NONE,
@@ -1024,3 +1024,25 @@
 	return server->interests[interest];
 }
 
+GType
+indicate_listener_server_get_gtype (void)
+{
+  static GType our_type = 0;
+  
+  if (our_type == 0)
+    our_type = g_pointer_type_register_static ("IndicateListenerServer");
+
+  return our_type;
+}
+
+GType
+indicate_listener_indicator_get_gtype (void)
+{
+  static GType our_type = 0;
+  
+  if (our_type == 0)
+    our_type = g_pointer_type_register_static ("IndicateListenerIndicator");
+
+  return our_type;
+}
+

=== modified file 'libindicate/listener.h'
--- libindicate/listener.h	2009-04-03 20:09:06 +0000
+++ libindicate/listener.h	2009-04-10 10:16:39 +0000
@@ -59,7 +59,12 @@
 #define INDICATE_LISTENER_INDICATOR_ID(indicator)    (indicate_listener_indicator_get_id(indicator))
 
 typedef struct _IndicateListenerServer IndicateListenerServer;
+#define INDICATE_TYPE_LISTENER_SERVER (indicate_listener_server_get_gtype ())
+GType                   indicate_listener_server_get_gtype (void) G_GNUC_CONST;
+
 typedef struct _IndicateListenerIndicator IndicateListenerIndicator;
+#define INDICATE_TYPE_LISTENER_INDICATOR (indicate_listener_indicator_get_gtype ())
+GType                   indicate_listener_indicator_get_gtype (void) G_GNUC_CONST;
 
 typedef struct _IndicateListener IndicateListener;
 struct _IndicateListener {

=== modified file 'libindicate/server.h'
--- libindicate/server.h	2009-04-08 02:08:27 +0000
+++ libindicate/server.h	2009-04-08 11:25:50 +0000
@@ -124,10 +124,6 @@
 IndicateServer * indicate_server_ref_default (void);
 void indicate_server_set_default (IndicateServer * server);
 
-/* Check to see if there is someone, out there, who likes this */
-gboolean indicate_server_check_interest (IndicateServer * server, IndicateInterests interest);
-
-
 /* Signal emission functions for sub-classes of the server */
 void indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gchar *type);
 void indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const gchar *type);

_______________________________________________
Mailing list: https://launchpad.net/~dx-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dx-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to