eekboard-context-service: Return early if schema is unavailable
This also fixes a leak of GSettingsSchema.
This commit is contained in:
@ -244,27 +244,28 @@ eekboard_context_service_init (EekboardContextService *self)
|
|||||||
self->priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(self);
|
self->priv = EEKBOARD_CONTEXT_SERVICE_GET_PRIVATE(self);
|
||||||
const char *schema_name = "org.gnome.desktop.input-sources";
|
const char *schema_name = "org.gnome.desktop.input-sources";
|
||||||
GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default();
|
GSettingsSchemaSource *ssrc = g_settings_schema_source_get_default();
|
||||||
if (ssrc) {
|
g_autoptr(GSettingsSchema) schema = NULL;
|
||||||
GSettingsSchema *schema = g_settings_schema_source_lookup(ssrc,
|
|
||||||
schema_name,
|
if (!ssrc) {
|
||||||
TRUE);
|
g_warning("No gsettings schemas installed. Layout switching unavailable.");
|
||||||
if (schema) {
|
return;
|
||||||
// Not referencing the found schema directly,
|
}
|
||||||
// because it's not clear how...
|
|
||||||
self->priv->settings = g_settings_new (schema_name);
|
schema = g_settings_schema_source_lookup(ssrc, schema_name, TRUE);
|
||||||
gulong conn_id = g_signal_connect(self->priv->settings, "change-event",
|
if (schema) {
|
||||||
G_CALLBACK(settings_handle_layout_changed),
|
// Not referencing the found schema directly,
|
||||||
self);
|
// because it's not clear how...
|
||||||
if (conn_id == 0) {
|
self->priv->settings = g_settings_new (schema_name);
|
||||||
g_warning ("Could not connect to gsettings updates, "
|
gulong conn_id = g_signal_connect(self->priv->settings, "change-event",
|
||||||
"automatic layout changing unavailable");
|
G_CALLBACK(settings_handle_layout_changed),
|
||||||
}
|
self);
|
||||||
} else {
|
if (conn_id == 0) {
|
||||||
g_warning("Gsettings schema %s is not installed on the system. "
|
g_warning ("Could not connect to gsettings updates, "
|
||||||
"Layout switching unavailable", schema_name);
|
"automatic layout changing unavailable");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
g_warning("No gsettings schemas installed. Layout switching unavailable.");
|
g_warning("Gsettings schema %s is not installed on the system. "
|
||||||
|
"Layout switching unavailable", schema_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user