From 0cdcae487a88628e4f34721e3595b5597b768fbd Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 2 Mar 2011 18:03:55 +0100 Subject: [PATCH] Allow re-ordering tabs with Ctrl+Shift+PageUp/PageDown --- midori/midori-browser.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 9d5e98f1..4b2f152b 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -4380,6 +4380,24 @@ _action_inspect_page_activate (GtkAction* action, } #endif +static void +_action_tab_move_backward_activate (GtkAction* action, + MidoriBrowser* browser) +{ + gint n = gtk_notebook_get_current_page (GTK_NOTEBOOK (browser->notebook)); + GtkWidget* widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n); + gtk_notebook_reorder_child (GTK_NOTEBOOK (browser->notebook), widget, n - 1); +} + +static void +_action_tab_move_forward_activate (GtkAction* action, + MidoriBrowser* browser) +{ + gint n = gtk_notebook_get_current_page (GTK_NOTEBOOK (browser->notebook)); + GtkWidget* widget = gtk_notebook_get_nth_page (GTK_NOTEBOOK (browser->notebook), n); + gtk_notebook_reorder_child (GTK_NOTEBOOK (browser->notebook), widget, n + 1); +} + static void _action_tab_previous_activate (GtkAction* action, MidoriBrowser* browser) @@ -5037,6 +5055,10 @@ static const GtkActionEntry entries[] = { "TabNext", GTK_STOCK_GO_FORWARD, N_("_Next Tab"), "Page_Down", N_("Switch to the next tab"), G_CALLBACK (_action_tab_next_activate) }, + { "TabMoveBackward", NULL, N_("_Move Tab Backward"), "Page_Up", + N_("Move tab behind the previous tab"), G_CALLBACK (_action_tab_move_backward_activate) }, + { "TabMoveForward", NULL, N_("_Move Tab Forward"), "Page_Down", + N_("Move tab in front of the next tab"), G_CALLBACK (_action_tab_move_forward_activate) }, { "TabCurrent", NULL, N_("Focus _Current Tab"), "Home", N_("Focus the current tab"), G_CALLBACK (_action_tab_current_activate) }, @@ -5315,6 +5337,8 @@ static const gchar* ui_markup = /* For accelerators to work all actions need to be used *somewhere* in the UI definition */ "" + "" + "" "" "" ""