Merge lp:~eeejay/indicator-applet/gtypified into lp:indicator-applet/0.4

Proposed by Eitan Isaacson
Status: Merged
Merge reported by: Ted Gould
Merged at revision: not available
Proposed branch: lp:~eeejay/indicator-applet/gtypified
Merge into: lp:indicator-applet/0.4
Diff against target: None lines
To merge this branch: bzr merge lp:~eeejay/indicator-applet/gtypified
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+5431@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eitan Isaacson (eeejay) wrote :

This adds some touches that make all types in the API gtypes. This makes bindings much easier to create.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libindicate/Makefile.am'
2--- libindicate/Makefile.am 2009-04-03 17:27:31 +0000
3+++ libindicate/Makefile.am 2009-04-08 11:25:50 +0000
4@@ -1,3 +1,6 @@
5+MARSHAL_PREFIX = indicate_marshal
6+MARSHAL_FILE = indicate-marshal
7+ENUM_FILE = indicate-enum-types
8
9 INCLUDES= \
10 -DG_LOG_DOMAIN=\"libindicate\"
11@@ -14,7 +17,9 @@
12 dbus-listener-server.h \
13 dbus-listener-client.h \
14 listener-marshal.c \
15- listener-marshal.h
16+ listener-marshal.h \
17+ $(ENUM_FILE).h \
18+ $(ENUM_FILE).c
19
20 lib_LTLIBRARIES = \
21 libindicate.la
22@@ -26,7 +31,8 @@
23 indicator-message.h \
24 listener.h \
25 server.h \
26- interests.h
27+ interests.h \
28+ $(ENUM_FILE).h
29
30 libindicateinclude_HEADERS = \
31 $(indicate_headers)
32@@ -37,6 +43,7 @@
33 dbus-indicate-client.h \
34 dbus-listener-server.h \
35 dbus-listener-client.h \
36+ indicate-enum-types.c \
37 server.c \
38 listener.c \
39 listener-marshal.c \
40@@ -97,6 +104,39 @@
41 pkgconfig_DATA = indicate.pc
42 pkgconfigdir = $(libdir)/pkgconfig
43
44+$(ENUM_FILE).h: s-enum-types-h
45+ @true
46+s-enum-types-h: $(indicate_headers) Makefile
47+ ( cd $(srcdir) && glib-mkenums \
48+ --fhead "#ifndef _INDICATE_ENUM_TYPES_H_\n#define _INDICATE_ENUM_TYPES_H_\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
49+ --fprod "/* enumerations from \"@filename@\" */\n" \
50+ --vhead "GType @enum_name@_get_type(void);\n#define INDICATE_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
51+ --ftail "G_END_DECLS\n\n#endif /* _INDICATE_ENUM_TYPES_H_ */" \
52+ interests.h ) > tmp-$(ENUM_FILE).h \
53+ && (cmp -s tmp-$(ENUM_FILE).h $(ENUM_FILE).h || cp tmp-$(ENUM_FILE).h $(ENUM_FILE).h ) \
54+ && rm -f tmp-$(ENUM_FILE).h \
55+ && echo timestamp > $(@F)
56+
57+$(ENUM_FILE).c: s-enum-types-c
58+ @true
59+s-enum-types-c: $(indicate_headers) Makefile
60+ ( cd $(srcdir) && glib-mkenums \
61+ --fhead "#include <libindicate/interests.h>\n#include <glib-object.h>" \
62+ --fprod "\n/* enumerations from \"@filename@\" */" \
63+ --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
64+ --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
65+ --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
66+ interests.h ) > tmp-$(ENUM_FILE).c \
67+ && (cmp -s tmp-$(ENUM_FILE).c $(ENUM_FILE).c || cp tmp-$(ENUM_FILE).c $(ENUM_FILE).c ) \
68+ && rm -f tmp-$(ENUM_FILE).c \
69+ && echo timestamp > $(@F)
70+
71+CLEANFILES = \
72+ $(ENUM_FILE).c \
73+ $(ENUM_FILE).h \
74+ s-enum-types-c \
75+ s-enum-types-h
76+
77 if USE_GIR
78
79 gobjectintrospection_gir_DATA = \
80
81=== modified file 'libindicate/interests.h'
82--- libindicate/interests.h 2009-04-02 18:34:40 +0000
83+++ libindicate/interests.h 2009-04-08 11:25:50 +0000
84@@ -34,8 +34,7 @@
85
86 G_BEGIN_DECLS
87
88-typedef enum _IndicateInterests IndicateInterests;
89-enum _IndicateInterests {
90+typedef enum {
91 INDICATE_INTEREST_NONE, /**< We're of no interest */
92 INDICATE_INTEREST_SERVER_DISPLAY, /**< Displays the server's existance to the user */
93 INDICATE_INTEREST_SERVER_SIGNAL, /**< Will send signals to the server to be displayed */
94@@ -43,7 +42,7 @@
95 INDICATE_INTEREST_INDICATOR_SIGNAL, /**< Will return signals based on individual indicators being responded to */
96 INDICATE_INTEREST_INDICATOR_COUNT, /**< Only displays a count of the indicators */
97 INDICATE_INTEREST_LAST /**< Makes merges and counting easier */
98-};
99+} IndicateInterests;
100
101 G_END_DECLS
102
103
104=== modified file 'libindicate/listener.c'
105--- libindicate/listener.c 2009-04-07 15:14:00 +0000
106+++ libindicate/listener.c 2009-04-10 10:16:39 +0000
107@@ -154,35 +154,35 @@
108 G_STRUCT_OFFSET (IndicateListenerClass, indicator_added),
109 NULL, NULL,
110 _indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
111- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING);
112+ G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
113 signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED,
114 G_TYPE_FROM_CLASS (class),
115 G_SIGNAL_RUN_LAST,
116 G_STRUCT_OFFSET (IndicateListenerClass, indicator_removed),
117 NULL, NULL,
118 _indicate_listener_marshal_VOID__POINTER_POINTER_STRING,
119- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING);
120+ G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING);
121 signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED,
122 G_TYPE_FROM_CLASS (class),
123 G_SIGNAL_RUN_LAST,
124 G_STRUCT_OFFSET (IndicateListenerClass, indicator_modified),
125 NULL, NULL,
126 _indicate_listener_marshal_VOID__POINTER_POINTER_STRING_STRING,
127- G_TYPE_NONE, 4, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
128+ G_TYPE_NONE, 4, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING, G_TYPE_STRING);
129 signals[SERVER_ADDED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_ADDED,
130 G_TYPE_FROM_CLASS (class),
131 G_SIGNAL_RUN_LAST,
132 G_STRUCT_OFFSET (IndicateListenerClass, server_added),
133 NULL, NULL,
134 _indicate_listener_marshal_VOID__POINTER_STRING,
135- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
136+ G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
137 signals[SERVER_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_REMOVED,
138 G_TYPE_FROM_CLASS (class),
139 G_SIGNAL_RUN_LAST,
140 G_STRUCT_OFFSET (IndicateListenerClass, server_removed),
141 NULL, NULL,
142 _indicate_listener_marshal_VOID__POINTER_STRING,
143- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_STRING);
144+ G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING);
145
146 dbus_g_object_register_marshaller(_indicate_listener_marshal_VOID__UINT_STRING,
147 G_TYPE_NONE,
148@@ -1024,3 +1024,25 @@
149 return server->interests[interest];
150 }
151
152+GType
153+indicate_listener_server_get_gtype (void)
154+{
155+ static GType our_type = 0;
156+
157+ if (our_type == 0)
158+ our_type = g_pointer_type_register_static ("IndicateListenerServer");
159+
160+ return our_type;
161+}
162+
163+GType
164+indicate_listener_indicator_get_gtype (void)
165+{
166+ static GType our_type = 0;
167+
168+ if (our_type == 0)
169+ our_type = g_pointer_type_register_static ("IndicateListenerIndicator");
170+
171+ return our_type;
172+}
173+
174
175=== modified file 'libindicate/listener.h'
176--- libindicate/listener.h 2009-04-03 20:09:06 +0000
177+++ libindicate/listener.h 2009-04-10 10:16:39 +0000
178@@ -59,7 +59,12 @@
179 #define INDICATE_LISTENER_INDICATOR_ID(indicator) (indicate_listener_indicator_get_id(indicator))
180
181 typedef struct _IndicateListenerServer IndicateListenerServer;
182+#define INDICATE_TYPE_LISTENER_SERVER (indicate_listener_server_get_gtype ())
183+GType indicate_listener_server_get_gtype (void) G_GNUC_CONST;
184+
185 typedef struct _IndicateListenerIndicator IndicateListenerIndicator;
186+#define INDICATE_TYPE_LISTENER_INDICATOR (indicate_listener_indicator_get_gtype ())
187+GType indicate_listener_indicator_get_gtype (void) G_GNUC_CONST;
188
189 typedef struct _IndicateListener IndicateListener;
190 struct _IndicateListener {
191
192=== modified file 'libindicate/server.h'
193--- libindicate/server.h 2009-04-08 02:08:27 +0000
194+++ libindicate/server.h 2009-04-08 11:25:50 +0000
195@@ -124,10 +124,6 @@
196 IndicateServer * indicate_server_ref_default (void);
197 void indicate_server_set_default (IndicateServer * server);
198
199-/* Check to see if there is someone, out there, who likes this */
200-gboolean indicate_server_check_interest (IndicateServer * server, IndicateInterests interest);
201-
202-
203 /* Signal emission functions for sub-classes of the server */
204 void indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gchar *type);
205 void indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const gchar *type);

Subscribers

People subscribed via source and target branches

to status/vote changes: