[gtksourceview/wip/chergert/vim: 161/293] add visual stub




commit 437fa1a148ccbaccdf3cfd0d2dac9966a8d4cc87
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 29 16:23:49 2021 -0700

    add visual stub

 gtksourceview/vim/gtk-source-vim-visual.c | 91 +++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)
---
diff --git a/gtksourceview/vim/gtk-source-vim-visual.c b/gtksourceview/vim/gtk-source-vim-visual.c
new file mode 100644
index 00000000..4190ad21
--- /dev/null
+++ b/gtksourceview/vim/gtk-source-vim-visual.c
@@ -0,0 +1,91 @@
+/*
+ * This file is part of GtkSourceView
+ *
+ * Copyright 2021 Christian Hergert <chergert redhat com>
+ *
+ * GtkSourceView is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * GtkSourceView 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "gtk-source-vim-visual.h"
+
+struct _GtkSourceVimVisual
+{
+       GtkSourceVimState parent_class;
+       GtkSourceVimVisualMode mode;
+};
+
+G_DEFINE_TYPE (GtkSourceVimVisual, gtk_source_vim_visual, GTK_SOURCE_TYPE_VIM_STATE)
+
+static const char *
+gtk_source_vim_visual_get_command_bar_text (GtkSourceVimState *state)
+{
+       GtkSourceVimVisual *self = (GtkSourceVimVisual *)state;
+
+       g_assert (GTK_SOURCE_IS_VIM_VISUAL (self));
+
+       switch (self->mode)
+       {
+               case GTK_SOURCE_VIM_VISUAL_CHAR:
+                       return _("-- VISUAL --");
+
+               case GTK_SOURCE_VIM_VISUAL_LINE:
+                       return _("-- VISUAL LINE --");
+
+               case GTK_SOURCE_VIM_VISUAL_BLOCK:
+                       return _("-- VISUAL BLOCK --");
+
+               default:
+                       g_assert_not_reached ();
+                       return NULL;
+       }
+}
+
+static void
+gtk_source_vim_visual_dispose (GObject *object)
+{
+       G_OBJECT_CLASS (gtk_source_vim_visual_parent_class)->dispose (object);
+}
+
+static void
+gtk_source_vim_visual_class_init (GtkSourceVimVisualClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkSourceVimStateClass *state_class = GTK_SOURCE_VIM_STATE_CLASS (klass);
+
+       object_class->dispose = gtk_source_vim_visual_dispose;
+
+       state_class->get_command_bar_text = gtk_source_vim_visual_get_command_bar_text;
+}
+
+static void
+gtk_source_vim_visual_init (GtkSourceVimVisual *self)
+{
+}
+
+GtkSourceVimState *
+gtk_source_vim_visual_new (GtkSourceVimVisualMode mode)
+{
+       GtkSourceVimVisual *self;
+
+       self = g_object_new (GTK_SOURCE_TYPE_VIM_VISUAL, NULL);
+       self->mode = mode;
+
+       return GTK_SOURCE_VIM_STATE (self);
+}


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