summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--applets/fish/Makefile.am28
-rw-r--r--applets/fish/fish.c18
-rw-r--r--applets/fish/fish.gresource.xml7
3 files changed, 30 insertions, 23 deletions
diff --git a/applets/fish/Makefile.am b/applets/fish/Makefile.am
index 7f63cf5f..e43cb57f 100644
--- a/applets/fish/Makefile.am
+++ b/applets/fish/Makefile.am
@@ -6,13 +6,13 @@ AM_CPPFLAGS = \
-I$(top_builddir)/libmate-panel-applet \
-DMATELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-DFISH_ICONDIR=\""$(fishbitmapsdir)"\" \
- -DFISH_BUILDERDIR=\""$(uidir)"\" \
- -DFISH_MENU_UI_DIR=\""$(xmluidir)"\" \
$(DISABLE_DEPRECATED_CFLAGS)
AM_CFLAGS = $(WARN_CFLAGS)
-FISH_SOURCES = fish.c
+FISH_SOURCES = \
+ fish.c \
+ $(BUILT_SOURCES)
FISH_LDADD = \
../../libmate-panel-applet/libmate-panel-applet-4.la \
@@ -71,11 +71,19 @@ fishbitmaps_DATA = \
footguy.png \
monkey.png
-uidir = $(datadir)/mate-panel/ui
-ui_DATA = fish.ui
+ui_FILES = \
+ fish.ui \
+ fish-menu.xml
-xmluidir = $(datadir)/mate-panel/ui
-xmlui_DATA = fish-menu.xml
+fish-resources.c: fish.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/fish.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name fish $<
+
+fish-resources.h: fish.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/fish.gresource.xml)
+ $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name fish $<
+
+BUILT_SOURCES = \
+ fish-resources.c \
+ fish-resources.h
fish_gschemas_in = org.mate.panel.applet.fish.gschema.xml.in
gsettings_SCHEMAS = $(fish_gschemas_in:.xml.in=.xml)
@@ -87,10 +95,10 @@ EXTRA_DIST = \
$(fishbitmaps_DATA) \
org.mate.panel.FishApplet.mate-panel-applet.in.in \
$(service_in_files) \
- $(ui_DATA) \
- $(xmlui_DATA) \
+ $(ui_FILES) \
+ fish.gresource.xml \
$(fish_gschemas_in)
-CLEANFILES = $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS)
+CLEANFILES = $(BUILT_SOURCES) $(applet_DATA) $(applet_DATA).in $(service_DATA) $(gsettings_SCHEMAS)
-include $(top_srcdir)/git.mk
diff --git a/applets/fish/fish.c b/applets/fish/fish.c
index c8dfd259..c502e3c1 100644
--- a/applets/fish/fish.c
+++ b/applets/fish/fish.c
@@ -50,6 +50,7 @@
(G_TYPE_CHECK_INSTANCE_TYPE((o), FISH_TYPE_APPLET))
#define FISH_ICON "mate-panel-fish"
+#define FISH_RESOURCE_PATH "/org/mate/panel/applet/fish/"
#define FISH_SCHEMA "org.mate.panel.applet.fish"
#define FISH_NAME_KEY "name"
@@ -378,7 +379,6 @@ static void chooser_preview_update(GtkFileChooser* file_chooser, gpointer data)
static void display_preferences_dialog(GtkAction* action, FishApplet* fish)
{
GtkBuilder *builder;
- GError *error;
GtkWidget *button;
GtkFileFilter *filter;
GtkWidget *chooser_preview;
@@ -393,14 +393,7 @@ static void display_preferences_dialog(GtkAction* action, FishApplet* fish)
builder = gtk_builder_new ();
gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
-
- error = NULL;
- gtk_builder_add_from_file (builder, FISH_BUILDERDIR "/fish.ui", &error);
- if (error) {
- g_warning ("Error loading preferences: %s", error->message);
- g_error_free (error);
- return;
- }
+ gtk_builder_add_from_resource (builder, FISH_RESOURCE_PATH "fish.ui", NULL);
fish->preferences_dialog = GTK_WIDGET (gtk_builder_get_object (builder, "fish_preferences_dialog"));
@@ -1716,7 +1709,6 @@ static gboolean fish_applet_fill(FishApplet* fish)
{
MatePanelApplet* applet = (MatePanelApplet*) fish;
GtkActionGroup* action_group;
- gchar* ui_path;
fish->orientation = mate_panel_applet_get_orient (applet);
@@ -1751,9 +1743,9 @@ static gboolean fish_applet_fill(FishApplet* fish)
fish_menu_verbs,
G_N_ELEMENTS (fish_menu_verbs),
fish);
- ui_path = g_build_filename (FISH_MENU_UI_DIR, "fish-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,
+ FISH_RESOURCE_PATH "fish-menu.xml",
+ action_group);
if (mate_panel_applet_get_locked_down (applet)) {
GtkAction *action;
diff --git a/applets/fish/fish.gresource.xml b/applets/fish/fish.gresource.xml
new file mode 100644
index 00000000..15aa9082
--- /dev/null
+++ b/applets/fish/fish.gresource.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/mate/panel/applet/fish">
+ <file compressed="true">fish.ui</file>
+ <file compressed="true">fish-menu.xml</file>
+ </gresource>
+</gresources>