settings: Read desktop privacy settings and monitor privacy-screen option
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1952>
This commit is contained in:
parent
f231672084
commit
55469fda78
@ -78,4 +78,6 @@ gboolean meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings);
|
||||
|
||||
int meta_settings_get_xwayland_disable_extensions (MetaSettings *settings);
|
||||
|
||||
gboolean meta_settings_is_privacy_screen_enabled (MetaSettings *settings);
|
||||
|
||||
#endif /* META_SETTINGS_PRIVATE_H */
|
||||
|
@ -41,6 +41,7 @@ enum
|
||||
GLOBAL_SCALING_FACTOR_CHANGED,
|
||||
FONT_DPI_CHANGED,
|
||||
EXPERIMENTAL_FEATURES_CHANGED,
|
||||
PRIVACY_SCREEN_CHANGED,
|
||||
|
||||
N_SIGNALS
|
||||
};
|
||||
@ -55,6 +56,7 @@ struct _MetaSettings
|
||||
|
||||
GSettings *interface_settings;
|
||||
GSettings *mutter_settings;
|
||||
GSettings *privacy_settings;
|
||||
GSettings *wayland_settings;
|
||||
|
||||
int ui_scaling_factor;
|
||||
@ -62,6 +64,8 @@ struct _MetaSettings
|
||||
|
||||
int font_dpi;
|
||||
|
||||
gboolean privacy_screen;
|
||||
|
||||
MetaExperimentalFeature experimental_features;
|
||||
gboolean experimental_features_overridden;
|
||||
|
||||
@ -221,6 +225,25 @@ interface_settings_changed (GSettings *interface_settings,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
privacy_settings_changed (GSettings *privacy_settings,
|
||||
const char *key,
|
||||
MetaSettings *settings)
|
||||
{
|
||||
if (g_str_equal (key, "privacy-screen"))
|
||||
{
|
||||
gboolean privacy_screen;
|
||||
|
||||
privacy_screen = g_settings_get_boolean (privacy_settings, key);
|
||||
|
||||
if (settings->privacy_screen != privacy_screen)
|
||||
{
|
||||
settings->privacy_screen = privacy_screen;
|
||||
g_signal_emit (settings, signals[PRIVACY_SCREEN_CHANGED], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_settings_is_experimental_feature_enabled (MetaSettings *settings,
|
||||
MetaExperimentalFeature feature)
|
||||
@ -400,6 +423,14 @@ update_xwayland_disable_extensions (MetaSettings *settings)
|
||||
"xwayland-disable-extension");
|
||||
}
|
||||
|
||||
static void
|
||||
update_privacy_settings (MetaSettings *settings)
|
||||
{
|
||||
privacy_settings_changed (settings->privacy_settings,
|
||||
"privacy-screen",
|
||||
settings);
|
||||
}
|
||||
|
||||
static void
|
||||
wayland_settings_changed (GSettings *wayland_settings,
|
||||
gchar *key,
|
||||
@ -441,6 +472,12 @@ meta_settings_get_xwayland_disable_extensions (MetaSettings *settings)
|
||||
return (settings->xwayland_disable_extensions);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_settings_is_privacy_screen_enabled (MetaSettings *settings)
|
||||
{
|
||||
return settings->privacy_screen;
|
||||
}
|
||||
|
||||
MetaSettings *
|
||||
meta_settings_new (MetaBackend *backend)
|
||||
{
|
||||
@ -459,6 +496,7 @@ meta_settings_dispose (GObject *object)
|
||||
|
||||
g_clear_object (&settings->mutter_settings);
|
||||
g_clear_object (&settings->interface_settings);
|
||||
g_clear_object (&settings->privacy_settings);
|
||||
g_clear_object (&settings->wayland_settings);
|
||||
g_clear_pointer (&settings->xwayland_grab_allow_list_patterns,
|
||||
g_ptr_array_unref);
|
||||
@ -475,6 +513,10 @@ meta_settings_init (MetaSettings *settings)
|
||||
g_signal_connect (settings->interface_settings, "changed",
|
||||
G_CALLBACK (interface_settings_changed),
|
||||
settings);
|
||||
settings->privacy_settings = g_settings_new ("org.gnome.desktop.privacy");
|
||||
g_signal_connect (settings->privacy_settings, "changed",
|
||||
G_CALLBACK (privacy_settings_changed),
|
||||
settings);
|
||||
settings->mutter_settings = g_settings_new ("org.gnome.mutter");
|
||||
g_signal_connect (settings->mutter_settings, "changed",
|
||||
G_CALLBACK (mutter_settings_changed),
|
||||
@ -495,6 +537,7 @@ meta_settings_init (MetaSettings *settings)
|
||||
update_xwayland_grab_access_rules (settings);
|
||||
update_xwayland_allow_grabs (settings);
|
||||
update_xwayland_disable_extensions (settings);
|
||||
update_privacy_settings (settings);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -556,4 +599,12 @@ meta_settings_class_init (MetaSettingsClass *klass)
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, G_TYPE_UINT);
|
||||
|
||||
signals[PRIVACY_SCREEN_CHANGED] =
|
||||
g_signal_new ("privacy-screen-changed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user