[Xfce4-commits] <midori:master> Duplicate tabs in an API function & Granite support
Christian Dywan
noreply at xfce.org
Mon Nov 5 21:12:03 CET 2012
Updating branch refs/heads/master
to 3eb4b70d5a8ef68b5b2213eedc85ded64db18875 (commit)
from 33faeaeac29ff3c8a643e6a4e53961509c9badc1 (commit)
commit 3eb4b70d5a8ef68b5b2213eedc85ded64db18875
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Nov 5 21:09:03 2012 +0100
Duplicate tabs in an API function & Granite support
midori/midori-browser.c | 22 ++++++++++++++++------
midori/midori-view.c | 7 +++++++
midori/midori-view.h | 3 +++
midori/midori.vapi | 1 +
4 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index b90c699..1211567 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -4844,12 +4844,7 @@ _action_tab_duplicate_activate (GtkAction* action,
MidoriBrowser* browser)
{
GtkWidget* view = midori_browser_get_current_tab (browser);
- MidoriNewView where = MIDORI_NEW_VIEW_TAB;
- GtkWidget* new_view = midori_view_new_with_item (
- midori_view_get_proxy_item (MIDORI_VIEW (view)), browser->settings);
- const gchar* uri = midori_view_get_display_uri (MIDORI_VIEW (view));
- g_signal_emit_by_name (view, "new-view", new_view, where, TRUE);
- midori_view_set_uri (MIDORI_VIEW (new_view), uri);
+ midori_view_duplicate (MIDORI_VIEW (view));
}
static void
@@ -5271,6 +5266,16 @@ midori_browser_notebook_tab_moved_cb (GtkWidget* notebook,
MIDORI_VIEW (view), new_pos, browser);
}
}
+
+static void
+midori_browser_notebook_tab_duplicated_cb (GtkWidget* notebook,
+ GraniteWidgetsTab* tab,
+ MidoriBrowser* browser)
+{
+ GtkWidget* view = granite_widgets_tab_get_page (tab);
+ midori_view_duplicate (MIDORI_VIEW (view));
+}
+
#else
static void
midori_browser_notebook_page_added_cb (GtkNotebook* notebook,
@@ -6495,6 +6500,8 @@ midori_browser_init (MidoriBrowser* browser)
browser->notebook = (GtkWidget*)granite_widgets_dynamic_notebook_new ();
granite_widgets_dynamic_notebook_set_allow_new_window (
GRANITE_WIDGETS_DYNAMIC_NOTEBOOK (browser->notebook), TRUE);
+ granite_widgets_dynamic_notebook_set_allow_duplication (
+ GRANITE_WIDGETS_DYNAMIC_NOTEBOOK (browser->notebook), TRUE);
/* FIXME: work-around a bug */
gtk_widget_show_all (browser->notebook);
granite_widgets_dynamic_notebook_set_group_name (
@@ -6533,6 +6540,9 @@ midori_browser_init (MidoriBrowser* browser)
g_signal_connect (browser->notebook, "tab-moved",
G_CALLBACK (midori_browser_notebook_tab_moved_cb),
browser);
+ g_signal_connect (browser->notebook, "tab-duplicated",
+ G_CALLBACK (midori_browser_notebook_tab_duplicated_cb),
+ browser);
#else
g_signal_connect (browser->notebook, "switch-page",
G_CALLBACK (midori_browser_notebook_switch_page_cb),
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 464faf0..423c4a7 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -4334,10 +4334,17 @@ static void
midori_view_tab_label_menu_duplicate_tab_cb (GtkWidget* menuitem,
MidoriView* view)
{
+ midori_view_duplicate (view);
+}
+
+GtkWidget*
+midori_view_duplicate (MidoriView* view)
+{
MidoriNewView where = MIDORI_NEW_VIEW_TAB;
GtkWidget* new_view = midori_view_new_with_item (view->item, view->settings);
g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where, TRUE);
midori_view_set_uri (MIDORI_VIEW (new_view), midori_tab_get_uri (MIDORI_TAB (view)));
+ return new_view;
}
static void
diff --git a/midori/midori-view.h b/midori/midori-view.h
index 88cba94..a62e69d 100644
--- a/midori/midori-view.h
+++ b/midori/midori-view.h
@@ -119,6 +119,9 @@ midori_view_get_proxy_menu_item (MidoriView* view);
GtkWidget*
midori_view_get_tab_menu (MidoriView* view);
+GtkWidget*
+midori_view_duplicate (MidoriView* view);
+
PangoEllipsizeMode
midori_view_get_label_ellipsize (MidoriView* view);
diff --git a/midori/midori.vapi b/midori/midori.vapi
index 2fa7c02..7d1890d 100644
--- a/midori/midori.vapi
+++ b/midori/midori.vapi
@@ -143,6 +143,7 @@ namespace Midori {
public bool has_selection ();
public string get_selected_text ();
public Gtk.MenuItem get_proxy_menu_item ();
+ public Gtk.Widget duplicate ();
public Gtk.Menu get_tab_menu ();
public Pango.EllipsizeMode get_label_ellipsize ();
public Gtk.Label get_proxy_tab_label ();
More information about the Xfce4-commits
mailing list