From e2ab831d570f04cfe7e65510ab9ed95b8acd4b2d Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 9 Oct 2024 10:19:38 +0300 Subject: [PATCH] remove deprecated optional arguments --- src/app/browser.rs | 2 +- src/app/browser/header.rs | 2 +- src/app/browser/header/title.rs | 19 +++++++------------ 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/app/browser.rs b/src/app/browser.rs index ecc58175..542ae126 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -136,7 +136,7 @@ impl Browser { None => GString::new(), // @TODO }; - header.update(Some(title.as_str()), Some(subtitle.as_str())); + header.update(title.as_str(), subtitle.as_str()); } }); diff --git a/src/app/browser/header.rs b/src/app/browser/header.rs index cb9f2ae8..6c543f2a 100644 --- a/src/app/browser/header.rs +++ b/src/app/browser/header.rs @@ -56,7 +56,7 @@ impl Header { } // Actions - pub fn update(&self, title: Option<&str>, description: Option<&str>) { + pub fn update(&self, title: &str, description: &str) { self.title.update(title, description); } diff --git a/src/app/browser/header/title.rs b/src/app/browser/header/title.rs index 8f185d7a..8de81da6 100644 --- a/src/app/browser/header/title.rs +++ b/src/app/browser/header/title.rs @@ -16,25 +16,20 @@ impl Title { } // Actions - pub fn update(&self, title: Option<&str>, subtitle: Option<&str>) { + pub fn update(&self, title: &str, subtitle: &str) { // Update title - let mut name = Vec::new(); + let mut parts = Vec::new(); - if let Some(value) = title { - if !value.is_empty() { - name.push(value); - } + if !title.is_empty() { + parts.push(title); } - name.push(DEFAULT_TITLE); + parts.push(DEFAULT_TITLE); - self.gobject.set_title(&name.join(" - ")); + self.gobject.set_title(&parts.join(" - ")); // Update subtitle - self.gobject.set_subtitle(&match subtitle { - Some(value) => value, - None => "", // @TODO - }); + self.gobject.set_subtitle(subtitle); } // Getters