[gnome-builder] plugins/buildui: add default run command selection to tweaks



commit 4ca0cdf5536f38a96f1cf902346fe7e8328f587d
Author: Christian Hergert <chergert redhat com>
Date:   Fri Aug 26 17:33:25 2022 -0700

    plugins/buildui: add default run command selection to tweaks
    
    But only for the project mode.

 src/plugins/buildui/gbp-buildui-tweaks-addin.c | 10 ++++++
 src/plugins/buildui/tweaks.ui                  | 49 ++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
---
diff --git a/src/plugins/buildui/gbp-buildui-tweaks-addin.c b/src/plugins/buildui/gbp-buildui-tweaks-addin.c
index b65d9a215..44a858976 100644
--- a/src/plugins/buildui/gbp-buildui-tweaks-addin.c
+++ b/src/plugins/buildui/gbp-buildui-tweaks-addin.c
@@ -46,7 +46,17 @@ gbp_buildui_tweaks_addin_load (IdeTweaksAddin *addin,
   if ((self->context = ide_tweaks_get_context (tweaks)))
     {
       IdeRuntimeManager *runtime_manager = ide_runtime_manager_from_context (self->context);
+      IdeRunCommands *run_commands = ide_run_commands_from_context (self->context);
+
       ide_tweaks_expose_object (tweaks, "Runtimes", G_OBJECT (runtime_manager));
+      ide_tweaks_expose_object (tweaks, "RunCommands", G_OBJECT (run_commands));
+    }
+  else
+    {
+      g_autoptr(GListStore) store = g_list_store_new (G_TYPE_OBJECT);
+
+      ide_tweaks_expose_object (tweaks, "Runtimes", G_OBJECT (store));
+      ide_tweaks_expose_object (tweaks, "RunCommands", G_OBJECT (store));
     }
 
   ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
diff --git a/src/plugins/buildui/tweaks.ui b/src/plugins/buildui/tweaks.ui
index 43222e229..648e380fe 100644
--- a/src/plugins/buildui/tweaks.ui
+++ b/src/plugins/buildui/tweaks.ui
@@ -3,6 +3,55 @@
   <template class="IdeTweaks">
     <child internal-child="foundry_section">
       <object class="IdeTweaksSection">
+        <child>
+          <object class="IdeTweaksPage" id="application_page">
+            <property name="icon-name">application-x-executable-symbolic</property>
+            <property name="title" translatable="yes">Application</property>
+            <child>
+              <object class="IdeTweaksGroup">
+                <property name="title" translatable="yes">Commands</property>
+                <property name="hidden-when">application</property>
+                <child>
+                  <object class="IdeTweaksCombo">
+                    <property name="title" translatable="yes">Run Command</property>
+                    <property name="subtitle" translatable="yes">This command is used to run your 
project</property>
+                    <property name="binding">
+                      <object class="IdeTweaksSetting">
+                        <property name="schema-id">org.gnome.builder.project</property>
+                        <property name="schema-key">default-run-command</property>
+                      </object>
+                    </property>
+                    <child>
+                      <object class="IdeTweaksChoice">
+                        <property name="title" translatable="yes">Automatically Discover</property>
+                        <property name="value">''</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksFactory" id="run_commands_factory">
+                        <property name="model">RunCommands</property>
+                        <child>
+                          <object class="IdeTweaksChoice">
+                            <binding name="title">
+                              <lookup name="display-name" type="IdeRunCommand">
+                                <lookup name="item">run_commands_factory</lookup>
+                              </lookup>
+                            </binding>
+                            <binding name="value">
+                              <lookup name="id" type="IdeRunCommand">
+                                <lookup name="item">run_commands_factory</lookup>
+                              </lookup>
+                            </binding>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
         <child>
           <object class="IdeTweaksPage" id="build_page">
             <property name="icon-name">builder-build-symbolic</property>


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