[gnome-builder/wip/gtk4-port: 398/736] plugins/vim: port to GTK 4
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 398/736] plugins/vim: port to GTK 4
- Date: Tue, 26 Apr 2022 01:46:25 +0000 (UTC)
commit 2f69be3bc9f2f40b0f4de2ca94156e19524e46c8
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 4 18:04:22 2022 -0700
plugins/vim: port to GTK 4
This is just a start by removing the old legacy command stuff which will
not be needed with GTK 4 and making the preferences addin compile. That
may still need more work (butin libide-gui).
Up next in this will be to add the statusbar control and what not.
src/plugins/meson.build | 2 +-
src/plugins/vim/gb-vim.c | 1683 ---------------------------
src/plugins/vim/gb-vim.h | 48 -
src/plugins/vim/gbp-vim-command-provider.c | 121 --
src/plugins/vim/gbp-vim-command-provider.h | 31 -
src/plugins/vim/gbp-vim-command.c | 154 ---
src/plugins/vim/gbp-vim-command.h | 36 -
src/plugins/vim/gbp-vim-preferences-addin.c | 43 +-
src/plugins/vim/gbp-vim-preferences-addin.h | 2 +-
src/plugins/vim/meson.build | 3 -
src/plugins/vim/vim-plugin.c | 5 +-
src/plugins/vim/vim.gresource.xml | 1 -
src/plugins/vim/vim.plugin | 3 +-
13 files changed, 25 insertions(+), 2107 deletions(-)
---
diff --git a/src/plugins/meson.build b/src/plugins/meson.build
index 469a64281..012ea8ff7 100644
--- a/src/plugins/meson.build
+++ b/src/plugins/meson.build
@@ -138,7 +138,7 @@ subdir('update-manager')
#subdir('vala-pack')
#subdir('valgrind')
subdir('vcsui')
-#subdir('vim')
+subdir('vim')
#subdir('vls')
subdir('waf')
#subdir('words')
diff --git a/src/plugins/vim/gbp-vim-preferences-addin.c b/src/plugins/vim/gbp-vim-preferences-addin.c
index b29f090d8..232dea357 100644
--- a/src/plugins/vim/gbp-vim-preferences-addin.c
+++ b/src/plugins/vim/gbp-vim-preferences-addin.c
@@ -23,6 +23,7 @@
#include "config.h"
#include <glib/gi18n.h>
+
#include <libide-gui.h>
#include "gbp-vim-preferences-addin.h"
@@ -30,41 +31,40 @@
struct _GbpVimPreferencesAddin
{
GObject parent_instance;
- guint keybinding_id;
+};
+
+static const IdePreferenceItemEntry items[] = {
+ { "keyboard", "keybindings", "vim", 0, ide_preferences_window_check,
+ N_("Vim"),
+ N_("Emulate keyboard shortcuts from Vim"),
+ "org.gnome.builder.editor", NULL, "keybindings", "'vim'" },
};
static void
-gbp_vim_preferences_addin_load (IdePreferencesAddin *addin,
- DzlPreferences *preferences)
+gbp_vim_preferences_addin_load (IdePreferencesAddin *addin,
+ IdePreferencesWindow *window)
{
GbpVimPreferencesAddin *self = (GbpVimPreferencesAddin *)addin;
+ IDE_ENTRY;
+
g_assert (GBP_IS_VIM_PREFERENCES_ADDIN (self));
- g_assert (DZL_IS_PREFERENCES (preferences));
-
- self->keybinding_id = dzl_preferences_add_radio (preferences,
- "keyboard",
- "mode",
- "org.gnome.builder.editor",
- "keybindings",
- NULL,
- "\"vim\"",
- _("Vim"),
- _("Emulates the Vim text editor"),
- NULL,
- 30);
+ g_assert (IDE_IS_PREFERENCES_WINDOW (window));
+
+ ide_preferences_window_add_items (window, items, G_N_ELEMENTS (items), window, NULL);
+
+ IDE_EXIT;
}
static void
-gbp_vim_preferences_addin_unload (IdePreferencesAddin *addin,
- DzlPreferences *preferences)
+gbp_vim_preferences_addin_unload (IdePreferencesAddin *addin,
+ IdePreferencesWindow *window)
{
GbpVimPreferencesAddin *self = (GbpVimPreferencesAddin *)addin;
g_assert (GBP_IS_VIM_PREFERENCES_ADDIN (self));
- g_assert (DZL_IS_PREFERENCES (preferences));
+ g_assert (IDE_IS_PREFERENCES_WINDOW (window));
- dzl_preferences_remove_id (preferences, self->keybinding_id);
}
static void
@@ -75,8 +75,7 @@ preferences_addin_iface_init (IdePreferencesAddinInterface *iface)
}
G_DEFINE_FINAL_TYPE_WITH_CODE (GbpVimPreferencesAddin, gbp_vim_preferences_addin, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (IDE_TYPE_PREFERENCES_ADDIN,
- preferences_addin_iface_init))
+ G_IMPLEMENT_INTERFACE (IDE_TYPE_PREFERENCES_ADDIN,
preferences_addin_iface_init))
static void
gbp_vim_preferences_addin_class_init (GbpVimPreferencesAddinClass *klass)
diff --git a/src/plugins/vim/gbp-vim-preferences-addin.h b/src/plugins/vim/gbp-vim-preferences-addin.h
index 7a8663cf4..d20fda95f 100644
--- a/src/plugins/vim/gbp-vim-preferences-addin.h
+++ b/src/plugins/vim/gbp-vim-preferences-addin.h
@@ -1,6 +1,6 @@
/* gbp-vim-preferences-addin.h
*
- * Copyright 2018-2019 Christian Hergert <chergert redhat com>
+ * 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
diff --git a/src/plugins/vim/meson.build b/src/plugins/vim/meson.build
index fcdcde818..ec147497c 100644
--- a/src/plugins/vim/meson.build
+++ b/src/plugins/vim/meson.build
@@ -1,8 +1,5 @@
plugins_sources += files([
'vim-plugin.c',
- 'gb-vim.c',
- 'gbp-vim-command.c',
- 'gbp-vim-command-provider.c',
'gbp-vim-preferences-addin.c',
])
diff --git a/src/plugins/vim/vim-plugin.c b/src/plugins/vim/vim-plugin.c
index 5a4cca438..d35b539e3 100644
--- a/src/plugins/vim/vim-plugin.c
+++ b/src/plugins/vim/vim-plugin.c
@@ -23,10 +23,10 @@
#include "config.h"
#include <libpeas/peas.h>
+
#include <libide-core.h>
#include <libide-gui.h>
-#include "gbp-vim-command-provider.h"
#include "gbp-vim-preferences-addin.h"
_IDE_EXTERN void
@@ -35,7 +35,4 @@ _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_COMMAND_PROVIDER,
- GBP_TYPE_VIM_COMMAND_PROVIDER);
}
diff --git a/src/plugins/vim/vim.gresource.xml b/src/plugins/vim/vim.gresource.xml
index 6d08eaaf2..6db9e6389 100644
--- a/src/plugins/vim/vim.gresource.xml
+++ b/src/plugins/vim/vim.gresource.xml
@@ -2,6 +2,5 @@
<gresources>
<gresource prefix="/plugins/vim">
<file>vim.plugin</file>
- <file>keybindings/vim.css</file>
</gresource>
</gresources>
diff --git a/src/plugins/vim/vim.plugin b/src/plugins/vim/vim.plugin
index 5d9d0ef21..c134f97c6 100644
--- a/src/plugins/vim/vim.plugin
+++ b/src/plugins/vim/vim.plugin
@@ -1,9 +1,8 @@
[Plugin]
Authors=Christian Hergert <christian hergert me>
Builtin=true
-Copyright=Copyright © 2015-2018 Christian Hergert
+Copyright=Copyright © 2015-2022 Christian Hergert
Description=Emulation of various VIM features
Embedded=_gbp_vim_register_types
-Hidden=true
Module=vim
Name=VIM Emulation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]