[mutter/bilelmoussaoui/settings-daemon: 1/2] Backend: Check if the gsettings scheme exists
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/bilelmoussaoui/settings-daemon: 1/2] Backend: Check if the gsettings scheme exists
- Date: Tue, 3 May 2022 10:47:29 +0000 (UTC)
commit 49b580f31ae72b1aff970d6622998a5c322a9eec
Author: Bilal Elmoussaoui <belmouss redhat com>
Date: Tue May 3 12:40:13 2022 +0200
Backend: Check if the gsettings scheme exists
Mutter makes use of a gsettings scheme that comes from
gnome-settings-daemon to check for the screen orientation.
In use cases where gnome-settings-daemon is not available,
this would lead to a crash as the key doesn't exists
src/backends/meta-orientation-manager.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/meta-orientation-manager.c b/src/backends/meta-orientation-manager.c
index 7989aa84fc..2dd059615f 100644
--- a/src/backends/meta-orientation-manager.c
+++ b/src/backends/meta-orientation-manager.c
@@ -273,6 +273,7 @@ iio_sensor_vanished_cb (GDBusConnection *connection,
static void
meta_orientation_manager_init (MetaOrientationManager *self)
{
+ GSettingsSchemaSource *schema_source = g_settings_schema_source_get_default ();
self->iio_watch_id = g_bus_watch_name (G_BUS_TYPE_SYSTEM,
"net.hadess.SensorProxy",
G_BUS_NAME_WATCHER_FLAGS_NONE,
@@ -281,10 +282,14 @@ meta_orientation_manager_init (MetaOrientationManager *self)
self,
NULL);
- self->settings = g_settings_new (CONF_SCHEMA);
- g_signal_connect_object (self->settings, "changed::"ORIENTATION_LOCK_KEY,
- G_CALLBACK (orientation_lock_changed), self, 0);
- sync_state (self);
+ if (schema_source != NULL &&
+ g_settings_schema_source_lookup (schema_source, CONF_SCHEMA, TRUE))
+ {
+ self->settings = g_settings_new (CONF_SCHEMA);
+ g_signal_connect_object (self->settings, "changed::"ORIENTATION_LOCK_KEY,
+ G_CALLBACK (orientation_lock_changed), self, 0);
+ sync_state (self);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]