]> spindle.queued.net Git - midori/commitdiff
Allow re-ordering tabs with Ctrl+Shift+PageUp/PageDown
authorChristian Dywan <christian@twotoasts.de>
Wed, 2 Mar 2011 17:03:55 +0000 (18:03 +0100)
committerChristian Dywan <christian@twotoasts.de>
Wed, 2 Mar 2011 21:26:06 +0000 (22:26 +0100)
midori/midori-browser.c

index 9d5e98f18914c6fc93f9aaaa82b64959eca9ee9b..4b2f152be39c9c6c31b28c301d0b044120e83c6b 100644 (file)
@@ -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"), "<Ctrl>Page_Down",
         N_("Switch to the next tab"), G_CALLBACK (_action_tab_next_activate) },
+    { "TabMoveBackward", NULL, N_("_Move Tab Backward"), "<Ctrl><Shift>Page_Up",
+       N_("Move tab behind the previous tab"), G_CALLBACK (_action_tab_move_backward_activate) },
+    { "TabMoveForward", NULL, N_("_Move Tab Forward"), "<Ctrl><Shift>Page_Down",
+       N_("Move tab in front of the next tab"), G_CALLBACK (_action_tab_move_forward_activate) },
     { "TabCurrent", NULL,
         N_("Focus _Current Tab"), "<Ctrl>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 */
         "<menu action='Dummy'>"
+            "<menuitem action='TabMoveBackward'/>"
+            "<menuitem action='TabMoveForward'/>"
             "<menuitem action='ScrollLeft'/>"
             "<menuitem action='ScrollDown'/>"
             "<menuitem action='ScrollUp'/>"