[Xfce4-commits] <midori:master> Implement minimize, duplicate and close other as actions

Christian Dywan noreply at xfce.org
Thu Jul 8 23:12:01 CEST 2010


Updating branch refs/heads/master
         to e794fe798af5cc3eaf32bcc61446cb0257210946 (commit)
       from 880587a05519b5c419d15f0e30d903e7627a245c (commit)

commit e794fe798af5cc3eaf32bcc61446cb0257210946
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Jul 8 23:08:18 2010 +0200

    Implement minimize, duplicate and close other as actions
    
    This allows keyboard shortcuts to be assigned to these operations.

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

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index cdbe57d..e421c54 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -4403,6 +4403,46 @@ _action_tab_current_activate (GtkAction*     action,
     gtk_widget_grab_focus (view);
 }
 
+static void
+_action_tab_minimize_activate (GtkAction*     action,
+                               MidoriBrowser* browser)
+{
+    GtkWidget* view = midori_browser_get_current_tab (browser);
+    g_object_set (view, "minimized",
+                  !katze_object_get_boolean (view, "minimized"), NULL);
+}
+
+static void
+_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 = g_object_new (MIDORI_TYPE_VIEW,
+        "settings", browser->settings, NULL);
+    midori_view_set_uri (MIDORI_VIEW (new_view),
+        midori_view_get_display_uri (MIDORI_VIEW (view)));
+    gtk_widget_show (new_view);
+    g_signal_emit_by_name (view, "new-view", new_view, where);
+}
+
+static void
+midori_browser_close_other_tabs_cb (GtkWidget* view,
+                                    gpointer   data)
+{
+    GtkWidget* remaining_view = data;
+    if (view != remaining_view)
+        gtk_widget_destroy (view);
+}
+
+static void
+_action_tab_close_other_activate (GtkAction*     action,
+                                  MidoriBrowser* browser)
+{
+    GtkWidget* view = midori_browser_get_current_tab (browser);
+    midori_browser_foreach (browser, midori_browser_close_other_tabs_cb, view);
+}
+
 static const gchar* credits_authors[] =
     { "Christian Dywan <christian at twotoasts.de>", NULL };
 static const gchar* credits_documenters[] =
@@ -4960,6 +5000,15 @@ static const GtkActionEntry entries[] =
     { "TabCurrent", NULL,
         N_("Focus _Current Tab"), "<Ctrl>Home",
         N_("Focus the current tab"), G_CALLBACK (_action_tab_current_activate) },
+    { "TabMinimize", NULL,
+        N_("Minimize _Current Tab"), "",
+        N_("Minimize the current tab"), G_CALLBACK (_action_tab_minimize_activate) },
+    { "TabDuplicate", NULL,
+        N_("_Duplicate Current Tab"), "",
+        N_("Duplicate the current tab"), G_CALLBACK (_action_tab_duplicate_activate) },
+    { "TabCloseOther", NULL,
+        N_("Close Ot_her Tabs"), "",
+        N_("Close all tabs except the current tab"), G_CALLBACK (_action_tab_close_other_activate) },
     { "LastSession", NULL,
         N_("Open last _session"), NULL,
         N_("Open the tabs saved in the last session"), NULL },
@@ -5238,6 +5287,9 @@ static const gchar* ui_markup =
             "<menuitem action='TabPrevious'/>"
             "<menuitem action='TabNext'/>"
             "<menuitem action='TabCurrent'/>"
+            "<menuitem action='TabMinimize'/>"
+            "<menuitem action='TabDuplicate'/>"
+            "<menuitem action='TabCloseOther'/>"
             "<menuitem action='LastSession'/>"
             "<menuitem action='UndoTabClose'/>"
             "<menuitem action='TrashEmpty'/>"



More information about the Xfce4-commits mailing list