From eafb5fddf84324ebf6b0cc90422f10ee314b5b28 Mon Sep 17 00:00:00 2001 From: rbuj Date: Tue, 7 May 2019 00:05:26 +0200 Subject: capplets: Use gresources for UI files --- capplets/appearance/Makefile.am | 12 +++++++++--- capplets/appearance/appearance-main.c | 6 +----- capplets/appearance/data/Makefile.am | 12 ++++-------- .../org.mate.mcc.appearance.gresource.xml | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 capplets/appearance/org.mate.mcc.appearance.gresource.xml (limited to 'capplets/appearance') diff --git a/capplets/appearance/Makefile.am b/capplets/appearance/Makefile.am index 500fcc64..7ae3edd1 100644 --- a/capplets/appearance/Makefile.am +++ b/capplets/appearance/Makefile.am @@ -1,10 +1,14 @@ SUBDIRS = data +BUILT_SOURCES = mate-appearance-properties-resources.h mate-appearance-properties-resources.c + # This is used in MATECC_CAPPLETS_CFLAGS cappletname = appearance bin_PROGRAMS = mate-appearance-properties +nodist_mate_appearance_properties_SOURCES = \ + $(BUILT_SOURCES) mate_appearance_properties_SOURCES = \ appearance.h \ appearance-desktop.c \ @@ -43,7 +47,6 @@ mate_appearance_properties_LDADD = \ $(MARCO_LIBS) mate_appearance_properties_LDFLAGS = -export-dynamic -gtkbuilderdir = $(pkgdatadir)/ui pixmapdir = $(pkgdatadir)/pixmaps wallpaperdir = $(datadir)/mate-background-properties @@ -53,10 +56,13 @@ AM_CPPFLAGS = \ $(FONT_CAPPLET_CFLAGS) \ -DMATELOCALEDIR="\"$(datadir)/locale\"" \ -DMATECC_DATA_DIR="\"$(pkgdatadir)\"" \ - -DMATECC_GTKBUILDER_DIR="\"$(gtkbuilderdir)\"" \ -DMATECC_PIXMAP_DIR="\"$(pixmapdir)\"" \ -DWALLPAPER_DATADIR="\"$(wallpaperdir)\"" -CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) +mate-appearance-properties-resources.h mate-appearance-properties-resources.c: org.mate.mcc.appearance.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/org.mate.mcc.appearance.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name appearance $< + +CLEANFILES = $(MATECC_CAPPLETS_CLEANFILES) $(BUILT_SOURCES) +EXTRA_DIST = org.mate.mcc.appearance.gresource.xml -include $(top_srcdir)/git.mk diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c index b2b77353..bd6fc87f 100644 --- a/capplets/appearance/appearance-main.c +++ b/capplets/appearance/appearance-main.c @@ -36,7 +36,6 @@ static AppearanceData * init_appearance_data (int *argc, char ***argv, GOptionContext *context) { AppearanceData *data = NULL; - gchar *uifile; GtkBuilder *ui; GError *err = NULL; @@ -45,11 +44,8 @@ init_appearance_data (int *argc, char ***argv, GOptionContext *context) activate_settings_daemon (); /* set up the data */ - uifile = g_build_filename (MATECC_GTKBUILDER_DIR, "appearance.ui", - NULL); ui = gtk_builder_new (); - gtk_builder_add_from_file (ui, uifile, &err); - g_free (uifile); + gtk_builder_add_from_resource (ui, "/org/mate/mcc/appearance/data/appearance.ui", &err); if (err) { diff --git a/capplets/appearance/data/Makefile.am b/capplets/appearance/data/Makefile.am index 4bec1621..9db85374 100644 --- a/capplets/appearance/data/Makefile.am +++ b/capplets/appearance/data/Makefile.am @@ -1,7 +1,4 @@ -gtkbuilderdir = $(pkgdatadir)/ui -dist_gtkbuilder_DATA = appearance.ui - pixmapdir = $(pkgdatadir)/pixmaps dist_pixmap_DATA = \ subpixel-bgr.png \ @@ -25,9 +22,6 @@ desktop_in_files = \ mate-theme-installer.desktop.in desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) - - - @INTLTOOL_XML_RULE@ xml_in_files = \ @@ -36,7 +30,6 @@ xml_in_files = \ mimedir = $(datadir)/mime/packages mime_DATA = $(xml_in_files:.xml.in=.xml) - install-data-hook: if ENABLE_UPDATE_MIMEDB $(UPDATE_MIME_DATABASE) "$(DESTDIR)$(datadir)/mime" @@ -47,7 +40,10 @@ if ENABLE_UPDATE_MIMEDB $(UPDATE_MIME_DATABASE) "$(DESTDIR)$(datadir)/mime" endif -EXTRA_DIST = $(xml_in_files) $(desktop_in_files) +EXTRA_DIST = \ + appearance.ui \ + $(xml_in_files) \ + $(desktop_in_files) CLEANFILES = $(desktop_DATA) $(mime_DATA) diff --git a/capplets/appearance/org.mate.mcc.appearance.gresource.xml b/capplets/appearance/org.mate.mcc.appearance.gresource.xml new file mode 100644 index 00000000..7fc4bf8e --- /dev/null +++ b/capplets/appearance/org.mate.mcc.appearance.gresource.xml @@ -0,0 +1,22 @@ + + + + + data/appearance.ui + + -- cgit v1.2.1