From ca4a3b697836a99590c1e81a0b263588609b647c Mon Sep 17 00:00:00 2001 From: rbuj Date: Sat, 18 Jul 2020 21:37:40 +0200 Subject: charpick: Load menu from resources --- charpick/Makefile.am | 64 ++++++++++++++++++++----------- charpick/charpick-resources.gresource.xml | 6 +++ charpick/charpick.c | 9 ++--- 3 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 charpick/charpick-resources.gresource.xml diff --git a/charpick/Makefile.am b/charpick/Makefile.am index 5397d2d0..1c505e20 100644 --- a/charpick/Makefile.am +++ b/charpick/Makefile.am @@ -1,22 +1,36 @@ +NULL = + SUBDIRS = help -AM_CPPFLAGS = \ - -I. \ - -I$(srcdir) \ - -DCHARPICK_MENU_UI_DIR=\""$(uidir)"\" \ - ${WARN_CFLAGS} \ - $(MATE_APPLETS4_CFLAGS) \ - $(GUCHARMAP_CFLAGS) +AM_CPPFLAGS = \ + -I. \ + -I$(srcdir) \ + -DCHARPICK_RESOURCE_PATH=\""/org/mate/mate-applets/charpick/"\" \ + ${WARN_CFLAGS} \ + $(MATE_APPLETS4_CFLAGS) \ + $(GUCHARMAP_CFLAGS) \ + $(NULL) libexec_PROGRAMS = mate-charpick-applet -mate_charpick_applet_SOURCES = charpick.c \ - charpick.h \ - properties.c +BUILT_SOURCES = charpick-resources.c charpick-resources.h +nodist_mate_charpick_applet_SOURCES = $(BUILT_SOURCES) +mate_charpick_applet_SOURCES = \ + charpick.c \ + charpick.h \ + properties.c \ + $(NULL) + +mate_charpick_applet_LDADD = \ + $(MATE_APPLETS4_LIBS) \ + $(GUCHARMAP_LIBS) \ + $(NULL) -mate_charpick_applet_LDADD = \ - $(MATE_APPLETS4_LIBS) \ - $(GUCHARMAP_LIBS) +charpick-resources.c: charpick-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/charpick-resources.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name charpick $< + +charpick-resources.h: charpick-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/charpick-resources.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name charpick $< appletdir = $(datadir)/mate-panel/applets applet_in_files = org.mate.applets.CharpickerApplet.mate-panel-applet.desktop.in @@ -44,15 +58,21 @@ charpick_gschema_in_files = org.mate.panel.applet.charpick.gschema.xml.in gsettings_SCHEMAS = $(charpick_gschema_in_files:.xml.in=.xml) @GSETTINGS_RULES@ -uidir = $(datadir)/mate/ui -ui_DATA = charpick-applet-menu.xml - -CLEANFILES = $(applet_DATA) $(applet_in_files) $(service_DATA) $(gsettings_SCHEMAS) *.gschema.valid +CLEANFILES = \ + $(applet_DATA) \ + $(applet_in_files) \ + $(service_DATA) \ + $(gsettings_SCHEMAS) \ + $(BUILT_SOURCES) \ + *.gschema.valid \ + $(NULL) -EXTRA_DIST = \ - $(applet_in_files).in \ - $(service_in_files) \ - $(ui_DATA) \ - $(charpick_gschema_in_files) +EXTRA_DIST = \ + $(applet_in_files).in \ + $(service_in_files) \ + $(charpick_gschema_in_files) \ + charpick-applet-menu.xml \ + charpick-resources.gresource.xml \ + $(NULL) -include $(top_srcdir)/git.mk diff --git a/charpick/charpick-resources.gresource.xml b/charpick/charpick-resources.gresource.xml new file mode 100644 index 00000000..a29ae881 --- /dev/null +++ b/charpick/charpick-resources.gresource.xml @@ -0,0 +1,6 @@ + + + + charpick-applet-menu.xml + + diff --git a/charpick/charpick.c b/charpick/charpick.c index 5cec3217..619d44c8 100644 --- a/charpick/charpick.c +++ b/charpick/charpick.c @@ -704,7 +704,6 @@ charpicker_applet_fill (MatePanelApplet *applet) GList *list; gchar *string; GtkActionGroup *action_group; - gchar *ui_path; g_set_application_name (_("Character Palette")); @@ -788,10 +787,10 @@ charpicker_applet_fill (MatePanelApplet *applet) charpick_applet_menu_actions, G_N_ELEMENTS (charpick_applet_menu_actions), curr_data); - ui_path = g_build_filename (CHARPICK_MENU_UI_DIR, "charpick-applet-menu.xml", NULL); - mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet), - ui_path, action_group); - g_free (ui_path); + + mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet), + CHARPICK_RESOURCE_PATH "charpick-applet-menu.xml", + action_group); if (mate_panel_applet_get_locked_down (MATE_PANEL_APPLET (applet))) { GtkAction *action; -- cgit v1.2.1