[gnome-builder] plugins/projectui: expose project configurations to factory
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/projectui: expose project configurations to factory
- Date: Wed, 24 Aug 2022 00:49:03 +0000 (UTC)
commit f1b79e14d9f62028d884843d8eae64604250c8e2
Author: Christian Hergert <chergert redhat com>
Date: Tue Aug 23 17:28:45 2022 -0700
plugins/projectui: expose project configurations to factory
src/plugins/projectui/gbp-projectui-tweaks-addin.c | 38 ++++++++++++++++++++--
src/plugins/projectui/tweaks.ui | 12 +++++++
2 files changed, 48 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/projectui/gbp-projectui-tweaks-addin.c
b/src/plugins/projectui/gbp-projectui-tweaks-addin.c
index ff736ff9d..4cf94d02e 100644
--- a/src/plugins/projectui/gbp-projectui-tweaks-addin.c
+++ b/src/plugins/projectui/gbp-projectui-tweaks-addin.c
@@ -24,6 +24,10 @@
#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include <libide-foundry.h>
+
#include "gbp-projectui-tweaks-addin.h"
struct _GbpProjectuiTweaksAddin
@@ -33,14 +37,44 @@ struct _GbpProjectuiTweaksAddin
G_DEFINE_FINAL_TYPE (GbpProjectuiTweaksAddin, gbp_projectui_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+static void
+gbp_projectui_tweaks_addin_load (IdeTweaksAddin *addin,
+ IdeTweaks *tweaks)
+{
+ GbpProjectuiTweaksAddin *self = (GbpProjectuiTweaksAddin *)addin;
+ g_autoptr(GtkFlattenListModel) configs = NULL;
+ g_autoptr(GListStore) store = NULL;
+ IdeContext *context;
+
+ g_assert (IDE_IS_MAIN_THREAD ());
+ g_assert (GBP_IS_PROJECTUI_TWEAKS_ADDIN (self));
+ g_assert (IDE_IS_TWEAKS (tweaks));
+
+ ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+ IDE_STRV_INIT ("/plugins/projectui/tweaks.ui"));
+
+ store = g_list_store_new (G_TYPE_LIST_MODEL);
+ configs = gtk_flatten_list_model_new (G_LIST_MODEL (g_object_ref (store)));
+ ide_tweaks_expose_object (tweaks, "Configurations", G_OBJECT (configs));
+
+ if ((context = ide_tweaks_get_context (tweaks)))
+ {
+ IdeConfigManager *config_manager = ide_config_manager_from_context (context);
+ g_list_store_append (store, config_manager);
+ }
+
+ IDE_TWEAKS_ADDIN_CLASS (gbp_projectui_tweaks_addin_parent_class)->load (addin, tweaks);
+}
+
static void
gbp_projectui_tweaks_addin_class_init (GbpProjectuiTweaksAddinClass *klass)
{
+ IdeTweaksAddinClass *tweaks_addin_class = IDE_TWEAKS_ADDIN_CLASS (klass);
+
+ tweaks_addin_class->load = gbp_projectui_tweaks_addin_load;
}
static void
gbp_projectui_tweaks_addin_init (GbpProjectuiTweaksAddin *self)
{
- ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
- IDE_STRV_INIT ("/plugins/projectui/tweaks.ui"));
}
diff --git a/src/plugins/projectui/tweaks.ui b/src/plugins/projectui/tweaks.ui
index d718c19df..13d44ffdf 100644
--- a/src/plugins/projectui/tweaks.ui
+++ b/src/plugins/projectui/tweaks.ui
@@ -94,6 +94,18 @@
<child>
<object class="IdeTweaksPage" id="overview_page">
<property name="title" translatable="yes">Overview</property>
+ <property name="icon-name" translatable="yes">info-symbolic</property>
+ </object>
+ </child>
+ <child>
+ <object class="IdeTweaksPage" id="configs_page">
+ <property name="title" translatable="yes">Configurations</property>
+ <property name="icon-name" translatable="yes">builder-build-configure-symbolic</property>
+ <child>
+ <object class="IdeTweaksFactory" id="config_factory">
+ <property name="model">Configurations</property>
+ </object>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]