remove extra getters

This commit is contained in:
yggverse 2024-11-28 01:35:48 +02:00
parent 3ce272cd70
commit 0af69d99f6
56 changed files with 240 additions and 710 deletions

View file

@ -20,14 +20,14 @@ use std::rc::Rc;
/// [SimpleActionGroup](https://docs.gtk.org/gio/class.SimpleActionGroup.html) wrapper for `Browser` actions
pub struct Action {
// Actions
about: Rc<About>,
close: Rc<Close>,
debug: Rc<Debug>,
profile: Rc<Profile>,
update: Rc<Update>,
pub about: Rc<About>,
pub close: Rc<Close>,
pub debug: Rc<Debug>,
pub profile: Rc<Profile>,
pub update: Rc<Update>,
// Group
id: GString,
gobject: SimpleActionGroup,
pub id: GString,
pub gobject: SimpleActionGroup,
}
impl Action {
@ -49,11 +49,11 @@ impl Action {
let gobject = SimpleActionGroup::new();
// Add action to given group
gobject.add_action(about.gobject());
gobject.add_action(close.gobject());
gobject.add_action(debug.gobject());
gobject.add_action(profile.gobject());
gobject.add_action(update.gobject());
gobject.add_action(&about.gobject);
gobject.add_action(&close.gobject);
gobject.add_action(&debug.gobject);
gobject.add_action(&profile.gobject);
gobject.add_action(&update.gobject);
// Done
Self {
@ -66,44 +66,4 @@ impl Action {
gobject,
}
}
// Getters
/// Get reference to `About` action
pub fn about(&self) -> &Rc<About> {
&self.about
}
/// Get reference to `Close` action
pub fn close(&self) -> &Rc<Close> {
&self.close
}
/// Get reference to `Debug` action
pub fn debug(&self) -> &Rc<Debug> {
&self.debug
}
/// Get reference to `Profile` action
pub fn profile(&self) -> &Rc<Profile> {
&self.profile
}
/// Get reference to `Update` action
pub fn update(&self) -> &Rc<Update> {
&self.update
}
/// 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
}
}