aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-04 17:08:47 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-04 17:08:47 +0800
commitb446f6693c136813dd6ad780ab826a45939e89ce (patch)
treef37c82d24c2141f1b31ef22bf78d3bd675e1c844
parent78c2e1a47c7fc6074a80c8b91dbdc1f57e3ba817 (diff)
downloadgsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.tar
gsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.tar.gz
gsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.tar.bz2
gsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.tar.lz
gsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.tar.xz
gsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.tar.zst
gsoc2013-epiphany-b446f6693c136813dd6ad780ab826a45939e89ce.zip
update undo/redo sensitivity
2003-11-04 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-window.c: (window_cmd_edit): update undo/redo sensitivity 2003-11-04 David Adam Bordoley <bordoley@msu.edu> * data/ui/epiphany-ui.xml: * src/window-commands.c: (window_cmd_edit_undo), (window_cmd_edit_redo): * src/window-commands.h: Menus for Undo/Redo
-rw-r--r--ChangeLog15
-rw-r--r--data/ui/epiphany-ui.xml3
-rw-r--r--src/ephy-window.c20
-rw-r--r--src/window-commands.c34
-rw-r--r--src/window-commands.h6
5 files changed, 77 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 890c46b91..cf52fe8c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2003-11-04 Marco Pesenti Gritti <marco@gnome.org>
+ * src/ephy-window.c: (window_cmd_edit):
+
+ update undo/redo sensitivity
+
+2003-11-04 David Adam Bordoley <bordoley@msu.edu>
+
+ * data/ui/epiphany-ui.xml:
+ * src/window-commands.c: (window_cmd_edit_undo),
+ (window_cmd_edit_redo):
+ * src/window-commands.h:
+
+ Menus for Undo/Redo
+
+2003-11-04 Marco Pesenti Gritti <marco@gnome.org>
+
* data/ui/epiphany-ui.xml:
Show only paste in the context menu, it's the only
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 5c6b2cf0d..a9cbdc49a 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -14,6 +14,9 @@
</menu>
<menu name="EditMenu" action="Edit">
+ <menuitem name="EditUndoMenu" action="EditUndo"/>
+ <menuitem name="EditRedoMenu" action="EditRedo"/>
+ <separator name="EditSep0"/>
<menuitem name="EditCutMenu" action="EditCut"/>
<menuitem name="EditCopyMenu" action="EditCopy"/>
<menuitem name="EditPasteMenu" action="EditPaste"/>
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);