summaryrefslogtreecommitdiff
path: root/image-converter
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-03-10 09:31:53 +0100
committerraveit65 <[email protected]>2020-03-14 14:31:30 +0100
commitd014b696b3ca43a1521f85b3313890844fe41c3a (patch)
tree5b3e57da8e0c0c45dd7f1d4685d4c5945950d2b3 /image-converter
parentf6dd91097d31b7967c3926985045ceb8a8708666 (diff)
downloadcaja-extensions-d014b696b3ca43a1521f85b3313890844fe41c3a.tar.bz2
caja-extensions-d014b696b3ca43a1521f85b3313890844fe41c3a.tar.xz
image-converter: use gresources for UI files
Diffstat (limited to 'image-converter')
-rw-r--r--image-converter/Makefile.am22
-rw-r--r--image-converter/caja-image-resizer.c7
-rw-r--r--image-converter/caja-image-rotator.c7
-rw-r--r--image-converter/org.mate.caja.extensions.imageconverter.gresource.xml23
4 files changed, 39 insertions, 20 deletions
diff --git a/image-converter/Makefile.am b/image-converter/Makefile.am
index df93167..08e18a9 100644
--- a/image-converter/Makefile.am
+++ b/image-converter/Makefile.am
@@ -1,7 +1,6 @@
NULL =
AM_CPPFLAGS = \
$(DISABLE_DEPRECATED_CPPFLAGS) \
- -DDATADIR=\"$(datadir)\" \
-DMATELOCALEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir) \
-I$(top_builddir) \
@@ -15,6 +14,10 @@ caja_extensiondir=$(CAJA_EXTENSION_DIR)
caja_extension_LTLIBRARIES=libcaja-image-converter.la
+resources_built_sources = caja-image-converter-resources.h caja-image-converter-resources.c
+$(resources_built_sources): org.mate.caja.extensions.imageconverter.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.caja.extensions.imageconverter.gresource.xml)
+ $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name imageconverter $<
+
libcaja_image_converter_la_SOURCES = \
image-converter.c \
caja-image-converter.c \
@@ -23,6 +26,7 @@ libcaja_image_converter_la_SOURCES = \
caja-image-resizer.h \
caja-image-rotator.c \
caja-image-rotator.h \
+ $(resources_built_sources) \
$(NULL)
libcaja_image_converter_la_CPPFLAGS = \
$(AM_CPPFLAGS) \
@@ -39,17 +43,19 @@ libcaja_image_converter_la_LIBADD = \
$(IMAGE_CONVERTER_LIBS) \
$(NULL)
-builderdir = $(datadir)/caja-extensions
-builder_DATA = \
- caja-image-resize.ui \
- caja-image-rotate.ui
-
extensiondir = $(datadir)/caja/extensions
extension_in_files = libcaja-image-converter.caja-extension.desktop.in
extension_DATA = $(extension_in_files:.caja-extension.desktop.in=.caja-extension)
$(extension_DATA): $(extension_in_files)
$(AM_V_GEN) $(MSGFMT) --desktop --keyword= --keyword=Copyright --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@
-EXTRA_DIST = $(builder_DATA)
+EXTRA_DIST = \
+ caja-image-resize.ui \
+ caja-image-rotate.ui \
+ org.mate.caja.extensions.imageconverter.gresource.xml \
+ $(NULL)
-CLEANFILES = $(extension_DATA)
+CLEANFILES = \
+ $(extension_DATA) \
+ $(resources_built_sources) \
+ $(NULL)
diff --git a/image-converter/caja-image-resizer.c b/image-converter/caja-image-resizer.c
index 713e21b..0685466 100644
--- a/image-converter/caja-image-resizer.c
+++ b/image-converter/caja-image-resizer.c
@@ -334,19 +334,14 @@ caja_image_resizer_init(CajaImageResizer *resizer)
CajaImageResizerPrivate *priv = caja_image_resizer_get_instance_private (resizer);
GtkBuilder *ui;
- gchar *path;
- guint result;
GError *err = NULL;
/* Let's create our gtkbuilder and load the xml file */
ui = gtk_builder_new ();
gtk_builder_set_translation_domain (ui, GETTEXT_PACKAGE);
- path = g_build_filename (DATADIR, PACKAGE, "caja-image-resize.ui", NULL);
- result = gtk_builder_add_from_file (ui, path, &err);
- g_free (path);
/* If we're unable to load the xml file */
- if (result == 0) {
+ if (gtk_builder_add_from_resource (ui, "/org/mate/caja/extensions/imageconverter/caja-image-resize.ui", &err) == 0) {
g_warning ("%s", err->message);
g_error_free (err);
return;
diff --git a/image-converter/caja-image-rotator.c b/image-converter/caja-image-rotator.c
index 0186f0d..7ba0271 100644
--- a/image-converter/caja-image-rotator.c
+++ b/image-converter/caja-image-rotator.c
@@ -345,19 +345,14 @@ caja_image_rotator_init(CajaImageRotator *rotator)
CajaImageRotatorPrivate *priv = caja_image_rotator_get_instance_private (rotator);
GtkBuilder *ui;
- gchar *path;
- guint result;
GError *err = NULL;
/* Let's create our gtkbuilder and load the xml file */
ui = gtk_builder_new ();
gtk_builder_set_translation_domain (ui, GETTEXT_PACKAGE);
- path = g_build_filename (DATADIR, PACKAGE, "caja-image-rotate.ui", NULL);
- result = gtk_builder_add_from_file (ui, path, &err);
- g_free (path);
/* If we're unable to load the xml file */
- if (result == 0) {
+ if (gtk_builder_add_from_resource (ui, "/org/mate/caja/extensions/imageconverter/caja-image-rotate.ui", &err) == 0) {
g_warning ("%s", err->message);
g_error_free (err);
return;
diff --git a/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml b/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml
new file mode 100644
index 0000000..309c152
--- /dev/null
+++ b/image-converter/org.mate.caja.extensions.imageconverter.gresource.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This file is part of Caja Extensions.
+
+ Caja Extensions 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.
+
+ Caja Extensions 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 Caja Extensions. If not, see <http://www.gnu.org/licenses/>.
+-->
+<gresources>
+ <gresource prefix="/org/mate/caja/extensions/imageconverter">
+ <file compressed="true">caja-image-resize.ui</file>
+ <file compressed="true">caja-image-rotate.ui</file>
+ </gresource>
+</gresources>