summaryrefslogtreecommitdiff
path: root/charpick
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-18 21:37:40 +0200
committerraveit65 <[email protected]>2020-07-30 18:37:40 +0200
commitca4a3b697836a99590c1e81a0b263588609b647c (patch)
treed4f84e64736689da2e57594d96363a5a9d6edb40 /charpick
parentfd1a917a0ca74063ed52f9798c9491556b08c8f4 (diff)
downloadmate-applets-ca4a3b697836a99590c1e81a0b263588609b647c.tar.bz2
mate-applets-ca4a3b697836a99590c1e81a0b263588609b647c.tar.xz
charpick: Load menu from resources
Diffstat (limited to 'charpick')
-rw-r--r--charpick/Makefile.am64
-rw-r--r--charpick/charpick-resources.gresource.xml6
-rw-r--r--charpick/charpick.c9
3 files changed, 52 insertions, 27 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/charpick">
+ <file compressed="true">charpick-applet-menu.xml</file>
+ </gresource>
+</gresources>
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;