aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-notebook.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ephy-notebook.c')
-rw-r--r--src/ephy-notebook.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/ephy-notebook.c b/src/ephy-notebook.c
index 3acde1c30..8c97d9228 100644
--- a/src/ephy-notebook.c
+++ b/src/ephy-notebook.c
@@ -1004,23 +1004,12 @@ void
ephy_notebook_remove_tab (EphyNotebook *nb,
EphyTab *tab)
{
- int num, position, curr;
+ int position, curr;
GtkWidget *label, *ebox;
g_return_if_fail (EPHY_IS_NOTEBOOK (nb));
g_return_if_fail (EPHY_IS_TAB (tab));
- num = gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb));
- if (num <= 1)
- {
- GtkWidget *window;
- window = gtk_widget_get_toplevel (GTK_WIDGET (nb));
-
- g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab);
- gtk_widget_destroy (window);
- return;
- }
-
/* Remove the page from the focused pages list */
nb->priv->focused_pages = g_list_remove (nb->priv->focused_pages,
tab);
@@ -1057,4 +1046,10 @@ ephy_notebook_remove_tab (EphyNotebook *nb,
g_signal_emit (G_OBJECT (nb), signals[TAB_REMOVED], 0, tab);
g_object_unref (tab);
+
+ /* if that was the last tab, destroy the window */
+ if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (nb)) == 0)
+ {
+ gtk_widget_destroy (gtk_widget_get_toplevel (GTK_WIDGET (nb)));
+ }
}