summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-12-02 12:27:00 +0100
committerraveit65 <[email protected]>2020-12-10 12:43:18 +0100
commited6f8343524607cd288ababeb9295541e717aa41 (patch)
treec4108037dddee2679302bb130f5323ee56c553b7
parent4cb6f915b1a91497df1b13cdab887df1bdaed101 (diff)
downloadmate-applets-ed6f8343524607cd288ababeb9295541e717aa41.tar.bz2
mate-applets-ed6f8343524607cd288ababeb9295541e717aa41.tar.xz
trashapplet: load menu and ui files from resource bundle
-rw-r--r--configure.ac5
-rw-r--r--trashapplet/Makefile.am10
-rw-r--r--trashapplet/src/Makefile.am16
-rw-r--r--trashapplet/src/trash-empty.c5
-rw-r--r--trashapplet/src/trashapplet.c7
-rw-r--r--trashapplet/trashapplet-resources.gresource.xml7
6 files changed, 29 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac
index 4985b96a..f93f81f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -530,12 +530,9 @@ pixmapsdir="${datadir}/pixmaps"
AC_SUBST(pixmapsdir)
pkgdatadir="${datadir}/mate-applets"
AC_SUBST(pkgdatadir)
-builderdir="${pkgdatadir}/builder"
-AC_SUBST(builderdir)
AC_DEFINE_DIR(MATE_PIXMAPSDIR, "${pixmapsdir}", [Mate Pixmaps Directory])
AC_DEFINE_DIR(PKGDATADIR, "${pkgdatadir}", [Mate Applets Directory])
-AC_DEFINE_DIR(GTK_BUILDERDIR, "${builderdir}", [GtkBuilder Resources Directory])
AC_DEFINE_DIR(DATADIR, "${datadir}", [datadir])
AC_DEFINE_DIR(PKG_DATA_DIR, "${pkgdatadir}", [pkgdatadir])
AC_DEFINE_DIR(SYSCONFDIR, "${sysconfdir}", [sysconfdir])
@@ -543,14 +540,12 @@ AC_DEFINE_DIR(LIBDIR, "${libdir}", [libdir])
AC_DEFINE_DIR(PREFIX, "$prefix", [install prefix])
AS_AC_EXPAND(DATADIR, "${datadir}")
-AS_AC_EXPAND(BUILDERDIR, $builderdir)
AC_SUBST(VERSION)
AC_SUBST(PACKAGE)
AC_SUBST(DATADIR)
AC_SUBST(LIBDIR)
AC_SUBST(PKGDATADIR)
-AC_SUBST(BUILDERDIR)
dnl ***************************************************************************
dnl *** Output Makefiles et al ***
diff --git a/trashapplet/Makefile.am b/trashapplet/Makefile.am
index 7941dba2..26b85624 100644
--- a/trashapplet/Makefile.am
+++ b/trashapplet/Makefile.am
@@ -22,16 +22,12 @@ org.mate.panel.applet.TrashAppletFactory.service: $(service_in_files)
-e "s|\@LIBEXECDIR\@|$(libexecdir)|" \
$< > $@
-uidir = $(datadir)/mate/ui
-ui_DATA = trashapplet-menu.xml
-
-builder_DATA = trashapplet-empty-progress.ui
-
EXTRA_DIST = \
- $(ui_DATA) \
$(applet_in_files).in \
$(service_in_files) \
- $(builder_DATA)
+ trashapplet-empty-progress.ui \
+ trashapplet-menu.xml \
+ trashapplet-resources.gresource.xml
CLEANFILES = $(applet_DATA) $(applet_in_files) $(service_DATA)
diff --git a/trashapplet/src/Makefile.am b/trashapplet/src/Makefile.am
index 493c0cf5..194e44ad 100644
--- a/trashapplet/src/Makefile.am
+++ b/trashapplet/src/Makefile.am
@@ -1,11 +1,16 @@
AM_CPPFLAGS = -I$(top_srcdir) \
$(MATE_APPLETS4_CFLAGS) \
$(GIO_CFLAGS) \
- -DTRASH_MENU_UI_DIR=\""$(datadir)/mate/ui"\" \
+ -DGRESOURCE=\""/org/mate/mate-applets/trash/\"" \
${WARN_CFLAGS}
libexec_PROGRAMS = trashapplet
+BUILT_SOURCES = \
+ trashapplet-resources.c \
+ trashapplet-resources.h
+
+nodist_trashapplet_SOURCES = $(BUILT_SOURCES)
trashapplet_SOURCES = \
trashapplet.c \
trash-empty.h \
@@ -18,4 +23,13 @@ trashapplet_LDADD = \
$(GIO_LIBS) \
-lX11
+trashapplet-resources.c: ../trashapplet-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/../ --generate-dependencies $(srcdir)/../trashapplet-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/../ --generate --c-name trashapplet $<
+
+trashapplet-resources.h: ../trashapplet-resources.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir)/../ --generate-dependencies $(srcdir)/../trashapplet-resources.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)/../ --generate --c-name trashapplet $<
+
+CLEANFILES = \
+ $(BUILT_SOURCES)
+
-include $(top_srcdir)/git.mk
diff --git a/trashapplet/src/trash-empty.c b/trashapplet/src/trash-empty.c
index 567849cd..9ad61e5a 100644
--- a/trashapplet/src/trash-empty.c
+++ b/trashapplet/src/trash-empty.c
@@ -236,10 +236,7 @@ trash_empty_start (GtkWidget *parent)
GtkBuilder *builder;
gint i;
- builder = gtk_builder_new ();
- gtk_builder_add_from_file (builder,
- GTK_BUILDERDIR "/trashapplet-empty-progress.ui",
- NULL);
+ builder = gtk_builder_new_from_resource (GRESOURCE "trashapplet-empty-progress.ui");
for (i = 0; i < G_N_ELEMENTS (widgets); i++)
{
diff --git a/trashapplet/src/trashapplet.c b/trashapplet/src/trashapplet.c
index d3c419ce..c6a4d5ff 100644
--- a/trashapplet/src/trashapplet.c
+++ b/trashapplet/src/trashapplet.c
@@ -616,7 +616,6 @@ trash_applet_factory (MatePanelApplet *applet,
if (!strcmp (iid, "TrashApplet"))
{
GtkActionGroup *action_group;
- gchar *ui_path;
g_set_application_name (_("Trash Applet"));
@@ -629,9 +628,9 @@ trash_applet_factory (MatePanelApplet *applet,
trash_applet_menu_actions,
G_N_ELEMENTS (trash_applet_menu_actions),
applet);
- ui_path = g_build_filename (TRASH_MENU_UI_DIR, "trashapplet-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,
+ GRESOURCE "trashapplet-menu.xml",
+ action_group);
g_object_unref (action_group);
gtk_widget_show (GTK_WIDGET (applet));
diff --git a/trashapplet/trashapplet-resources.gresource.xml b/trashapplet/trashapplet-resources.gresource.xml
new file mode 100644
index 00000000..db287937
--- /dev/null
+++ b/trashapplet/trashapplet-resources.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/mate-applets/trash">
+ <file compressed="true">trashapplet-empty-progress.ui</file>
+ <file compressed="true">trashapplet-menu.xml</file>
+ </gresource>
+</gresources>