[anjuta] anjuta: Only show app-menu if supported by environment
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] anjuta: Only show app-menu if supported by environment
- Date: Tue, 9 Jul 2013 20:45:23 +0000 (UTC)
commit 18426b5259cfbeed39238bd8c5569f6d3bb14772
Author: Johannes Schmid <jhs gnome org>
Date: Tue Jul 9 22:45:01 2013 +0200
anjuta: Only show app-menu if supported by environment
src/anjuta-application.c | 53 ++++++++++++++++++++++++++-------------------
1 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/src/anjuta-application.c b/src/anjuta-application.c
index 33b7f05..fee5b71 100644
--- a/src/anjuta-application.c
+++ b/src/anjuta-application.c
@@ -564,7 +564,10 @@ anjuta_application_startup (GApplication* application)
AnjutaApplication *app = ANJUTA_APPLICATION (application);
GtkBuilder *builder;
GError *error = NULL;
-
+ GtkSettings* settings = gtk_settings_get_default ();
+ gboolean has_app_menu;
+
+
#ifdef ENABLE_NLS
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
@@ -573,30 +576,36 @@ anjuta_application_startup (GApplication* application)
#endif
G_APPLICATION_CLASS (anjuta_application_parent_class)->startup (application);
-
- g_action_map_add_action_entries (G_ACTION_MAP (app),
- app_entries,
- G_N_ELEMENTS (app_entries),
- app);
-
- builder = gtk_builder_new ();
- if (!gtk_builder_add_from_file (builder,
- ANJUTA_MENU_UI_FILE,
- &error))
- {
- g_warning ("loading menu builder file: %s", error->message);
- g_error_free (error);
- }
- else
+
+ g_object_get (G_OBJECT (settings),
+ "gtk-shell-shows-app-menu", &has_app_menu,
+ NULL);
+ if (has_app_menu)
{
- GMenuModel *app_menu;
+ g_action_map_add_action_entries (G_ACTION_MAP (app),
+ app_entries,
+ G_N_ELEMENTS (app_entries),
+ app);
+
+ builder = gtk_builder_new ();
+ if (!gtk_builder_add_from_file (builder,
+ ANJUTA_MENU_UI_FILE,
+ &error))
+ {
+ g_warning ("loading menu builder file: %s", error->message);
+ g_error_free (error);
+ }
+ else
+ {
+ GMenuModel *app_menu;
- app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
- gtk_application_set_app_menu (GTK_APPLICATION (application),
- app_menu);
- }
+ app_menu = G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"));
+ gtk_application_set_app_menu (GTK_APPLICATION (application),
+ app_menu);
+ }
- g_object_unref (builder);
+ g_object_unref (builder);
+ }
}
/* GObject implementation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]