diff options
author | rbuj <[email protected]> | 2019-12-09 23:05:56 +0100 |
---|---|---|
committer | Robert Antoni Buj Gelonch <[email protected]> | 2019-12-23 08:55:37 +0100 |
commit | d6318fc5174c6e5915ed22c53b17a681850c97c0 (patch) | |
tree | 52e0c82b9e6318f70ffb07fac79b0d396970a6f9 | |
parent | b8b0f4f70656476e51c0a645875d07c8c8225626 (diff) | |
download | mate-utils-d6318fc5174c6e5915ed22c53b17a681850c97c0.tar.bz2 mate-utils-d6318fc5174c6e5915ed22c53b17a681850c97c0.tar.xz |
Use gresources for UI files
-rw-r--r-- | baobab/data/Makefile.am | 10 | ||||
-rw-r--r-- | baobab/data/org.mate.disk-usage-analyzer.gresource.xml | 23 | ||||
-rw-r--r-- | baobab/src/Makefile.am | 10 | ||||
-rw-r--r-- | baobab/src/baobab-prefs.c | 9 | ||||
-rw-r--r-- | baobab/src/baobab.c | 6 | ||||
-rw-r--r-- | configure.ac | 14 | ||||
-rw-r--r-- | logview/data/Makefile.am | 9 | ||||
-rw-r--r-- | logview/data/org.mate.system-log.gresource.xml | 23 | ||||
-rw-r--r-- | logview/src/Makefile.am | 24 | ||||
-rw-r--r-- | logview/src/logview-filter-manager.c | 6 | ||||
-rw-r--r-- | logview/src/logview-window.c | 6 | ||||
-rw-r--r-- | mate-screenshot/data/Makefile.am | 7 | ||||
-rw-r--r-- | mate-screenshot/data/org.mate.screenshot.gresource.xml | 22 | ||||
-rw-r--r-- | mate-screenshot/src/Makefile.am | 22 | ||||
-rw-r--r-- | mate-screenshot/src/screenshot-dialog.c | 4 |
15 files changed, 147 insertions, 48 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); diff --git a/configure.ac b/configure.ac index 587f5079..244e217c 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,20 @@ AM_CONDITIONAL([HAVE_INKSCAPE], [test "x$INKSCAPE" != x]) MATE_COMPILE_WARNINGS([yes]) +# GLIB_COMPILE_RESOURCES +AC_ARG_VAR([GLIB_COMPILE_RESOURCES],[glib-compile-resources bin]) +AC_PATH_PROG([GLIB_COMPILE_RESOURCES],[glib-compile-resources],[]) +if test -z "$GLIB_COMPILE_RESOURCES"; then + AC_MSG_ERROR([glib-compile-resources not found]) +fi + +# XMLLINT +AC_ARG_VAR([XMLLINT],[xmllint bin]) +AC_PATH_PROG([XMLLINT],[xmllint],[]) +if test -z "$XMLLINT"; then + AC_MSG_ERROR([xmllint not found]) +fi + AC_PATH_XTRA AC_C_CONST diff --git a/logview/data/Makefile.am b/logview/data/Makefile.am index 1fda2fb1..451f93fa 100644 --- a/logview/data/Makefile.am +++ b/logview/data/Makefile.am @@ -1,8 +1,5 @@ SUBDIRS=icons -xmldir = $(pkgdatadir) -xml_DATA = logview-toolbar.xml logview-filter.ui - desktopdir = $(datadir)/applications desktop_in_files = mate-system-log.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) @@ -19,9 +16,11 @@ gsettings_SCHEMAS = org.mate.system-log.gschema.xml @GSETTINGS_RULES@ EXTRA_DIST = \ + logview-filter.ui \ + logview-toolbar.xml \ mate-system-log.desktop.in.in \ - $(xml_DATA) \ - $(man_MANS) + $(man_MANS) \ + org.mate.system-log.gresource.xml DISTCLEANFILES = \ $(desktop_DATA) \ diff --git a/logview/data/org.mate.system-log.gresource.xml b/logview/data/org.mate.system-log.gresource.xml new file mode 100644 index 00000000..14b1103d --- /dev/null +++ b/logview/data/org.mate.system-log.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/system-log"> + <file compressed="true">logview-filter.ui</file> + <file compressed="true">logview-toolbar.xml</file> + </gresource> +</gresources> diff --git a/logview/src/Makefile.am b/logview/src/Makefile.am index b270678e..a0268760 100644 --- a/logview/src/Makefile.am +++ b/logview/src/Makefile.am @@ -5,14 +5,18 @@ AM_CPPFLAGS = \ -DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ -DDATADIR=\""$(datadir)"\" \ -DLOGVIEWINSTALLPREFIX=\""$(prefix)/\"" \ - -DLOGVIEW_DATADIR=\""$(pkgdatadir)"\" \ $(NULL) bin_PROGRAMS = mate-system-log BUILT_SOURCES = \ logview-marshal.c \ - logview-marshal.h + logview-marshal.h \ + logview-resources.c \ + logview-resources.h + +nodist_mate_system_log_SOURCES = \ + $(BUILT_SOURCES) mate_system_log_SOURCES = \ logview-app.c \ @@ -33,11 +37,10 @@ mate_system_log_SOURCES = \ logview-findbar.c \ logview-prefs.c \ logview-prefs.h \ - logview-filter.h \ - logview-filter.c \ - logview-filter-manager.h \ - logview-filter-manager.c \ - $(BUILT_SOURCES) + logview-filter.h \ + logview-filter.c \ + logview-filter-manager.h \ + logview-filter-manager.c mate_system_log_CFLAGS = \ $(GLIB_CFLAGS) \ @@ -47,7 +50,7 @@ mate_system_log_CFLAGS = \ $(WARN_CFLAGS) \ $(NULL) -mate_system_log_LDADD = \ +mate_system_log_LDADD = \ $(GLIB_LIBS) \ $(GIO_LIBS) \ $(GTHREAD_LIBS) \ @@ -62,9 +65,12 @@ logview-marshal.c: logview-marshal.list $(GLIB_GENMARSHAL) echo "#include \"logview-marshal.h\"" > $@ && \ $(GLIB_GENMARSHAL) $< --body --prefix=logview_marshal >> $@ +logview-resources.h logview-resources.c: $(srcdir)/../data/org.mate.system-log.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.system-log.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name logview $< + EXTRA_DIST = logview-marshal.list -CLEANFILES = \ +CLEANFILES = \ $(BUILT_SOURCES) dist-hook: diff --git a/logview/src/logview-filter-manager.c b/logview/src/logview-filter-manager.c index 4f3df30c..e086ba76 100644 --- a/logview/src/logview-filter-manager.c +++ b/logview/src/logview-filter-manager.c @@ -27,7 +27,7 @@ #include <string.h> #include <glib/gi18n.h> -#define UI_FILE LOGVIEW_DATADIR "/logview-filter.ui" +#define UI_RESOURCE "/org/mate/system-log/logview-filter.ui" struct _LogviewFilterManagerPrivate { GtkWidget *tree; @@ -280,9 +280,7 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter) error = NULL; name = NULL; - gtk_builder_add_from_file (builder, UI_FILE, &error); - - if (error) { + if (gtk_builder_add_from_resource (builder, UI_RESOURCE, &error) == 0) { g_warning ("Could not load filter ui: %s", error->message); g_error_free (error); return; diff --git a/logview/src/logview-window.c b/logview/src/logview-window.c index d36e69ea..8c419dce 100644 --- a/logview/src/logview-window.c +++ b/logview/src/logview-window.c @@ -1311,9 +1311,9 @@ logview_window_init (LogviewWindow *logview) accel_group = gtk_ui_manager_get_accel_group (priv->ui_manager); gtk_window_add_accel_group (GTK_WINDOW (logview), accel_group); - res = gtk_ui_manager_add_ui_from_file (priv->ui_manager, - LOGVIEW_DATADIR "/logview-toolbar.xml", - &error); + res = gtk_ui_manager_add_ui_from_resource (priv->ui_manager, + "/org/mate/system-log/logview-toolbar.xml", + &error); if (res == FALSE) { priv->ui_manager = NULL; diff --git a/mate-screenshot/data/Makefile.am b/mate-screenshot/data/Makefile.am index d96df67f..2b4ede33 100644 --- a/mate-screenshot/data/Makefile.am +++ b/mate-screenshot/data/Makefile.am @@ -4,8 +4,6 @@ mate_screenshot_DATA = $(mate_screenshot_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ man_MANS = mate-screenshot.1 -uidir = $(datadir)/mate-screenshot -ui_DATA = mate-screenshot.ui @INTLTOOL_XML_RULE@ appdatadir = $(datadir)/metainfo @@ -17,9 +15,10 @@ gsettings_SCHEMAS = org.mate.screenshot.gschema.xml EXTRA_DIST = \ $(appdata_in_files) \ - $(mate_screenshot_in_files) \ + $(mate_screenshot_in_files) \ $(man_MANS) \ - $(ui_DATA) + mate-screenshot.ui \ + org.mate.screenshot.gresource.xml CLEANFILES = \ $(gsettings_SCHEMAS) \ diff --git a/mate-screenshot/data/org.mate.screenshot.gresource.xml b/mate-screenshot/data/org.mate.screenshot.gresource.xml new file mode 100644 index 00000000..33c75736 --- /dev/null +++ b/mate-screenshot/data/org.mate.screenshot.gresource.xml @@ -0,0 +1,22 @@ +<?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/screenshot"> + <file compressed="true">mate-screenshot.ui</file> + </gresource> +</gresources> diff --git a/mate-screenshot/src/Makefile.am b/mate-screenshot/src/Makefile.am index 9ae05a73..e5104cbd 100644 --- a/mate-screenshot/src/Makefile.am +++ b/mate-screenshot/src/Makefile.am @@ -4,11 +4,20 @@ AM_CPPFLAGS = \ -I. \ -I$(srcdir) \ -DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \ - -DUIDIR=\""$(datadir)/mate-screenshot"\" + $(NULL) bin_PROGRAMS = mate-screenshot -mate_screenshot_SOURCES = \ +BUILT_SOURCES = \ + screenshot-resources.c \ + screenshot-resources.h \ + $(NULL) + +nodist_mate_screenshot_SOURCES = \ + $(BUILT_SOURCES) \ + $(NULL) + +mate_screenshot_SOURCES = \ mate-screenshot.c \ screenshot-dialog.c \ screenshot-dialog.h \ @@ -32,7 +41,7 @@ mate_screenshot_CFLAGS = \ mate_screenshot_LDFLAGS = -export-dynamic -mate_screenshot_LDADD = \ +mate_screenshot_LDADD = \ $(XSHAPE_LIBS) \ $(GLIB_LIBS) \ $(GIO_LIBS) \ @@ -41,6 +50,13 @@ mate_screenshot_LDADD = \ $(GTK_LIBS) \ -lm +screenshot-resources.h screenshot-resources.c: $(srcdir)/../data/org.mate.screenshot.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.screenshot.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name screenshot $< + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(NULL) + install-exec-local: rm -f $(DESTDIR)$(bindir)/mate-panel-screenshot ln -s mate-screenshot $(DESTDIR)$(bindir)/mate-panel-screenshot diff --git a/mate-screenshot/src/screenshot-dialog.c b/mate-screenshot/src/screenshot-dialog.c index f9450582..854ae3e4 100644 --- a/mate-screenshot/src/screenshot-dialog.c +++ b/mate-screenshot/src/screenshot-dialog.c @@ -181,7 +181,6 @@ screenshot_dialog_new (GdkPixbuf *screenshot, GFile *tmp_file; GFile *parent_file; GError *error = NULL; - guint res; tmp_file = g_file_new_for_uri (initial_uri); parent_file = g_file_get_parent (tmp_file); @@ -194,11 +193,10 @@ screenshot_dialog_new (GdkPixbuf *screenshot, dialog = g_new0 (ScreenshotDialog, 1); dialog->ui = gtk_builder_new (); - res = gtk_builder_add_from_file (dialog->ui, UIDIR "/mate-screenshot.ui", &error); dialog->screenshot = screenshot; - if (res == 0) + if (gtk_builder_add_from_resource (dialog->ui, "/org/mate/screenshot/mate-screenshot.ui", &error) == 0) { GtkWidget *dialog; dialog = gtk_message_dialog_new (NULL, 0, |