[gthumb] show the app menu on the headerbar if the shell doesn't show it
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] show the app menu on the headerbar if the shell doesn't show it
- Date: Sun, 29 Mar 2015 17:34:26 +0000 (UTC)
commit 67ccaa344ad46536e0bbffa03acdf305d83ac904
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Mar 29 16:49:59 2015 +0200
show the app menu on the headerbar if the shell doesn't show it
gthumb/gth-window.c | 25 +++++++++++++++++++++++++
gthumb/main.c | 6 ------
2 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/gthumb/gth-window.c b/gthumb/gth-window.c
index b4ade2f..ac059c9 100644
--- a/gthumb/gth-window.c
+++ b/gthumb/gth-window.c
@@ -115,6 +115,31 @@ _gth_window_add_header_bar (GthWindow *self)
self->priv->headerbar = gtk_header_bar_new ();
gtk_widget_show (self->priv->headerbar);
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (self->priv->headerbar), TRUE);
+
+ {
+ gboolean shell_shows_app_menu;
+ char *decoration_layout;
+
+ g_object_get (gtk_settings_get_default (),
+ "gtk-shell-shows-app-menu", &shell_shows_app_menu,
+ "gtk-decoration-layout", &decoration_layout,
+ NULL);
+ if (! shell_shows_app_menu && ((decoration_layout == NULL) || (strstr (decoration_layout,
"menu") == NULL))) {
+ gboolean left_part_is_empty;
+ char *new_layout;
+
+ /* add 'menu' to the left */
+
+ left_part_is_empty = (decoration_layout == NULL) || (decoration_layout[0] == '\0') ||
(decoration_layout[0] == ':');
+ new_layout = g_strconcat ("menu", (left_part_is_empty ? "" : ","), decoration_layout,
NULL);
+ gtk_header_bar_set_decoration_layout (GTK_HEADER_BAR (self->priv->headerbar),
new_layout);
+
+ g_free (new_layout);
+ }
+
+ g_free (decoration_layout);
+ }
+
self->priv->title = gth_window_title_new ();
gtk_widget_show (self->priv->title);
gtk_header_bar_set_custom_title (GTK_HEADER_BAR (self->priv->headerbar), self->priv->title);
diff --git a/gthumb/main.c b/gthumb/main.c
index 38e49e3..21098f5 100644
--- a/gthumb/main.c
+++ b/gthumb/main.c
@@ -221,12 +221,6 @@ _gth_application_initialize_app_menu (GApplication *application)
gboolean show_app_menu;
GtkBuilder *builder;
- g_object_get (gtk_settings_get_default (),
- "gtk-shell-shows-app-menu", &show_app_menu,
- NULL);
- if (! show_app_menu)
- return;
-
g_action_map_add_action_entries (G_ACTION_MAP (application),
app_menu_entries,
G_N_ELEMENTS (app_menu_entries),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]