[the-board] [tb] Add soup util to workaround non-introspected functions
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [tb] Add soup util to workaround non-introspected functions
- Date: Sun, 28 Nov 2010 12:35:22 +0000 (UTC)
commit 9d7294a7d87ccb564ad082da9858847b17e4dc20
Author: Lucas Rocha <lucasr gnome org>
Date: Fri Nov 26 00:52:41 2010 +0000
[tb] Add soup util to workaround non-introspected functions
configure.ac | 2 ++
src/Makefile-tb.am | 21 +++++++++++++++++++++
src/tb/tb-gio-util.c | 1 -
src/tb/tb-soup-util.c | 21 +++++++++++++++++++++
src/tb/tb-soup-util.h | 9 +++++++++
5 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f5374c6..241deee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,8 @@ else
HAVE_LIBSOUP_RESULT="no"
fi
+AM_CONDITIONAL(HAVE_LIBSOUP, [test "$HAVE_LIBSOUP" = 1])
+
AC_ARG_ENABLE([nautilus],
AC_HELP_STRING([--enable-nautilus],[enable nautilus support]),,
[enable_nautilus=yes])
diff --git a/src/Makefile-tb.am b/src/Makefile-tb.am
index bc92d4d..62be74e 100644
--- a/src/Makefile-tb.am
+++ b/src/Makefile-tb.am
@@ -6,6 +6,10 @@ tb_cflags = \
-DG_DISABLE_DEPRECATED \
$(THE_BOARD_CFLAGS)
+if HAVE_LIBSOUP
+tb_cflags += $(LIBSOUP_CFLAGS)
+endif
+
tb_built_sources = \
tb-enum-types.h \
tb-enum-types.c
@@ -20,12 +24,20 @@ tb_source_h = \
tb/tb-gdk-util.h \
tb/tb-gobject-util.h
+if HAVE_LIBSOUP
+tb_source_h += tb/tb-soup-util.h
+endif
+
tb_source_c = \
tb/tb-box.c \
tb/tb-gio-util.c \
tb/tb-gdk-util.c \
tb/tb-gobject-util.c
+if HAVE_LIBSOUP
+tb_source_c += tb/tb-soup-util.c
+endif
+
tb-enum-types.h: stamp-tb-enum-types.h Makefile
@true
@@ -51,6 +63,10 @@ lib_LTLIBRARIES += libtb-1.0.la
libtb_1_0_la_LIBADD = \
$(THE_BOARD_LIBS)
+if HAVE_LIBSOUP
+libtb_1_0_la_LIBADD += $(LIBSOUP_LIBS)
+endif
+
libtb_1_0_la_SOURCES = \
$(tb_source_c) \
$(tb_source_h) \
@@ -77,6 +93,11 @@ Tb_1_0_gir_INCLUDES = \
GdkPixbuf-2.0 \
Gtk-3.0 \
Mx-1.0
+
+if HAVE_LIBSOUP
+Tb_1_0_gir_INCLUDES += Soup-2.4
+endif
+
Tb_1_0_gir_FILES = \
$(addprefix $(srcdir)/,$(tb_source_h)) \
$(addprefix $(srcdir)/,$(tb_source_c)) \
diff --git a/src/tb/tb-gio-util.c b/src/tb/tb-gio-util.c
index 1c327af..0dbe9a1 100644
--- a/src/tb/tb-gio-util.c
+++ b/src/tb/tb-gio-util.c
@@ -102,4 +102,3 @@ tb_g_file_delete_finish(GFile *file,
return TRUE;
}
-
diff --git a/src/tb/tb-soup-util.c b/src/tb/tb-soup-util.c
new file mode 100644
index 0000000..c43c8a6
--- /dev/null
+++ b/src/tb/tb-soup-util.c
@@ -0,0 +1,21 @@
+
+#include <libsoup/soup.h>
+
+#include "tb/tb-soup-util.h"
+
+/* This is only necessary because the SoupBuffer
+ * is not properly gir-introspected yet */
+
+/**
+ * tb_soup_buffer_get_data:
+ *
+ * Returns: (transfer full): the soup buffer.
+ */
+GByteArray *
+tb_soup_buffer_get_data(SoupBuffer *buffer) {
+ GByteArray *result = g_byte_array_new();
+
+ g_byte_array_append(result, (guint8*) buffer->data, buffer->length);
+
+ return result;
+}
diff --git a/src/tb/tb-soup-util.h b/src/tb/tb-soup-util.h
new file mode 100644
index 0000000..1b9fa38
--- /dev/null
+++ b/src/tb/tb-soup-util.h
@@ -0,0 +1,9 @@
+#ifndef __TB_SOUP_UTIL_H__
+#define __TB_SOUP_UTIL_H__
+
+#include <glib.h>
+#include <libsoup/soup.h>
+
+GByteArray *tb_soup_buffer_get_data (SoupBuffer *buffer);
+
+#endif /* __TB_SOUP_UTIL_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]