[gnome-builder] plugins/ctags: add tweaks for ctags under text editor



commit 4e54533dfe3e082eecab0102f2496e9aa75b80c1
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 18 18:34:47 2022 -0700

    plugins/ctags: add tweaks for ctags under text editor

 src/plugins/ctags/ctags-plugin.c           |  4 +++
 src/plugins/ctags/ctags.gresource.xml      |  1 +
 src/plugins/ctags/ctags.plugin             |  1 +
 src/plugins/ctags/gbp-ctags-tweaks-addin.c | 44 ++++++++++++++++++++++++++++
 src/plugins/ctags/gbp-ctags-tweaks-addin.h | 31 ++++++++++++++++++++
 src/plugins/ctags/meson.build              |  1 +
 src/plugins/ctags/tweaks.ui                | 47 ++++++++++++++++++++++++++++++
 7 files changed, 129 insertions(+)
---
diff --git a/src/plugins/ctags/ctags-plugin.c b/src/plugins/ctags/ctags-plugin.c
index 9f5ab2612..b501746a4 100644
--- a/src/plugins/ctags/ctags-plugin.c
+++ b/src/plugins/ctags/ctags-plugin.c
@@ -28,6 +28,7 @@
 #include <libide-sourceview.h>
 #include <libide-io.h>
 
+#include "gbp-ctags-tweaks-addin.h"
 #include "gbp-ctags-workbench-addin.h"
 #include "ide-ctags-builder.h"
 #include "ide-ctags-completion-item.h"
@@ -51,6 +52,9 @@ _ide_ctags_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_WORKBENCH_ADDIN,
                                               GBP_TYPE_CTAGS_WORKBENCH_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TWEAKS_ADDIN,
+                                              GBP_TYPE_CTAGS_TWEAKS_ADDIN);
 
   ide_g_file_add_ignored_pattern ("tags.??????");
 }
diff --git a/src/plugins/ctags/ctags.gresource.xml b/src/plugins/ctags/ctags.gresource.xml
index fa181ff16..7f0e8cb05 100644
--- a/src/plugins/ctags/ctags.gresource.xml
+++ b/src/plugins/ctags/ctags.gresource.xml
@@ -2,5 +2,6 @@
 <gresources>
   <gresource prefix="/plugins/ctags">
     <file>ctags.plugin</file>
+    <file preprocess="xml-stripblanks">tweaks.ui</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/ctags/ctags.plugin b/src/plugins/ctags/ctags.plugin
index d85838732..527b4d639 100644
--- a/src/plugins/ctags/ctags.plugin
+++ b/src/plugins/ctags/ctags.plugin
@@ -2,6 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2015-2018 Christian Hergert
+Depends=editorui;
 Description=Provides integration with Ctags for auto-completion and symbol resolving
 Embedded=_ide_ctags_register_types
 Module=ctags
diff --git a/src/plugins/ctags/gbp-ctags-tweaks-addin.c b/src/plugins/ctags/gbp-ctags-tweaks-addin.c
new file mode 100644
index 000000000..86e209000
--- /dev/null
+++ b/src/plugins/ctags/gbp-ctags-tweaks-addin.c
@@ -0,0 +1,44 @@
+/* gbp-ctags-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-ctags-tweaks-addin"
+
+#include "config.h"
+
+#include "gbp-ctags-tweaks-addin.h"
+
+struct _GbpCtagsTweaksAddin
+{
+  IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpCtagsTweaksAddin, gbp_ctags_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_ctags_tweaks_addin_class_init (GbpCtagsTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_ctags_tweaks_addin_init (GbpCtagsTweaksAddin *self)
+{
+  ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+                                       IDE_STRV_INIT ("/plugins/ctags/tweaks.ui"));
+}
diff --git a/src/plugins/ctags/gbp-ctags-tweaks-addin.h b/src/plugins/ctags/gbp-ctags-tweaks-addin.h
new file mode 100644
index 000000000..6b5288589
--- /dev/null
+++ b/src/plugins/ctags/gbp-ctags-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-ctags-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_CTAGS_TWEAKS_ADDIN (gbp_ctags_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpCtagsTweaksAddin, gbp_ctags_tweaks_addin, GBP, CTAGS_TWEAKS_ADDIN, IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/ctags/meson.build b/src/plugins/ctags/meson.build
index 0d58f1dbf..421e82d8f 100644
--- a/src/plugins/ctags/meson.build
+++ b/src/plugins/ctags/meson.build
@@ -14,6 +14,7 @@ plugins_sources += files([
   'ide-ctags-symbol-tree.c',
   'ide-ctags-util.c',
   'ide-tags-builder.c',
+  'gbp-ctags-tweaks-addin.c',
   'gbp-ctags-workbench-addin.c',
 ])
 
diff --git a/src/plugins/ctags/tweaks.ui b/src/plugins/ctags/tweaks.ui
new file mode 100644
index 000000000..93ebe755a
--- /dev/null
+++ b/src/plugins/ctags/tweaks.ui
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaks">
+    <child internal-child="visual_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="editor_page">
+          <object class="IdeTweaksPage">
+            <child internal-child="editor_plugins_section">
+              <object class="IdeTweaksSection">
+                <child>
+                  <object class="IdeTweaksPage" id="editor_plugins_ctags_page">
+                    <property name="title" translatable="yes">CTags</property>
+                    <child>
+                      <object class="IdeTweaksGroup">
+                        <property name="title" translatable="yes">Code Completion</property>
+                        <child>
+                          <object class="IdeTweaksSwitch">
+                            <property name="title" translatable="yes">CTags Proposals</property>
+                            <property name="subtitle" translatable="yes">Use CTags to suggest code 
completion proposals</property>
+                            <property 
name="action-name">settings.org.gnome.builder.code-insight.ctags-autocompletion</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksGroup">
+                        <child>
+                          <object class="IdeTweaksDirectory">
+                            <property name="is-directory">false</property>
+                            <property name="title" translatable="yes">CTags Path</property>
+                            <property name="subtitle" translatable="yes">The path to the ctags 
executable</property>
+                            <property name="settings">settings_org_gnome_builder_code_insight</property>
+                            <property name="key">ctags-path</property>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>


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