[gtksourceview/wip/chergert/vim] wire up command text as well



commit cf8cffdedc8bead2f592ba451206b4bc878bf18f
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 26 16:59:24 2021 -0700

    wire up command text as well
    
    we will want this so we can preview things as we type.

 tests/test-vim.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/tests/test-vim.c b/tests/test-vim.c
index c81242ba..fd3518f2 100644
--- a/tests/test-vim.c
+++ b/tests/test-vim.c
@@ -88,7 +88,9 @@ main (int argc,
        GtkIMContext *im_context;
        GtkEventController *key;
        GtkSourceBuffer *buffer;
-       GtkText *command_bar;
+       GtkLabel *command_bar;
+       GtkLabel *command;
+       GtkBox *box;
        GFile *file;
 
        gtk_init ();
@@ -113,18 +115,31 @@ main (int argc,
                             "top-margin", 6,
                             "left-margin", 6,
                             NULL);
+       box = g_object_new (GTK_TYPE_BOX,
+                           "orientation", GTK_ORIENTATION_HORIZONTAL,
+                           "hexpand", TRUE,
+                           NULL);
        command_bar = g_object_new (GTK_TYPE_LABEL,
+                                   "hexpand", TRUE,
                                    "xalign", 0.0f,
                                    "margin-top", 6,
                                    "margin-bottom", 6,
                                    NULL);
+       command = g_object_new (GTK_TYPE_LABEL,
+                               "xalign", 0.0f,
+                               "margin-top", 6,
+                               "margin-bottom", 6,
+                               NULL);
+       gtk_box_append (box, GTK_WIDGET (command_bar));
+       gtk_box_append (box, GTK_WIDGET (command));
 
        gtk_window_set_child (window, GTK_WIDGET (scroller));
        gtk_scrolled_window_set_child (scroller, GTK_WIDGET (view));
-       gtk_text_view_set_gutter (GTK_TEXT_VIEW (view), GTK_TEXT_WINDOW_BOTTOM, GTK_WIDGET (command_bar));
+       gtk_text_view_set_gutter (GTK_TEXT_VIEW (view), GTK_TEXT_WINDOW_BOTTOM, GTK_WIDGET (box));
 
        im_context = gtk_source_vim_im_context_new ();
        g_object_bind_property (im_context, "command-bar-text", command_bar, "label", G_BINDING_SYNC_CREATE);
+       g_object_bind_property (im_context, "command-text", command, "label", G_BINDING_SYNC_CREATE);
        g_signal_connect (im_context, "execute-command", G_CALLBACK (execute_command), NULL);
        gtk_im_context_set_client_widget (im_context, GTK_WIDGET (view));
 


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