From 315174befbf8b821b832efe5a2083d12df0f358b Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 11 Dec 2024 07:33:06 +0200 Subject: [PATCH] enshort member names --- .../item/page/navigation/request/widget.rs | 40 ++++++------------- .../navigation/request/widget/primary_icon.rs | 32 +++++++-------- 2 files changed, 29 insertions(+), 43 deletions(-) diff --git a/src/app/browser/window/tab/item/page/navigation/request/widget.rs b/src/app/browser/window/tab/item/page/navigation/request/widget.rs index 0be67cf7..5a40a197 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/widget.rs @@ -184,42 +184,28 @@ impl Widget { self.entry.set_primary_icon_sensitive(false); match primary_icon::from(&self.entry.text()) { - PrimaryIcon::Download { - icon_name, - tooltip_text, - } => { - self.entry.set_primary_icon_name(Some(icon_name)); - self.entry.set_primary_icon_tooltip_text(Some(tooltip_text)); + PrimaryIcon::Download { name, tooltip } => { + self.entry.set_primary_icon_name(Some(name)); + self.entry.set_primary_icon_tooltip_text(Some(tooltip)); } - PrimaryIcon::Gemini { - icon_name, - tooltip_text, - } => { + PrimaryIcon::Gemini { name, tooltip } => { self.entry.set_primary_icon_activatable(true); self.entry.set_primary_icon_sensitive(true); - self.entry.set_primary_icon_name(Some(icon_name)); + self.entry.set_primary_icon_name(Some(name)); if is_identity_active { self.entry.first_child().unwrap().add_css_class("success"); // @TODO handle - self.entry - .set_primary_icon_tooltip_text(Some(tooltip_text.1)); + self.entry.set_primary_icon_tooltip_text(Some(tooltip.1)); } else { - self.entry - .set_primary_icon_tooltip_text(Some(tooltip_text.0)); + self.entry.set_primary_icon_tooltip_text(Some(tooltip.0)); } } - PrimaryIcon::Search { - icon_name, - tooltip_text, - } => { - self.entry.set_primary_icon_name(Some(icon_name)); - self.entry.set_primary_icon_tooltip_text(Some(tooltip_text)); + PrimaryIcon::Search { name, tooltip } => { + self.entry.set_primary_icon_name(Some(name)); + self.entry.set_primary_icon_tooltip_text(Some(tooltip)); } - PrimaryIcon::Source { - icon_name, - tooltip_text, - } => { - self.entry.set_primary_icon_name(Some(icon_name)); - self.entry.set_primary_icon_tooltip_text(Some(tooltip_text)); + PrimaryIcon::Source { name, tooltip } => { + self.entry.set_primary_icon_name(Some(name)); + self.entry.set_primary_icon_tooltip_text(Some(tooltip)); } } diff --git a/src/app/browser/window/tab/item/page/navigation/request/widget/primary_icon.rs b/src/app/browser/window/tab/item/page/navigation/request/widget/primary_icon.rs index 11044aeb..5090e1a9 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/widget/primary_icon.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/widget/primary_icon.rs @@ -1,46 +1,46 @@ pub enum PrimaryIcon<'a> { Download { - icon_name: &'a str, - tooltip_text: &'a str, + name: &'a str, + tooltip: &'a str, }, Gemini { - icon_name: &'a str, - tooltip_text: (&'a str, &'a str), + name: &'a str, + tooltip: (&'a str, &'a str), }, Search { - icon_name: &'a str, - tooltip_text: &'a str, + name: &'a str, + tooltip: &'a str, }, Source { - icon_name: &'a str, - tooltip_text: &'a str, + name: &'a str, + tooltip: &'a str, }, } pub fn from(request: &str) -> PrimaryIcon { if request.starts_with("download:") { return PrimaryIcon::Download { - icon_name: "document-save-symbolic", - tooltip_text: "Download", + name: "document-save-symbolic", + tooltip: "Download", }; } if request.starts_with("source:") { return PrimaryIcon::Source { - icon_name: "applications-system-symbolic", - tooltip_text: "Source view", + name: "applications-system-symbolic", + tooltip: "Source view", }; } if request.starts_with("gemini:") { return PrimaryIcon::Gemini { - icon_name: "channel-secure-symbolic", - tooltip_text: ("Guest session", "User session"), + name: "channel-secure-symbolic", + tooltip: ("Guest session", "User session"), }; } PrimaryIcon::Search { - icon_name: "system-search-symbolic", - tooltip_text: "Search", + name: "system-search-symbolic", + tooltip: "Search", } }