implement save as.. menu item

This commit is contained in:
yggverse 2024-12-11 16:19:37 +02:00
parent 6f038539d6
commit 17985d9a7b
8 changed files with 142 additions and 34 deletions

View file

@ -5,7 +5,7 @@ use widget::Widget;
use crate::app::browser::{window::tab::item::Action as TabAction, Action as BrowserAction};
use gtk::{
glib::{GString, Uri, UriFlags},
glib::{gformat, GString, Uri, UriFlags},
prelude::EditableExt,
};
use sqlite::Transaction;
@ -88,6 +88,12 @@ impl Request {
Ok(())
}
// Setters
pub fn to_download(&self) {
self.widget.entry.set_text(&self.download());
}
// Getters
pub fn uri(&self) -> Option<Uri> {
@ -110,6 +116,10 @@ impl Request {
text
}
pub fn download(&self) -> GString {
gformat!("download:{}", self.strip_prefix())
}
}
// Tools

View file

@ -25,6 +25,15 @@ impl Menu {
)),
);
main.append(
Some("Save as.."),
Some(&format!(
"{}.{}",
window_action.id,
window_action.save_as.gobject.name()
)),
);
let main_mark = gtk::gio::Menu::new();
main_mark.append(