[gnome-builder] plugins/clang: extend text editor tweaks for clang



commit ac16fab234bb3201c3516e763e5cc3589c689fc1
Author: Christian Hergert <chergert redhat com>
Date:   Thu Aug 18 15:52:05 2022 -0700

    plugins/clang: extend text editor tweaks for clang

 src/plugins/clang/clang-plugin.c           |  4 +++
 src/plugins/clang/clang.gresource.xml      |  1 +
 src/plugins/clang/clang.plugin             |  1 +
 src/plugins/clang/gbp-clang-tweaks-addin.c | 44 ++++++++++++++++++++++++++++
 src/plugins/clang/gbp-clang-tweaks-addin.h | 31 ++++++++++++++++++++
 src/plugins/clang/meson.build              |  1 +
 src/plugins/clang/tweaks.ui                | 47 ++++++++++++++++++++++++++++++
 7 files changed, 129 insertions(+)
---
diff --git a/src/plugins/clang/clang-plugin.c b/src/plugins/clang/clang-plugin.c
index da43703fd..7b72ba413 100644
--- a/src/plugins/clang/clang-plugin.c
+++ b/src/plugins/clang/clang-plugin.c
@@ -40,6 +40,7 @@
 #include "ide-clang-symbol-node.h"
 #include "ide-clang-symbol-resolver.h"
 #include "ide-clang-symbol-tree.h"
+#include "gbp-clang-tweaks-addin.h"
 
 _IDE_EXTERN void
 _ide_clang_register_types (PeasObjectModule *module)
@@ -65,4 +66,7 @@ _ide_clang_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_RENAME_PROVIDER,
                                               IDE_TYPE_CLANG_RENAME_PROVIDER);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TWEAKS_ADDIN,
+                                              GBP_TYPE_CLANG_TWEAKS_ADDIN);
 }
diff --git a/src/plugins/clang/clang.gresource.xml b/src/plugins/clang/clang.gresource.xml
index 0514f91bb..76033bbaf 100644
--- a/src/plugins/clang/clang.gresource.xml
+++ b/src/plugins/clang/clang.gresource.xml
@@ -2,5 +2,6 @@
 <gresources>
   <gresource prefix="/plugins/clang">
     <file>clang.plugin</file>
+    <file preprocess="xml-stripblanks">tweaks.ui</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/clang/clang.plugin b/src/plugins/clang/clang.plugin
index c21f74810..f0722a114 100644
--- a/src/plugins/clang/clang.plugin
+++ b/src/plugins/clang/clang.plugin
@@ -2,6 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2015 Christian Hergert
+Depends=editorui;
 Description=Provides integration with Clang
 Embedded=_ide_clang_register_types
 Module=clang
diff --git a/src/plugins/clang/gbp-clang-tweaks-addin.c b/src/plugins/clang/gbp-clang-tweaks-addin.c
new file mode 100644
index 000000000..0205abff7
--- /dev/null
+++ b/src/plugins/clang/gbp-clang-tweaks-addin.c
@@ -0,0 +1,44 @@
+/* gbp-clang-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-clang-tweaks-addin"
+
+#include "config.h"
+
+#include "gbp-clang-tweaks-addin.h"
+
+struct _GbpClangTweaksAddin
+{
+  IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpClangTweaksAddin, gbp_clang_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_clang_tweaks_addin_class_init (GbpClangTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_clang_tweaks_addin_init (GbpClangTweaksAddin *self)
+{
+  ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+                                       IDE_STRV_INIT ("/plugins/clang/tweaks.ui"));
+}
diff --git a/src/plugins/clang/gbp-clang-tweaks-addin.h b/src/plugins/clang/gbp-clang-tweaks-addin.h
new file mode 100644
index 000000000..b77140af2
--- /dev/null
+++ b/src/plugins/clang/gbp-clang-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-clang-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_CLANG_TWEAKS_ADDIN (gbp_clang_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpClangTweaksAddin, gbp_clang_tweaks_addin, GBP, CLANG_TWEAKS_ADDIN, IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/clang/meson.build b/src/plugins/clang/meson.build
index bdd6e8a64..bc5554112 100644
--- a/src/plugins/clang/meson.build
+++ b/src/plugins/clang/meson.build
@@ -15,6 +15,7 @@ plugins_sources += files([
   'ide-clang-symbol-node.c',
   'ide-clang-symbol-resolver.c',
   'ide-clang-symbol-tree.c',
+  'gbp-clang-tweaks-addin.c',
 ])
 
 gnome_builder_clang_sources = [
diff --git a/src/plugins/clang/tweaks.ui b/src/plugins/clang/tweaks.ui
new file mode 100644
index 000000000..0acc371f6
--- /dev/null
+++ b/src/plugins/clang/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_clang_page">
+                    <property name="title" translatable="yes">Clang</property>
+                    <child>
+                      <object class="IdeTweaksSettings" id="settings_org_gnome_builder_clang">
+                        <property name="schema-id">org.gnome.builder.clang</property>
+                        <property name="application-only">true</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="IdeTweaksGroup">
+                        <property name="title" translatable="yes">Code Completion</property>
+                        <child>
+                          <object class="IdeTweaksSwitch">
+                            <property name="title" translatable="yes">Complete Parentheses</property>
+                            <property name="subtitle" translatable="yes">Include parentheses when completing 
clang proposals</property>
+                            <property 
name="action-name">settings.org.gnome.builder.clang.complete-parens</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="IdeTweaksSwitch">
+                            <property name="title" translatable="yes">Complete Parameters</property>
+                            <property name="subtitle" translatable="yes">Include parameters and type 
information when completing clang proposals</property>
+                            <property 
name="action-name">settings.org.gnome.builder.clang.complete-params</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]