Skip to content

Commit 9ee6deb

Browse files
author
raveit65
committed
na-tray: Convert to GResource
1 parent ff613c4 commit 9ee6deb

File tree

4 files changed

+29
-9
lines changed

4 files changed

+29
-9
lines changed

applets/notification_area/Makefile.am

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ AM_CPPFLAGS = \
1414
-I$(top_builddir)/libmate-panel-applet \
1515
-DMATELOCALEDIR=\""$(datadir)/locale"\" \
1616
-DG_LOG_DOMAIN=\""notification-area-applet"\" \
17-
-DNOTIFICATION_AREA_MENU_UI_DIR=\""$(uidir)"\" \
1817
-DPROVIDE_WATCHER_SERVICE=1 \
1918
$(DISABLE_DEPRECATED_CFLAGS)
2019

@@ -33,7 +32,10 @@ libtray_la_LIBADD = \
3332
status-notifier/libstatus-notifier.la \
3433
system-tray/libsystem-tray.la
3534

36-
NOTIFICATION_AREA_SOURCES = main.c main.h
35+
NOTIFICATION_AREA_SOURCES = \
36+
main.c \
37+
main.h \
38+
$(BUILT_SOURCES)
3739

3840
NOTIFICATION_AREA_LDADD = \
3941
../../libmate-panel-applet/libmate-panel-applet-4.la \
@@ -91,12 +93,23 @@ org.mate.panel.applet.NotificationAreaAppletFactory.service: $(service_in_files)
9193
$< > $@
9294
endif
9395

94-
uidir = $(datadir)/mate-panel/ui
95-
ui_DATA = notification-area-menu.xml
96+
ui_FILES = \
97+
notification-area-menu.xml
98+
99+
na-resources.c: na.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/na.gresource.xml)
100+
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name na $<
101+
102+
na-resources.h: na.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/na.gresource.xml)
103+
$(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name na $<
104+
105+
BUILT_SOURCES = \
106+
na-resources.c \
107+
na-resources.h
96108

97109
EXTRA_DIST = \
98110
org.mate.panel.NotificationAreaApplet.mate-panel-applet.in.in \
99-
$(ui_DATA) \
111+
$(ui_FILES) \
112+
na.gresource.xml \
100113
$(service_in_files)
101114

102115
CLEANFILES = \

applets/notification_area/main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,12 @@ na_tray_applet_realize (GtkWidget *widget)
196196
parent_class_realize (widget);
197197

198198
GtkActionGroup* action_group;
199-
gchar* ui_path;
200199
action_group = gtk_action_group_new("NA Applet Menu Actions");
201200
gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE);
202201
gtk_action_group_add_actions(action_group, menu_actions, G_N_ELEMENTS(menu_actions), applet);
203-
ui_path = g_build_filename(NOTIFICATION_AREA_MENU_UI_DIR, "notification-area-menu.xml", NULL);
204-
mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(applet), ui_path, action_group);
205-
g_free(ui_path);
202+
mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet),
203+
NA_RESOURCE_PATH "notification-area-menu.xml",
204+
action_group);
206205
g_object_unref(action_group);
207206
}
208207

applets/notification_area/main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
#include <mate-panel-applet.h>
2626

27+
#define NA_RESOURCE_PATH "/org/mate/panel/applet/na/"
28+
2729
G_BEGIN_DECLS
2830

2931
#define NA_TYPE_TRAY_APPLET (na_tray_applet_get_type ())
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<gresources>
3+
<gresource prefix="/org/mate/panel/applet/na">
4+
<file compressed="true">notification-area-menu.xml</file>
5+
</gresource>
6+
</gresources>

0 commit comments

Comments
 (0)