summaryrefslogtreecommitdiff
path: root/drivemount
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-07-20 16:16:40 +0200
committerraveit65 <[email protected]>2020-08-30 11:02:14 +0200
commit38158f29de9a72124018848999abef27c68c2675 (patch)
tree470ef4b29d130e2ca3d8789b38ef4cddf5f67a26 /drivemount
parentb4bb016cbce9f02ee8fe0436c53f28a1ba4b0d4a (diff)
downloadmate-applets-38158f29de9a72124018848999abef27c68c2675.tar.bz2
mate-applets-38158f29de9a72124018848999abef27c68c2675.tar.xz
drivemount: Load menu from resources
Diffstat (limited to 'drivemount')
-rw-r--r--drivemount/Makefile.am68
-rw-r--r--drivemount/drivemount-resources.gresource.xml6
-rw-r--r--drivemount/drivemount.c7
3 files changed, 55 insertions, 26 deletions
diff --git a/drivemount/Makefile.am b/drivemount/Makefile.am
index a33779bd..16088a47 100644
--- a/drivemount/Makefile.am
+++ b/drivemount/Makefile.am
@@ -1,38 +1,47 @@
+NULL =
+
SUBDIRS = help
-AM_CPPFLAGS = \
- -I. \
- -I$(srcdir) \
- -DDRIVEMOUNT_MENU_UI_DIR=\""$(uidir)"\" \
- ${WARN_CFLAGS} \
- $(MATE_APPLETS4_CFLAGS)
+AM_CPPFLAGS = \
+ -I. \
+ -I$(srcdir) \
+ -DDRIVEMOUNT_RESOURCE_PATH=\""/org/mate/mate-applets/drivemount/"\" \
+ ${WARN_CFLAGS} \
+ $(MATE_APPLETS4_CFLAGS) \
+ $(NULL)
libexec_PROGRAMS = mate-drivemount-applet
+BUILT_SOURCES = \
+ drivemount-resources.c \
+ drivemount-resources.h \
+ $(NULL)
+
+nodist_mate_drivemount_applet_SOURCES = \
+ $(BUILT_SOURCES) \
+ $(NULL)
+
mate_drivemount_applet_SOURCES = \
- drivemount.c \
- drive-list.c \
- drive-list.h \
- drive-button.c \
- drive-button.h
+ drivemount.c \
+ drive-list.c \
+ drive-list.h \
+ drive-button.c \
+ drive-button.h \
+ $(NULL)
-mate_drivemount_applet_LDADD = \
+mate_drivemount_applet_LDADD = \
$(MATE_APPLETS4_LIBS)
-uidir = $(datadir)/mate/ui
-ui_DATA = drivemount-applet-menu.xml
+drivemount-resources.c: drivemount-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/drivemount-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name drivemount $<
+
+drivemount-resources.h: drivemount-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/drivemount-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name drivemount $<
drivemount_gschema_in_files = org.mate.drivemount.gschema.xml.in
gsettings_SCHEMAS = $(drivemount_gschema_in_files:.xml.in=.xml)
@GSETTINGS_RULES@
-EXTRA_DIST = \
- $(applet_in_files).in \
- $(service_in_files) \
- $(drivemount_gschema_in_files) \
- $(ui_DATA)
-
-
appletdir = $(datadir)/mate-panel/applets
applet_in_files = org.mate.applets.DriveMountApplet.mate-panel-applet.desktop.in
applet_DATA = $(applet_in_files:.mate-panel-applet.desktop.in=.mate-panel-applet)
@@ -55,6 +64,21 @@ org.mate.panel.applet.DriveMountAppletFactory.service: $(service_in_files)
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
-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) \
+ $(drivemount_gschema_in_files) \
+ drivemount-applet-menu.xml \
+ drivemount-resources.gresource.xml \
+ $(NULL)
-include $(top_srcdir)/git.mk
diff --git a/drivemount/drivemount-resources.gresource.xml b/drivemount/drivemount-resources.gresource.xml
new file mode 100644
index 00000000..3a8c57a8
--- /dev/null
+++ b/drivemount/drivemount-resources.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/drivemount">
+ <file compressed="true">drivemount-applet-menu.xml</file>
+ </gresource>
+</gresources>
diff --git a/drivemount/drivemount.c b/drivemount/drivemount.c
index 84d6f77f..450bce32 100644
--- a/drivemount/drivemount.c
+++ b/drivemount/drivemount.c
@@ -179,7 +179,6 @@ applet_factory (MatePanelApplet *applet,
GtkWidget *drive_list;
AtkObject *ao;
GtkActionGroup *action_group;
- gchar *ui_path;
if (!strcmp (iid, drivemount_iid)) {
g_set_application_name (_("Disk Mounter"));
@@ -211,9 +210,9 @@ applet_factory (MatePanelApplet *applet,
applet_menu_actions,
G_N_ELEMENTS (applet_menu_actions),
drive_list);
- ui_path = g_build_filename (DRIVEMOUNT_MENU_UI_DIR, "drivemount-applet-menu.xml", NULL);
- mate_panel_applet_setup_menu_from_file (applet, ui_path, action_group);
- g_free (ui_path);
+ mate_panel_applet_setup_menu_from_resource (applet,
+ DRIVEMOUNT_RESOURCE_PATH "drivemount-applet-menu.xml",
+ action_group);
g_object_unref (action_group);
ao = gtk_widget_get_accessible (GTK_WIDGET (applet));