diff options
author | Richard Purdie <richard@openedhand.com> | 2005-09-28 22:52:08 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2005-09-28 22:52:08 +0000 |
commit | fddaad5f93028ade759d7094f98b968ecc35791c (patch) | |
tree | 76e860418c885c5a8f2d049d77408d3144bb0d97 /openembedded/packages/libglade | |
parent | cb47354f1ce201e7b2d16698be19055c0d15c984 (diff) | |
download | poky-fddaad5f93028ade759d7094f98b968ecc35791c.tar.gz |
Add libglade for eds-dbus
git-svn-id: https://svn.o-hand.com/repos/poky@54 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'openembedded/packages/libglade')
3 files changed, 632 insertions, 0 deletions
diff --git a/openembedded/packages/libglade/libglade-2.5.1/glade-cruft.patch b/openembedded/packages/libglade/libglade-2.5.1/glade-cruft.patch new file mode 100644 index 0000000000..0fceccf0c4 --- /dev/null +++ b/openembedded/packages/libglade/libglade-2.5.1/glade-cruft.patch | |||
@@ -0,0 +1,100 @@ | |||
1 | diff -ur libglade-2.4.0~/configure.in libglade-2.4.0/configure.in | ||
2 | --- libglade-2.4.0~/configure.in 2004-05-17 12:38:31.000000000 +0100 | ||
3 | +++ libglade-2.4.0/configure.in 2004-07-28 16:53:09.000000000 +0100 | ||
4 | @@ -147,6 +147,18 @@ | ||
5 | AM_CONDITIONAL(HAVE_PYTHON, $have_python) | ||
6 | AC_SUBST(PYTHON) | ||
7 | |||
8 | +AC_MSG_CHECKING([for cruft in libgtk]) | ||
9 | +AC_TRY_LINK([ | ||
10 | +#include <gtk/gtk.h> | ||
11 | +#include <stdio.h> | ||
12 | +], [ gtk_tree_get_type (); return 0; ], | ||
13 | + [ AC_MSG_RESULT(yes) | ||
14 | + have_cruft=yes ], | ||
15 | + [ AC_MSG_RESULT(no) | ||
16 | + AC_DEFINE(DISABLE_CRUFT,,[leave out support for old, broken widgets]) | ||
17 | + have_cruft=no ]) | ||
18 | +AC_SUBST(DISABLE_CRUFT) | ||
19 | + | ||
20 | dnl add debugging options ... | ||
21 | changequote(,)dnl | ||
22 | if test "x$GCC" = xyes; then | ||
23 | Only in libglade-2.4.0: configure.in.orig | ||
24 | diff -ur libglade-2.4.0~/glade/glade-gtk.c libglade-2.4.0/glade/glade-gtk.c | ||
25 | --- libglade-2.4.0~/glade/glade-gtk.c 2004-03-13 13:47:35.000000000 +0000 | ||
26 | +++ libglade-2.4.0/glade/glade-gtk.c 2004-07-28 16:53:52.000000000 +0100 | ||
27 | @@ -213,6 +213,8 @@ | ||
28 | gtk_clist_column_titles_hide (GTK_CLIST (w)); | ||
29 | } | ||
30 | |||
31 | +#ifndef DISABLE_CRUFT | ||
32 | + | ||
33 | static void | ||
34 | tree_set_selection_mode (GladeXML *xml, GtkWidget *w, | ||
35 | const char *name, const char *value) | ||
36 | @@ -238,6 +240,8 @@ | ||
37 | gtk_tree_set_view_lines (GTK_TREE (w), BOOL (value)); | ||
38 | } | ||
39 | |||
40 | +#endif | ||
41 | + | ||
42 | static void | ||
43 | list_set_selection_mode (GladeXML *xml, GtkWidget *w, | ||
44 | const char *name, const char *value) | ||
45 | @@ -254,6 +258,7 @@ | ||
46 | gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (w), BOOL (value)); | ||
47 | } | ||
48 | |||
49 | +#ifndef DISABLE_CRUFT | ||
50 | static void | ||
51 | text_set_text (GladeXML *xml, GtkWidget *w, | ||
52 | const char *name, const char *value) | ||
53 | @@ -262,6 +267,7 @@ | ||
54 | |||
55 | gtk_editable_insert_text (GTK_EDITABLE (w), value, -1, &pos); | ||
56 | } | ||
57 | +#endif | ||
58 | |||
59 | static void | ||
60 | radio_menu_item_set_group (GladeXML *xml, GtkWidget *w, | ||
61 | @@ -1125,13 +1131,17 @@ | ||
62 | glade_register_custom_prop (GTK_TYPE_CLIST, "selection_mode", clist_set_selection_mode); | ||
63 | glade_register_custom_prop (GTK_TYPE_CLIST, "shadow_type", clist_set_shadow_type); | ||
64 | glade_register_custom_prop (GTK_TYPE_CLIST, "show_titles", clist_set_show_titles); | ||
65 | +#ifndef DISABLE_CRUFT | ||
66 | glade_register_custom_prop (GTK_TYPE_TREE, "selection_mode", tree_set_selection_mode); | ||
67 | glade_register_custom_prop (GTK_TYPE_TREE, "view_mode", tree_set_view_mode); | ||
68 | glade_register_custom_prop (GTK_TYPE_TREE, "view_line", tree_set_view_line); | ||
69 | +#endif | ||
70 | glade_register_custom_prop (GTK_TYPE_LIST, "selection_mode", list_set_selection_mode); | ||
71 | glade_register_custom_prop (GTK_TYPE_CHECK_MENU_ITEM, "always_show_toggle", | ||
72 | check_menu_item_set_always_show_toggle); | ||
73 | +#ifndef DISABLE_CRUFT | ||
74 | glade_register_custom_prop (GTK_TYPE_TEXT, "text", text_set_text); | ||
75 | +#endif | ||
76 | glade_register_custom_prop (GTK_TYPE_RADIO_MENU_ITEM, "group", | ||
77 | radio_menu_item_set_group); | ||
78 | glade_register_custom_prop (GTK_TYPE_TOOLBAR, "tooltips", toolbar_set_tooltips); | ||
79 | @@ -1288,8 +1298,10 @@ | ||
80 | glade_standard_build_children, NULL); | ||
81 | glade_register_widget (GTK_TYPE_TEAROFF_MENU_ITEM, glade_standard_build_widget, | ||
82 | NULL, NULL); | ||
83 | +#ifndef DISABLE_CRUFT | ||
84 | glade_register_widget (GTK_TYPE_TEXT, glade_standard_build_widget, | ||
85 | NULL, NULL); | ||
86 | +#endif | ||
87 | glade_register_widget (GTK_TYPE_TEXT_VIEW, glade_standard_build_widget, | ||
88 | NULL, NULL); | ||
89 | glade_register_widget (GTK_TYPE_TIPS_QUERY, glade_standard_build_widget, | ||
90 | @@ -1304,8 +1316,10 @@ | ||
91 | glade_standard_build_children, NULL); | ||
92 | glade_register_widget (GTK_TYPE_TOOL_BUTTON, glade_standard_build_widget, | ||
93 | NULL, NULL); | ||
94 | +#ifndef DISABLE_CRUFT | ||
95 | glade_register_widget (GTK_TYPE_TREE, glade_standard_build_widget, | ||
96 | NULL, NULL); | ||
97 | +#endif | ||
98 | glade_register_widget (GTK_TYPE_TREE_VIEW, glade_standard_build_widget, | ||
99 | NULL, NULL); | ||
100 | glade_register_widget (GTK_TYPE_VBUTTON_BOX, glade_standard_build_widget, | ||
diff --git a/openembedded/packages/libglade/libglade-2.5.1/no-xml2.patch b/openembedded/packages/libglade/libglade-2.5.1/no-xml2.patch new file mode 100644 index 0000000000..1c2e215b8d --- /dev/null +++ b/openembedded/packages/libglade/libglade-2.5.1/no-xml2.patch | |||
@@ -0,0 +1,499 @@ | |||
1 | diff -urN libglade-2.4.2.orig/configure.in libglade-2.4.2/configure.in | ||
2 | --- libglade-2.4.2.orig/configure.in 2005-02-11 12:42:58.000000000 +0100 | ||
3 | +++ libglade-2.4.2/configure.in 2005-03-22 01:22:00.000000000 +0100 | ||
4 | @@ -52,11 +52,33 @@ | ||
5 | AC_PATH_PROG(PKG_CONFIG, pkg-config, no) | ||
6 | |||
7 | PKG_CHECK_MODULES(LIBGLADE, [dnl | ||
8 | - libxml-2.0 >= required_libxml_version dnl | ||
9 | atk >= required_atk_version dnl | ||
10 | gtk+-2.0 >= required_gtk_version dnl | ||
11 | glib-2.0 >= required_glib_version]) | ||
12 | |||
13 | +disable_xml2=no | ||
14 | +AC_ARG_WITH([libxml2], | ||
15 | + AC_HELP_STRING([--without-libxml2], [Don't use libxml2, use Glib's GMarkupParser instead]), | ||
16 | + [disable_xml2=yes], | ||
17 | + [disable_xml2=no]) | ||
18 | + | ||
19 | +AC_MSG_CHECKING([if we are using libxml2]) | ||
20 | +if test "x$disable_xml2" == "xno"; then | ||
21 | + AC_MSG_RESULT(yes) | ||
22 | + PKG_CHECK_MODULES(XML2, libxml-2.0 >= 2.4.10) | ||
23 | + PKGCFG_REQUIRE_LIBXML2="libxml-2.0" | ||
24 | + LIBGLADE_CFLAGS="$LIBGLADE_CFLAGS $XML2_CFLAGS" | ||
25 | + LIBGLADE_LIBS="$LIBGLADE_LIBS $XML2_LIBS" | ||
26 | +else | ||
27 | + LIBGLADE_CFLAGS="$LIBGLADE_CFLAGS -DUSE_GMARKUP_PARSER" | ||
28 | + PKGCFG_REQUIRE_LIBXML2="" | ||
29 | + AC_MSG_RESULT(no) | ||
30 | +fi | ||
31 | + | ||
32 | +AC_SUBST(XML2_LIBS) | ||
33 | +AC_SUBST(XML2_CFLAGS) | ||
34 | +AC_SUBST(PKGCFG_REQUIRE_LIBXML2) | ||
35 | + | ||
36 | AC_MSG_CHECKING([for native Win32]) | ||
37 | case "$host" in | ||
38 | *-*-mingw*) | ||
39 | @@ -116,6 +138,21 @@ | ||
40 | fi | ||
41 | fi | ||
42 | |||
43 | +if test "x$disable_xml2" == "xyes"; then | ||
44 | + echo "*****************************************************" | ||
45 | + echo " You chose to disable libxml2 and use Glib's" | ||
46 | + echo " GMarkupParser instead." | ||
47 | + echo | ||
48 | + echo " Please bear in mind that using libglade with" | ||
49 | + echo " GMarkupParser is an experimental feature only." | ||
50 | + echo | ||
51 | + echo " Please post problems or success stories to" | ||
52 | + echo " the glade-devel mailing list. Thank you." | ||
53 | + echo "*****************************************************" | ||
54 | +fi | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | GTK_DOC_CHECK(1.0) | ||
59 | |||
60 | dnl gettext stuff ... there is no message catalog for libglade -- libglade | ||
61 | diff -urN libglade-2.4.2.orig/glade/glade-parser.c libglade-2.4.2/glade/glade-parser.c | ||
62 | --- libglade-2.4.2.orig/glade/glade-parser.c 2004-11-11 11:56:13.000000000 +0100 | ||
63 | +++ libglade-2.4.2/glade/glade-parser.c 2005-03-22 01:20:00.000000000 +0100 | ||
64 | @@ -34,7 +34,15 @@ | ||
65 | # define dgettext(Domain, String) (String) | ||
66 | #endif | ||
67 | |||
68 | -#include <libxml/parser.h> | ||
69 | +#ifdef USE_GMARKUP_PARSER | ||
70 | +# include <zlib.h> | ||
71 | +#else | ||
72 | +# include <libxml/parser.h> | ||
73 | +#endif | ||
74 | + | ||
75 | +#ifdef USE_GMARKUP_PARSER | ||
76 | +# define xmlChar gchar | ||
77 | +#endif | ||
78 | |||
79 | #include "glade-parser.h" | ||
80 | #include "glade-private.h" | ||
81 | @@ -508,7 +516,9 @@ | ||
82 | case PARSER_START: | ||
83 | if (!strcmp(name, "glade-interface")) { | ||
84 | state->state = PARSER_GLADE_INTERFACE; | ||
85 | -#if 0 | ||
86 | + | ||
87 | +#ifndef USE_GMARKUP_PARSER | ||
88 | + #if 0 | ||
89 | /* check for correct XML namespace */ | ||
90 | for (i = 0; attrs && attrs[i] != NULL; i += 2) { | ||
91 | if (!strcmp(attrs[i], "xmlns") && | ||
92 | @@ -518,7 +528,9 @@ | ||
93 | g_warning("unknown attribute `%s' for <glade-interface>", | ||
94 | attrs[i]); | ||
95 | } | ||
96 | + #endif | ||
97 | #endif | ||
98 | + | ||
99 | } else { | ||
100 | g_warning("Expected <glade-interface>. Got <%s>.", name); | ||
101 | state->prev_state = state->state; | ||
102 | @@ -1063,12 +1075,18 @@ | ||
103 | } | ||
104 | } | ||
105 | |||
106 | +#ifndef USE_GMARKUP_PARSER | ||
107 | + | ||
108 | static xmlEntityPtr | ||
109 | glade_parser_get_entity(GladeParseState *state, const xmlChar *name) | ||
110 | { | ||
111 | return xmlGetPredefinedEntity(name); | ||
112 | } | ||
113 | |||
114 | +#endif /* !defined(USE_GMARKUP_PARSER) */ | ||
115 | + | ||
116 | +#ifndef USE_GMARKUP_PARSER | ||
117 | + | ||
118 | static void | ||
119 | glade_parser_warning(GladeParseState *state, const char *msg, ...) | ||
120 | { | ||
121 | @@ -1079,6 +1097,10 @@ | ||
122 | va_end(args); | ||
123 | } | ||
124 | |||
125 | +#endif /* !defined(USE_GMARKUP_PARSER) */ | ||
126 | + | ||
127 | +#ifndef USE_GMARKUP_PARSER | ||
128 | + | ||
129 | static void | ||
130 | glade_parser_error(GladeParseState *state, const char *msg, ...) | ||
131 | { | ||
132 | @@ -1089,6 +1111,10 @@ | ||
133 | va_end(args); | ||
134 | } | ||
135 | |||
136 | +#endif /* !defined(USE_GMARKUP_PARSER) */ | ||
137 | + | ||
138 | +#ifndef USE_GMARKUP_PARSER | ||
139 | + | ||
140 | static void | ||
141 | glade_parser_fatal_error(GladeParseState *state, const char *msg, ...) | ||
142 | { | ||
143 | @@ -1099,6 +1125,10 @@ | ||
144 | va_end(args); | ||
145 | } | ||
146 | |||
147 | +#endif /* !defined(USE_GMARKUP_PARSER) */ | ||
148 | + | ||
149 | +#ifndef USE_GMARKUP_PARSER | ||
150 | + | ||
151 | static xmlSAXHandler glade_parser = { | ||
152 | (internalSubsetSAXFunc)NULL, /* internalSubset */ | ||
153 | (isStandaloneSAXFunc)NULL, /* isStandalone */ | ||
154 | @@ -1126,6 +1156,82 @@ | ||
155 | (fatalErrorSAXFunc)glade_parser_fatal_error, /* fatalError */ | ||
156 | }; | ||
157 | |||
158 | +#else /* USE_GMARKUP_PARSER */ | ||
159 | + | ||
160 | +static void | ||
161 | +glade_parser_start_element_wrapper(GMarkupParseContext *context, | ||
162 | + const gchar *name, | ||
163 | + const gchar **attr_names, | ||
164 | + const gchar **attr_values, | ||
165 | + gpointer state, | ||
166 | + GError **error) | ||
167 | +{ | ||
168 | + guint i = 0; | ||
169 | + | ||
170 | + /* Pack attribute names/values from two separate | ||
171 | + * arrays (GMarkupParser style) into one single | ||
172 | + * array (libxml SAXParser style). This is not | ||
173 | + * very efficient, but we do it to make the | ||
174 | + * GMarkupParser code as little invasive as | ||
175 | + * possible. */ | ||
176 | + | ||
177 | + while (attr_names[i] != NULL) { | ||
178 | + ++i; | ||
179 | + } | ||
180 | + | ||
181 | + if (1) | ||
182 | + { | ||
183 | + const gchar *attr[(i*2)+1]; | ||
184 | + guint j, k; | ||
185 | + | ||
186 | + for (j=0, k=0; k < i; j += 2) | ||
187 | + { | ||
188 | + attr[j] = attr_names[k]; | ||
189 | + attr[j+1] = attr_values[k]; | ||
190 | + ++k; | ||
191 | + } | ||
192 | + attr[i*2] = NULL; | ||
193 | + | ||
194 | + glade_parser_start_element((GladeParseState*)state, name, attr); | ||
195 | + } | ||
196 | +} | ||
197 | + | ||
198 | +static void | ||
199 | +glade_parser_end_element_wrapper(GMarkupParseContext *context, | ||
200 | + const gchar *name, | ||
201 | + gpointer state, | ||
202 | + GError **err) | ||
203 | +{ | ||
204 | + glade_parser_end_element((GladeParseState*)state, name); | ||
205 | +} | ||
206 | + | ||
207 | +static void | ||
208 | +glade_parser_characters_wrapper(GMarkupParseContext *context, | ||
209 | + const gchar *chars, | ||
210 | + gsize len, | ||
211 | + gpointer state, | ||
212 | + GError **err) | ||
213 | +{ | ||
214 | + glade_parser_characters((GladeParseState*)state, chars, (int) len); | ||
215 | +} | ||
216 | + | ||
217 | +static void | ||
218 | +glade_parser_error(GMarkupParseContext *context, GError *err, gpointer data) | ||
219 | +{ | ||
220 | + g_log("Glade-Parser", G_LOG_LEVEL_CRITICAL, "%s", err->message); | ||
221 | +} | ||
222 | + | ||
223 | +static const GMarkupParser glade_parser = { | ||
224 | + glade_parser_start_element_wrapper, /* element open */ | ||
225 | + glade_parser_end_element_wrapper, /* element close */ | ||
226 | + glade_parser_characters_wrapper, /* text content */ | ||
227 | + NULL, /* passthrough */ | ||
228 | + glade_parser_error, /* parse error */ | ||
229 | +}; | ||
230 | + | ||
231 | +#endif /* USE_GMARKUP_PARSER */ | ||
232 | + | ||
233 | + | ||
234 | static void | ||
235 | widget_info_free(GladeWidgetInfo *info) | ||
236 | { | ||
237 | @@ -1191,6 +1297,9 @@ | ||
238 | * | ||
239 | * Returns: the GladeInterface structure for the XML file. | ||
240 | */ | ||
241 | + | ||
242 | +#ifndef USE_GMARKUP_PARSER | ||
243 | + | ||
244 | GladeInterface * | ||
245 | glade_parser_parse_file(const gchar *file, const gchar *domain) | ||
246 | { | ||
247 | @@ -1222,6 +1331,31 @@ | ||
248 | return state.interface; | ||
249 | } | ||
250 | |||
251 | +#else /* defined(USE_GMARKUP_PARSER) */ | ||
252 | + | ||
253 | +GladeInterface * | ||
254 | +glade_parser_parse_file(const gchar *file, const gchar *domain) | ||
255 | +{ | ||
256 | + GladeInterface *interface; | ||
257 | + GError *err = NULL; | ||
258 | + gchar *content = NULL; | ||
259 | + gsize clen; | ||
260 | + | ||
261 | + if (!g_file_get_contents(file, &content, &clen, &err)) { | ||
262 | + g_warning("could not load glade file: %s", err->message); | ||
263 | + g_error_free(err); | ||
264 | + return NULL; | ||
265 | + } | ||
266 | + | ||
267 | + interface = glade_parser_parse_buffer(content, (gint) clen, domain); | ||
268 | + | ||
269 | + g_free(content); | ||
270 | + | ||
271 | + return interface; | ||
272 | +} | ||
273 | + | ||
274 | +#endif /* USE_GMARKUP_PARSER */ | ||
275 | + | ||
276 | /** | ||
277 | * glade_parser_parse_buffer | ||
278 | * @buffer: a buffer in memory containing XML data. | ||
279 | @@ -1237,6 +1371,9 @@ | ||
280 | * | ||
281 | * Returns: the GladeInterface structure for the XML buffer. | ||
282 | */ | ||
283 | + | ||
284 | +#ifndef USE_GMARKUP_PARSER | ||
285 | + | ||
286 | GladeInterface * | ||
287 | glade_parser_parse_buffer(const gchar *buffer, gint len, const gchar *domain) | ||
288 | { | ||
289 | @@ -1263,6 +1400,161 @@ | ||
290 | return state.interface; | ||
291 | } | ||
292 | |||
293 | +#else /* defined(USE_GMARKUP_PARSER) */ | ||
294 | + | ||
295 | + | ||
296 | +static GladeInterface * | ||
297 | +glade_parser_parse_buffer_internal(const gchar *buffer, gint len, const gchar *domain) | ||
298 | +{ | ||
299 | + GMarkupParseContext *context; | ||
300 | + GladeParseState state = { 0 }; | ||
301 | + GError *err = NULL; | ||
302 | + | ||
303 | + state.interface = NULL; | ||
304 | + if (domain) | ||
305 | + state.domain = domain; | ||
306 | + else | ||
307 | + state.domain = textdomain(NULL); | ||
308 | + | ||
309 | + /* FIXME: This strstr() is not safe, as it ignores the len | ||
310 | + * argument and assumes the buffer is NUL-terminated */ | ||
311 | + if (strstr(buffer, "<?xml") == NULL) { | ||
312 | + g_warning("No XML header found in document!"); | ||
313 | + return NULL; | ||
314 | + } | ||
315 | + | ||
316 | + context = g_markup_parse_context_new(&glade_parser, (GMarkupParseFlags) 0, &state, NULL); | ||
317 | + | ||
318 | + glade_parser_start_document(&state); | ||
319 | + | ||
320 | + if (!g_markup_parse_context_parse(context, buffer, (gssize) len, &err)) { | ||
321 | + g_warning("document not well formed: %s", err->message); | ||
322 | + g_error_free(err); | ||
323 | + if (state.interface) | ||
324 | + glade_interface_destroy (state.interface); | ||
325 | + return NULL; | ||
326 | + } | ||
327 | + | ||
328 | + glade_parser_end_document(&state); | ||
329 | + | ||
330 | + if (state.state != PARSER_FINISH) { | ||
331 | + g_warning("did not finish in PARSER_FINISH state!"); | ||
332 | + | ||
333 | + if (state.interface) | ||
334 | + glade_interface_destroy(state.interface); | ||
335 | + | ||
336 | + return NULL; | ||
337 | + } | ||
338 | + | ||
339 | + return state.interface; | ||
340 | +} | ||
341 | + | ||
342 | +struct _gzip_rfc1952_hdr | ||
343 | +{ | ||
344 | + guint8 id1, id2, cm, flags; | ||
345 | + guint32 mtime; | ||
346 | + guint8 xflags; | ||
347 | + guint8 os; | ||
348 | +}; | ||
349 | + | ||
350 | +static GladeInterface * | ||
351 | +glade_parser_parse_gzipped_buffer(const gchar *buffer, gint len, const gchar *domain) | ||
352 | +{ | ||
353 | + struct _gzip_rfc1952_hdr *hdr = (struct _gzip_rfc1952_hdr*)buffer; | ||
354 | + struct z_stream_s zstream; | ||
355 | + GladeInterface *interface; | ||
356 | + const guint8 *cbuf; /* start of compressed data */ | ||
357 | + guint8 *decompress_buf; | ||
358 | + gulong decompress_len = 0; | ||
359 | + gint ret; | ||
360 | + | ||
361 | + g_assert(hdr != NULL && hdr->id1 == 0x1f && hdr->id2 == 0x8b); | ||
362 | + | ||
363 | + if (hdr->cm != Z_DEFLATED) { | ||
364 | + g_warning("Unknown decompression method %u", (guint) hdr->cm); | ||
365 | + return NULL; | ||
366 | + } | ||
367 | + | ||
368 | + /* Uncompressed size (modulo 2^32) is last | ||
369 | + * 4 bytes of gzipped file, and little endian. | ||
370 | + * See RFC 1952 */ | ||
371 | + decompress_len = GUINT32_FROM_LE(*((guint32*)(((guint8*)buffer) + len - 4))); | ||
372 | + | ||
373 | + /* paranoid mode: glade files > 5MB are unlikely */ | ||
374 | + g_return_val_if_fail(decompress_len < 5*1024*1024, NULL); | ||
375 | + | ||
376 | + decompress_buf = g_malloc0(decompress_len + 1); /* +1 for NUL-terminator */ | ||
377 | + | ||
378 | + /* find start of compressed data, skipping header stuff */ | ||
379 | + cbuf = (guint8*)buffer + 10; | ||
380 | + if (hdr->flags & 0x04) { | ||
381 | + guint16 xlen = GUINT16_FROM_LE(*((guint16*)cbuf)); | ||
382 | + cbuf += xlen + 2; | ||
383 | + } | ||
384 | + if (hdr->flags & 0x08) { | ||
385 | + guint16 onamelen = strlen(cbuf); | ||
386 | + cbuf += onamelen + 1; | ||
387 | + } | ||
388 | + if (hdr->flags & 0x10) { | ||
389 | + guint16 commentlen = strlen(cbuf); | ||
390 | + cbuf += commentlen + 1; | ||
391 | + } | ||
392 | + if (hdr->flags & 0x02) | ||
393 | + { | ||
394 | + cbuf += 2; /* skip header CRC16 */ | ||
395 | + } | ||
396 | + | ||
397 | + zstream.next_in = (void*)cbuf; | ||
398 | + zstream.avail_in = (uLongf) len - ((void*)cbuf-(void*)buffer) - 4 - 4 +1; | ||
399 | + zstream.next_out = decompress_buf; | ||
400 | + zstream.avail_out= decompress_len; | ||
401 | + zstream.zalloc = Z_NULL; | ||
402 | + zstream.zfree = Z_NULL; | ||
403 | + zstream.opaque = Z_NULL; | ||
404 | + | ||
405 | + ret = inflateInit2(&zstream, -MAX_WBITS); | ||
406 | + | ||
407 | + if (ret != Z_OK) { | ||
408 | + g_warning("inflateInit2() failed. zlib error code: %d", ret); | ||
409 | + g_free(decompress_buf); | ||
410 | + return NULL; | ||
411 | + } | ||
412 | + | ||
413 | + ret = inflate(&zstream, Z_FINISH); | ||
414 | + | ||
415 | + if (ret != Z_STREAM_END) { | ||
416 | + g_warning("zlib decompression failed. zlib error code: %d", ret); | ||
417 | + g_free(decompress_buf); | ||
418 | + return NULL; | ||
419 | + } | ||
420 | + | ||
421 | + interface = glade_parser_parse_buffer_internal(decompress_buf, decompress_len, domain); | ||
422 | + | ||
423 | + g_free(decompress_buf); | ||
424 | + | ||
425 | + return interface; | ||
426 | +} | ||
427 | + | ||
428 | +GladeInterface * | ||
429 | +glade_parser_parse_buffer(const gchar *buffer, gint len, const gchar *domain) | ||
430 | +{ | ||
431 | + g_return_val_if_fail(buffer != NULL, NULL); | ||
432 | + g_return_val_if_fail(len > 0, NULL); | ||
433 | + | ||
434 | + /* Check if buffer is gzipped */ | ||
435 | + if (buffer[0] == 0x1f && buffer[1] == (gchar)0x8b) { | ||
436 | + return glade_parser_parse_gzipped_buffer(buffer, len, domain); | ||
437 | + } | ||
438 | + | ||
439 | + /* Buffer is cleartext. */ | ||
440 | + return glade_parser_parse_buffer_internal(buffer, len, domain); | ||
441 | +} | ||
442 | + | ||
443 | +#endif /* USE_GMARKUP_PARSER */ | ||
444 | + | ||
445 | + | ||
446 | +#ifndef USE_GMARKUP_PARSER | ||
447 | + | ||
448 | static void | ||
449 | dump_widget(xmlNode *parent, GladeWidgetInfo *info, gint indent) | ||
450 | { | ||
451 | @@ -1382,6 +1674,8 @@ | ||
452 | xmlNodeAddContent(widget, " "); | ||
453 | } | ||
454 | |||
455 | +#endif /* !defined(USE_GMARKUP_PARSER) */ | ||
456 | + | ||
457 | /** | ||
458 | * glade_interface_dump | ||
459 | * @interface: the GladeInterface | ||
460 | @@ -1390,6 +1684,9 @@ | ||
461 | * This function dumps the contents of a GladeInterface into a file as | ||
462 | * XML. It is intended mainly as a debugging tool. | ||
463 | */ | ||
464 | + | ||
465 | +#ifndef USE_GMARKUP_PARSER | ||
466 | + | ||
467 | void | ||
468 | glade_interface_dump(GladeInterface *interface, const gchar *filename) | ||
469 | { | ||
470 | @@ -1428,6 +1725,17 @@ | ||
471 | xmlFreeDoc(doc); | ||
472 | } | ||
473 | |||
474 | +#else /* defined(USE_GMARKUP_PARSER) */ | ||
475 | + | ||
476 | +void | ||
477 | +glade_interface_dump(GladeInterface *interface, const gchar *filename) | ||
478 | +{ | ||
479 | + g_warning("glade_interface_dump() is only available with libxml2."); | ||
480 | +} | ||
481 | + | ||
482 | +#endif /* USE_GMARKUP_PARSER */ | ||
483 | + | ||
484 | + | ||
485 | #if 0 | ||
486 | int | ||
487 | main(int argc, char **argv) { | ||
488 | diff -urN libglade-2.4.2.orig/libglade-2.0.pc.in libglade-2.4.2/libglade-2.0.pc.in | ||
489 | --- libglade-2.4.2.orig/libglade-2.0.pc.in 2001-12-12 15:28:23.000000000 +0100 | ||
490 | +++ libglade-2.4.2/libglade-2.0.pc.in 2005-03-22 01:20:00.000000000 +0100 | ||
491 | @@ -11,7 +11,7 @@ | ||
492 | Name: Libglade | ||
493 | Description: a library for dynamically loading GLADE interface files | ||
494 | Version: @VERSION@ | ||
495 | -Requires: gtk+-2.0 libxml-2.0 | ||
496 | +Requires: gtk+-2.0 @PKGCFG_REQUIRE_LIBXML2@ | ||
497 | Libs: -L${libdir} -lglade-2.0 | ||
498 | Cflags: -I${includedir}/libglade-2.0 | ||
499 | |||
diff --git a/openembedded/packages/libglade/libglade_2.5.1.bb b/openembedded/packages/libglade/libglade_2.5.1.bb new file mode 100644 index 0000000000..f7f75e501d --- /dev/null +++ b/openembedded/packages/libglade/libglade_2.5.1.bb | |||
@@ -0,0 +1,33 @@ | |||
1 | LICENSE = "LGPL" | ||
2 | DESCRIPTION = "Runtime support for GTK interface builder" | ||
3 | SECTION = "libs" | ||
4 | PRIORITY = "optional" | ||
5 | DEPENDS = "gtk+ gtk-doc" | ||
6 | MAINTAINER = "Phil Blundell <pb@handhelds.org>" | ||
7 | |||
8 | inherit autotools pkgconfig gnome | ||
9 | |||
10 | PR = "r0" | ||
11 | |||
12 | SRC_URI += "file://glade-cruft.patch;patch=1 file://no-xml2.patch;patch=1" | ||
13 | |||
14 | EXTRA_OECONF += "--without-libxml2" | ||
15 | |||
16 | CFLAGS += "-lz" | ||
17 | |||
18 | PACKAGES += " ${PN}-data" | ||
19 | FILES_${PN} = "${libdir}/lib*.so.*" | ||
20 | FILES_${PN}-data = "${datadir}/xml/libglade/glade-2.0.dtd" | ||
21 | FILES_${PN}-dev += "${bindir}/libglade-convert" | ||
22 | #RDEPENDS_${PN} = "${PN}-data" | ||
23 | |||
24 | headers = "glade-build.h glade-init.h glade-parser.h glade-xml.h glade.h" | ||
25 | |||
26 | do_stage () { | ||
27 | oe_libinstall -a -so -C glade libglade-2.0 ${STAGING_LIBDIR} | ||
28 | |||
29 | mkdir -p ${STAGING_INCDIR}/libglade-2.0/glade | ||
30 | for i in ${headers}; do | ||
31 | install -m 0644 ${S}/glade/$i ${STAGING_INCDIR}/libglade-2.0/glade/$i | ||
32 | done | ||
33 | } | ||