return 0;
}
+static void
+tilda_window_show_hide_tabs_if_appropriate (TildaWindow *self)
+{
+ debug_enter ();
+ debug_assert (TILDA_IS_WINDOW(self));
+
+ /* If we only have one tab, we have a choice to make, otherwise, always show tabs */
+ if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook)) <= 1)
+ {
+ if (self->always_show_tabs)
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
+ else
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), FALSE);
+ }
+ else
+ {
+ gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
+ }
+}
+
/**
* Clean up and remove self completely from the program
*
gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), notebook_index);
/* Always show tabs if we have > 1 tab open */
- if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook)) > 1)
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
+ tilda_window_show_hide_tabs_if_appropriate (self);
/* Focus the VTE Terminal */
gtk_widget_grab_focus (tt->vte_term);
gtk_notebook_remove_page (GTK_NOTEBOOK (self->notebook), notebook_index);
/* We should hide the tabs if there is only one tab left */
- if (gtk_notebook_get_n_pages (GTK_NOTEBOOK (self->notebook)) <= 1)
- {
- if (!self->always_show_tabs)
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->notebook), FALSE);
- }
+ tilda_window_show_hide_tabs_if_appropriate (self);
/* Remove the term from our lists, then free it */
g_ptr_array_remove_fast (self->terms, tt);
case TILDA_WINDOW_ALWAYS_SHOW_TABS:
self->always_show_tabs = g_value_get_boolean (value);
- if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook)) <= 1)
- {
- if (self->always_show_tabs)
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), TRUE);
- else
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK(self->notebook), FALSE);
- }
+ tilda_window_show_hide_tabs_if_appropriate (self);
debug_printf ("window always show tabs: %d\n", self->always_show_tabs);
break;