implement nex protocol driver

This commit is contained in:
yggverse 2025-06-26 17:02:18 +03:00
parent aafd3b5db3
commit 02eb8e4a71
7 changed files with 311 additions and 15 deletions

View file

@ -309,7 +309,10 @@ fn update_primary_icon(entry: &Entry, profile: &Profile) {
entry.first_child().unwrap().remove_css_class("success"); // @TODO handle
match primary_icon::from(&entry.text()) {
PrimaryIcon::Download { name, tooltip } | PrimaryIcon::File { name, tooltip } => {
PrimaryIcon::Download { name, tooltip }
| PrimaryIcon::File { name, tooltip }
| PrimaryIcon::Source { name, tooltip }
| PrimaryIcon::Nex { name, tooltip } => {
entry.set_primary_icon_activatable(false);
entry.set_primary_icon_sensitive(false);
entry.set_primary_icon_name(Some(name));
@ -332,12 +335,6 @@ fn update_primary_icon(entry: &Entry, profile: &Profile) {
entry.set_primary_icon_name(Some(name));
entry.set_primary_icon_tooltip_text(Some(tooltip));
}
PrimaryIcon::Source { name, tooltip } => {
entry.set_primary_icon_activatable(false);
entry.set_primary_icon_sensitive(false);
entry.set_primary_icon_name(Some(name));
entry.set_primary_icon_tooltip_text(Some(tooltip));
}
}
}
@ -415,10 +412,7 @@ fn prefix_less(entry: &Entry) -> GString {
/// Try get current request value as [Uri](https://docs.gtk.org/glib/struct.Uri.html)
/// * `strip_prefix` on parse
fn uri(entry: &Entry) -> Option<Uri> {
match Uri::parse(&prefix_less(entry), UriFlags::NONE) {
Ok(uri) => Some(uri),
_ => None,
}
Uri::parse(&prefix_less(entry), UriFlags::NONE).ok()
}
/// Try build home [Uri](https://docs.gtk.org/glib/struct.Uri.html) for `Self`

View file

@ -23,6 +23,10 @@ pub enum PrimaryIcon<'a> {
name: &'a str,
tooltip: (&'a str, &'a str),
},
Nex {
name: &'a str,
tooltip: &'a str,
},
}
pub fn from(request: &str) -> PrimaryIcon {
@ -49,20 +53,27 @@ pub fn from(request: &str) -> PrimaryIcon {
};
}
if prefix.starts_with("gemini:") {
if prefix.starts_with("gemini://") {
return PrimaryIcon::Gemini {
name: "channel-secure-symbolic",
tooltip: ("Guest session", "User session"),
};
}
if prefix.starts_with("titan:") {
if prefix.starts_with("titan://") {
return PrimaryIcon::Titan {
name: "document-send-symbolic",
tooltip: ("Guest titan input", "User titan input"),
};
}
if prefix.starts_with("nex://") {
return PrimaryIcon::Nex {
name: "network-server-symbolic",
tooltip: "Nex protocol connection",
};
}
PrimaryIcon::Search {
name: "system-search-symbolic",
tooltip: "Choose default search provider",