Commit 0e3dee67 authored by Paolo Maggi's avatar Paolo Maggi

Added Shift+Ctrl+K keybinding to reset last searched text.

parent f956eed7
2006-01-05 Paolo Maggi <paolo@gnome.org>
* gedit/gedit-view.c (gedit_view_class_init): added reset_searched_text
signal and keybinding
(reset_searched_text): new function
* gedit/gedit-view.h: added reset_searched_text signal
2006-01-05 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-document.c (compute_num_of_lines): make utf8-aware.
......
......@@ -105,6 +105,8 @@ static gint gedit_view_focus_out (GtkWidget *widget,
static gboolean start_interactive_search (GeditView *view);
static gboolean start_interactive_goto_line (GeditView *view);
static gboolean reset_searched_text (GeditView *view);
static void hide_search_window (GeditView *view,
gboolean cancel);
......@@ -123,6 +125,7 @@ enum
{
START_INTERACTIVE_SEARCH,
START_INTERACTIVE_GOTO_LINE,
RESET_SEARCHED_TEXT,
LAST_SIGNAL
};
......@@ -162,6 +165,7 @@ gedit_view_class_init (GeditViewClass *klass)
klass->start_interactive_search = start_interactive_search;
klass->start_interactive_goto_line = start_interactive_goto_line;
klass->reset_searched_text = reset_searched_text;
textview_class->move_cursor = gedit_view_move_cursor;
view_signals[START_INTERACTIVE_SEARCH] =
......@@ -180,17 +184,30 @@ gedit_view_class_init (GeditViewClass *klass)
G_STRUCT_OFFSET (GeditViewClass, start_interactive_goto_line),
NULL, NULL,
gedit_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
G_TYPE_BOOLEAN, 0);
view_signals[RESET_SEARCHED_TEXT] =
g_signal_new ("reset_searched_text",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
G_STRUCT_OFFSET (GeditViewClass, reset_searched_text),
NULL, NULL,
gedit_marshal_BOOLEAN__NONE,
G_TYPE_BOOLEAN, 0);
g_type_class_add_private (klass, sizeof (GeditViewPrivate));
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_k, GDK_CONTROL_MASK, "start_interactive_search", 0);
gtk_binding_entry_add_signal (binding_set, GDK_K, GDK_CONTROL_MASK, "start_interactive_search", 0);
gtk_binding_entry_add_signal (binding_set, GDK_K, GDK_CONTROL_MASK, "start_interactive_search", 0);
gtk_binding_entry_add_signal (binding_set, GDK_i, GDK_CONTROL_MASK, "start_interactive_goto_line", 0);
gtk_binding_entry_add_signal (binding_set, GDK_I, GDK_CONTROL_MASK, "start_interactive_goto_line", 0);
gtk_binding_entry_add_signal (binding_set, GDK_I, GDK_CONTROL_MASK, "start_interactive_goto_line", 0);
gtk_binding_entry_add_signal (binding_set, GDK_k, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "reset_searched_text", 0);
gtk_binding_entry_add_signal (binding_set, GDK_K, GDK_CONTROL_MASK | GDK_SHIFT_MASK, "reset_searched_text", 0);
}
static void
......@@ -1736,6 +1753,19 @@ start_interactive_search_real (GeditView *view)
return TRUE;
}
static gboolean
reset_searched_text (GeditView *view)
{
GeditDocument *doc;
g_print ("Reset!");
doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
gedit_document_set_search_text (doc, "", GEDIT_SEARCH_DONT_SET_FLAGS);
return TRUE;
}
static gboolean
start_interactive_search (GeditView *view)
{
......
......@@ -74,8 +74,11 @@ struct _GeditViewClass
GtkSourceViewClass parent_class;
/* FIXME: Do we need placeholders ? */
/* Key bindings */
gboolean (* start_interactive_search) (GeditView *view);
gboolean (* start_interactive_goto_line)(GeditView *view);
gboolean (* reset_searched_text) (GeditView *view);
};
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment