mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
create separated wrappers for history, close action group
This commit is contained in:
parent
4afa2c204c
commit
8113022cd4
22 changed files with 557 additions and 335 deletions
|
|
@ -3,8 +3,9 @@ use database::Database;
|
|||
|
||||
use adw::ApplicationWindow;
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
prelude::{ActionMapExt, GtkWindowExt, IsA},
|
||||
gio::SimpleActionGroup,
|
||||
glib::GString,
|
||||
prelude::{GtkWindowExt, IsA, WidgetExt},
|
||||
};
|
||||
use sqlite::Transaction;
|
||||
|
||||
|
|
@ -19,7 +20,10 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new(content: &impl IsA<gtk::Widget>, actions: &[SimpleAction]) -> Self {
|
||||
pub fn new(
|
||||
content: &impl IsA<gtk::Widget>,
|
||||
action_groups: &[(&GString, &SimpleActionGroup)],
|
||||
) -> Self {
|
||||
// Init GTK
|
||||
let gobject = ApplicationWindow::builder()
|
||||
.content(content)
|
||||
|
|
@ -29,8 +33,8 @@ impl Widget {
|
|||
.build();
|
||||
|
||||
// Register actions
|
||||
for action in actions {
|
||||
gobject.add_action(action);
|
||||
for (name, group) in action_groups {
|
||||
gobject.insert_action_group(name, Some(group.clone()));
|
||||
}
|
||||
|
||||
// Return new struct
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue