[gnome-builder] libide/core: add ide_context_unregister_settings()



commit 28e4a91af1d81475c5fb176ffea0495ae43573a5
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 26 23:12:45 2022 -0700

    libide/core: add ide_context_unregister_settings()
    
    To reverse what happend with a call to register_settings().

 src/libide/core/ide-context.c | 19 +++++++++++++++++++
 src/libide/core/ide-context.h |  3 +++
 2 files changed, 22 insertions(+)
---
diff --git a/src/libide/core/ide-context.c b/src/libide/core/ide-context.c
index 4e1d3301e..a7c20075b 100644
--- a/src/libide/core/ide-context.c
+++ b/src/libide/core/ide-context.c
@@ -875,3 +875,22 @@ ide_context_register_settings (IdeContext *self,
       ide_action_muxer_insert_action_group (muxer, project_group, G_ACTION_GROUP (project_settings));
     }
 }
+
+void
+ide_context_unregister_settings (IdeContext *self,
+                                 const char *schema_id)
+{
+  g_autoptr(IdeActionMuxer) muxer = NULL;
+
+  g_return_if_fail (IDE_IS_CONTEXT (self));
+  g_return_if_fail (schema_id != NULL);
+
+  if ((muxer = ide_context_ref_action_muxer (self)))
+    {
+      g_autofree char *project_group = g_strconcat ("settings.project:", schema_id, NULL);
+      g_autofree char *app_group = g_strconcat ("settings.app:", schema_id, NULL);
+
+      ide_action_muxer_insert_action_group (muxer, project_group, NULL);
+      ide_action_muxer_insert_action_group (muxer, app_group, NULL);
+    }
+}
diff --git a/src/libide/core/ide-context.h b/src/libide/core/ide-context.h
index 1748ff7ea..78e562800 100644
--- a/src/libide/core/ide-context.h
+++ b/src/libide/core/ide-context.h
@@ -92,6 +92,9 @@ IDE_AVAILABLE_IN_ALL
 void            ide_context_register_settings    (IdeContext     *self,
                                                   const char     *schema_id);
 IDE_AVAILABLE_IN_ALL
+void            ide_context_unregister_settings  (IdeContext     *self,
+                                                  const char     *schema_id);
+IDE_AVAILABLE_IN_ALL
 IdeSettings    *ide_context_ref_settings         (IdeContext     *self,
                                                   const char     *schema_id);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]