From 7363693872c492c084e52de797126c7f887a16a1 Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 13 Dec 2020 20:29:21 +0100 Subject: multiload: load menu from resource bundle --- multiload/data/Makefile.am | 6 ++---- multiload/data/multiload-resources.gresource.xml | 6 ++++++ multiload/src/Makefile.am | 16 +++++++++++++++- multiload/src/main.c | 6 +++--- 4 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 multiload/data/multiload-resources.gresource.xml (limited to 'multiload') diff --git a/multiload/data/Makefile.am b/multiload/data/Makefile.am index bacb6f1e..9c7357f2 100644 --- a/multiload/data/Makefile.am +++ b/multiload/data/Makefile.am @@ -2,9 +2,6 @@ multiload_gschema_in_files = org.mate.panel.applet.multiload.gschema.xml.in gsettings_SCHEMAS = $(multiload_gschema_in_files:.xml.in=.xml) @GSETTINGS_RULES@ -uidir = $(datadir)/mate/ui -ui_DATA = multiload-applet-menu.xml - appletdir = $(datadir)/mate-panel/applets applet_in_in_files = org.mate.applets.MultiLoadApplet.mate-panel-applet.desktop.in.in applet_in_files = $(applet_in_in_files:.desktop.in.in=.desktop.in) @@ -39,6 +36,7 @@ EXTRA_DIST = \ $(applet_in_in_files) \ $(service_in_files) \ $(multiload_gschema_in_files) \ - $(ui_DATA) + multiload-applet-menu.xml \ + multiload-resources.gresource.xml -include $(top_srcdir)/git.mk diff --git a/multiload/data/multiload-resources.gresource.xml b/multiload/data/multiload-resources.gresource.xml new file mode 100644 index 00000000..490e97c2 --- /dev/null +++ b/multiload/data/multiload-resources.gresource.xml @@ -0,0 +1,6 @@ + + + + multiload-applet-menu.xml + + diff --git a/multiload/src/Makefile.am b/multiload/src/Makefile.am index ab0ab6fd..670f1c50 100644 --- a/multiload/src/Makefile.am +++ b/multiload/src/Makefile.am @@ -1,6 +1,8 @@ +NULL = + AM_CPPFLAGS = \ -I$(srcdir) \ - -DMULTILOAD_MENU_UI_DIR=\""$(datadir)/mate/ui/"\" \ + -DMULTILOAD_RESOURCE_PATH=\""/org/mate/mate-applets/multiload/"\" \ $(MATE_APPLETS4_CFLAGS) \ $(GTOP_APPLETS_CFLAGS) \ $(GIO_CFLAGS) \ @@ -8,6 +10,8 @@ AM_CPPFLAGS = \ libexec_PROGRAMS = mate-multiload-applet +BUILT_SOURCES = multiload-resources.c multiload-resources.h +nodist_mate_multiload_applet_SOURCES = $(BUILT_SOURCES) mate_multiload_applet_SOURCES = \ global.h \ linux-proc.h \ @@ -26,4 +30,14 @@ mate_multiload_applet_LDADD = \ $(GIO_LIBS) \ -lm +multiload-resources.c: $(srcdir)/../data/multiload-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/../data --generate-dependencies $(srcdir)/../data/multiload-resources.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/../data --generate --c-name multiload $< + +multiload-resources.h: $(srcdir)/../data/multiload-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/../data --generate-dependencies $(srcdir)/../data/multiload-resources.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/../data --generate --c-name multiload $< + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(NULL) + -include $(top_srcdir)/git.mk diff --git a/multiload/src/main.c b/multiload/src/main.c index 50732e01..e2cfe6bd 100644 --- a/multiload/src/main.c +++ b/multiload/src/main.c @@ -509,9 +509,9 @@ multiload_applet_new(MatePanelApplet *applet, const gchar *iid, gpointer data) multiload_menu_actions, G_N_ELEMENTS (multiload_menu_actions), ma); - mate_panel_applet_setup_menu_from_file (applet, - MULTILOAD_MENU_UI_DIR "multiload-applet-menu.xml", - action_group); + mate_panel_applet_setup_menu_from_resource (applet, + MULTILOAD_RESOURCE_PATH "multiload-applet-menu.xml", + action_group); if (mate_panel_applet_get_locked_down (applet)) { GtkAction *action; -- cgit v1.2.1