summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-18 17:11:04 +0200
committerraveit65 <[email protected]>2020-07-29 17:54:46 +0200
commit1dafc4423968a404273e4a9372b42bad8390bad3 (patch)
tree53dcedcc65fcb37dbc8e029ce84f94fd00208092
parentd797a1d2ed72765c945970cbd68cb4cbd0597b83 (diff)
downloadmate-applets-1dafc4423968a404273e4a9372b42bad8390bad3.tar.bz2
mate-applets-1dafc4423968a404273e4a9372b42bad8390bad3.tar.xz
accessx-status: Load menu from resources
-rw-r--r--accessx-status/Makefile.am28
-rw-r--r--accessx-status/accessx-status-resources.gresource.xml6
-rw-r--r--accessx-status/applet.c7
3 files changed, 31 insertions, 10 deletions
diff --git a/accessx-status/Makefile.am b/accessx-status/Makefile.am
index f71ab438..013ff92b 100644
--- a/accessx-status/Makefile.am
+++ b/accessx-status/Makefile.am
@@ -1,3 +1,5 @@
+NULL =
+
SUBDIRS = docs pixmaps
AM_CPPFLAGS = \
@@ -5,10 +7,13 @@ AM_CPPFLAGS = \
$(MATE_APPLETS4_CFLAGS) \
$(GIO_CFLAGS) \
-DACCESSX_PIXMAPS_DIR=\""$(datadir)/pixmaps/mate-accessx-status-applet"\" \
- -DACCESSX_MENU_UI_DIR=\""$(uidir)"\"
+ -DACCESSX_RESOURCE_PATH=\""/org/mate/mate-applets/accessx-status/"\" \
+ $(NULL)
libexec_PROGRAMS = accessx-status-applet
+BUILT_SOURCES = accessx-status-resources.c accessx-status-resources.h
+nodist_accessx_status_applet_SOURCES = $(BUILT_SOURCES)
accessx_status_applet_SOURCES = \
applet.c \
applet.h
@@ -18,6 +23,12 @@ accessx_status_applet_LDADD = \
$(GIO_LIBS) \
$(X_LIBS)
+accessx-status-resources.c: accessx-status-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/accessx-status-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) [email protected] --sourcedir=$(srcdir) --generate --c-name accessx $<
+
+accessx-status-resources.h: accessx-status-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/accessx-status-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) [email protected] --sourcedir=$(srcdir) --generate --c-name accessx $<
+
appletdir = $(datadir)/mate-panel/applets
applet_in_files = org.mate.applets.AccessxStatusApplet.mate-panel-applet.desktop.in
applet_DATA = $(applet_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet)
@@ -40,15 +51,20 @@ org.mate.panel.applet.AccessxStatusAppletFactory.service: $(service_in_files)
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
-uidir = $(datadir)/mate/ui
-ui_DATA = accessx-status-applet-menu.xml
-
-CLEANFILES = $(applet_DATA) $(applet_in_files) $(service_DATA) $(ACCESSX_STATUS_APPLET_CLEANFILES)
+CLEANFILES = \
+ $(applet_DATA) \
+ $(applet_in_files) \
+ $(service_DATA) \
+ $(ACCESSX_STATUS_APPLET_CLEANFILES) \
+ $(BUILT_SOURCES) \
+ $(NULL)
EXTRA_DIST = \
+ accessx-status-applet-menu.xml \
+ accessx-status-resources.gresource.xml \
$(applet_in_files).in \
$(service_in_files) \
- $(ui_DATA)
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/accessx-status/accessx-status-resources.gresource.xml b/accessx-status/accessx-status-resources.gresource.xml
new file mode 100644
index 00000000..7d7d902f
--- /dev/null
+++ b/accessx-status/accessx-status-resources.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/accessx-status">
+ <file compressed="true">accessx-status-applet-menu.xml</file>
+ </gresource>
+</gresources>
diff --git a/accessx-status/applet.c b/accessx-status/applet.c
index f38456fb..59256b3e 100644
--- a/accessx-status/applet.c
+++ b/accessx-status/applet.c
@@ -1342,7 +1342,6 @@ static gboolean accessx_status_applet_fill(MatePanelApplet* applet)
AccessxStatusApplet* sapplet;
AtkObject* atk_object;
GtkActionGroup* action_group;
- gchar* ui_path;
gboolean was_realized = FALSE;
sapplet = create_applet(applet);
@@ -1369,9 +1368,9 @@ static gboolean accessx_status_applet_fill(MatePanelApplet* applet)
action_group = gtk_action_group_new("Accessx Applet Actions");
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
gtk_action_group_add_actions(action_group, accessx_status_applet_menu_actions, G_N_ELEMENTS(accessx_status_applet_menu_actions), sapplet);
- ui_path = g_build_filename(ACCESSX_MENU_UI_DIR, "accessx-status-applet-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file(sapplet->applet, ui_path, action_group);
- g_free(ui_path);
+ mate_panel_applet_setup_menu_from_resource (sapplet->applet,
+ ACCESSX_RESOURCE_PATH "accessx-status-applet-menu.xml",
+ action_group);
if (mate_panel_applet_get_locked_down(sapplet->applet))
{