[buoh/builder-port: 1/4] Move menu to GResource



commit c61e42c35588ddfd3d6e751f0e314b2b8cf0d244
Author: Jan Tojnar <jtojnar gmail com>
Date:   Mon Sep 10 00:51:39 2018 +0200

    Move menu to GResource
    
    https://developer.gnome.org/gio/stable/GResource.html

 data/meson.build                  |  5 -----
 data/org.gnome.buoh.gresource.xml |  6 ++++++
 meson.build                       |  2 +-
 src/buoh-window.c                 |  6 +++---
 src/meson.build                   | 11 ++++++++++-
 5 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 8bdd41b..aa6b319 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -1,8 +1,3 @@
-install_data(
-  'buoh-ui.xml',
-  install_dir: uidir,
-)
-
 desktop = 'buoh.desktop'
 i18n.merge_file(
   desktop,
diff --git a/data/org.gnome.buoh.gresource.xml b/data/org.gnome.buoh.gresource.xml
new file mode 100644
index 0000000..476097c
--- /dev/null
+++ b/data/org.gnome.buoh.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/buoh">
+    <file>buoh-ui.xml</file>
+  </gresource>
+</gresources>
diff --git a/meson.build b/meson.build
index cd5e3bb..69f4a43 100644
--- a/meson.build
+++ b/meson.build
@@ -8,6 +8,7 @@ project(
 gnome = import('gnome')
 i18n = import('i18n')
 python3 = import('python3')
+data_dir = join_paths(meson.source_root(), 'data')
 po_dir = join_paths(meson.source_root(), 'po')
 
 prefix = get_option('prefix')
@@ -18,7 +19,6 @@ localedir = join_paths(prefix, get_option('localedir'))
 pkgdatadir = join_paths(datadir, meson.project_name())
 schemadir = join_paths(datadir, 'glib-2.0', 'schemas')
 comicsdir = join_paths(pkgdatadir, 'comics')
-uidir = join_paths(pkgdatadir, 'ui')
 
 # Dependencies
 gtk = dependency('gtk+-3.0', version: '>= 3.22.0')
diff --git a/src/buoh-window.c b/src/buoh-window.c
index 74b7401..7e74fad 100644
--- a/src/buoh-window.c
+++ b/src/buoh-window.c
@@ -277,9 +277,9 @@ buoh_window_init (BuohWindow *buoh_window)
         accel_group = gtk_ui_manager_get_accel_group (buoh_window->priv->ui_manager);
         gtk_window_add_accel_group (GTK_WINDOW (buoh_window), accel_group);
 
-        if (!gtk_ui_manager_add_ui_from_file (buoh_window->priv->ui_manager,
-                                              UI_DIR"/buoh-ui.xml",
-                                              &error)) {
+        if (!gtk_ui_manager_add_ui_from_resource (buoh_window->priv->ui_manager,
+                                                  "/org/gnome/buoh/buoh-ui.xml",
+                                                  &error)) {
                 buoh_debug ("Could not merge buoh-ui.xml: %s", error->message);
                 g_error_free (error);
         }
diff --git a/src/meson.build b/src/meson.build
index f9f4c2a..3a23135 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -19,8 +19,17 @@ sources = files(
   'main.c',
 )
 
+sources += gnome.compile_resources(
+  'buoh-resources',
+  join_paths(data_dir, 'org.gnome.buoh.gresource.xml'),
+  source_dir: [
+    data_dir,
+  ],
+  c_name: 'buoh',
+  export: true,
+)
+
 cflags = [
-  '-DUI_DIR="@0@"'.format(uidir),
   '-DCOMICS_DIR="@0@"'.format(comicsdir),
   '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
   '-DVERSION="@0@"'.format(meson.project_version()),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]