[gnome-builder] plugins/vim: add tweak to set vim shortcut theme



commit e5bab12e6d73a92844625d4d1545eb4c6dcaa6d5
Author: Christian Hergert <chergert redhat com>
Date:   Tue Aug 16 14:36:15 2022 -0700

    plugins/vim: add tweak to set vim shortcut theme

 src/plugins/vim/gbp-vim-tweaks-addin.c | 46 ++++++++++++++++++++++++++++++++++
 src/plugins/vim/gbp-vim-tweaks-addin.h | 31 +++++++++++++++++++++++
 src/plugins/vim/meson.build            |  1 +
 src/plugins/vim/tweaks.ui              | 27 ++++++++++++++++++++
 src/plugins/vim/vim-plugin.c           |  5 ++++
 src/plugins/vim/vim.gresource.xml      |  1 +
 src/plugins/vim/vim.plugin             |  1 +
 7 files changed, 112 insertions(+)
---
diff --git a/src/plugins/vim/gbp-vim-tweaks-addin.c b/src/plugins/vim/gbp-vim-tweaks-addin.c
new file mode 100644
index 000000000..35dbf6ff3
--- /dev/null
+++ b/src/plugins/vim/gbp-vim-tweaks-addin.c
@@ -0,0 +1,46 @@
+/* gbp-vim-tweaks-addin.c
+ *
+ * Copyright 2018-2019 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-vim-tweaks-addin"
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "gbp-vim-tweaks-addin.h"
+
+struct _GbpVimTweaksAddin
+{
+  IdeTweaksAddin parent_instance;
+};
+
+G_DEFINE_FINAL_TYPE (GbpVimTweaksAddin, gbp_vim_tweaks_addin, IDE_TYPE_TWEAKS_ADDIN)
+
+static void
+gbp_vim_tweaks_addin_class_init (GbpVimTweaksAddinClass *klass)
+{
+}
+
+static void
+gbp_vim_tweaks_addin_init (GbpVimTweaksAddin *self)
+{
+  ide_tweaks_addin_set_resource_paths (IDE_TWEAKS_ADDIN (self),
+                                       IDE_STRV_INIT ("/plugins/vim/tweaks.ui"));
+}
diff --git a/src/plugins/vim/gbp-vim-tweaks-addin.h b/src/plugins/vim/gbp-vim-tweaks-addin.h
new file mode 100644
index 000000000..d40bb44ef
--- /dev/null
+++ b/src/plugins/vim/gbp-vim-tweaks-addin.h
@@ -0,0 +1,31 @@
+/* gbp-vim-tweaks-addin.h
+ *
+ * Copyright 2018-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_VIM_TWEAKS_ADDIN (gbp_vim_tweaks_addin_get_type())
+
+G_DECLARE_FINAL_TYPE (GbpVimTweaksAddin, gbp_vim_tweaks_addin, GBP, VIM_TWEAKS_ADDIN, IdeTweaksAddin)
+
+G_END_DECLS
diff --git a/src/plugins/vim/meson.build b/src/plugins/vim/meson.build
index 8fdfd0080..81cdd41a2 100644
--- a/src/plugins/vim/meson.build
+++ b/src/plugins/vim/meson.build
@@ -2,6 +2,7 @@ plugins_sources += files([
   'vim-plugin.c',
   'gbp-vim-editor-page-addin.c',
   'gbp-vim-preferences-addin.c',
+  'gbp-vim-tweaks-addin.c',
   'gbp-vim-workspace-addin.c',
 ])
 
diff --git a/src/plugins/vim/tweaks.ui b/src/plugins/vim/tweaks.ui
new file mode 100644
index 000000000..4847e1579
--- /dev/null
+++ b/src/plugins/vim/tweaks.ui
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="IdeTweaks">
+    <child internal-child="visual_section">
+      <object class="IdeTweaksSection">
+        <child internal-child="shortcuts_page">
+          <object class="IdeTweaksPage">
+            <child internal-child="shorcut_theme_group">
+              <object class="IdeTweaksGroup">
+                <child internal-child="shortcut_theme_combo">
+                  <object class="IdeTweaksCombo">
+                    <child>
+                      <object class="IdeTweaksChoice">
+                        <property name="title" translatable="yes">Vim</property>
+                        <property name="action-target">'vim'</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/plugins/vim/vim-plugin.c b/src/plugins/vim/vim-plugin.c
index 417836cd2..134a58c9e 100644
--- a/src/plugins/vim/vim-plugin.c
+++ b/src/plugins/vim/vim-plugin.c
@@ -27,9 +27,11 @@
 #include <libide-core.h>
 #include <libide-gui.h>
 #include <libide-editor.h>
+#include <libide-tweaks.h>
 
 #include "gbp-vim-editor-page-addin.h"
 #include "gbp-vim-preferences-addin.h"
+#include "gbp-vim-tweaks-addin.h"
 #include "gbp-vim-workspace-addin.h"
 
 _IDE_EXTERN void
@@ -41,6 +43,9 @@ _gbp_vim_register_types (PeasObjectModule *module)
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_PREFERENCES_ADDIN,
                                               GBP_TYPE_VIM_PREFERENCES_ADDIN);
+  peas_object_module_register_extension_type (module,
+                                              IDE_TYPE_TWEAKS_ADDIN,
+                                              GBP_TYPE_VIM_TWEAKS_ADDIN);
   peas_object_module_register_extension_type (module,
                                               IDE_TYPE_WORKSPACE_ADDIN,
                                               GBP_TYPE_VIM_WORKSPACE_ADDIN);
diff --git a/src/plugins/vim/vim.gresource.xml b/src/plugins/vim/vim.gresource.xml
index 6db9e6389..2e4c5e02d 100644
--- a/src/plugins/vim/vim.gresource.xml
+++ b/src/plugins/vim/vim.gresource.xml
@@ -2,5 +2,6 @@
 <gresources>
   <gresource prefix="/plugins/vim">
     <file>vim.plugin</file>
+    <file preprocess="xml-stripblanks">tweaks.ui</file>
   </gresource>
 </gresources>
diff --git a/src/plugins/vim/vim.plugin b/src/plugins/vim/vim.plugin
index 6decdc4ad..6fc1c9e4e 100644
--- a/src/plugins/vim/vim.plugin
+++ b/src/plugins/vim/vim.plugin
@@ -2,6 +2,7 @@
 Authors=Christian Hergert <christian hergert me>
 Builtin=true
 Copyright=Copyright © 2015-2022 Christian Hergert
+Depends=editorui
 Description=Emulation of various VIM features
 Embedded=_gbp_vim_register_types
 Module=vim


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