changeset 2093:16cdda1f8379

Made tab and window titles more informative (WRT length)
author Jorge Arellano Cid <jcid@dillo.org>
date Di, 14 Jun 2011 17:48:29 -0400
parents ab594893c6f9
children 6cee904c7bb1
files src/uicmd.cc src/web.cc
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/uicmd.cc	Di Jun 14 17:39:41 2011 -0400
+++ b/src/uicmd.cc	Di Jun 14 17:48:29 2011 -0400
@@ -296,8 +296,8 @@
 
       // Update window title
       if ((bw = a_UIcmd_get_bw_by_widget(cbtn->ui()))) {
-         const char *title = a_History_get_title(NAV_TOP_UIDX(bw), 1);
-         a_UIcmd_set_page_title(bw, title ? title : "");
+         const char *title = (cbtn->ui())->label();
+         cbtn->window()->copy_label(title ? title : "");
       }
    }
 }
@@ -1157,6 +1157,7 @@
          uint_t i = MIN(size - 4, 1 + a_Utf8_end_of_char(title, size - 8));
          snprintf(title + i, 4, "...");
       }
+      BW2UI(bw)->copy_label(title);
       BW2UI(bw)->window()->copy_label(title);
    }
    BW2UI(bw)->tabs()->set_tab_label(BW2UI(bw), label);
--- a/src/web.cc	Di Jun 14 17:39:41 2011 -0400
+++ b/src/web.cc	Di Jun 14 17:48:29 2011 -0400
@@ -78,8 +78,11 @@
       /* This method frees the old dw if any */
       layout->setWidget(dw);
 
-      /* Clear the title bar for pages without a <TITLE> tag */
-      a_UIcmd_set_page_title(Web->bw, "");
+      /* Set the page title with the bare filename (e.g. for images),
+       * HTML pages with a <TITLE> tag will overwrite it later */
+      const char *p = strrchr(URL_STR(Web->url), '/');
+      a_UIcmd_set_page_title(Web->bw, p ? p+1 : "");
+
       a_UIcmd_set_location_text(Web->bw, URL_STR(Web->url));
       /* Reset both progress bars */
       a_UIcmd_set_page_prog(Web->bw, 0, 2);