diff options
author | Matthias Clasen <mclasen@redhat.com> | 2007-05-18 22:29:55 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2007-05-18 22:29:55 +0000 |
commit | 26e5d4d6f745eed6330c568f3959a29bf7e95556 (patch) | |
tree | 0298c1d4b7e96bf56ac1eb5f7571ca0cf6f8e2f0 /gtk/gtktextview.c | |
parent | b82c9dc589e7c1cf3e6a4aad5b3ebbdeab292b12 (diff) | |
download | gtk+-26e5d4d6f745eed6330c568f3959a29bf7e95556.tar.gz |
Add a toggle-cursor-visibility keybinding signal, and bind F7 to it.
2007-05-18 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextview.c: Add a toggle-cursor-visibility keybinding
signal, and bind F7 to it. (#380048, Tim Miao)
svn path=/trunk/; revision=17869
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r-- | gtk/gtktextview.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 42f47c50fe..df238b3899 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -136,6 +136,7 @@ enum MOVE_FOCUS, MOVE_VIEWPORT, SELECT_ALL, + TOGGLE_CURSOR_VISIBLE, LAST_SIGNAL }; @@ -276,6 +277,7 @@ static void gtk_text_view_cut_clipboard (GtkTextView *text_view); static void gtk_text_view_copy_clipboard (GtkTextView *text_view); static void gtk_text_view_paste_clipboard (GtkTextView *text_view); static void gtk_text_view_toggle_overwrite (GtkTextView *text_view); +static void gtk_text_view_toggle_cursor_visible (GtkTextView *text_view); static void gtk_text_view_move_focus (GtkTextView *text_view, GtkDirectionType direction_type); static void gtk_text_view_unselect (GtkTextView *text_view); @@ -825,10 +827,17 @@ gtk_text_view_class_init (GtkTextViewClass *klass) G_CALLBACK (gtk_text_view_select_all), NULL, NULL, _gtk_marshal_VOID__BOOLEAN, - G_TYPE_NONE, 1, - G_TYPE_BOOLEAN, TRUE); + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); + + signals[TOGGLE_CURSOR_VISIBLE] = + _gtk_binding_signal_new (I_("toggle_cursor_visible"), + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_CALLBACK (gtk_text_view_toggle_cursor_visible), + NULL, NULL, + _gtk_marshal_VOID__VOID, + G_TYPE_NONE, 0); - /* * Key bindings */ @@ -1005,6 +1014,10 @@ gtk_text_view_class_init (GtkTextViewClass *klass) gtk_binding_entry_add_signal (binding_set, GDK_KP_Insert, 0, "toggle_overwrite", 0); + /* Caret mode */ + gtk_binding_entry_add_signal (binding_set, GDK_F7, 0, + "toggle_cursor_visible", 0); + /* Control-tab focus motion */ gtk_binding_entry_add_signal (binding_set, GDK_Tab, GDK_CONTROL_MASK, "move_focus", 1, @@ -2444,6 +2457,12 @@ gtk_text_view_get_tabs (GtkTextView *text_view) return text_view->tabs ? pango_tab_array_copy (text_view->tabs) : NULL; } +static void +gtk_text_view_toggle_cursor_visible (GtkTextView *text_view) +{ + gtk_text_view_set_cursor_visible (!text_view->cursor_visible); +} + /** * gtk_text_view_set_cursor_visible: * @text_view: a #GtkTextView |