From 7214cf362179010b6c1e9f9cc2186e7ea7dd590c Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 17 Aug 2019 12:20:42 +0200 Subject: Use gresources for gpm-prefs.ui and gpm-statistics.ui --- src/Makefile.am | 34 ++++++++++++++++++++++++++++------ src/gpm-main.c | 2 +- src/gpm-prefs-core.c | 2 +- src/gpm-statistics.c | 4 ++-- 4 files changed, 32 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index b50bf93..e17e2dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -22,16 +22,16 @@ AM_CPPFLAGS = \ -DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE \ $(UPOWER_CFLAGS) \ -DBINDIR=\"$(bindir)\" \ - -DSBINDIR=\"$(sbindir)\" \ - -DMATELOCALEDIR=\""$(datadir)/locale"\" \ + -DSBINDIR=\"$(sbindir)\" \ + -DMATELOCALEDIR=\""$(datadir)/locale"\" \ -DDATADIR=\"$(datadir)\" \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBDIR=\""$(libdir)"\" \ -DVERSION="\"$(VERSION)\"" \ - -DGPM_DATA=\"$(pkgdatadir)\" \ + -DGPM_ICONS_DATA=\"$(pkgdatadir)/icons\" \ -DGTKBUILDERDIR=\"$(pkgdatadir)\" \ - -DUP_DISABLE_DEPRECATED \ + -DUP_DISABLE_DEPRECATED \ -DEGG_LOG_FILE=\""/tmp/gpm.log"\" \ -DEGG_VERBOSE="\"GPM_VERBOSE\"" \ -DEGG_LOGGING="\"GPM_LOGGING\"" \ @@ -94,7 +94,15 @@ mate_power_backlight_helper_CFLAGS = \ $(WARNINGFLAGS) \ $(NULL) -mate_power_statistics_SOURCES = \ +mate-power-statistics-resources.h mate-power-statistics-resources.c: $(srcdir)/../data/org.mate.power-manager.statistics.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.power-manager.statistics.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name statistics $< + +nodist_mate_power_statistics_SOURCES = \ + mate-power-statistics-resources.h \ + mate-power-statistics-resources.c \ + $(NULL) + +mate_power_statistics_SOURCES = \ gpm-statistics.c \ gpm-point-obj.c \ gpm-point-obj.h \ @@ -115,6 +123,14 @@ mate_power_statistics_CFLAGS = \ $(WARNINGFLAGS) \ $(NULL) +mate-power-preferences-resources.h mate-power-preferences-resources.c: $(srcdir)/../data/org.mate.power-manager.preferences.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir)/../data $(srcdir)/../data/org.mate.power-manager.preferences.gresource.xml) + $(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir)/../data --generate --c-name preferences $< + +nodist_mate_power_preferences_SOURCES = \ + mate-power-preferences-resources.h \ + mate-power-preferences-resources.c \ + $(NULL) + mate_power_preferences_SOURCES = \ gpm-prefs.c \ gpm-prefs-core.h \ @@ -294,7 +310,13 @@ clean-local: rm -f *~ rm -f gpm-marshal.c gpm-marshal.h -CLEANFILES = $(BUILT_SOURCES) +CLEANFILES = \ + $(BUILT_SOURCES) \ + mate-power-preferences-resources.h \ + mate-power-preferences-resources.c \ + mate-power-statistics-resources.h \ + mate-power-statistics-resources.c \ + $(NULL) if HAVE_TESTS TESTS = mate-power-self-test diff --git a/src/gpm-main.c b/src/gpm-main.c index 3244e00..e7444ff 100644 --- a/src/gpm-main.c +++ b/src/gpm-main.c @@ -228,7 +228,7 @@ main (int argc, char *argv[]) /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), - GPM_DATA G_DIR_SEPARATOR_S "icons"); + GPM_ICONS_DATA); loop = g_main_loop_new (NULL, FALSE); diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index 58db4b4..2f07c14 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -833,7 +833,7 @@ gpm_prefs_init (GpmPrefs *prefs) error = NULL; prefs->priv->builder = gtk_builder_new (); - retval = gtk_builder_add_from_file (prefs->priv->builder, GPM_DATA "/gpm-prefs.ui", &error); + retval = gtk_builder_add_from_resource (prefs->priv->builder, "/org/mate/powermanager/preferences/gpm-prefs.ui", &error); if (error) { egg_error ("failed to load ui: %s", error->message); diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index cbbd564..fc302a4 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -1615,14 +1615,14 @@ main (int argc, char *argv[]) /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), - GPM_DATA G_DIR_SEPARATOR_S "icons"); + GPM_ICONS_DATA); /* get data from the settings */ settings = g_settings_new (GPM_SETTINGS_SCHEMA); /* get UI */ builder = gtk_builder_new (); - retval = gtk_builder_add_from_file (builder, GPM_DATA "/gpm-statistics.ui", &error); + retval = gtk_builder_add_from_resource (builder, "/org/mate/powermanager/statistics/gpm-statistics.ui", &error); if (error) { egg_error ("failed to load ui: %s", error->message); -- cgit v1.2.1