aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ephy-window.c20
-rw-r--r--src/window-commands.c34
-rw-r--r--src/window-commands.h6
3 files changed, 59 insertions, 1 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 03b1d70d2..cbc45f074 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -109,6 +109,12 @@ static GtkActionEntry ephy_menu_entries [] = {
G_CALLBACK (window_cmd_file_close_window) },
/* Edit menu */
+ { "EditUndo", GTK_STOCK_UNDO, N_("_Undo"), "<control>Z",
+ N_("Undo the last action"),
+ G_CALLBACK (window_cmd_edit_undo) },
+ { "EditRedo", GTK_STOCK_REDO, N_("Re_do"), "<shift><control>Z",
+ N_("Redo the last undone action"),
+ G_CALLBACK (window_cmd_edit_redo) },
{ "EditCut", GTK_STOCK_CUT, N_("Cu_t"), "<control>X",
N_("Cut the selection"),
G_CALLBACK (window_cmd_edit_cut) },
@@ -350,7 +356,7 @@ window_cmd_edit (GtkAction *action,
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
GtkActionGroup *action_group;
- gboolean can_copy, can_cut;
+ gboolean can_copy, can_cut, can_undo, can_redo;
if (GTK_IS_EDITABLE (widget))
{
@@ -361,6 +367,8 @@ window_cmd_edit (GtkAction *action,
can_copy = has_selection;
can_cut = has_selection;
+ can_undo = FALSE;
+ can_redo = FALSE;
}
else
{
@@ -373,6 +381,10 @@ window_cmd_edit (GtkAction *action,
(EPHY_COMMAND_MANAGER (embed), "cmd_copy", &can_copy);
ephy_command_manager_get_command_state
(EPHY_COMMAND_MANAGER (embed), "cmd_cut", &can_cut);
+ ephy_command_manager_get_command_state
+ (EPHY_COMMAND_MANAGER (embed), "cmd_undo", &can_undo);
+ ephy_command_manager_get_command_state
+ (EPHY_COMMAND_MANAGER (embed), "cmd_redo", &can_redo);
}
action_group = window->priv->action_group;
@@ -382,6 +394,12 @@ window_cmd_edit (GtkAction *action,
action = gtk_action_group_get_action (action_group, "EditCut");
g_object_set (action, "sensitive", can_cut, NULL);
+
+ action = gtk_action_group_get_action (action_group, "EditUndo");
+ g_object_set (action, "sensitive", can_undo, NULL);
+
+ action = gtk_action_group_get_action (action_group, "EditRedo");
+ g_object_set (action, "sensitive", can_redo, NULL);
}
static void
diff --git a/src/window-commands.c b/src/window-commands.c
index 4d9e54e33..d7d48834b 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -399,6 +399,40 @@ window_cmd_file_close_window (GtkAction *action,
}
void
+window_cmd_edit_undo (GtkAction *action,
+ EphyWindow *window)
+{
+ GtkWidget *widget;
+ GtkWidget *embed;
+
+ widget = gtk_window_get_focus (GTK_WINDOW (window));
+ embed = gtk_widget_get_ancestor (widget, EPHY_TYPE_EMBED);
+
+ if (embed)
+ {
+ ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
+ "cmd_undo");
+ }
+}
+
+void
+window_cmd_edit_redo (GtkAction *action,
+ EphyWindow *window)
+{
+ GtkWidget *widget;
+ GtkWidget *embed;
+
+ widget = gtk_window_get_focus (GTK_WINDOW (window));
+ embed = gtk_widget_get_ancestor (widget, EPHY_TYPE_EMBED);
+
+ if (embed)
+ {
+ ephy_command_manager_do_command (EPHY_COMMAND_MANAGER (embed),
+ "cmd_redo");
+ }
+}
+
+void
window_cmd_edit_cut (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/window-commands.h b/src/window-commands.h
index 2f0f8bc14..63640abbe 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -80,6 +80,12 @@ void window_cmd_file_send_to (GtkAction *action,
void window_cmd_file_close_window (GtkAction *action,
EphyWindow *window);
+void window_cmd_edit_undo (GtkAction *action,
+ EphyWindow *window);
+
+void window_cmd_edit_redo (GtkAction *action,
+ EphyWindow *window);
+
void window_cmd_edit_cut (GtkAction *action,
EphyWindow *window);