From ff5debba3755465eaeb4766b213cd5d37ffe8e01 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 7 Aug 2006 20:42:44 +0000 Subject: Add "delete text" command. 2006-08-07 Christian Persch * src/ephy-window.c: * src/window-commands.c: * src/window-commands.h: Add "delete text" command. --- ChangeLog | 8 ++++++++ src/ephy-window.c | 3 +++ src/window-commands.c | 22 ++++++++++++++++++++++ src/window-commands.h | 3 +++ 4 files changed, 36 insertions(+) diff --git a/ChangeLog b/ChangeLog index 780eda001..9463c7102 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-08-07 Christian Persch + + * src/ephy-window.c: + * src/window-commands.c: + * src/window-commands.h: + + Add "delete text" command. + 2006-08-07 Christian Persch * src/ephy-window.c: diff --git a/src/ephy-window.c b/src/ephy-window.c index 8f4678d99..aeff35da7 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -171,6 +171,9 @@ static const GtkActionEntry ephy_menu_entries [] = { { "EditPaste", GTK_STOCK_PASTE, N_("_Paste"), "V", N_("Paste clipboard"), G_CALLBACK (window_cmd_edit_paste) }, + { "EditDelete", GTK_STOCK_DELETE, NULL, NULL, + N_("Delete text"), + G_CALLBACK (window_cmd_edit_delete) }, { "EditSelectAll", NULL, N_("Select _All"), "A", N_("Select the entire page"), G_CALLBACK (window_cmd_edit_select_all) }, diff --git a/src/window-commands.c b/src/window-commands.c index 46dee486b..b3391491c 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -463,6 +463,28 @@ window_cmd_edit_paste (GtkAction *action, } } +void +window_cmd_edit_delete (GtkAction *action, + EphyWindow *window) +{ + GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window)); + + if (GTK_IS_EDITABLE (widget)) + { + gtk_editable_delete_text (GTK_EDITABLE (widget), 0, -1); + } + else + { + EphyEmbed *embed; + + embed = ephy_window_get_active_embed (window); + g_return_if_fail (embed != NULL); + + ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed), + "cmd_delete"); + } +} + void window_cmd_edit_select_all (GtkAction *action, EphyWindow *window) diff --git a/src/window-commands.h b/src/window-commands.h index 1bafbc460..30026ee9c 100644 --- a/src/window-commands.h +++ b/src/window-commands.h @@ -94,6 +94,9 @@ void window_cmd_edit_copy (GtkAction *action, void window_cmd_edit_paste (GtkAction *action, EphyWindow *window); +void window_cmd_edit_delete (GtkAction *action, + EphyWindow *window); + void window_cmd_edit_select_all (GtkAction *action, EphyWindow *window); -- cgit v1.2.3