remove constructions not in use

This commit is contained in:
yggverse 2024-11-11 13:25:43 +02:00
parent 3d9ea1d54e
commit 89d0d13c42
4 changed files with 4 additions and 51 deletions

View File

@ -22,7 +22,6 @@ pub struct Item {
// useful as widget name in GTK actions callback // useful as widget name in GTK actions callback
id: GString, id: GString,
// Components // Components
action: Rc<Action>,
page: Rc<Page>, page: Rc<Page>,
widget: Rc<Widget>, widget: Rc<Widget>,
} }
@ -94,12 +93,7 @@ impl Item {
}); });
// Done // Done
Self { Self { id, page, widget }
id,
action,
page,
widget,
}
} }
// Actions // Actions

View File

@ -1,20 +1,12 @@
mod load; mod load;
use load::Load; use load::Load;
use gtk::{
gio::SimpleActionGroup,
glib::{uuid_string_random, GString},
prelude::ActionMapExt,
};
use std::rc::Rc; use std::rc::Rc;
/// [SimpleActionGroup](https://docs.gtk.org/gio/class.SimpleActionGroup.html) wrapper for `Browser` actions /// [SimpleActionGroup](https://docs.gtk.org/gio/class.SimpleActionGroup.html) wrapper for `Browser` actions
pub struct Action { pub struct Action {
// Actions // Actions
load: Rc<Load>, load: Rc<Load>,
// Group
id: GString,
gobject: SimpleActionGroup,
} }
impl Action { impl Action {
@ -22,20 +14,9 @@ impl Action {
/// Create new `Self` /// Create new `Self`
pub fn new() -> Self { pub fn new() -> Self {
// Init actions Self {
let load = Rc::new(Load::new()); load: Rc::new(Load::new()),
}
// Generate unique group ID
let id = uuid_string_random();
// Init group
let gobject = SimpleActionGroup::new();
// Add action to given group
gobject.add_action(load.gobject());
// Done
Self { load, id, gobject }
} }
// Getters // Getters
@ -44,17 +25,4 @@ impl Action {
pub fn load(&self) -> &Rc<Load> { pub fn load(&self) -> &Rc<Load> {
&self.load &self.load
} }
/// Get auto-generated name for action group
/// * useful for manual relationship with GObjects or as the `detailed_name`
/// for [Accels](https://docs.gtk.org/gtk4/method.Application.set_accels_for_action.html) or
/// [Menu](https://docs.gtk.org/gio/class.Menu.html) builder
pub fn id(&self) -> &GString {
&self.id
}
/// Get reference to [SimpleActionGroup](https://docs.gtk.org/gio/class.SimpleActionGroup.html) GObject
pub fn gobject(&self) -> &SimpleActionGroup {
&self.gobject
}
} }

View File

@ -50,11 +50,4 @@ impl Load {
}) })
}); });
} }
// Getters
/// Get reference to [SimpleAction](https://docs.gtk.org/gio/class.SimpleAction.html) GObject
pub fn gobject(&self) -> &SimpleAction {
&self.gobject
}
} }

View File

@ -33,7 +33,6 @@ pub struct Page {
cancellable: RefCell<Cancellable>, cancellable: RefCell<Cancellable>,
// Actions // Actions
browser_action: Rc<BrowserAction>, browser_action: Rc<BrowserAction>,
window_action: Rc<WindowAction>,
tab_action: Rc<TabAction>, tab_action: Rc<TabAction>,
// Components // Components
navigation: Rc<Navigation>, navigation: Rc<Navigation>,
@ -78,7 +77,6 @@ impl Page {
id, id,
// Actions // Actions
browser_action, browser_action,
window_action,
tab_action, tab_action,
// Components // Components
content, content,