From de5e7a717554d12aff944608b018ae9d2bddd2c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Armin=20Krezovi=C4=87?= Date: Sat, 26 Aug 2017 22:43:57 +0200 Subject: [PATCH] Don't use gtk_settings callback to set shell_shows_app_menu GTK+ won't be initialized if X11 is not available Instead, when setting gtk-shell-shows-app-menu, meta_prefs_set_show_fallback_app_menu should be called as well. https://bugzilla.gnome.org/show_bug.cgi?id=759538 --- src/core/prefs.c | 43 +++++++++++++------------------------------ src/meta/prefs.h | 2 ++ 2 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/core/prefs.c b/src/core/prefs.c index bad54cbf2..2f96e5633 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -137,10 +137,6 @@ static void bindings_changed (GSettings *settings, gchar *key, gpointer data); -static void shell_shows_app_menu_changed (GtkSettings *settings, - GParamSpec *pspec, - gpointer data); - static void update_cursor_size_from_gtk (GtkSettings *settings, GParamSpec *pspec, gpointer data); @@ -974,10 +970,6 @@ meta_prefs_init (void) G_CALLBACK (wayland_settings_changed), NULL); g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings); - g_signal_connect (gtk_settings_get_default (), - "notify::gtk-shell-shows-app-menu", - G_CALLBACK (shell_shows_app_menu_changed), NULL); - if (!meta_is_wayland_compositor ()) g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size", G_CALLBACK (update_cursor_size_from_gtk), NULL); @@ -1003,7 +995,6 @@ meta_prefs_init (void) handle_preference_init_int (); update_cursor_size (); - shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL); init_bindings (); } @@ -1218,27 +1209,6 @@ bindings_changed (GSettings *settings, g_strfreev (strokes); } -static void -shell_shows_app_menu_changed (GtkSettings *settings, - GParamSpec *pspec, - gpointer data) -{ - int shell_shows_app_menu = 1; - gboolean changed = FALSE; - - g_object_get (settings, - "gtk-shell-shows-app-menu", &shell_shows_app_menu, - NULL); - - - changed = (show_fallback_app_menu == !!shell_shows_app_menu); - - show_fallback_app_menu = !shell_shows_app_menu; - - if (changed) - queue_changed (META_PREF_BUTTON_LAYOUT); -} - static void update_cursor_size (void) { @@ -1343,6 +1313,19 @@ meta_prefs_get_show_fallback_app_menu (void) return show_fallback_app_menu; } +void +meta_prefs_set_show_fallback_app_menu (gboolean whether) +{ + gboolean changed = FALSE; + + changed = (show_fallback_app_menu == !whether); + + show_fallback_app_menu = whether; + + if (changed) + queue_changed (META_PREF_BUTTON_LAYOUT); +} + const char* meta_prefs_get_cursor_theme (void) { diff --git a/src/meta/prefs.h b/src/meta/prefs.h index 378ef5d4f..b2618af48 100644 --- a/src/meta/prefs.h +++ b/src/meta/prefs.h @@ -140,7 +140,9 @@ gboolean meta_prefs_get_gnome_animations (void); gboolean meta_prefs_get_edge_tiling (void); gboolean meta_prefs_get_auto_maximize (void); gboolean meta_prefs_get_center_new_windows (void); + gboolean meta_prefs_get_show_fallback_app_menu (void); +void meta_prefs_set_show_fallback_app_menu (gboolean whether); void meta_prefs_get_button_layout (MetaButtonLayout *button_layout);