[gnome-builder/wip/vim] vim: add a GtkEntry to be used for vim command entry
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] vim: add a GtkEntry to be used for vim command entry
- Date: Wed, 1 Oct 2014 01:45:46 +0000 (UTC)
commit f51409489187547a8fef6f3e8e1dc27c9c3a7ecc
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 30 18:45:40 2014 -0700
vim: add a GtkEntry to be used for vim command entry
src/editor/gb-editor-tab-private.h | 1 +
src/editor/gb-editor-tab.c | 3 +++
src/editor/gb-editor-vim.c | 10 +++++++++-
src/resources/ui/gb-editor-tab.ui | 10 +++++++++-
4 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-editor-tab-private.h b/src/editor/gb-editor-tab-private.h
index eb352ba..89010ba 100644
--- a/src/editor/gb-editor-tab-private.h
+++ b/src/editor/gb-editor-tab-private.h
@@ -106,6 +106,7 @@ struct _GbEditorTabPrivate
GbSourceView *source_view;
GdTaggedEntry *search_entry;
GdTaggedEntryTag *search_entry_tag;
+ GtkEntry *vim_command_entry;
/*
* Information about our target file and encoding.
diff --git a/src/editor/gb-editor-tab.c b/src/editor/gb-editor-tab.c
index 65672c5..e70d470 100644
--- a/src/editor/gb-editor-tab.c
+++ b/src/editor/gb-editor-tab.c
@@ -1129,6 +1129,7 @@ gb_editor_tab_constructed (GObject *object)
gtk_source_gutter_insert (gutter, priv->change_renderer, 0);
priv->vim = g_object_new (GB_TYPE_EDITOR_VIM,
+ "command-entry", priv->vim_command_entry,
"enabled", TRUE,
"text-view", priv->source_view,
NULL);
@@ -1352,6 +1353,8 @@ gb_editor_tab_class_init (GbEditorTabClass *klass)
snippets_provider);
gtk_widget_class_bind_template_child_private (widget_class, GbEditorTab,
source_view);
+ gtk_widget_class_bind_template_child_private (widget_class, GbEditorTab,
+ vim_command_entry);
g_type_ensure (GB_TYPE_EDITOR_DOCUMENT);
g_type_ensure (GB_TYPE_SOURCE_CHANGE_MONITOR);
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index ac2d51f..7ae5b26 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -136,7 +136,12 @@ gb_editor_vim_set_mode (GbEditorVim *vim,
{
gtk_widget_set_visible (GTK_WIDGET (vim->priv->command_entry),
(mode == GB_EDITOR_VIM_COMMAND));
- gtk_widget_grab_focus (GTK_WIDGET (vim->priv->command_entry));
+ gtk_editable_set_editable (GTK_EDITABLE (vim->priv->command_entry),
+ (mode == GB_EDITOR_VIM_COMMAND));
+ if (mode == GB_EDITOR_VIM_COMMAND)
+ gtk_widget_grab_focus (GTK_WIDGET (vim->priv->command_entry));
+ else
+ gtk_widget_grab_focus (GTK_WIDGET (vim->priv->text_view));
}
/*
@@ -1352,7 +1357,10 @@ gb_editor_vim_command_entry_activate_cb (GtkEntry *entry,
g_return_if_fail (GB_IS_EDITOR_VIM (vim));
text = gtk_entry_get_text (entry);
+
g_print ("Execute Command Line: \"%s\"\n", text);
+
+ gb_editor_vim_set_mode (vim, GB_EDITOR_VIM_NORMAL);
}
static gboolean
diff --git a/src/resources/ui/gb-editor-tab.ui b/src/resources/ui/gb-editor-tab.ui
index 79edb6a..ffec2f2 100644
--- a/src/resources/ui/gb-editor-tab.ui
+++ b/src/resources/ui/gb-editor-tab.ui
@@ -32,7 +32,7 @@
<property name="halign">fill</property>
<property name="valign">start</property>
<property name="fraction">0.0</property>
- <style>
+ <style>
<class name="osd"/>
</style>
</object>
@@ -45,6 +45,14 @@
</object>
</child>
<child type="overlay">
+ <object class="GtkEntry" id="vim_command_entry">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="valign">end</property>
+ <property name="width_chars">20</property>
+ </object>
+ </child>
+ <child type="overlay">
<object class="GtkRevealer" id="revealer">
<property name="visible">True</property>
<property name="can_focus">False</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]