diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui.cc | 8 | ||||
-rw-r--r-- | src/ui.hh | 2 | ||||
-rw-r--r-- | src/uicmd.cc | 16 |
3 files changed, 16 insertions, 10 deletions
@@ -1059,17 +1059,15 @@ void UI::set_render_layout(Widget &nw) /* * Set the window title */ -void UI::set_page_title(const char *label) +void UI::set_tab_title(const char *label) { char title[128]; dReturn_if_fail(label != NULL); snprintf(title, 128, "Dillo: %s", label); - this->window()->copy_label(title); - this->window()->redraw_label(); - - if (tabs() && *label) { + if (*label) { + // Make a label for this tab size_t tab_chars = 18; snprintf(title, tab_chars + 1, "%s", label); if (strlen(label) > tab_chars) { @@ -92,7 +92,7 @@ public: void set_img_prog(int n_img, int t_img, int cmd); void set_bug_prog(int n_bug); void set_render_layout(Widget &nw); - void set_page_title(const char *label); + void set_tab_title(const char *label); void customize(int flags); void button_set_sens(UIButton btn, int sens); void paste_url(); diff --git a/src/uicmd.cc b/src/uicmd.cc index 489530c4..4aa0da8f 100644 --- a/src/uicmd.cc +++ b/src/uicmd.cc @@ -264,7 +264,7 @@ public: // Update the window title BrowserWindow *bw = a_UIcmd_get_bw_by_widget(selected_child()); const char *title = a_History_get_title(a_Nav_get_top_uidx(bw), 1); - BW2UI(bw)->set_page_title(title ? title : ""); + a_UIcmd_set_page_title(bw, title ? title : ""); } else if (e == MOVE) { CustShrinkTabPager *cstp = (CustShrinkTabPager *) pager(); if (event_inside(r) && children() > 1) { @@ -1127,12 +1127,20 @@ void a_UIcmd_set_bug_prog(BrowserWindow *bw, int n_bug) } /* - * Set the page title. - * now it goes to the window titlebar (maybe to TAB label in the future). + * Set the page title in the window titlebar and tab label. + * (Update window titlebar for the current tab only) */ void a_UIcmd_set_page_title(BrowserWindow *bw, const char *label) { - BW2UI(bw)->set_page_title(label); + char title[128]; + + if (a_UIcmd_get_bw_by_widget(BW2UI(bw)->tabs()->selected_child()) == bw) { + // This is the focused bw, set window title + snprintf(title, 128, "Dillo: %s", label); + BW2UI(bw)->window()->copy_label(title); + BW2UI(bw)->window()->redraw_label(); + } + BW2UI(bw)->set_tab_title(label); } /* |