[gnome-builder] plugins/project-tree: add tweaks for project tree



commit b620dad883f288df2954e1df0eda57b87f36d0cb
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 18 18:45:12 2022 -0700

    plugins/project-tree: add tweaks for project tree

 .../project-tree/gbp-project-tree-tweaks-addin.c   | 44 +++++++++++++++++++++
 .../project-tree/gbp-project-tree-tweaks-addin.h   | 31 +++++++++++++++
 src/plugins/project-tree/meson.build               |  1 +
 src/plugins/project-tree/project-tree-plugin.c     |  4 ++
 .../project-tree/project-tree.gresource.xml        |  1 +
 src/plugins/project-tree/project-tree.plugin       |  1 +
 src/plugins/project-tree/tweaks.ui                 | 45 ++++++++++++++++++++++
 7 files changed, 127 insertions(+)
---
diff --git a/src/plugins/project-tree/gbp-project-tree-tweaks-addin.c 
b/src/plugins/project-tree/gbp-project-tree-tweaks-addin.c
new file mode 100644
index 000000000..575458232
--- /dev/null
+++ b/src/plugins/project-tree/gbp-project-tree-tweaks-addin.c
@@ -0,0 +1,44 @@
+/* gbp-project-tree-tweaks-addin.c
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#define G_LOG_DOMAIN "gbp-project-tree-tweaks-addin"
+
+#include "config.h"
+
+#include "gbp-project-tree-tweaks-addin.h"
+
+struct _GbpProjectTreeTweaksAddin
+{
+  IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpProjectTreeTweaksAddin, gbp_project_tree_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_project_tree_tweaks_addin_class_init (GbpProjectTreeTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_project_tree_tweaks_addin_init (GbpProjectTreeTweaksAddin *self)
+{
+  ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+                                       IDE_STRV_INIT ("/plugins/project-tree/tweaks.ui"));
+}
diff --git a/src/plugins/project-tree/gbp-project-tree-tweaks-addin.h 
b/src/plugins/project-tree/gbp-project-tree-tweaks-addin.h
new file mode 100644
index 000000000..ae2751908
--- /dev/null
+++ b/src/plugins/project-tree/gbp-project-tree-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-project-tree-tweaks-addin.h
+ *
+ * Copyright 2022 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <libide-tweaks.h>
+
+G_BEGIN_DECLS
+
+#define GBP_TYPE_PROJECT_TREE_TWEAKS_ADDIN (gbp_project_tree_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpProjectTreeTweaksAddin, gbp_project_tree_tweaks_addin, GBP, 
PROJECT_TREE_TWEAKS_ADDIN, IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/project-tree/meson.build b/src/plugins/project-tree/meson.build
index 1532d6f00..8d7b22302 100644
--- a/src/plugins/project-tree/meson.build
+++ b/src/plugins/project-tree/meson.build
@@ -5,6 +5,7 @@ plugins_sources += files([
   'gbp-project-tree-frame-addin.c',
   'gbp-project-tree-pane.c',
   'gbp-project-tree-pane-actions.c',
+  'gbp-project-tree-tweaks-addin.c',
   'gbp-project-tree-workspace-addin.c',
   'gbp-new-file-popover.c',
   'gbp-rename-file-popover.c',
diff --git a/src/plugins/project-tree/project-tree-plugin.c b/src/plugins/project-tree/project-tree-plugin.c
index fec200437..25814ffb1 100644
--- a/src/plugins/project-tree/project-tree-plugin.c
+++ b/src/plugins/project-tree/project-tree-plugin.c
@@ -28,6 +28,7 @@
 
 #include "gbp-project-tree-addin.h"
 #include "gbp-project-tree-frame-addin.h"
+#include "gbp-project-tree-tweaks-addin.h"
 #include "gbp-project-tree-workspace-addin.h"
 
 void
@@ -39,6 +40,9 @@ _gbp_project_tree_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_FRAME_ADDIN,
                                               GBP_TYPE_PROJECT_TREE_FRAME_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TWEAKS_ADDIN,
+                                              GBP_TYPE_PROJECT_TREE_TWEAKS_ADDIN);
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_WORKSPACE_ADDIN,
                                               GBP_TYPE_PROJECT_TREE_WORKSPACE_ADDIN);
diff --git a/src/plugins/project-tree/project-tree.gresource.xml 
b/src/plugins/project-tree/project-tree.gresource.xml
index b170d433e..5f2cd07f1 100644
--- a/src/plugins/project-tree/project-tree.gresource.xml
+++ b/src/plugins/project-tree/project-tree.gresource.xml
@@ -5,6 +5,7 @@
     <file preprocess="xml-stripblanks">gbp-project-tree-pane.ui</file>
     <file preprocess="xml-stripblanks">gbp-new-file-popover.ui</file>
     <file preprocess="xml-stripblanks">gbp-rename-file-popover.ui</file>
+    <file preprocess="xml-stripblanks">tweaks.ui</file>
     <file>project-tree.plugin</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/project-tree/project-tree.plugin b/src/plugins/project-tree/project-tree.plugin
index 27a68c00b..0e9bc07d0 100644
--- a/src/plugins/project-tree/project-tree.plugin
+++ b/src/plugins/project-tree/project-tree.plugin
@@ -2,6 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2014-2018 Christian Hergert
+Depends=projectui;editorui;
 Description=Builder's project creation wizard
 Embedded=_gbp_project_tree_register_types
 Hidden=true
diff --git a/src/plugins/project-tree/tweaks.ui b/src/plugins/project-tree/tweaks.ui
new file mode 100644
index 000000000..d183168b0
--- /dev/null
+++ b/src/plugins/project-tree/tweaks.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaks">
+    <child>
+      <object class="IdeTweaksSettings" id="settings_org_gnome_builder_project_tree">
+        <property name="schema-id">org.gnome.builder.project-tree</property>
+        <property name="application-only">true</property>
+      </object>
+    </child>
+    <child internal-child="projects_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="projects_page">
+          <object class="IdeTweaksPage">
+            <child>
+              <object class="IdeTweaksGroup">
+                <property name="title" translatable="yes">Project Tree</property>
+                <child>
+                  <object class="IdeTweaksSwitch">
+                    <property name="title" translatable="yes">Show Icons</property>
+                    <property name="subtitle" translatable="yes">Display icons next to files within the 
project tree</property>
+                    <property 
name="action-name">settings.org.gnome.builder.project-tree.show-icons</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksSwitch">
+                    <property name="title" translatable="yes">Show Ignored Files</property>
+                    <property name="subtitle" translatable="yes">Show files which are typically 
ignored</property>
+                    <property 
name="action-name">settings.org.gnome.builder.project-tree.show-ignored-files</property>
+                  </object>
+                </child>
+                <child>
+                  <object class="IdeTweaksSwitch">
+                    <property name="title" translatable="yes">Sort Directories First</property>
+                    <property name="subtitle" translatable="yes">Sort directories before files in the same 
directory</property>
+                    <property 
name="action-name">settings.org.gnome.builder.project-tree.sort-directories-first</property>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>


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