summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kramlich <grim@reaperworld.com>2017-06-20 01:49:19 +0000
committerGary Kramlich <grim@reaperworld.com>2017-06-20 01:49:19 +0000
commitb48616c164f1deaeea8e920bd65d5bc467f2b107 (patch)
tree2e82dbf5230f945107f799b221ce743312ef3c7d
parentfce7dbd3429ff76a787cbf764eff3c483df59696 (diff)
parent902b882b7ca2737bf1fe2e4651fdf28c0f39b6f8 (diff)
downloadpidgin-b48616c164f1deaeea8e920bd65d5bc467f2b107.tar.gz
Merged in qulogic/pidgin (pull request #217)
Move gtkdebug.html into a GResource. Approved-by: Mike Ruprecht <cmaiku@gmail.com> Approved-by: Gary Kramlich <grim@reaperworld.com>
-rw-r--r--.hgignore2
-rw-r--r--configure.ac3
-rw-r--r--pidgin/Makefile.am22
-rw-r--r--pidgin/gtkdebug.c25
-rw-r--r--pidgin/pidgin.gresource.xml6
5 files changed, 46 insertions, 12 deletions
diff --git a/.hgignore b/.hgignore
index 8b7486924a..31126b5982 100644
--- a/.hgignore
+++ b/.hgignore
@@ -105,7 +105,7 @@ pidgin-.*.tar.bz2
pidgin-.*.tar.gz
pidgin-[0-9a-z.-]+/
pidgin.apspec$
-pidgin/.*\.html\.h$
+pidgin/.*\.gresource\.[ch]$
pidgin/pidgin$
pidgin/data/pidgin.appdata.xml$
pidgin/data/pidgin.desktop$
diff --git a/configure.ac b/configure.ac
index e680c62b18..12882a01e3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,7 +109,6 @@ GNT_LT_VERSION_INFO="gnt_lt_current:gnt_micro_version:gnt_minor_version"
AC_SUBST(GNT_LT_VERSION_INFO)
AC_PATH_PROG(sedpath, sed)
-AC_PATH_PROG(xxdpath, xxd)
dnl Storing configure arguments
AC_DEFINE_UNQUOTED(CONFIG_ARGS, "$ac_configure_args", [configure arguments])
@@ -488,6 +487,8 @@ AC_SUBST(GLIB_GENMARSHAL)
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
AC_SUBST(GLIB_MKENUMS)
+AC_PATH_PROG(GLIB_COMPILE_RESOURCES, [glib-compile-resources])
+
AC_PATH_PROG(GTESTER, gtester)
GLIB_TESTS
diff --git a/pidgin/Makefile.am b/pidgin/Makefile.am
index b41f00c4c9..be608bb42d 100644
--- a/pidgin/Makefile.am
+++ b/pidgin/Makefile.am
@@ -4,6 +4,7 @@ EXTRA_DIST = \
getopt1.c \
gtk3compat.h \
gtkdebug.html \
+ pidgin.gresource.xml \
Makefile.mingw \
data/pidgin.appdata.xml.in \
data/pidgin.desktop.in \
@@ -85,6 +86,7 @@ libpidgin_la_SOURCES = \
gtkxfer.c \
libpidgin.c \
minidialog.c \
+ pidgin.gresource.c \
pidgintooltip.c
libpidgin_la_headers = \
@@ -172,18 +174,22 @@ libpidginincludedir=$(includedir)/pidgin
libpidgininclude_HEADERS = \
$(libpidgin_la_headers)
-libpidgin_la_builtheaders = gtkdebug.html.h
+libpidgin_la_builtheaders = pidgin.gresource.h
+libpidgin_la_builtsources = pidgin.gresource.c
-BUILT_SOURCES = $(libpidgin_la_builtheaders)
+BUILT_SOURCES = $(libpidgin_la_builtheaders) $(libpidgin_la_builtsources)
-CLEANFILES = gtkdebug.html.h
+CLEANFILES = pidgin.gresource.h pidgin.gresource.c
-%.html.h: %.html
- $(AM_V_GEN)echo "static const char $*_html[] = {" > $@
- $(AM_V_at)$(sedpath) -e 's/^[ ]\+//g' -e 's/[ ]\+/ /g' $< | $(xxdpath) -i | sed -e 's/\(0x[0-9a-f][0-9a-f]\)$$/\1, 0x00/' >> $@
- $(AM_V_at)echo "};" >> $@
+%.gresource.h: %.gresource.xml
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --generate-header --target $@ --c-name $* --sourcedir $(srcdir) $<
-gtkdebug.c: gtkdebug.html.h
+%.gresource.c: %.gresource.xml
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --generate-source --target $@ --c-name $* --sourcedir $(srcdir) $<
+
+pidgin.gresource.c: gtkdebug.html
+pidgin.gresource.h: gtkdebug.html
+gtkdebug.c: pidgin.gresource.h
libpidgin_la_DEPENDENCIES = @LIBOBJS@ $(LIBPIDGIN_WIN32RES)
libpidgin_la_LDFLAGS = -export-dynamic -no-undefined \
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
index 2d9513452e..32e4b9ba23 100644
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -40,7 +40,7 @@
#include "gtk3compat.h"
-#include "gtkdebug.html.h"
+#include "pidgin.gresource.h"
typedef struct
{
@@ -409,7 +409,10 @@ toolbar_context(GtkWidget *toolbar, GdkEventButton *event, gpointer null)
static DebugWindow *
debug_window_new(void)
{
+ GError *error;
DebugWindow *win;
+ GResource *resource;
+ GBytes *resource_bytes;
GtkWidget *vbox;
GtkWidget *toolbar;
GtkWidget *frame;
@@ -586,7 +589,25 @@ debug_window_new(void)
frame = pidgin_create_webview(FALSE, &win->text, NULL);
pidgin_webview_set_format_functions(PIDGIN_WEBVIEW(win->text),
PIDGIN_WEBVIEW_ALL ^ PIDGIN_WEBVIEW_SMILEY ^ PIDGIN_WEBVIEW_IMAGE);
- pidgin_webview_load_html_string(PIDGIN_WEBVIEW(win->text), gtkdebug_html);
+ resource = pidgin_get_resource();
+ error = NULL;
+ resource_bytes = g_resource_lookup_data(resource,
+ "/im/pidgin/Pidgin/gtkdebug.html",
+ G_RESOURCE_LOOKUP_FLAGS_NONE,
+ &error);
+ if (G_UNLIKELY(resource_bytes == NULL || error != NULL)) {
+ gchar *msg = g_strdup_printf("Unable to load debug window HTML: %s\n",
+ error ? error->message : "Unknown error");
+ g_clear_error(&error);
+ pidgin_webview_load_html_string(PIDGIN_WEBVIEW(win->text), msg);
+ g_free(msg);
+ } else {
+ gconstpointer gtkdebug_html;
+ gtkdebug_html = g_bytes_get_data(resource_bytes, NULL);
+ pidgin_webview_load_html_string(PIDGIN_WEBVIEW(win->text),
+ gtkdebug_html);
+ }
+ g_bytes_unref(resource_bytes);
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);
gtk_widget_show(frame);
diff --git a/pidgin/pidgin.gresource.xml b/pidgin/pidgin.gresource.xml
new file mode 100644
index 0000000000..bad609d00d
--- /dev/null
+++ b/pidgin/pidgin.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/im/pidgin/Pidgin">
+ <file compressed="true">gtkdebug.html</file>
+ </gresource>
+</gresources>