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 --- applets/brightness/Makefile.am | 4 +-- applets/brightness/brightness-applet.c | 2 +- applets/inhibit/Makefile.am | 4 +-- applets/inhibit/inhibit-applet.c | 2 +- configure.ac | 14 ++++++++ data/Makefile.am | 40 ++++++++++++---------- ...rg.mate.power-manager.preferences.gresource.xml | 22 ++++++++++++ ...org.mate.power-manager.statistics.gresource.xml | 22 ++++++++++++ src/Makefile.am | 34 ++++++++++++++---- src/gpm-main.c | 2 +- src/gpm-prefs-core.c | 2 +- src/gpm-statistics.c | 4 +-- 12 files changed, 117 insertions(+), 35 deletions(-) create mode 100644 data/org.mate.power-manager.preferences.gresource.xml create mode 100644 data/org.mate.power-manager.statistics.gresource.xml diff --git a/applets/brightness/Makefile.am b/applets/brightness/Makefile.am index 7962787..5977106 100644 --- a/applets/brightness/Makefile.am +++ b/applets/brightness/Makefile.am @@ -6,13 +6,13 @@ AM_CPPFLAGS = \ $(PANEL_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ -DBINDIR=\"$(bindir)\" \ - -DMATELOCALEDIR=\""$(datadir)/locale"\" \ + -DMATELOCALEDIR=\""$(datadir)/locale"\" \ -DDATADIR=\"$(datadir)\" \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBDIR=\""$(libdir)"\" \ -DVERSION="\"$(VERSION)\"" \ - -DGPM_DATA=\"$(pkgdatadir)\" \ + -DGPM_ICONS_DATA=\"$(pkgdatadir)/icons\" \ -DBRIGHTNESS_MENU_UI_DIR=\""$(uidir)"\" \ -DEGG_LOG_FILE=\""~/mate-power-manager.log"\" \ -DEGG_VERBOSE="\"GPM_VERBOSE\"" \ diff --git a/applets/brightness/brightness-applet.c b/applets/brightness/brightness-applet.c index 9074fa9..ebf9914 100644 --- a/applets/brightness/brightness-applet.c +++ b/applets/brightness/brightness-applet.c @@ -996,7 +996,7 @@ gpm_brightness_applet_init (GpmBrightnessApplet *applet) /* 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); /* monitor the daemon */ applet->bus_watch_id = diff --git a/applets/inhibit/Makefile.am b/applets/inhibit/Makefile.am index 111ab2b..b32f178 100644 --- a/applets/inhibit/Makefile.am +++ b/applets/inhibit/Makefile.am @@ -6,13 +6,13 @@ AM_CPPFLAGS = \ $(PANEL_CFLAGS) \ $(LIBNOTIFY_CFLAGS) \ -DBINDIR=\"$(bindir)\" \ - -DMATELOCALEDIR=\""$(datadir)/locale"\" \ + -DMATELOCALEDIR=\""$(datadir)/locale"\" \ -DDATADIR=\"$(datadir)\" \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBDIR=\""$(libdir)"\" \ -DVERSION="\"$(VERSION)\"" \ - -DGPM_DATA=\"$(pkgdatadir)\" \ + -DGPM_ICONS_DATA=\"$(pkgdatadir)/icons\" \ -DINHIBIT_MENU_UI_DIR=\""$(uidir)"\" \ -DEGG_LOG_FILE=\""~/mate-power-manager.log"\" \ -DEGG_VERBOSE="\"GPM_VERBOSE\"" \ diff --git a/applets/inhibit/inhibit-applet.c b/applets/inhibit/inhibit-applet.c index 02b38c4..7d903dd 100644 --- a/applets/inhibit/inhibit-applet.c +++ b/applets/inhibit/inhibit-applet.c @@ -471,7 +471,7 @@ gpm_inhibit_applet_init (GpmInhibitApplet *applet) /* 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); /* monitor the daemon */ applet->bus_watch_id = diff --git a/configure.ac b/configure.ac index ad322c6..eb12978 100644 --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,20 @@ YELP_HELP_INIT AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) +# 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_ARG_ENABLE(deprecated, [AS_HELP_STRING([--enable-deprecated], [Warn about deprecated usages [default=no]])],, diff --git a/data/Makefile.am b/data/Makefile.am index 0974e1d..436cdf7 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -24,31 +24,33 @@ $(service_DATA): $(service_in_files) Makefile gsettings_schemas_in_files = org.mate.power-manager.gschema.xml.in gsettings_SCHEMAS = $(gsettings_schemas_in_files:.xml.in=.xml) -pkgdata_DATA = \ - gpm-statistics.ui \ - gpm-prefs.ui \ +pkgdata_DATA = \ acme.ui -man_MANS = \ - mate-power-manager.1 \ - mate-power-backlight-helper.1 \ - mate-power-statistics.1 \ +man_MANS = \ + mate-power-manager.1 \ + mate-power-backlight-helper.1 \ + mate-power-statistics.1 \ mate-power-preferences.1 -EXTRA_DIST = \ - $(service_in_files) \ - $(autostart_in_files) \ - $(desktop_in_files) \ - $(gsettings_schemas_in_files) \ - $(pkgdata_DATA) \ - $(man_MANS) +EXTRA_DIST = \ + $(service_in_files) \ + $(autostart_in_files) \ + $(desktop_in_files) \ + $(gsettings_schemas_in_files) \ + $(pkgdata_DATA) \ + $(man_MANS) \ + org.mate.power-manager.preferences.gresource.xml \ + org.mate.power-manager.statistics.gresource.xml \ + gpm-prefs.ui \ + gpm-statistics.ui clean-local : rm -f *~ -DISTCLEANFILES = \ - mate-power-manager.desktop \ - mate-power-preferences.desktop \ - mate-power-statistics.desktop \ - org.mate.PowerManager.service \ +DISTCLEANFILES = \ + mate-power-manager.desktop \ + mate-power-preferences.desktop \ + mate-power-statistics.desktop \ + org.mate.PowerManager.service \ $(gsettings_SCHEMAS) diff --git a/data/org.mate.power-manager.preferences.gresource.xml b/data/org.mate.power-manager.preferences.gresource.xml new file mode 100644 index 0000000..fd4f94c --- /dev/null +++ b/data/org.mate.power-manager.preferences.gresource.xml @@ -0,0 +1,22 @@ + + + + + gpm-prefs.ui + + diff --git a/data/org.mate.power-manager.statistics.gresource.xml b/data/org.mate.power-manager.statistics.gresource.xml new file mode 100644 index 0000000..a879e53 --- /dev/null +++ b/data/org.mate.power-manager.statistics.gresource.xml @@ -0,0 +1,22 @@ + + + + + gpm-statistics.ui + + 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