[epiphany] Add Duplicate Tab window command
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Add Duplicate Tab window command
- Date: Tue, 29 Mar 2016 18:23:27 +0000 (UTC)
commit b46bb84c6ce3125947a6d54088633c23f17e81fc
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date: Mon Mar 7 13:49:52 2016 +0200
Add Duplicate Tab window command
https://bugzilla.gnome.org/show_bug.cgi?id=763221
src/ephy-window.c | 2 ++
src/resources/epiphany-ui.xml | 1 +
src/window-commands.c | 24 ++++++++++++++++++++++++
src/window-commands.h | 2 ++
4 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 4c42a5d..b8cb631 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -177,6 +177,8 @@ static const GtkActionEntry ephy_menu_entries [] = {
G_CALLBACK (window_cmd_tabs_move_left) },
{ "TabsMoveRight", NULL, N_("Move Tab _Right"), "<shift><control>Page_Down", NULL,
G_CALLBACK (window_cmd_tabs_move_right) },
+ { "TabsDuplicate", NULL, N_("Du_plicate"), "<shift><control>D", NULL,
+ G_CALLBACK (window_cmd_tabs_duplicate) },
{ "TabsDetach", NULL, N_("_Detach Tab"), NULL, NULL,
G_CALLBACK (window_cmd_tabs_detach) },
diff --git a/src/resources/epiphany-ui.xml b/src/resources/epiphany-ui.xml
index 26e47ac..efe51a4 100644
--- a/src/resources/epiphany-ui.xml
+++ b/src/resources/epiphany-ui.xml
@@ -4,6 +4,7 @@
<menuitem name="TabMoveLeftENP" action="TabsMoveLeft"/>
<menuitem name="TabMoveRightENP" action="TabsMoveRight"/>
</placeholder>
+ <menuitem name="TabDuplicateENP" action="TabsDuplicate"/>
<menuitem name="TabCloseENP" action="FileCloseTab"/>
<!-- <menuitem name="TabDetachENP" action="TabsDetach"/> -->
</popup>
diff --git a/src/window-commands.c b/src/window-commands.c
index c83fdd5..be9744c 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1534,6 +1534,30 @@ void window_cmd_tabs_move_right (GtkAction *action,
}
void
+window_cmd_tabs_duplicate (GtkAction *action,
+ EphyWindow *window)
+{
+ EphyEmbed *embed, *new_embed;
+ EphyWebView *view, *new_view;
+ WebKitWebViewSessionState *session_state;
+
+ embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER (window));
+ view = ephy_embed_get_web_view (embed);
+ session_state = webkit_web_view_get_session_state (WEBKIT_WEB_VIEW (view));
+
+ new_embed = ephy_shell_new_tab (ephy_shell_get_default (),
+ window,
+ embed,
+ EPHY_NEW_TAB_APPEND_AFTER | EPHY_NEW_TAB_JUMP);
+
+ new_view = ephy_embed_get_web_view (new_embed);
+
+ webkit_web_view_restore_session_state (WEBKIT_WEB_VIEW (new_view), session_state);
+ webkit_web_view_session_state_unref (session_state);
+ ephy_web_view_load_url (new_view, webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view)));
+}
+
+void
window_cmd_tabs_detach (GtkAction *action,
EphyWindow *window)
{
diff --git a/src/window-commands.h b/src/window-commands.h
index 29b6025..1db5a47 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -90,6 +90,8 @@ void window_cmd_tabs_move_left (GtkAction *action,
EphyWindow *window);
void window_cmd_tabs_move_right (GtkAction *action,
EphyWindow *window);
+void window_cmd_tabs_duplicate (GtkAction *action,
+ EphyWindow *window);
void window_cmd_tabs_detach (GtkAction *action,
EphyWindow *window);
void window_cmd_load_location (GtkAction *action,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]