diff --git a/data/meson.build b/data/meson.build index 4def2b8c..d54df3cd 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,52 +1,12 @@ +gnome = import('gnome') -install_data( - 'keyboards/keyboards.xml', - install_dir: pkgdatadir + '/keyboards/', +squeekboard_resources = gnome.compile_resources( + 'squeekboard-resources', + 'squeekboard.gresources.xml', + + c_name: 'squeekboard', ) -install_data( - 'keyboards/geometry/compact.xml', - install_dir: pkgdatadir + '/keyboards/geometry/', -) - -symbols = [ - 'ar.xml', - 'as-inscript.xml', - 'be.xml', - 'bn-inscript.xml', - 'fa.xml', - 'gu-inscript.xml', - 'he.xml', - 'hi-inscript.xml', - 'ja-kana.xml', - 'kk.xml', - 'kn-inscript.xml', - 'ks-inscript.xml', - 'ks.xml', - 'mai-inscript.xml', - 'ml-inscript.xml', - 'mr-inscript.xml', - 'my.xml', - 'or-inscript.xml', - 'pa-inscript.xml', - 'ru.xml', - 'sd-inscript.xml', - 'ta-inscript.xml', - 'te-inscript.xml', - 'th.xml', - 'ua.xml', - 'ug.xml', - 'us.xml', - 'zh-bopomofo.xml', -] - -foreach symbol: symbols - install_data( - 'keyboards/symbols/' + symbol, - install_dir: pkgdatadir + '/keyboards/symbols/', - ) -endforeach - desktop_file = 'sm.puri.Squeekboard.desktop' i18n.merge_file('desktop', diff --git a/data/squeekboard.gresources.xml b/data/squeekboard.gresources.xml new file mode 100644 index 00000000..106e050f --- /dev/null +++ b/data/squeekboard.gresources.xml @@ -0,0 +1,36 @@ + + + + style.css + keyboards/geometry/compact.xml + keyboards/keyboards.xml + keyboards/symbols/ar.xml + keyboards/symbols/as-inscript.xml + keyboards/symbols/be.xml + keyboards/symbols/bn-inscript.xml + keyboards/symbols/fa.xml + keyboards/symbols/gu-inscript.xml + keyboards/symbols/he.xml + keyboards/symbols/hi-inscript.xml + keyboards/symbols/ja-kana.xml + keyboards/symbols/kk.xml + keyboards/symbols/kn-inscript.xml + keyboards/symbols/ks-inscript.xml + keyboards/symbols/ks.xml + keyboards/symbols/mai-inscript.xml + keyboards/symbols/ml-inscript.xml + keyboards/symbols/mr-inscript.xml + keyboards/symbols/my.xml + keyboards/symbols/or-inscript.xml + keyboards/symbols/pa-inscript.xml + keyboards/symbols/ru.xml + keyboards/symbols/sd-inscript.xml + keyboards/symbols/ta-inscript.xml + keyboards/symbols/te-inscript.xml + keyboards/symbols/th.xml + keyboards/symbols/ua.xml + keyboards/symbols/ug.xml + keyboards/symbols/us.xml + keyboards/symbols/zh-bopomofo.xml + + diff --git a/src/style.css b/data/style.css similarity index 100% rename from src/style.css rename to data/style.css diff --git a/eek/eek-xml-layout.c b/eek/eek-xml-layout.c index 0d99965d..5cae0732 100644 --- a/eek/eek-xml-layout.c +++ b/eek/eek-xml-layout.c @@ -1,7 +1,7 @@ -/* +/* * Copyright (C) 2011 Daiki Ueno * Copyright (C) 2011 Red Hat, Inc. - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -25,6 +25,7 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ +#include /* GResource */ #include #include @@ -35,6 +36,8 @@ #include "eek-keysym.h" #include "eek-text.h" +#include "squeekboard-resources.h" + enum { PROP_0, PROP_ID, @@ -451,7 +454,7 @@ geometry_start_element_callback (GMarkupParseContext *pcontext, "corner-radius"); if (attribute != NULL) data->corner_radius = g_strtod (attribute, NULL); - + goto out; } @@ -1058,10 +1061,10 @@ initable_init (GInitable *initable, gchar *path; EekXmlKeyboardDesc *desc; - priv->keyboards_dir = (gchar *) g_getenv ("EEKBOARD_KEYBOARDSDIR"); + priv->keyboards_dir = g_strdup ((gchar *) g_getenv ("EEKBOARD_KEYBOARDSDIR")); + if (priv->keyboards_dir == NULL) - priv->keyboards_dir = KEYBOARDSDIR; - priv->keyboards_dir = g_strdup (priv->keyboards_dir); + priv->keyboards_dir = g_strdup ("resource:///sm/puri/squeekboard/keyboards/"); path = g_build_filename (priv->keyboards_dir, "keyboards.xml", NULL); keyboards = parse_keyboards (path, error); @@ -1112,7 +1115,7 @@ eek_xml_list_keyboards (void) keyboards_dir = g_getenv ("EEKBOARD_KEYBOARDSDIR"); if (keyboards_dir == NULL) - keyboards_dir = KEYBOARDSDIR; + keyboards_dir = g_strdup ("resource:///sm/puri/squeekboard/keyboards/"); path = g_build_filename (keyboards_dir, "keyboards.xml", NULL); keyboards = parse_keyboards (path, NULL); g_free (path); @@ -1181,7 +1184,9 @@ parse_geometry (const gchar *path, EekKeyboard *keyboard, GError **error) GFileInputStream *input; gboolean retval; - file = g_file_new_for_path (path); + file = g_str_has_prefix (path, "resource://") + ? g_file_new_for_uri (path) + : g_file_new_for_path (path); input = g_file_read (file, NULL, error); g_object_unref (file); @@ -1307,7 +1312,9 @@ parse_symbols (const gchar *path, EekKeyboard *keyboard, GError **error) GFileInputStream *input; gboolean retval; - file = g_file_new_for_path (path); + file = g_str_has_prefix (path, "resource://") + ? g_file_new_for_uri (path) + : g_file_new_for_path (path); input = g_file_read (file, NULL, error); g_object_unref (file); @@ -1340,7 +1347,9 @@ parse_prerequisites (const gchar *path, GError **error) GList *prerequisites; gboolean retval; - file = g_file_new_for_path (path); + file = g_str_has_prefix (path, "resource://") + ? g_file_new_for_uri (path) + : g_file_new_for_path (path); input = g_file_read (file, NULL, error); g_object_unref (file); @@ -1375,7 +1384,9 @@ parse_keyboards (const gchar *path, GError **error) GList *keyboards; gboolean retval; - file = g_file_new_for_path (path); + file = g_str_has_prefix (path, "resource://") + ? g_file_new_for_uri (path) + : g_file_new_for_path (path); input = g_file_read (file, NULL, error); g_object_unref (file); @@ -1452,7 +1463,7 @@ static void scale_keyboard (EekKeyboard *keyboard, for (i = 0; i < n_outlines; i++) { EekOutline *outline = eek_keyboard_get_outline (keyboard, i); gint j; - + for (j = 0; j < outline->num_points; j++) { outline->points[j].x *= scale; outline->points[j].y *= scale; diff --git a/src/meson.build b/src/meson.build index 1b304308..ad56e928 100644 --- a/src/meson.build +++ b/src/meson.build @@ -4,13 +4,6 @@ dbus_src = gnome.gdbus_codegen( join_paths(dbusdir, 'sm.puri.OSK0.xml') ) -squeekboard_resources = gnome.compile_resources( - 'squeekboard-resources', - 'squeekboard.gresources.xml', - - c_name: 'squeekboard', -) - sources = [ 'imservice.c', 'server-context-service.c', diff --git a/src/squeekboard.gresources.xml b/src/squeekboard.gresources.xml deleted file mode 100644 index 3f17a884..00000000 --- a/src/squeekboard.gresources.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - style.css - -