From 33dc55587e907102c7fff4550ace43ff7d256e81 Mon Sep 17 00:00:00 2001 From: Rob Kendrick Date: Sat, 18 Oct 2008 14:37:29 +0000 Subject: Ctrl+W now closes just the current tab, and Ctrl+Shift+W closes the window. Added menu item to do this, too. svn path=/trunk/netsurf/; revision=5593 --- gtk/gtk_tabs.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'gtk/gtk_tabs.c') diff --git a/gtk/gtk_tabs.c b/gtk/gtk_tabs.c index 9d22267e6..0926fc085 100644 --- a/gtk/gtk_tabs.c +++ b/gtk/gtk_tabs.c @@ -165,3 +165,17 @@ void nsgtk_tab_page_changed(GtkNotebook *notebook, GtkNotebookPage *page, if (gw) nsgtk_scaffolding_set_top_level(gw); } + +void nsgtk_tab_close_current(GtkNotebook *notebook) +{ + gint curr_page = gtk_notebook_get_current_page(notebook); + GtkWidget *window = gtk_notebook_get_nth_page(notebook, curr_page); + struct gui_window *gw = g_object_get_data(G_OBJECT(window), + "gui_window"); + + if (gtk_notebook_get_n_pages(notebook) < 2) + return; /* wicked things happen if we close the last tab */ + + gtk_notebook_remove_page(notebook, curr_page); + nsgtk_window_destroy_browser(gw); +} -- cgit v1.2.3