[gnome-builder/wip/vim] editor: allow initializing find with the search text.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/vim] editor: allow initializing find with the search text.
- Date: Tue, 30 Sep 2014 07:50:05 +0000 (UTC)
commit a19f4098c16b9c2004577392a552ff45b0d5b10a
Author: Christian Hergert <christian hergert me>
Date: Tue Sep 30 00:49:57 2014 -0700
editor: allow initializing find with the search text.
src/editor/gb-editor-commands.c | 2 +-
src/editor/gb-editor-tab.c | 4 ++++
src/editor/gb-editor-vim.c | 3 ++-
src/editor/gb-source-view.c | 10 ++++++----
src/editor/gb-source-view.h | 6 ++++--
5 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/editor/gb-editor-commands.c b/src/editor/gb-editor-commands.c
index d4d7cda..738caae 100644
--- a/src/editor/gb-editor-commands.c
+++ b/src/editor/gb-editor-commands.c
@@ -218,7 +218,7 @@ gb_editor_commands_find (GbEditorWorkspace *workspace,
{
ENTRY;
g_return_if_fail (GB_IS_EDITOR_TAB (tab));
- gb_source_view_begin_search (tab->priv->source_view);
+ gb_source_view_begin_search (tab->priv->source_view, NULL);
EXIT;
}
diff --git a/src/editor/gb-editor-tab.c b/src/editor/gb-editor-tab.c
index 3bea8a2..0564546 100644
--- a/src/editor/gb-editor-tab.c
+++ b/src/editor/gb-editor-tab.c
@@ -886,6 +886,7 @@ on_source_view_push_snippet (GbSourceView *source_view,
static void
on_source_view_begin_search (GbSourceView *source_view,
+ const gchar *search_text,
GbEditorTab *tab)
{
GbEditorTabPrivate *priv;
@@ -895,6 +896,9 @@ on_source_view_begin_search (GbSourceView *source_view,
priv = tab->priv;
+ if (search_text)
+ gtk_entry_set_text (GTK_ENTRY (priv->search_entry), search_text);
+
gtk_revealer_set_reveal_child (priv->revealer, TRUE);
gtk_source_search_context_set_highlight (priv->search_context, TRUE);
gtk_widget_grab_focus (GTK_WIDGET (priv->search_entry));
diff --git a/src/editor/gb-editor-vim.c b/src/editor/gb-editor-vim.c
index 381bc48..46d1263 100644
--- a/src/editor/gb-editor-vim.c
+++ b/src/editor/gb-editor-vim.c
@@ -1101,7 +1101,8 @@ gb_editor_vim_handle_normal (GbEditorVim *vim,
*/
if (GB_IS_SOURCE_VIEW (vim->priv->text_view))
{
- gb_source_view_begin_search (GB_SOURCE_VIEW (vim->priv->text_view));
+ gb_source_view_begin_search (GB_SOURCE_VIEW (vim->priv->text_view),
+ NULL);
return TRUE;
}
diff --git a/src/editor/gb-source-view.c b/src/editor/gb-source-view.c
index 48bad47..294dbc3 100644
--- a/src/editor/gb-source-view.c
+++ b/src/editor/gb-source-view.c
@@ -75,11 +75,12 @@ static GParamSpec *gParamSpecs [LAST_PROP];
static guint gSignals [LAST_SIGNAL];
void
-gb_source_view_begin_search (GbSourceView *view)
+gb_source_view_begin_search (GbSourceView *view,
+ const gchar *search_text)
{
g_return_if_fail (GB_IS_SOURCE_VIEW (view));
- g_signal_emit (view, gSignals [BEGIN_SEARCH], 0);
+ g_signal_emit (view, gSignals [BEGIN_SEARCH], 0, search_text);
}
static void
@@ -1478,9 +1479,10 @@ gb_source_view_class_init (GbSourceViewClass *klass)
G_STRUCT_OFFSET (GbSourceViewClass, begin_search),
NULL,
NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE,
- 0);
+ 1,
+ G_TYPE_STRING);
}
static void
diff --git a/src/editor/gb-source-view.h b/src/editor/gb-source-view.h
index bbdf45e..af4081e 100644
--- a/src/editor/gb-source-view.h
+++ b/src/editor/gb-source-view.h
@@ -56,7 +56,8 @@ struct _GbSourceViewClass
GtkTextIter *location);
void (*pop_snippet) (GbSourceView *view,
GbSourceSnippet *snippet);
- void (*begin_search) (GbSourceView *view);
+ void (*begin_search) (GbSourceView *view,
+ const gchar *search_text);
};
GType gb_source_view_get_type (void) G_GNUC_CONST;
@@ -69,7 +70,8 @@ void gb_source_view_set_show_shadow (GbSourceView *v
GbSourceAutoIndenter *gb_source_view_get_auto_indenter (GbSourceView *view);
void gb_source_view_set_auto_indenter (GbSourceView *view,
GbSourceAutoIndenter *auto_indenter);
-void gb_source_view_begin_search (GbSourceView *view);
+void gb_source_view_begin_search (GbSourceView *view,
+ const gchar *search_text);
void gb_source_view_indent_selection (GbSourceView *view);
void gb_source_view_unindent_selection (GbSourceView *view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]