Implement 'Close other tabs' menu item in tab context menu

This commit is contained in:
Christian Dywan 2010-01-14 02:49:19 +01:00
parent 9b01e48975
commit 8dbc86361d

View file

@ -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); 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 static void
midori_view_tab_label_menu_minimize_tab_cb (GtkWidget* menuitem, midori_view_tab_label_menu_minimize_tab_cb (GtkWidget* menuitem,
MidoriView* view) MidoriView* view)
@ -3683,6 +3700,10 @@ midori_view_get_tab_menu (MidoriView* view)
G_CALLBACK (midori_view_tab_label_menu_minimize_tab_cb), view); G_CALLBACK (midori_view_tab_label_menu_minimize_tab_cb), view);
menuitem = gtk_separator_menu_item_new (); menuitem = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); 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); menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLOSE, NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem); gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_signal_connect (menuitem, "activate", g_signal_connect (menuitem, "activate",