[gnome-builder] libide/gui: start on plugin subpages



commit 756e12b1914a3d57f80aefaaf4966537733c655e
Author: Christian Hergert <chergert redhat com>
Date:   Wed Aug 17 14:52:05 2022 -0700

    libide/gui: start on plugin subpages
    
    Instead of one giant page, I'd like to see these separated so that it
    isn't so annoying to find plugins of a certain kind.

 src/libide/gui/ide-application-actions.c | 19 ++++++++++++++-----
 src/libide/gui/libide-gui.gresource.xml  |  1 +
 src/libide/gui/tweaks-plugins.ui         | 28 ++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+), 5 deletions(-)
---
diff --git a/src/libide/gui/ide-application-actions.c b/src/libide/gui/ide-application-actions.c
index c903a913d..8a718d2d8 100644
--- a/src/libide/gui/ide-application-actions.c
+++ b/src/libide/gui/ide-application-actions.c
@@ -43,10 +43,12 @@ ide_application_actions_tweaks (GSimpleAction *action,
                                 GVariant      *parameter,
                                 gpointer       user_data)
 {
+  static const char *tweaks_resources[] = {
+    "resource:///org/gnome/libide-gui/tweaks.ui",
+    "resource:///org/gnome/libide-gui/tweaks-plugins.ui",
+  };
   IdeApplication *self = user_data;
   g_autoptr(IdeTweaks) tweaks = NULL;
-  g_autoptr(GError) error = NULL;
-  g_autoptr(GFile) tweaks_file = NULL;
   IdeTweaksWindow *window;
   GtkWindow *toplevel = NULL;
   const GList *windows;
@@ -75,9 +77,16 @@ ide_application_actions_tweaks (GSimpleAction *action,
   tweaks = ide_tweaks_new ();
 
   /* Load our base tweaks scaffolding */
-  tweaks_file = g_file_new_for_uri ("resource:///org/gnome/libide-gui/tweaks.ui");
-  ide_tweaks_load_from_file (tweaks, tweaks_file, NULL, &error);
-  g_assert_no_error (error);
+  for (guint i = 0; i < G_N_ELEMENTS (tweaks_resources); i++)
+    {
+      g_autoptr(GFile) tweaks_file = g_file_new_for_uri (tweaks_resources[i]);
+      g_autoptr(GError) error = NULL;
+
+      ide_tweaks_load_from_file (tweaks, tweaks_file, NULL, &error);
+
+      if (error != NULL)
+        g_critical ("Failed to load tweaks: %s", error->message);
+    }
 
   /* Now display window */
   window = g_object_new (IDE_TYPE_TWEAKS_WINDOW,
diff --git a/src/libide/gui/libide-gui.gresource.xml b/src/libide/gui/libide-gui.gresource.xml
index 61f5aea1c..a4b094795 100644
--- a/src/libide/gui/libide-gui.gresource.xml
+++ b/src/libide/gui/libide-gui.gresource.xml
@@ -9,6 +9,7 @@
     <file>images/style-preview-light.png</file>
     <file>style.css</file>
     <file preprocess="xml-stripblanks">tweaks.ui</file>
+    <file preprocess="xml-stripblanks">tweaks-plugins.ui</file>
   </gresource>
   <gresource prefix="/org/gnome/libide-gui/ui">
     <file preprocess="xml-stripblanks">ide-environment-editor-row.ui</file>
diff --git a/src/libide/gui/tweaks-plugins.ui b/src/libide/gui/tweaks-plugins.ui
new file mode 100644
index 000000000..e0b1bf68a
--- /dev/null
+++ b/src/libide/gui/tweaks-plugins.ui
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaks">
+    <child internal-child="plugins_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="plugins_page">
+          <object class="IdeTweaksPage">
+            <child>
+              <object class="IdeTweaksPage" id="lsps_page">
+                <property name="title" translatable="yes">Language Servers</property>
+              </object>
+            </child>
+            <child>
+              <object class="IdeTweaksPage" id="vcs_page">
+                <property name="title" translatable="yes">Version Control</property>
+              </object>
+            </child>
+            <child>
+              <object class="IdeTweaksPage" id="sdks_page">
+                <property name="title" translatable="yes">SDKs</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>


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