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
This commit is contained in:
Armin Krezović 2017-08-26 22:43:57 +02:00 committed by Jonas Ådahl
parent e6b885210c
commit de5e7a7175
2 changed files with 15 additions and 30 deletions

View File

@ -137,10 +137,6 @@ static void bindings_changed (GSettings *settings,
gchar *key, gchar *key,
gpointer data); gpointer data);
static void shell_shows_app_menu_changed (GtkSettings *settings,
GParamSpec *pspec,
gpointer data);
static void update_cursor_size_from_gtk (GtkSettings *settings, static void update_cursor_size_from_gtk (GtkSettings *settings,
GParamSpec *pspec, GParamSpec *pspec,
gpointer data); gpointer data);
@ -974,10 +970,6 @@ meta_prefs_init (void)
G_CALLBACK (wayland_settings_changed), NULL); G_CALLBACK (wayland_settings_changed), NULL);
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings); 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 ()) if (!meta_is_wayland_compositor ())
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size", g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
G_CALLBACK (update_cursor_size_from_gtk), NULL); G_CALLBACK (update_cursor_size_from_gtk), NULL);
@ -1003,7 +995,6 @@ meta_prefs_init (void)
handle_preference_init_int (); handle_preference_init_int ();
update_cursor_size (); update_cursor_size ();
shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL);
init_bindings (); init_bindings ();
} }
@ -1218,27 +1209,6 @@ bindings_changed (GSettings *settings,
g_strfreev (strokes); 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 static void
update_cursor_size (void) update_cursor_size (void)
{ {
@ -1343,6 +1313,19 @@ meta_prefs_get_show_fallback_app_menu (void)
return show_fallback_app_menu; 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* const char*
meta_prefs_get_cursor_theme (void) meta_prefs_get_cursor_theme (void)
{ {

View File

@ -140,7 +140,9 @@ gboolean meta_prefs_get_gnome_animations (void);
gboolean meta_prefs_get_edge_tiling (void); gboolean meta_prefs_get_edge_tiling (void);
gboolean meta_prefs_get_auto_maximize (void); gboolean meta_prefs_get_auto_maximize (void);
gboolean meta_prefs_get_center_new_windows (void); gboolean meta_prefs_get_center_new_windows (void);
gboolean meta_prefs_get_show_fallback_app_menu (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); void meta_prefs_get_button_layout (MetaButtonLayout *button_layout);