talkatu/talkatu

0feed1461a4a
Parents
Children 5b1e0a8a76e1
Initial revision, simple copy paste works
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,4 @@
+syntax: regexp
+^build.*\/
+^src\/old\/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,5 @@
+# GtkIMHTML
+
+A rewrite of the GtkIMHTML widget found in Pidgin.
+
+This is highly experimental right now and might eat babies, we're not sure yet. So proceed with caution :-D
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson.build Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,100 @@
+###############################################################################
+# Project Info
+###############################################################################
+project('gtkimhtml', 'c', version : '0.1.0-dev',
+ meson_version : '>=0.37.0',
+ default_options : ['c_std=c99'])
+
+parts = meson.project_version().split('-')
+if parts.length() > 1
+ extra = parts[1]
+else
+ extra = ''
+endif
+
+parts = parts[0].split('.')
+GTKIMHTML_MAJOR_VERSION = parts[0]
+
+version_conf = configuration_data()
+version_conf.set('GTKIMHTML_MAJOR_VERSION', GTKIMHTML_MAJOR_VERSION)
+version_conf.set('GTKIMHTML_MINOR_VERSION', parts[1])
+version_conf.set('GTKIMHTML_MICRO_VERSION', parts[2])
+version_conf.set('GTKIMHTML_EXTRA_VERSION', extra)
+version_conf.set('GTKIMHTML_VERSION', meson.project_version())
+
+LOCALE_DIR = join_paths(get_option('prefix'), get_option('localedir'))
+add_project_arguments('-DLOCALEDIR="@0@"'.format(LOCALE_DIR), language : 'c')
+
+###############################################################################
+# Dependencies
+###############################################################################
+gnome = import('gnome')
+pkgconfig = import('pkgconfig')
+
+GLIB = dependency('glib-2.0', version : '>=2.34.0')
+GOBJECT = dependency('gobject-2.0')
+
+GTK3 = dependency('gtk+-3.0', version : '>=3.0.0')
+
+GUMBO = dependency('gumbo', version : '>=0.10')
+
+###############################################################################
+# NLS
+###############################################################################
+GETTEXT_PACKAGE = 'gtkimhtml'
+
+add_project_arguments('-DGETTEXT_PACKAGE="@0@"'.format(GETTEXT_PACKAGE),
+ language : 'c')
+
+if get_option('nls')
+ i18n = import('i18n')
+endif
+
+###############################################################################
+# Build Info
+###############################################################################
+compiler = meson.get_compiler('c')
+
+add_project_arguments(
+ '-DPREFIX="@0@"'.format(get_option('prefix')),
+ '-DLIBDIR="@0@"'.format(get_option('libdir')),
+ language : 'c'
+)
+
+if compiler.has_argument('-Wformat')
+ add_project_arguments('-Wformat', language : 'c')
+ if compiler.has_multi_arguments(['-Wformat', '-Werror=format-security'])
+ add_project_arguments('-Werror=format-security', language : 'c')
+ endif
+endif
+
+# check if we're using gcc
+if compiler.get_id() == 'gcc' or host_machine.platform() == 'darwin'
+ add_project_arguments(
+ '-DGTKIMHTML_UNUSED=__attribute__((unused))',
+ '-ggdb',
+ language : 'c'
+ )
+else
+ add_project_arguments(
+ '-DGTKIMHTML_UNUSED=',
+ language : 'c'
+ )
+endif
+
+toplevel_inc = include_directories('.')
+
+###############################################################################
+# Subdirectories
+###############################################################################
+subdir('src')
+subdir('po')
+
+###############################################################################
+# Install stuff
+###############################################################################
+# documentation
+install_data('ChangeLog', 'INSTALL', 'README', 'HACKING',
+ install_dir : join_paths(get_option('datadir'), 'doc', 'gtkimhtml'),
+)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson_options.txt Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,15 @@
+###############################################################################
+# Options
+###############################################################################
+option(
+ 'gobject-introspection',
+ type : 'boolean', value : true,
+ description : 'Whether or not to build a GObject Introspection type library'
+)
+
+option(
+ 'nls',
+ type : 'boolean', value : true,
+ description : 'Install translation files'
+)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/po/meson.build Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,3 @@
+if get_option('nls')
+# GETTEXTIZE_TRANSLATIONS(UPDATE)
+endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmlbuffer.c Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gumbo.h>
+#include <stdio.h>
+
+#include "gtkimhtmlbuffer.h"
+#include "gtkimhtmltagtable.h"
+
+G_DEFINE_TYPE(GtkIMHTMLBuffer, gtk_imhtml_buffer, GTK_TYPE_TEXT_BUFFER)
+
+/******************************************************************************
+ * Helpers
+ *****************************************************************************/
+static inline void
+_gtk_imhtml_buffer_insert_text_parent(GtkTextBuffer *buffer,
+ GtkTextIter *pos,
+ const gchar *new_text)
+{
+ GTK_TEXT_BUFFER_CLASS(gtk_imhtml_buffer_parent_class)->insert_text(
+ buffer,
+ pos,
+ new_text,
+ g_utf8_strlen(new_text, -1)
+ );
+}
+
+static gint
+_gtk_imhtml_buffer_insert_text_helper(GtkTextBuffer *buffer,
+ GtkTextIter *pos,
+ GumboNode *node,
+ GString *str)
+{
+ GtkTextTag *tag = NULL;
+ GumboVector *children = NULL;
+ const gchar *tag_name = NULL;
+ gint i = 0, start_pos, length = 0;
+
+ start_pos = gtk_text_iter_get_offset(pos);
+
+ switch(node->v.element.tag) {
+ case GUMBO_TAG_B:
+ case GUMBO_TAG_CODE:
+ case GUMBO_TAG_I:
+ case GUMBO_TAG_U:
+ case GUMBO_TAG_EM:
+ case GUMBO_TAG_STRIKE:
+ case GUMBO_TAG_SUB:
+ case GUMBO_TAG_SUP:
+ case GUMBO_TAG_PRE:
+ tag_name = gumbo_normalized_tagname(node->v.element.tag);
+
+ tag = gtk_text_tag_table_lookup(
+ gtk_text_buffer_get_tag_table(buffer),
+ tag_name
+ );
+
+ break;
+ default:
+ break;
+ }
+
+ children = &node->v.element.children;
+
+ for(i = 0; i < children->length; i++) {
+ GumboNode *child = (GumboNode *)children->data[i];
+
+ if(child->type == GUMBO_NODE_TEXT || child->type == GUMBO_NODE_WHITESPACE) {
+ gint text_length = g_utf8_strlen(child->v.text.text, -1);
+
+ /* add the text */
+ _gtk_imhtml_buffer_insert_text_parent(buffer, pos, child->v.text.text);
+
+ /* now adjust pos to the new insertion point */
+ gtk_text_buffer_get_iter_at_offset(
+ buffer,
+ pos,
+ gtk_text_iter_get_offset(pos) + text_length
+ );
+
+ length += text_length;
+
+ } else if(child->type == GUMBO_NODE_ELEMENT || child->type == GUMBO_NODE_TEMPLATE) {
+ length += _gtk_imhtml_buffer_insert_text_helper(buffer, pos, child, str);
+ }
+ }
+
+ if(tag) {
+ GtkTextIter start, end;
+
+ gtk_text_buffer_get_iter_at_offset(buffer, &start, start_pos);
+ gtk_text_buffer_get_iter_at_offset(buffer, &end, start_pos + length);
+
+ gtk_text_buffer_apply_tag(
+ buffer,
+ tag,
+ &start,
+ &end
+ );
+ }
+
+ return length;
+}
+
+/******************************************************************************
+ * GtkTextBuffer Implementation
+ *****************************************************************************/
+static void
+gtk_imthml_buffer_insert_text(GtkTextBuffer *buffer,
+ GtkTextIter *pos,
+ const gchar *new_text,
+ gint new_text_length)
+{
+ GString *str = g_string_new("");
+ GumboOutput *output = gumbo_parse(new_text);
+
+ _gtk_imhtml_buffer_insert_text_helper(buffer, pos, output->document, str);
+
+ GTK_TEXT_BUFFER_CLASS(gtk_imhtml_buffer_parent_class)->insert_text(
+ buffer,
+ pos,
+ str->str,
+ str->len
+ );
+
+ g_string_free(str, TRUE);
+}
+
+/******************************************************************************
+ * GObject Stuff
+ *****************************************************************************/
+
+static void
+gtk_imhtml_buffer_init(GtkIMHTMLBuffer *buffer) {
+}
+
+static void
+gtk_imhtml_buffer_class_init(GtkIMHTMLBufferClass *klass) {
+ GtkTextBufferClass *text_buffer_class = GTK_TEXT_BUFFER_CLASS(klass);
+
+ text_buffer_class->insert_text = gtk_imthml_buffer_insert_text;
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GtkTextBuffer *gtk_imhtml_buffer_new(void) {
+ GtkTextTagTable *table = gtk_imhtml_tag_table_new();
+
+ return g_object_new(
+ GTK_IMHTML_TYPE_BUFFER,
+ "tag-table", table,
+ NULL);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmlbuffer.h Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GTK_IMHTML_BUFFER_H
+#define GTK_IMHTML_BUFFER_H
+
+#include <gtk/gtk.h>
+
+#define GTK_IMHTML_TYPE_BUFFER (gtk_imhtml_buffer_get_type())
+#define GTK_IMHTML_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_IMHTML_TYPE_BUFFER, GtkIMHTMLBuffer))
+#define GTK_IMHTML_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_IMHTML_TYPE_BUFFER, GtkIMHTMLBufferClass))
+#define GTK_IMHTML_IS_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_IMHTML_TYPEBUFFER))
+#define GTK_IMHTML_IS_BUFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_IMHTML_TYPE_BUFFER))
+#define GTK_IMHTML_BUFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_IMHTML_TYPE_BUFFER, GtkIMHTMLBufferClass))
+
+typedef struct _GtkIMHTMLBuffer GtkIMHTMLBuffer;
+typedef struct _GtkIMHTMLBufferPrivate GtkIMHTMLBufferPrivate;
+typedef struct _GtkIMHTMLBufferClass GtkIMHTMLBufferClass;
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+struct _GtkIMHTMLBuffer {
+ GtkTextBuffer parent;
+
+ void (*_gplugin_reserved1)(void);
+ void (*_gplugin_reserved2)(void);
+ void (*_gplugin_reserved3)(void);
+ void (*_gplugin_reserved4)(void);
+};
+
+struct _GtkIMHTMLBufferClass {
+ GtkTextBufferClass parent;
+
+ void (*_gplugin_reserved1)(void);
+ void (*_gplugin_reserved2)(void);
+ void (*_gplugin_reserved3)(void);
+ void (*_gplugin_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+GType gtk_imhtml_buffer_get_type(void);
+
+GtkTextBuffer *gtk_imhtml_buffer_new(void);
+
+G_END_DECLS
+
+#endif /* GTK_IMHTML_BUFFER_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmldemo.c Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,26 @@
+#include <gtk/gtk.h>
+
+#include "gtkimhtmlbuffer.h"
+
+gint main(gint argc, gchar **argv) {
+ GtkWidget *win = NULL, *sw = NULL, *view = NULL;
+ GtkTextBuffer *buf = NULL;
+
+ gtk_init(&argc, &argv);
+
+ win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+ sw = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(win), sw);
+
+ buf = gtk_imhtml_buffer_new();
+ view = gtk_text_view_new_with_buffer(buf);
+
+ gtk_container_add(GTK_CONTAINER(sw), view);
+
+ gtk_widget_show_all(win);
+
+ gtk_main();
+
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmltagtable.c Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "gtkimhtmltagtable.h"
+
+/******************************************************************************
+ * GObject Stuff
+ *****************************************************************************/
+G_DEFINE_TYPE(GtkIMHTMLTagTable, gtk_imhtml_tag_table, GTK_TYPE_TEXT_TAG_TABLE)
+
+static void
+gtk_imhtml_tag_table_init(GtkIMHTMLTagTable *table) {
+ GtkTextTagTable *text_table = GTK_TEXT_TAG_TABLE(table);
+ GtkTextTag *tag = NULL;
+
+ tag = gtk_text_tag_new("b");
+ g_object_set(
+ G_OBJECT(tag),
+ "weight", PANGO_WEIGHT_BOLD,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("i");
+ g_object_set(
+ G_OBJECT(tag),
+ "style", PANGO_STYLE_ITALIC,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("u");
+ g_object_set(
+ G_OBJECT(tag),
+ "underline", PANGO_UNDERLINE_SINGLE,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("strike");
+ g_object_set(
+ G_OBJECT(tag),
+ "strikethrough", TRUE,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("sub");
+ g_object_set(
+ G_OBJECT(tag),
+ "rise", -5000,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("sup");
+ g_object_set(
+ G_OBJECT(tag),
+ "rise", 5000,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("pre");
+ g_object_set(
+ G_OBJECT(tag),
+ "family", "Monospace",
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("code");
+ g_object_set(
+ G_OBJECT(tag),
+ "family", "Monospace",
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("search");
+ g_object_set(
+ G_OBJECT(tag),
+ "background", "#22ff00",
+ "weight", PANGO_WEIGHT_BOLD,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("comment");
+ g_object_set(
+ G_OBJECT(tag),
+ "weight", PANGO_WEIGHT_NORMAL,
+ "invisible", FALSE,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+
+ tag = gtk_text_tag_new("em");
+ g_object_set(
+ G_OBJECT(tag),
+ "weight", PANGO_WEIGHT_BOLD,
+ "style", PANGO_STYLE_ITALIC,
+ NULL
+ );
+ gtk_text_tag_table_add(text_table, tag);
+ g_object_unref(G_OBJECT(tag));
+}
+
+static void
+gtk_imhtml_tag_table_class_init(GtkIMHTMLTagTableClass *klass) {
+}
+
+/******************************************************************************
+ * Public API
+ *****************************************************************************/
+GtkTextTagTable *gtk_imhtml_tag_table_new(void) {
+ return g_object_new(GTK_IMHTML_TYPE_TAG_TABLE, NULL);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gtkimhtmltagtable.h Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GTK_IMHTML_TAG_TABLE_H
+#define GTK_IMHTML_TAG_TABLE_H
+
+#include <gtk/gtk.h>
+
+#define GTK_IMHTML_TYPE_TAG_TABLE (gtk_imhtml_tag_table_get_type())
+#define GTK_IMHTML_TAG_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_IMHTML_TYPE_TAG_TABLE, GtkIMHTMLTAG_TABLE))
+#define GTK_IMHTML_TAG_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_IMHTML_TYPE_TAG_TABLE, GtkIMHTMLTAG_TABLEClass))
+#define GTK_IMHTML_IS_TAG_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_IMHTML_TYPETAG_TABLE))
+#define GTK_IMHTML_IS_TAG_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_IMHTML_TYPE_TAG_TABLE))
+#define GTK_IMHTML_TAG_TABLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_IMHTML_TYPE_TAG_TABLE, GtkIMHTMLTAG_TABLEClass))
+
+typedef struct _GtkIMHTMLTagTable GtkIMHTMLTagTable;
+typedef struct _GtkIMHTMLTagTablePrivate GtkIMHTMLTagTablePrivate;
+typedef struct _GtkIMHTMLTagTableClass GtkIMHTMLTagTableClass;
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include <gtk/gtk.h>
+
+struct _GtkIMHTMLTagTable {
+ GtkTextTagTable parent;
+
+ void (*_gplugin_reserved1)(void);
+ void (*_gplugin_reserved2)(void);
+ void (*_gplugin_reserved3)(void);
+ void (*_gplugin_reserved4)(void);
+};
+
+struct _GtkIMHTMLTagTableClass {
+ GtkTextTagTableClass parent;
+
+ void (*_gplugin_reserved1)(void);
+ void (*_gplugin_reserved2)(void);
+ void (*_gplugin_reserved3)(void);
+ void (*_gplugin_reserved4)(void);
+};
+
+G_BEGIN_DECLS
+
+GType gtk_imhtml_tag_table_get_type(void);
+
+GtkTextTagTable *gtk_imhtml_tag_table_new(void);
+
+G_END_DECLS
+
+#endif /* GTK_IMHTML_TAG_TABLE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/meson.build Thu Nov 30 23:09:22 2017 -0600
@@ -0,0 +1,118 @@
+###############################################################################
+# Library
+###############################################################################
+
+GTKIMHTML_LIBRARY_VERSION = '0.1.0'
+GTKIMHTML_HEADERS = [
+ 'gtkimhtmlbuffer.h',
+ 'gtkimhtmltagtable.h',
+]
+
+GTKIMHTML_SOURCES = [
+ 'gtkimhtmlbuffer.c',
+ 'gtkimhtmltagtable.c',
+]
+
+GTKIMHTML_PUBLIC_BUILT_HEADERS = [
+ # Modified below.
+]
+
+GTKIMHTML_PUBLIC_BUILT_SOURCES = [
+ # Modified below.
+]
+
+GTKIMHTML_PRIVATE_HEADERS = [
+]
+
+GTKIMHTML_PRIVATE_SOURCES = [
+]
+
+GTKIMHTML_PRIVATE_BUILT_HEADERS = [
+ # Modified below.
+]
+
+GTKIMHTML_PRIVATE_BUILT_SOURCES = [
+ # Modified below.
+]
+
+###############################################################################
+# Library target
+###############################################################################
+gtkimhtml = shared_library('gtkimhtml',
+ GTKIMHTML_SOURCES,
+ GTKIMHTML_PUBLIC_BUILT_SOURCES,
+ GTKIMHTML_PRIVATE_SOURCES,
+ GTKIMHTML_PRIVATE_BUILT_SOURCES,
+ GTKIMHTML_HEADERS,
+ GTKIMHTML_PUBLIC_BUILT_HEADERS,
+ c_args : ['-DGTKIMHTML_COMPILATION', '-DG_LOG_DOMAIN="GtkIMHTML"'],
+ include_directories : toplevel_inc,
+ dependencies : [GLIB, GOBJECT, GUMBO, GTK3],
+ version : GTKIMHTML_LIBRARY_VERSION,
+ install : true
+)
+gtkimhtml_dep = declare_dependency(
+ include_directories : [toplevel_inc, include_directories('.')],
+ link_with : gtkimhtml,
+ sources : GTKIMHTML_PUBLIC_BUILT_HEADERS, # Ensure they're built before use.
+ dependencies : [GLIB, GOBJECT]
+)
+
+pkgconfig.generate(
+ name : 'libgtkimhtml',
+ description : 'A fully featured GModule based plugin library',
+ version : meson.project_version(),
+ filebase : 'gtkimhtml',
+ subdirs : 'gtkimhtml-1.0',
+ libraries : gtkimhtml,
+ requires : ['glib-2.0', 'gobject-2.0', 'gmodule-2.0', 'gtk+-3.0'],
+ variables : [
+ 'plugindir=${libdir}',
+ ],
+)
+
+# nls
+if get_option('nls')
+# gettextize_pot_file(
+# SORT
+# LANGUAGES C
+# SOURCES ${GTKIMHTML_SOURCES} ${GTKIMHTML_NATIVE_SOURCES} gtkimhtml-query.c
+# BUILT_SOURCES ${GTKIMHTML_PUBLIC_BUILT_SOURCES}
+# FILENAME gtkimhtml.pot
+# )
+endif
+
+###############################################################################
+# GObject Introspection
+###############################################################################
+if get_option('gobject-introspection')
+ gtkimhtml_gir = gnome.generate_gir(gtkimhtml,
+ sources : GTKIMHTML_SOURCES + GTKIMHTML_HEADERS +
+ GTKIMHTML_PUBLIC_BUILT_SOURCES +
+ GTKIMHTML_PUBLIC_BUILT_HEADERS,
+ includes : ['GModule-2.0', 'GObject-2.0', 'Gtk-3.0'],
+ namespace : 'GtkIMHTML',
+ symbol_prefix : 'gtkimhtml',
+ nsversion : '@0@.0'.format(GTKIMHTML_MAJOR_VERSION),
+ install : true)
+endif
+
+###############################################################################
+# Driver program
+###############################################################################
+driver = executable('gtk-imhtml-demo',
+ 'gtkimhtmldemo.c',
+ dependencies: [GLIB, GTK3],
+ link_with: [gtkimhtml],
+ install: false,
+)
+
+###############################################################################
+# Install Stuff
+###############################################################################
+# install the normal includes into the gtkimhtml subdirectory
+install_headers(
+ GTKIMHTML_HEADERS,
+ subdir : 'gtkimhtml-1.0/gtkimhtml'
+)
+