From fb3abe3bc1cf858638867a2b92c53c5caf8e060f Mon Sep 17 00:00:00 2001 From: raveit65 Date: Sun, 22 Apr 2018 17:18:54 +0200 Subject: na-tray: Convert to GResource --- applets/notification_area/Makefile.am | 23 ++++++++++++++++++----- applets/notification_area/main.c | 7 +++---- applets/notification_area/main.h | 2 ++ applets/notification_area/na.gresource.xml | 6 ++++++ 4 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 applets/notification_area/na.gresource.xml (limited to 'applets') diff --git a/applets/notification_area/Makefile.am b/applets/notification_area/Makefile.am index 4e7272e5..083b4524 100644 --- a/applets/notification_area/Makefile.am +++ b/applets/notification_area/Makefile.am @@ -14,7 +14,6 @@ AM_CPPFLAGS = \ -I$(top_builddir)/libmate-panel-applet \ -DMATELOCALEDIR=\""$(datadir)/locale"\" \ -DG_LOG_DOMAIN=\""notification-area-applet"\" \ - -DNOTIFICATION_AREA_MENU_UI_DIR=\""$(uidir)"\" \ -DPROVIDE_WATCHER_SERVICE=1 \ $(DISABLE_DEPRECATED_CFLAGS) @@ -33,7 +32,10 @@ libtray_la_LIBADD = \ status-notifier/libstatus-notifier.la \ system-tray/libsystem-tray.la -NOTIFICATION_AREA_SOURCES = main.c main.h +NOTIFICATION_AREA_SOURCES = \ + main.c \ + main.h \ + $(BUILT_SOURCES) NOTIFICATION_AREA_LDADD = \ ../../libmate-panel-applet/libmate-panel-applet-4.la \ @@ -91,12 +93,23 @@ org.mate.panel.applet.NotificationAreaAppletFactory.service: $(service_in_files) $< > $@ endif -uidir = $(datadir)/mate-panel/ui -ui_DATA = notification-area-menu.xml +ui_FILES = \ + notification-area-menu.xml + +na-resources.c: na.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/na.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name na $< + +na-resources.h: na.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/na.gresource.xml) + $(AM_V_GEN)$(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate --c-name na $< + +BUILT_SOURCES = \ + na-resources.c \ + na-resources.h EXTRA_DIST = \ org.mate.panel.NotificationAreaApplet.mate-panel-applet.in.in \ - $(ui_DATA) \ + $(ui_FILES) \ + na.gresource.xml \ $(service_in_files) CLEANFILES = \ diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index 069a74b3..f656d029 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -196,13 +196,12 @@ na_tray_applet_realize (GtkWidget *widget) parent_class_realize (widget); GtkActionGroup* action_group; - gchar* ui_path; action_group = gtk_action_group_new("NA Applet Menu Actions"); gtk_action_group_set_translation_domain(action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions(action_group, menu_actions, G_N_ELEMENTS(menu_actions), applet); - ui_path = g_build_filename(NOTIFICATION_AREA_MENU_UI_DIR, "notification-area-menu.xml", NULL); - mate_panel_applet_setup_menu_from_file(MATE_PANEL_APPLET(applet), ui_path, action_group); - g_free(ui_path); + mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet), + NA_RESOURCE_PATH "notification-area-menu.xml", + action_group); g_object_unref(action_group); } diff --git a/applets/notification_area/main.h b/applets/notification_area/main.h index 9c0ad87b..3b8f11f1 100644 --- a/applets/notification_area/main.h +++ b/applets/notification_area/main.h @@ -24,6 +24,8 @@ #include +#define NA_RESOURCE_PATH "/org/mate/panel/applet/na/" + G_BEGIN_DECLS #define NA_TYPE_TRAY_APPLET (na_tray_applet_get_type ()) diff --git a/applets/notification_area/na.gresource.xml b/applets/notification_area/na.gresource.xml new file mode 100644 index 00000000..1b20172a --- /dev/null +++ b/applets/notification_area/na.gresource.xml @@ -0,0 +1,6 @@ + + + + notification-area-menu.xml + + -- cgit v1.2.1