[Xfce4-commits] <midori:master> Add Window > Focus Current Tab

Christian Dywan noreply at xfce.org
Wed Sep 30 23:04:01 CEST 2009


Updating branch refs/heads/master
         to 3686db6f6f73c6deba1884b9f34a357596ede457 (commit)
       from df88be1aff98f357839fbfe2f7ba29b1fb0bae7e (commit)

commit 3686db6f6f73c6deba1884b9f34a357596ede457
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Sep 30 22:18:17 2009 +0200

    Add Window > Focus Current Tab

 midori/midori-browser.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index 074d7ed..0297525 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -2695,6 +2695,10 @@ _action_window_populate_popup (GtkAction*     action,
     gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem);
     gtk_widget_show (menuitem);
     menuitem = gtk_action_create_menu_item (
+        _action_by_name (browser, "TabCurrent"));
+    gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem);
+    gtk_widget_show (menuitem);
+    menuitem = gtk_action_create_menu_item (
         _action_by_name (browser, "TabPrevious"));
     gtk_menu_shell_prepend (GTK_MENU_SHELL (menu), menuitem);
     gtk_widget_show (menuitem);
@@ -4004,6 +4008,15 @@ _action_tab_next_activate (GtkAction*     action,
     gtk_notebook_set_current_page (GTK_NOTEBOOK (browser->notebook), n + 1);
 }
 
+static void
+_action_tab_current_activate (GtkAction*     action,
+                              MidoriBrowser* browser)
+{
+    GtkWidget* view = midori_browser_get_current_tab (browser);
+    GtkWidget* child = gtk_bin_get_child (GTK_BIN (view));
+    gtk_widget_grab_focus (child ? child : view);
+}
+
 static const gchar* credits_authors[] = {
     "Christian Dywan <christian at twotoasts.de>", NULL };
 static const gchar* credits_documenters[] = {
@@ -4479,6 +4492,9 @@ 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) },
+ { "TabCurrent", NULL,
+   N_("Focus _Current Tab"), "<Ctrl>Home",
+   N_("Focus the current tab"), G_CALLBACK (_action_tab_current_activate) },
 
  { "Help", NULL, N_("_Help") },
  { "HelpContents", GTK_STOCK_HELP,
@@ -4744,6 +4760,7 @@ static const gchar* ui_markup =
     "<menuitem action='ClearPrivateData'/>"
     "<menuitem action='TabPrevious'/>"
     "<menuitem action='TabNext'/>"
+    "<menuitem action='TabCurrent'/>"
     "<menuitem action='UndoTabClose'/>"
     "<menuitem action='TrashEmpty'/>"
     "<menuitem action='Preferences'/>"



More information about the Xfce4-commits mailing list