[gnome-builder] libide/core: load project settings into action muxer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide/core: load project settings into action muxer
- Date: Wed, 27 Jul 2022 00:26:29 +0000 (UTC)
commit 3ca32756c47b599c781ace635b65d941f67960a3
Author: Christian Hergert <chergert redhat com>
Date: Tue Jul 26 17:26:08 2022 -0700
libide/core: load project settings into action muxer
This makes it so we don't have to load GSettings in various places and
connect it all the necessary action plumbing in GTK.
src/libide/core/ide-context.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/core/ide-context.c b/src/libide/core/ide-context.c
index 2f15f48ed..0d903fc16 100644
--- a/src/libide/core/ide-context.c
+++ b/src/libide/core/ide-context.c
@@ -28,6 +28,7 @@
#include "ide-context.h"
#include "ide-context-private.h"
+#include "ide-gsettings-action-group.h"
#include "ide-macros.h"
#include "ide-notifications.h"
@@ -378,9 +379,10 @@ ide_context_dup_project_id (IdeContext *self)
* Generally, this should only be done once after loading a project.
*/
void
-ide_context_set_project_id (IdeContext *self,
- const gchar *project_id)
+ide_context_set_project_id (IdeContext *self,
+ const char *project_id)
{
+ g_return_if_fail (IDE_IS_MAIN_THREAD ());
g_return_if_fail (IDE_IS_CONTEXT (self));
if (ide_str_empty0 (project_id))
@@ -389,8 +391,22 @@ ide_context_set_project_id (IdeContext *self,
ide_object_lock (IDE_OBJECT (self));
if (!ide_str_equal0 (self->project_id, project_id))
{
+ g_autoptr(IdeGSettingsActionGroup) project_settings_action_group = NULL;
+ g_autoptr(GSettings) project_settings = NULL;
+ g_autofree char *path = NULL;
+
g_free (self->project_id);
self->project_id = g_strdup (project_id);
+
+ path = g_strdup_printf ("/org/gnome/builder/projects/%s/", project_id);
+ project_settings = g_settings_new_with_path ("org.gnome.builder.project", path);
+ project_settings_action_group = g_object_new (IDE_TYPE_GSETTINGS_ACTION_GROUP,
+ "settings", project_settings,
+ NULL);
+ ide_action_muxer_insert_action_group (self->action_muxer,
+ "settings:org.gnome.builder.project",
+ G_ACTION_GROUP (project_settings_action_group));
+
ide_object_notify_by_pspec (IDE_OBJECT (self), properties [PROP_PROJECT_ID]);
}
ide_object_unlock (IDE_OBJECT (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]