[gnome-builder] libide/core: notify of state change when layers change
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/core: notify of state change when layers change
- Date: Tue, 26 Jul 2022 21:29:01 +0000 (UTC)
commit 0061433b1adb96dc881471c03345aff5371f6a4a
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 26 14:28:39 2022 -0700
libide/core: notify of state change when layers change
src/libide/core/ide-settings.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/core/ide-settings.c b/src/libide/core/ide-settings.c
index 1796ef203..ea04827d6 100644
--- a/src/libide/core/ide-settings.c
+++ b/src/libide/core/ide-settings.c
@@ -123,6 +123,23 @@ ide_settings_set_schema_id (IdeSettings *self,
}
}
+static void
+ide_settings_layered_settings_changed_cb (IdeSettings *self,
+ const char *key,
+ IdeLayeredSettings *layered_settings)
+{
+ g_autoptr(GVariant) value = NULL;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (key != NULL);
+ g_assert (IDE_IS_LAYERED_SETTINGS (layered_settings));
+
+ g_signal_emit (self, signals [CHANGED], g_quark_from_string (key), key);
+
+ value = ide_layered_settings_get_value (self->layered_settings, key);
+ g_action_group_action_state_changed (G_ACTION_GROUP (self), key, value);
+}
+
static void
ide_settings_constructed (GObject *object)
{
@@ -166,6 +183,12 @@ ide_settings_constructed (GObject *object)
full_path = g_strdup_printf ("/org/gnome/builder/%s", self->relative_path);
self->layered_settings = ide_layered_settings_new (self->schema_id, full_path);
+ g_signal_connect_object (self->layered_settings,
+ "changed",
+ G_CALLBACK (ide_settings_layered_settings_changed_cb),
+ self,
+ G_CONNECT_SWAPPED);
+
/* Add our project relative settings */
if (self->ignore_project_settings == FALSE)
{
@@ -305,10 +328,11 @@ ide_settings_class_init (IdeSettingsClass *klass)
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
0,
- NULL, NULL, NULL,
+ NULL, NULL,
+ NULL,
G_TYPE_NONE,
1,
- G_TYPE_STRING);
+ G_TYPE_STRING | G_SIGNAL_TYPE_STATIC_SCOPE);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]