implement separated dialogs for the Bookmarks and History menu items

This commit is contained in:
yggverse 2025-07-25 15:52:14 +03:00
parent e548efc93f
commit ebb38008e1
14 changed files with 378 additions and 171 deletions

View file

@ -0,0 +1,31 @@
use gtk::{gio::SimpleAction, glib::uuid_string_random};
/// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Profile` action of `Browser` group
pub struct Bookmarks {
pub simple_action: SimpleAction,
}
impl Default for Bookmarks {
fn default() -> Self {
Self::new()
}
}
impl Bookmarks {
// Constructors
/// Create new `Self`
pub fn new() -> Self {
Self {
simple_action: SimpleAction::new(&uuid_string_random(), None),
}
}
// Events
/// Define callback function for
/// [SimpleAction::activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
pub fn connect_activate(&self, callback: impl Fn() + 'static) {
self.simple_action.connect_activate(move |_, _| callback());
}
}

View file

@ -0,0 +1,31 @@
use gtk::{gio::SimpleAction, glib::uuid_string_random};
/// [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) wrapper for `Profile` action of `Browser` group
pub struct History {
pub simple_action: SimpleAction,
}
impl Default for History {
fn default() -> Self {
Self::new()
}
}
impl History {
// Constructors
/// Create new `Self`
pub fn new() -> Self {
Self {
simple_action: SimpleAction::new(&uuid_string_random(), None),
}
}
// Events
/// Define callback function for
/// [SimpleAction::activate](https://docs.gtk.org/gio/signal.SimpleAction.activate.html) signal
pub fn connect_activate(&self, callback: impl Fn() + 'static) {
self.simple_action.connect_activate(move |_, _| callback());
}
}