mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
move strip_prefix getter to request api
This commit is contained in:
parent
4e0797bd6e
commit
6f038539d6
3 changed files with 17 additions and 19 deletions
|
|
@ -5,7 +5,7 @@ use widget::Widget;
|
|||
|
||||
use crate::app::browser::{window::tab::item::Action as TabAction, Action as BrowserAction};
|
||||
use gtk::{
|
||||
glib::{Uri, UriFlags},
|
||||
glib::{GString, Uri, UriFlags},
|
||||
prelude::EditableExt,
|
||||
};
|
||||
use sqlite::Transaction;
|
||||
|
|
@ -96,6 +96,20 @@ impl Request {
|
|||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn strip_prefix(&self) -> GString {
|
||||
let mut text = self.widget.entry.text();
|
||||
|
||||
if let Some(postfix) = text.strip_prefix("source:") {
|
||||
text = postfix.into()
|
||||
};
|
||||
|
||||
if let Some(postfix) = text.strip_prefix("download:") {
|
||||
text = postfix.into()
|
||||
};
|
||||
|
||||
text
|
||||
}
|
||||
}
|
||||
|
||||
// Tools
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue