diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2013-11-04 13:48:01 -0500 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2013-11-04 13:48:01 -0500 |
commit | 9e2f6886fcfb2ec0eff9406709f1dd21c8f035a6 (patch) | |
tree | 709cf41e4582538e376524b069ed9fe0582447ab | |
parent | 7eb938eef962b34ce635fe6f0331a390ab38db92 (diff) |
add tab numbering
-rw-r--r-- | svte.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -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 */ |