From e095fd2471fb9b41c264e502473fea19a445b938 Mon Sep 17 00:00:00 2001 From: rbuj Date: Wed, 29 Jul 2020 12:57:44 +0200 Subject: netspeed: Load netspeed-menu.xml from resources --- netspeed/data/Makefile.am | 5 +---- netspeed/data/netspeed-resources.gresource.xml | 1 + netspeed/src/Makefile.am | 2 +- netspeed/src/netspeed.c | 15 ++++++++------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/netspeed/data/Makefile.am b/netspeed/data/Makefile.am index 54cd6597..350217f2 100644 --- a/netspeed/data/Makefile.am +++ b/netspeed/data/Makefile.am @@ -14,9 +14,6 @@ $(applet_in_files): $(applet_in_files).in Makefile $(applet_DATA): $(applet_in_files) Makefile $(AM_V_GEN) $(MSGFMT) --desktop --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ -xmluidir = $(datadir)/mate/ui -xmlui_DATA = netspeed-menu.xml - servicedir = $(datadir)/dbus-1/services service_in_files = org.mate.panel.applet.NetspeedAppletFactory.service.in service_DATA = $(service_in_files:.service.in=.service) @@ -32,10 +29,10 @@ gsettings_SCHEMAS = $(netspeed_gschema_in_files:.xml.in=.xml) EXTRA_DIST = \ $(applet_in_files).in \ - $(xmlui_DATA) \ $(service_in_files) \ $(netspeed_gschema_in_files) \ netspeed-details.ui \ + netspeed-menu.xml \ netspeed-preferences.ui \ netspeed-resources.gresource.xml \ $(NULL) diff --git a/netspeed/data/netspeed-resources.gresource.xml b/netspeed/data/netspeed-resources.gresource.xml index d083d9c7..a486d54c 100644 --- a/netspeed/data/netspeed-resources.gresource.xml +++ b/netspeed/data/netspeed-resources.gresource.xml @@ -2,6 +2,7 @@ netspeed-details.ui + netspeed-menu.xml netspeed-preferences.ui diff --git a/netspeed/src/Makefile.am b/netspeed/src/Makefile.am index dae9df37..404076ee 100644 --- a/netspeed/src/Makefile.am +++ b/netspeed/src/Makefile.am @@ -6,7 +6,7 @@ AM_CPPFLAGS = \ $(GIO_CFLAGS) \ $(GTOP_APPLETS_CFLAGS) \ $(MATE_APPLETS4_CFLAGS) \ - -DNETSPEED_MENU_UI_DIR=\""$(datadir)/mate/ui"\" \ + -DNETSPEED_RESOURCE_PATH=\""/org/mate/mate-applets/netspeed/"\" \ ${WARN_CFLAGS} if HAVE_NL diff --git a/netspeed/src/netspeed.c b/netspeed/src/netspeed.c index adb218cd..0fdcc3c0 100644 --- a/netspeed/src/netspeed.c +++ b/netspeed/src/netspeed.c @@ -1158,7 +1158,7 @@ settings_cb (GtkAction *action, return; } - builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/netspeed/netspeed-preferences.ui"); + builder = gtk_builder_new_from_resource (NETSPEED_RESOURCE_PATH "netspeed-preferences.ui"); applet->settings = GET_DIALOG ("preferences_dialog"); applet->network_device_combo = GET_WIDGET ("network_device_combo"); @@ -1297,7 +1297,7 @@ showinfo_cb (GtkAction *action, return; } - builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/netspeed/netspeed-details.ui"); + builder = gtk_builder_new_from_resource (NETSPEED_RESOURCE_PATH "netspeed-details.ui"); applet->details = GET_DIALOG ("dialog"); applet->drawingarea = GET_DRAWING_AREA ("drawingarea"); @@ -1550,6 +1550,7 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g MateNetspeedApplet *applet; int i; GtkWidget *spacer, *spacer_box; + GtkActionGroup *action_group; /* Have our background automatically painted. */ mate_panel_applet_set_background_widget(MATE_PANEL_APPLET(applet_widget), @@ -1718,17 +1719,17 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g G_CALLBACK(mate_netspeed_enter_cb), (gpointer)applet); - GtkActionGroup *action_group; - gchar *ui_path; action_group = gtk_action_group_new ("Netspeed Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); gtk_action_group_add_actions (action_group, mate_netspeed_applet_menu_actions, G_N_ELEMENTS (mate_netspeed_applet_menu_actions), applet); - ui_path = g_build_filename (NETSPEED_MENU_UI_DIR, "netspeed-menu.xml", NULL); - mate_panel_applet_setup_menu_from_file (MATE_PANEL_APPLET (applet->applet), ui_path, action_group); - g_free (ui_path); + + mate_panel_applet_setup_menu_from_resource (MATE_PANEL_APPLET (applet->applet), + NETSPEED_RESOURCE_PATH "netspeed-menu.xml", + action_group); + g_object_unref (action_group); return TRUE; -- cgit v1.2.1