From: Christian Dywan Date: Thu, 14 Jan 2010 01:49:19 +0000 (+0100) Subject: Implement 'Close other tabs' menu item in tab context menu X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dbc86361d02d50165326c76e73ec2fcead9fa27;p=midori Implement 'Close other tabs' menu item in tab context menu --- diff --git a/midori/midori-view.c b/midori/midori-view.c index 22a03571..b2415811 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -3617,6 +3617,23 @@ midori_view_tab_label_menu_duplicate_tab_cb (GtkWidget* menuitem, g_signal_emit (view, signals[NEW_VIEW], 0, new_view, where); } +static void +midori_view_browser_close_tabs_cb (GtkWidget* view, + gpointer data) +{ + GtkWidget* remaining_view = data; + if (view != remaining_view) + gtk_widget_destroy (view); +} + +static void +midori_view_tab_label_menu_close_other_tabs_cb (GtkWidget* menuitem, + GtkWidget* view) +{ + MidoriBrowser* browser = midori_browser_get_for_widget (view); + midori_browser_foreach (browser, midori_view_browser_close_tabs_cb, view); +} + static void midori_view_tab_label_menu_minimize_tab_cb (GtkWidget* menuitem, MidoriView* view) @@ -3683,6 +3700,10 @@ midori_view_get_tab_menu (MidoriView* view) G_CALLBACK (midori_view_tab_label_menu_minimize_tab_cb), view); menuitem = gtk_separator_menu_item_new (); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + menuitem = gtk_menu_item_new_with_mnemonic (_("Close ot_her Tabs")); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); + g_signal_connect (menuitem, "activate", + G_CALLBACK (midori_view_tab_label_menu_close_other_tabs_cb), view); menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLOSE, NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); g_signal_connect (menuitem, "activate",