mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 03:47:23 +01:00
recording tile: Expose tracks editor
This commit is contained in:
parent
740ad0cf0b
commit
c4162fd98a
2 changed files with 17 additions and 3 deletions
|
|
@ -66,5 +66,6 @@ template $MusicusRecordingTile: Gtk.FlowBoxChild {
|
|||
}
|
||||
|
||||
menu edit_menu {
|
||||
item (_("Edit recording"), "recording.edit")
|
||||
item (_("Edit recording"), "recording.edit-recording")
|
||||
item (_("Edit tracks"), "recording.edit-tracks")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use gtk::{gio, glib, prelude::*, subclass::prelude::*};
|
|||
use std::cell::OnceCell;
|
||||
|
||||
mod imp {
|
||||
use crate::editor::tracks_editor::TracksEditor;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Default, gtk::CompositeTemplate)]
|
||||
|
|
@ -45,7 +47,7 @@ mod imp {
|
|||
self.parent_constructed();
|
||||
|
||||
let obj = self.obj().to_owned();
|
||||
let edit_action = gio::ActionEntry::builder("edit")
|
||||
let edit_recording_action = gio::ActionEntry::builder("edit-recording")
|
||||
.activate(move |_, _, _| {
|
||||
obj.imp()
|
||||
.navigation
|
||||
|
|
@ -59,8 +61,19 @@ mod imp {
|
|||
})
|
||||
.build();
|
||||
|
||||
let obj = self.obj().to_owned();
|
||||
let edit_tracks_action = gio::ActionEntry::builder("edit-tracks")
|
||||
.activate(move |_, _, _| {
|
||||
obj.imp().navigation.get().unwrap().push(&TracksEditor::new(
|
||||
obj.imp().navigation.get().unwrap(),
|
||||
obj.imp().library.get().unwrap(),
|
||||
Some(obj.imp().recording.get().unwrap().clone()),
|
||||
));
|
||||
})
|
||||
.build();
|
||||
|
||||
let actions = gio::SimpleActionGroup::new();
|
||||
actions.add_action_entries([edit_action]);
|
||||
actions.add_action_entries([edit_recording_action, edit_tracks_action]);
|
||||
self.obj().insert_action_group("recording", Some(&actions));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue