From 814c513743bfb73ce3592d044c8fa4d02a022307 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 28 Sep 2024 19:23:54 +0300 Subject: [PATCH] use default label text on value is empty --- src/browser/main/tab/label/title.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/browser/main/tab/label/title.rs b/src/browser/main/tab/label/title.rs index 5095045e..63260ad5 100644 --- a/src/browser/main/tab/label/title.rs +++ b/src/browser/main/tab/label/title.rs @@ -1,5 +1,7 @@ use gtk::{glib::GString, pango::EllipsizeMode, Label}; +const DEFAULT_LABEL_TEXT: &str = "New page"; + pub struct Title { widget: Label, } @@ -9,7 +11,7 @@ impl Title { pub fn new() -> Self { Self { widget: Label::builder() - .label("New page") + .label(DEFAULT_LABEL_TEXT) .ellipsize(EllipsizeMode::End) .width_chars(16) .single_line_mode(true) @@ -21,7 +23,7 @@ impl Title { pub fn update(&self, title: Option<&GString>) { match title { Some(title) => self.widget.set_text(title), - None => self.widget.set_text(""), // @TODO None/false option + None => self.widget.set_text(DEFAULT_LABEL_TEXT), } }