aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-11-04 13:48:01 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2013-11-04 13:48:01 -0500
commit9e2f6886fcfb2ec0eff9406709f1dd21c8f035a6 (patch)
tree709cf41e4582538e376524b069ed9fe0582447ab
parent7eb938eef962b34ce635fe6f0331a390ab38db92 (diff)
add tab numbering
-rw-r--r--svte.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/svte.c b/svte.c
index 7258663..b99b564 100644
--- a/svte.c
+++ b/svte.c
@@ -362,13 +362,24 @@ static void tab_title(GtkWidget *widget, term *t) {
/* set the window title */
static void set_window_title(term *t){
- const char *title = vte_terminal_get_window_title(VTE_TERMINAL(t->vte));
+ gint number_of_pages = 0;
+ const char *term_title = vte_terminal_get_window_title(VTE_TERMINAL(t->vte));
- if (title == NULL) {
- title = "svte";
+ if (term_title == NULL) {
+ term_title = "svte";
}
- gtk_window_set_title(GTK_WINDOW(t->w->win), title);
+ number_of_pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(t->w->notebook));
+
+ if ( number_of_pages > 1) {
+ char *title = g_strdup_printf("%s (%d/%d)", term_title,
+ gtk_notebook_page_num(GTK_NOTEBOOK(t->w->notebook), t->vte) + 1,
+ number_of_pages);
+ gtk_window_set_title(GTK_WINDOW(t->w->win), title);
+ g_free(title);
+ } else {
+ gtk_window_set_title(GTK_WINDOW(t->w->win), term_title);
+ }
}
/* focus the tab */