mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
prefs: Show fallback app menu based on XSetting
Going through GSD's settings was done in context of patches that did not land; it is simpler and more consistent with GTK+ to use the corresponding XSetting instead.
This commit is contained in:
parent
276df8f18d
commit
f10cb02cbf
@ -53,7 +53,6 @@
|
||||
#define KEY_GNOME_ANIMATIONS "enable-animations"
|
||||
#define KEY_GNOME_CURSOR_THEME "cursor-theme"
|
||||
#define KEY_XKB_OPTIONS "xkb-options"
|
||||
#define KEY_XSETTINGS_OVERRIDES "overrides"
|
||||
|
||||
#define KEY_OVERLAY_KEY "overlay-key"
|
||||
#define KEY_WORKSPACES_ONLY_ON_PRIMARY "workspaces-only-on-primary"
|
||||
@ -132,9 +131,9 @@ static void bindings_changed (GSettings *settings,
|
||||
gchar *key,
|
||||
gpointer data);
|
||||
|
||||
static void xsettings_overrides_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 (GtkSettings *settings,
|
||||
GParamSpec *pspec,
|
||||
@ -947,24 +946,6 @@ queue_changed (MetaPreference pref)
|
||||
/* Initialisation. */
|
||||
/****************************************************************************/
|
||||
|
||||
static GSettings *
|
||||
get_xsettings_settings (void)
|
||||
{
|
||||
GSettings *settings = NULL;
|
||||
GSettingsSchema *schema;
|
||||
|
||||
schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
|
||||
SCHEMA_XSETTINGS, FALSE);
|
||||
|
||||
if (schema)
|
||||
{
|
||||
settings = g_settings_new_full (schema, NULL, NULL);
|
||||
g_settings_schema_unref (schema);
|
||||
}
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
void
|
||||
meta_prefs_init (void)
|
||||
{
|
||||
@ -996,15 +977,9 @@ meta_prefs_init (void)
|
||||
G_CALLBACK (settings_changed), NULL);
|
||||
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INTERFACE), settings);
|
||||
|
||||
settings = get_xsettings_settings ();
|
||||
if (settings)
|
||||
{
|
||||
g_signal_connect (settings, "changed::" KEY_XSETTINGS_OVERRIDES,
|
||||
G_CALLBACK (xsettings_overrides_changed), NULL);
|
||||
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_XSETTINGS), settings);
|
||||
|
||||
xsettings_overrides_changed (settings, KEY_XSETTINGS_OVERRIDES, NULL);
|
||||
}
|
||||
g_signal_connect (gtk_settings_get_default (),
|
||||
"notify::gtk-shell-shows-app-menu",
|
||||
G_CALLBACK (shell_shows_app_menu_changed), NULL);
|
||||
|
||||
g_signal_connect (gtk_settings_get_default (), "notify::gtk-cursor-theme-size",
|
||||
G_CALLBACK (update_cursor_size), NULL);
|
||||
@ -1030,6 +1005,7 @@ meta_prefs_init (void)
|
||||
handle_preference_init_int ();
|
||||
|
||||
update_cursor_size (gtk_settings_get_default (), NULL, NULL);
|
||||
shell_shows_app_menu_changed (gtk_settings_get_default (), NULL, NULL);
|
||||
|
||||
init_bindings ();
|
||||
}
|
||||
@ -1231,38 +1207,21 @@ bindings_changed (GSettings *settings,
|
||||
g_strfreev (strokes);
|
||||
}
|
||||
|
||||
/* The fallback app menu should be enabled if either we are not
|
||||
* showing the app menu (e.g. when using the default plugin) or
|
||||
* with a corresponding XSettings override; we ignore the former
|
||||
* and assume that we always show the app menu, not least
|
||||
* because we rely on the compositor implementation to display
|
||||
* the fallback ...
|
||||
*/
|
||||
static void
|
||||
xsettings_overrides_changed (GSettings *settings,
|
||||
gchar *key,
|
||||
gpointer data)
|
||||
shell_shows_app_menu_changed (GtkSettings *settings,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GVariant *value;
|
||||
GVariantDict overrides;
|
||||
int shell_shows_app_menu = 1;
|
||||
gboolean changed = FALSE;
|
||||
|
||||
if (!g_settings_get_boolean (settings, "active"))
|
||||
goto out;
|
||||
g_object_get (settings,
|
||||
"gtk-shell-shows-app-menu", &shell_shows_app_menu,
|
||||
NULL);
|
||||
|
||||
value = g_settings_get_value (settings, KEY_XSETTINGS_OVERRIDES);
|
||||
|
||||
g_variant_dict_init (&overrides, value);
|
||||
g_variant_unref (value);
|
||||
|
||||
g_variant_dict_lookup (&overrides,
|
||||
"Gtk/ShellShowsAppMenu", "i", &shell_shows_app_menu);
|
||||
g_variant_dict_clear (&overrides);
|
||||
|
||||
changed = (show_fallback_app_menu == !!shell_shows_app_menu);
|
||||
|
||||
out:
|
||||
show_fallback_app_menu = !shell_shows_app_menu;
|
||||
|
||||
if (changed)
|
||||
|
Loading…
Reference in New Issue
Block a user