if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (tw->notebook)) == 1)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (tw->notebook), FALSE);
-#if 0
- // FIXME FIXME FIXME: need to actually do the stuff below
- /* With no pages left, it's time to leave the program */
- if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (tw->notebook)) < 1)
- gtk_main_quit ();
-#endif
-
/* Remove the term from our lists, then free it */
g_ptr_array_remove_fast (tw->terms, tt);
g_object_unref (G_OBJECT(tt));
+ /* With no pages left, it's time to remove this window */
+ if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (tw->notebook)) < 1)
+ {
+ debug_printf ("no terminals left, closing window %d\n", tw->number);
+ tilda_del_window (tw->number);
+ }
+
/* Leave the loop, we're done */
break;
}
return ret;
}
-static void
+void
tilda_del_window (gint number)
{
debug_enter ();
debug_printf ("Deleting window 0x%x (number %d of %d)\n", win, win->number, windows->len-1);
g_ptr_array_remove_index (windows, i);
g_object_unref (G_OBJECT(win));
+
+ if (windows->len == 0)
+ {
+ debug_printf ("No windows left, exiting...\n");
+ gtk_main_quit ();
+ }
+
break;
}
}
gtk_main ();
debug_printf ("Out of gtk_main(), going down\n");
+ /* Free the pointer array we allocated earlier */
+ g_ptr_array_free (windows, TRUE);
+
return 0;
}
/* Project-global variables */
extern DBusGConnection *dbus_connection;
+/* API */
+void tilda_del_window (gint number);
+
#endif /* TILDA_H */
/* vim: set ts=4 sts=4 sw=4 noet tw=112: */