From: Ira W. Snyder Date: Sun, 17 Feb 2008 22:50:33 +0000 (-0800) Subject: [Window] Add always-show-tabs property X-Git-Url: https://www.irasnyder.com/gitweb/?p=tilda-gobject.git;a=commitdiff_plain;h=c6f563e5e04b2cfde566061af8516d3f6d37e4fb [Window] Add always-show-tabs property This property makes sure that the tab bar is always shown, even when there is only a single open tab. Requested by sipiatti. --- diff --git a/share-tilda.conf b/share-tilda.conf index 5de245d..98a5e73 100644 --- a/share-tilda.conf +++ b/share-tilda.conf @@ -24,6 +24,7 @@ hidden-at-start = false centered-horizontally = false centered-vertically = false full-width-tabs = true +always-show-tabs = false accelerator-quit = q accelerator-next-tab = Page_Down accelerator-previous-tab = Page_Up diff --git a/tilda-window.c b/tilda-window.c index e3cd897..1a293ca 100644 --- a/tilda-window.c +++ b/tilda-window.c @@ -107,6 +107,7 @@ tilda_window_add_terminal (TildaWindow *self) self->full_width_tabs, TRUE, GTK_PACK_START); 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); @@ -150,8 +151,11 @@ tilda_window_remove_terminal (TildaWindow *self, gint terminal_number) 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) - gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->notebook), FALSE); + 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); + } /* Remove the term from our lists, then free it */ g_ptr_array_remove_fast (self->terms, tt); @@ -689,6 +693,7 @@ enum tilda_window_properties { TILDA_WINDOW_CENTERED_HORIZONTALLY, TILDA_WINDOW_CENTERED_VERTICALLY, TILDA_WINDOW_FULL_WIDTH_TABS, + TILDA_WINDOW_ALWAYS_SHOW_TABS, TILDA_WINDOW_HAVE_REAL_TRANSPARENCY, }; @@ -978,6 +983,18 @@ tilda_window_set_property (GObject *object, debug_printf ("window full width tabs: %d\n", self->full_width_tabs); break; + 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); + } + debug_printf ("window always show tabs: %d\n", self->always_show_tabs); + break; + case TILDA_WINDOW_HAVE_REAL_TRANSPARENCY: self->have_real_transparency = g_value_get_boolean (value); debug_printf ("window have real transp: %d\n", self->have_real_transparency); @@ -1140,6 +1157,10 @@ tilda_window_get_property (GObject *object, g_value_set_boolean (value, self->full_width_tabs); break; + case TILDA_WINDOW_ALWAYS_SHOW_TABS: + g_value_set_boolean (value, self->always_show_tabs); + break; + case TILDA_WINDOW_HAVE_REAL_TRANSPARENCY: g_value_set_boolean (value, self->have_real_transparency); break; @@ -1232,6 +1253,7 @@ tilda_window_constructor (GType type, tilda_window_set_property_from_config (self, "centered-horizontally"); tilda_window_set_property_from_config (self, "centered-vertically"); tilda_window_set_property_from_config (self, "full-width-tabs"); + tilda_window_set_property_from_config (self, "always-show-tabs"); /* Add the initial terminal(s) */ for (i=0; iinitial_terminals; ++i) @@ -1689,6 +1711,16 @@ tilda_window_class_init (gpointer g_class, TILDA_WINDOW_FULL_WIDTH_TABS, pspec); + pspec = g_param_spec_boolean ("always-show-tabs", + _("Always show the tab bar, regardless of the number of open tabs"), + NULL, + TRUE, + G_PARAM_READWRITE); + + g_object_class_install_property (gobject_class, + TILDA_WINDOW_ALWAYS_SHOW_TABS, + pspec); + pspec = g_param_spec_boolean ("have-real-transparency", NULL, NULL, FALSE, G_PARAM_READABLE); diff --git a/tilda-window.h b/tilda-window.h index d8a10d6..9f30bdd 100644 --- a/tilda-window.h +++ b/tilda-window.h @@ -84,6 +84,7 @@ struct _TildaWindow { gboolean centered_horizontally; gboolean centered_vertically; gboolean full_width_tabs; + gboolean always_show_tabs; gboolean have_real_transparency; };