[gtksourceview/wip/chergert/vim] add command bar text helper



commit 7e0a34496357188a9c6a7599e6e8b219a904d58c
Author: Christian Hergert <chergert redhat com>
Date:   Fri Oct 29 16:23:41 2021 -0700

    add command bar text helper

 gtksourceview/vim/gtk-source-vim-state.h | 35 ++++++++++++++++----------------
 gtksourceview/vim/gtk-source-vim.c       |  5 +++++
 2 files changed, 23 insertions(+), 17 deletions(-)
---
diff --git a/gtksourceview/vim/gtk-source-vim-state.h b/gtksourceview/vim/gtk-source-vim-state.h
index e2de544c..b8ec2e04 100644
--- a/gtksourceview/vim/gtk-source-vim-state.h
+++ b/gtksourceview/vim/gtk-source-vim-state.h
@@ -37,23 +37,24 @@ struct _GtkSourceVimStateClass
 
        const char *command_bar_text;
 
-       void     (*view_set)        (GtkSourceVimState *state);
-       void     (*enter)           (GtkSourceVimState *state);
-       void     (*suspend)         (GtkSourceVimState *state,
-                                    GtkSourceVimState *to);
-       void     (*resume)          (GtkSourceVimState *state,
-                                    GtkSourceVimState *from);
-       void     (*leave)           (GtkSourceVimState *state);
-       gboolean (*handle_event)    (GtkSourceVimState *state,
-                                    GdkEvent          *event);
-       gboolean (*handle_keypress) (GtkSourceVimState *state,
-                                    guint              keyval,
-                                    guint              keycode,
-                                    GdkModifierType    mods,
-                                    const char        *string);
-       void     (*repeat)          (GtkSourceVimState *state);
-       void     (*append_command)  (GtkSourceVimState *state,
-                                    GString           *string);
+       const char *(*get_command_bar_text) (GtkSourceVimState *self);
+       void        (*view_set)             (GtkSourceVimState *self);
+       void        (*enter)                (GtkSourceVimState *self);
+       void        (*suspend)              (GtkSourceVimState *self,
+                                            GtkSourceVimState *to);
+       void        (*resume)               (GtkSourceVimState *self,
+                                            GtkSourceVimState *from);
+       void        (*leave)                (GtkSourceVimState *self);
+       gboolean    (*handle_event)         (GtkSourceVimState *self,
+                                            GdkEvent          *event);
+       gboolean    (*handle_keypress)      (GtkSourceVimState *self,
+                                            guint              keyval,
+                                            guint              keycode,
+                                            GdkModifierType    mods,
+                                            const char        *string);
+       void        (*repeat)               (GtkSourceVimState *self);
+       void        (*append_command)       (GtkSourceVimState *self,
+                                            GString           *string);
 };
 
 void               gtk_source_vim_state_set_parent            (GtkSourceVimState *self,
diff --git a/gtksourceview/vim/gtk-source-vim.c b/gtksourceview/vim/gtk-source-vim.c
index 20eaaa8d..6a995c34 100644
--- a/gtksourceview/vim/gtk-source-vim.c
+++ b/gtksourceview/vim/gtk-source-vim.c
@@ -255,6 +255,11 @@ gtk_source_vim_get_command_bar_text (GtkSourceVim *self)
                return gtk_source_vim_command_bar_get_text (GTK_SOURCE_VIM_COMMAND_BAR (current));
        }
 
+       if (GTK_SOURCE_VIM_STATE_GET_CLASS (current)->get_command_bar_text)
+       {
+               return GTK_SOURCE_VIM_STATE_GET_CLASS (current)->get_command_bar_text (current);
+       }
+
        if (GTK_SOURCE_VIM_STATE_GET_CLASS (current)->command_bar_text)
        {
                return GTK_SOURCE_VIM_STATE_GET_CLASS (current)->command_bar_text;


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