From a9bcc5ec168b90ddb5261652a205fff5e3170b42 Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Wed, 30 Jan 2008 20:13:16 -0800 Subject: [PATCH] [Window] Add support for configuration of tab width This adds the "full-width-tabs" property to TildaWindow which will allow users to set whether or not they want tabs to expand across the full width of the GtkNotebook. This feature was suggested by sipiatti. --- share-tilda.conf | 1 + tilda-window.c | 31 ++++++++++++++++++++++++++++++- tilda-window.h | 1 + tilda.c | 2 +- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/share-tilda.conf b/share-tilda.conf index d2c4460..5de245d 100644 --- a/share-tilda.conf +++ b/share-tilda.conf @@ -23,6 +23,7 @@ stick = true hidden-at-start = false centered-horizontally = false centered-vertically = false +full-width-tabs = true accelerator-quit = q accelerator-next-tab = Page_Down accelerator-previous-tab = Page_Up diff --git a/tilda-window.c b/tilda-window.c index 705a80a..5a37cb9 100644 --- a/tilda-window.c +++ b/tilda-window.c @@ -103,7 +103,8 @@ tilda_window_add_terminal (TildaWindow *self) label = gtk_label_new ("Tilda"); notebook_index = gtk_notebook_prepend_page (GTK_NOTEBOOK(self->notebook), tt->hbox, label); - gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(self->notebook), tt->hbox, TRUE, TRUE, GTK_PACK_END); + gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(self->notebook), tt->hbox, + self->full_width_tabs, TRUE, GTK_PACK_START); gtk_notebook_set_current_page (GTK_NOTEBOOK(self->notebook), notebook_index); if (gtk_notebook_get_n_pages (GTK_NOTEBOOK(self->notebook)) > 1) @@ -691,6 +692,7 @@ enum tilda_window_properties { TILDA_WINDOW_HIDDEN_AT_START, TILDA_WINDOW_CENTERED_HORIZONTALLY, TILDA_WINDOW_CENTERED_VERTICALLY, + TILDA_WINDOW_FULL_WIDTH_TABS, TILDA_WINDOW_HAVE_REAL_TRANSPARENCY, }; @@ -727,6 +729,7 @@ tilda_window_set_property (GObject *object, GParamSpec *pspec) { TildaWindow *self = (TildaWindow *) object; + gint i; switch (property_id) { @@ -968,6 +971,17 @@ tilda_window_set_property (GObject *object, debug_printf ("window centered vertically: %d\n", self->centered_vertically); break; + case TILDA_WINDOW_FULL_WIDTH_TABS: + self->full_width_tabs = g_value_get_boolean (value); + for (i=0; iterms->len; ++i) + gtk_notebook_set_tab_label_packing (GTK_NOTEBOOK(self->notebook), + TILDA_TERMINAL(g_ptr_array_index(self->terms, i))->hbox, + self->full_width_tabs, + TRUE, + GTK_PACK_START); + debug_printf ("window full width tabs: %d\n", self->full_width_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); @@ -1126,6 +1140,10 @@ tilda_window_get_property (GObject *object, g_value_set_boolean (value, self->centered_vertically); break; + case TILDA_WINDOW_FULL_WIDTH_TABS: + g_value_set_boolean (value, self->full_width_tabs); + break; + case TILDA_WINDOW_HAVE_REAL_TRANSPARENCY: g_value_set_boolean (value, self->have_real_transparency); break; @@ -1217,6 +1235,7 @@ tilda_window_constructor (GType type, tilda_window_set_property_from_config (self, "hidden-at-start"); 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"); /* Add the initial terminal(s) */ for (i=0; iinitial_terminals; ++i) @@ -1664,6 +1683,16 @@ tilda_window_class_init (gpointer g_class, TILDA_WINDOW_CENTERED_VERTICALLY, pspec); + pspec = g_param_spec_boolean ("full-width-tabs", + _("Tabs should have full width of window"), + NULL, + TRUE, + G_PARAM_READWRITE); + + g_object_class_install_property (gobject_class, + TILDA_WINDOW_FULL_WIDTH_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 2af640c..d8a10d6 100644 --- a/tilda-window.h +++ b/tilda-window.h @@ -83,6 +83,7 @@ struct _TildaWindow { gboolean hidden_at_start; gboolean centered_horizontally; gboolean centered_vertically; + gboolean full_width_tabs; gboolean have_real_transparency; }; diff --git a/tilda.c b/tilda.c index 617c5e2..d0d81f2 100644 --- a/tilda.c +++ b/tilda.c @@ -65,7 +65,7 @@ tilda_parse_command_line (gint argc, gchar *argv[]) /* All of the various command-line options */ const GOptionEntry cl_opts[] = { - { "version", 'V', 0, G_OPTION_ARG_NONE, &version, N_("Show version information"), NULL }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &version, _("Show version information"), NULL }, { NULL }, }; -- 2.34.1