aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ephy-shell.c24
-rw-r--r--src/resources/epiphany-application-menu.ui5
-rw-r--r--src/window-commands.c7
-rw-r--r--src/window-commands.h2
4 files changed, 38 insertions, 0 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index f08097422..6da0900a5 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -152,6 +152,14 @@ new_incognito_window (GSimpleAction *action,
}
static void
+reopen_closed_tab (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ window_cmd_undo_close_tab (NULL, NULL);
+}
+
+static void
show_bookmarks (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
@@ -214,6 +222,10 @@ static GActionEntry app_entries[] = {
{ "quit", quit_application, NULL, NULL, NULL },
};
+static GActionEntry app_normal_mode_entries[] = {
+ { "reopen-closed-tab", reopen_closed_tab, NULL, NULL, NULL },
+};
+
static void
ephy_shell_startup (GApplication* application)
{
@@ -231,6 +243,18 @@ ephy_shell_startup (GApplication* application)
app_entries, G_N_ELEMENTS (app_entries),
application);
+ if (mode != EPHY_EMBED_SHELL_MODE_INCOGNITO) {
+ g_action_map_add_action_entries (G_ACTION_MAP (application),
+ app_normal_mode_entries, G_N_ELEMENTS (app_normal_mode_entries),
+ application);
+ g_object_bind_property (G_OBJECT (ephy_shell_get_session (EPHY_SHELL (application))),
+ "can-undo-tab-closed",
+ g_action_map_lookup_action (G_ACTION_MAP (application),
+ "reopen-closed-tab"),
+ "enabled",
+ G_BINDING_SYNC_CREATE);
+ }
+
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder,
"/org/gnome/epiphany/epiphany-application-menu.ui",
diff --git a/src/resources/epiphany-application-menu.ui b/src/resources/epiphany-application-menu.ui
index 6b4523ba7..a77ae51ef 100644
--- a/src/resources/epiphany-application-menu.ui
+++ b/src/resources/epiphany-application-menu.ui
@@ -12,6 +12,11 @@
<attribute name="action">app.new-incognito</attribute>
<attribute name="accel">&lt;Primary&gt;i</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">Reopen Closed _Tab</attribute>
+ <attribute name="action">app.reopen-closed-tab</attribute>
+ <attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;t</attribute>
+ </item>
</section>
<section>
<item>
diff --git a/src/window-commands.c b/src/window-commands.c
index abf2950f7..df1274a0a 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -82,6 +82,13 @@ window_cmd_file_print (GtkAction *action,
}
void
+window_cmd_undo_close_tab (GtkAction *action,
+ EphyWindow *window)
+{
+ ephy_session_undo_close_tab (ephy_shell_get_session (ephy_shell_get_default ()));
+}
+
+void
window_cmd_file_send_to (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/window-commands.h b/src/window-commands.h
index 4d8582f31..8000c70dc 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -50,6 +50,8 @@ void window_cmd_file_save_as_application (GtkAction *action,
EphyWindow *window);
void window_cmd_file_print (GtkAction *action,
EphyWindow *window);
+void window_cmd_undo_close_tab (GtkAction *action,
+ EphyWindow *window);
void window_cmd_file_send_to (GtkAction *action,
EphyWindow *window);
void window_cmd_file_work_offline (GtkAction *action,