summaryrefslogtreecommitdiff
path: root/baobab
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-12-09 23:05:56 +0100
committerRobert Antoni Buj Gelonch <[email protected]>2019-12-23 08:55:37 +0100
commitd6318fc5174c6e5915ed22c53b17a681850c97c0 (patch)
tree52e0c82b9e6318f70ffb07fac79b0d396970a6f9 /baobab
parentb8b0f4f70656476e51c0a645875d07c8c8225626 (diff)
downloadmate-utils-d6318fc5174c6e5915ed22c53b17a681850c97c0.tar.bz2
mate-utils-d6318fc5174c6e5915ed22c53b17a681850c97c0.tar.xz
Use gresources for UI files
Diffstat (limited to 'baobab')
-rw-r--r--baobab/data/Makefile.am10
-rw-r--r--baobab/data/org.mate.disk-usage-analyzer.gresource.xml23
-rw-r--r--baobab/src/Makefile.am10
-rw-r--r--baobab/src/baobab-prefs.c9
-rw-r--r--baobab/src/baobab.c6
5 files changed, 41 insertions, 17 deletions
diff --git a/baobab/data/Makefile.am b/baobab/data/Makefile.am
index 37dadddf..4fd73c37 100644
--- a/baobab/data/Makefile.am
+++ b/baobab/data/Makefile.am
@@ -1,7 +1,3 @@
-uidir = $(datadir)/mate-disk-usage-analyzer
-ui_DATA = baobab-main-window.ui \
- baobab-dialog-scan-props.ui
-
baobabappdir = $(datadir)/applications
baobabapp_in_files = mate-disk-usage-analyzer.desktop.in
baobabapp_DATA = $(baobabapp_in_files:.desktop.in=.desktop)
@@ -23,10 +19,12 @@ gsettings_SCHEMAS = org.mate.disk-usage-analyzer.gschema.xml
man_MANS = mate-disk-usage-analyzer.1
EXTRA_DIST = \
- $(ui_DATA) \
+ baobab-main-window.ui \
+ baobab-dialog-scan-props.ui \
mate-disk-usage-analyzer.desktop.in.in \
$(appdata_in_files) \
- $(man_MANS)
+ $(man_MANS) \
+ org.mate.disk-usage-analyzer.gresource.xml
CLEANFILES = \
$(baobabapp_in_files) \
diff --git a/baobab/data/org.mate.disk-usage-analyzer.gresource.xml b/baobab/data/org.mate.disk-usage-analyzer.gresource.xml
new file mode 100644
index 00000000..27d4a27b
--- /dev/null
+++ b/baobab/data/org.mate.disk-usage-analyzer.gresource.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file is part of MATE Utils.
+
+ MATE Utils 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 2 of the License, or
+ (at your option) any later version.
+
+ MATE Utils 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with MATE Utils. If not, see <http://www.gnu.org/licenses/>.
+-->
+<gresources>
+ <gresource prefix="/org/mate/disk-usage-analyzer">
+ <file compressed="true">baobab-dialog-scan-props.ui</file>
+ <file compressed="true">baobab-main-window.ui</file>
+ </gresource>
+</gresources>
diff --git a/baobab/src/Makefile.am b/baobab/src/Makefile.am
index a5af080e..5b6f1987 100644
--- a/baobab/src/Makefile.am
+++ b/baobab/src/Makefile.am
@@ -5,13 +5,19 @@ AM_CPPFLAGS = \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBDIR=\""$(libdir)"\" \
-DDATADIR=\""$(datadir)"\" \
- -DPKGDATADIR=\""$(datadir)/mate-disk-usage-analyzer"\" \
-DBAOBAB_PIX_DIR=\""$(datadir)/mate-disk-usage-analyzer/pixmaps/"\" \
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
$(NULL)
bin_PROGRAMS = mate-disk-usage-analyzer
+BUILT_SOURCES = baobab-resources.h baobab-resources.c
+
+baobab-resources.h baobab-resources.c: $(srcdir)/../data/org.mate.disk-usage-analyzer.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.disk-usage-analyzer.gresource.xml)
+ $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name baobab $<
+
+nodist_mate_disk_usage_analyzer_SOURCES = \
+ $(BUILT_SOURCES)
mate_disk_usage_analyzer_SOURCES = \
baobab.c \
baobab.h \
@@ -52,3 +58,5 @@ mate_disk_usage_analyzer_LDADD = \
$(GTK_LIBS) \
$(LIBGTOP_LIBS) \
$(NULL)
+
+CLEANFILES = $(BUILT_SOURCES)
diff --git a/baobab/src/baobab-prefs.c b/baobab/src/baobab-prefs.c
index f43d3472..cdbb92c3 100644
--- a/baobab/src/baobab-prefs.c
+++ b/baobab/src/baobab-prefs.c
@@ -34,7 +34,7 @@
#include "baobab-utils.h"
#include "baobab-prefs.h"
-#define BAOBAB_PREFERENCES_UI_FILE PKGDATADIR "/baobab-dialog-scan-props.ui"
+#define BAOBAB_PREFERENCES_UI_RESOURCE "/org/mate/disk-usage-analyzer/baobab-dialog-scan-props.ui"
enum
{
@@ -284,12 +284,9 @@ baobab_prefs_dialog (void)
GError *error = NULL;
builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder,
- BAOBAB_PREFERENCES_UI_FILE,
- &error);
- if (error) {
- g_critical ("Can't load user interface file for the scan properties dialog: %s",
+ if (gtk_builder_add_from_resource (builder, BAOBAB_PREFERENCES_UI_RESOURCE, &error) == 0) {
+ g_critical ("Can't load user interface resource for the scan properties dialog: %s",
error->message);
g_object_unref (builder);
g_error_free (error);
diff --git a/baobab/src/baobab.c b/baobab/src/baobab.c
index 8425b142..07af1a1d 100644
--- a/baobab/src/baobab.c
+++ b/baobab/src/baobab.c
@@ -37,7 +37,7 @@
#include "baobab-treemap.h"
#include "baobab-ringschart.h"
-#define BAOBAB_UI_FILE PKGDATADIR "/baobab-main-window.ui"
+#define BAOBAB_UI_RESOURCE "/org/mate/disk-usage-analyzer/baobab-main-window.ui"
static void push_iter_in_stack (GtkTreeIter *);
static GtkTreeIter pop_iter_from_stack (void);
@@ -843,9 +843,7 @@ baobab_init (void)
/* Load the UI */
baobab.main_ui = gtk_builder_new ();
- gtk_builder_add_from_file (baobab.main_ui, BAOBAB_UI_FILE, &error);
-
- if (error) {
+ if (gtk_builder_add_from_resource (baobab.main_ui, BAOBAB_UI_RESOURCE, &error) == 0) {
g_object_unref (baobab.main_ui);
g_critical ("Unable to load the user interface file: %s", error->message);
g_error_free (error);