From 812f5f92e4554782e5cb584dcba392c1e1175cc9 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 20 Jul 2020 16:36:44 +0200 Subject: geyes: Load menu from resources --- geyes/Makefile.am | 7 ++----- geyes/geyes-resources.gresource.xml | 1 + geyes/geyes.c | 22 +++++++++++----------- geyes/themes.c | 2 +- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/geyes/Makefile.am b/geyes/Makefile.am index 514eee30..466e7ea7 100644 --- a/geyes/Makefile.am +++ b/geyes/Makefile.am @@ -8,7 +8,7 @@ AM_CPPFLAGS = \ $(MATE_APPLETS4_CFLAGS) \ -I$(includedir) \ -DGEYES_THEMES_DIR=\""$(pkgdatadir)/geyes/"\" \ - -DGEYES_MENU_UI_DIR=\""$(uidir)"\" \ + -DGEYES_RESOURCE_PATH=\""/org/mate/mate-applets/eyes/"\" \ ${WARN_CFLAGS} libexec_PROGRAMS = mate-geyes-applet @@ -53,9 +53,6 @@ org.mate.panel.applet.GeyesAppletFactory.service: $(service_in_files) -e "s|\@LIBEXECDIR\@|$(libexecdir)|" \ $< > $@ -uidir = $(datadir)/mate/ui -ui_DATA = geyes-applet-menu.xml - geyes_gschema_in_files = org.mate.panel.applet.geyes.gschema.xml.in gsettings_SCHEMAS = $(geyes_gschema_in_files:.xml.in=.xml) @GSETTINGS_RULES@ @@ -81,13 +78,13 @@ CLEANFILES = \ $(NULL) EXTRA_DIST = \ + geyes-applet-menu.xml \ geyes-resources.gresource.xml \ themes.ui \ README.themes \ $(applet_in_files).in \ $(service_in_files) \ $(geyes_gschema_in_files) \ - $(ui_DATA) \ $(icons) \ $(NULL) diff --git a/geyes/geyes-resources.gresource.xml b/geyes/geyes-resources.gresource.xml index 35ba69aa..4a7dc547 100644 --- a/geyes/geyes-resources.gresource.xml +++ b/geyes/geyes-resources.gresource.xml @@ -1,6 +1,7 @@ + geyes-applet-menu.xml themes.ui diff --git a/geyes/geyes.c b/geyes/geyes.c index 035d7275..4adf7e87 100644 --- a/geyes/geyes.c +++ b/geyes/geyes.c @@ -6,7 +6,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -384,14 +384,13 @@ geyes_applet_fill (MatePanelApplet *applet) { EyesApplet *eyes_applet; GtkActionGroup *action_group; - gchar *ui_path; g_set_application_name (_("Eyes")); - + gtk_window_set_default_icon_name ("mate-eyes-applet"); mate_panel_applet_set_flags (applet, MATE_PANEL_APPLET_EXPAND_MINOR); mate_panel_applet_set_background_widget (applet, GTK_WIDGET (applet)); - + eyes_applet = create_eyes (applet); eyes_applet->timeout_id = g_timeout_add ( @@ -399,14 +398,15 @@ geyes_applet_fill (MatePanelApplet *applet) action_group = gtk_action_group_new ("Geyes Applet Actions"); gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); + gtk_action_group_add_actions (action_group, - geyes_applet_menu_actions, - G_N_ELEMENTS (geyes_applet_menu_actions), - eyes_applet); - ui_path = g_build_filename (GEYES_MENU_UI_DIR, "geyes-applet-menu.xml", NULL); - mate_panel_applet_setup_menu_from_file (eyes_applet->applet, - ui_path, action_group); - g_free (ui_path); + geyes_applet_menu_actions, + G_N_ELEMENTS (geyes_applet_menu_actions), + eyes_applet); + + mate_panel_applet_setup_menu_from_resource (eyes_applet->applet, + GEYES_RESOURCE_PATH "geyes-applet-menu.xml", + action_group); if (mate_panel_applet_get_locked_down (eyes_applet->applet)) { GtkAction *action; diff --git a/geyes/themes.c b/geyes/themes.c index 8a3dee59..6eed8cc9 100644 --- a/geyes/themes.c +++ b/geyes/themes.c @@ -274,7 +274,7 @@ properties_cb (GtkAction *action, return; } - builder = gtk_builder_new_from_resource ("/org/mate/mate-applets/eyes/themes.ui"); + builder = gtk_builder_new_from_resource (GEYES_RESOURCE_PATH "themes.ui"); eyes_applet->prop_box.pbox = GET_WIDGET ("preferences_dialog"); tree = GET_WIDGET ("themes_treeview"); -- cgit v1.2.1