mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-12-15 10:01:39 +01:00
refactor: generic audio implementation (#98)
* refactor: Combine new_plugin and new for sidebar entries * chore: Format project * chore: Fix clippy warnings * wip: generic audio implementation * wip: format and fix warnings * wip: Refactor Dbus functions * wip: Add TAudioStreamObject * fix: use prelude instead of traits * wip: Add generic audio stream * wip: Work on generic audio listener * wip: Finish audio generics refactoring * fix: Use proper path for dbus function * chore: Format project * fix: Use adw prelude instead of traits
This commit is contained in:
parent
fd99d902c2
commit
5f0781ee18
52 changed files with 2590 additions and 2327 deletions
|
|
@ -5,10 +5,13 @@ use std::cell::RefCell;
|
|||
use std::sync::Arc;
|
||||
use std::time::SystemTime;
|
||||
|
||||
use crate::components::audio::audio_entry::{AudioIcons, DBusFunction, TAudioEntryImpl};
|
||||
use crate::components::audio::output::sink_entry;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{Button, CheckButton, CompositeTemplate, Label, Scale};
|
||||
|
||||
use super::sink_const::{ICONS, SETDEFAULT, SETMUTE, SETVOLUME};
|
||||
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetSinkEntry.ui")]
|
||||
pub struct SinkEntry {
|
||||
|
|
@ -22,7 +25,7 @@ pub struct SinkEntry {
|
|||
pub reset_volume_slider: TemplateChild<Scale>,
|
||||
#[template_child]
|
||||
pub reset_volume_percentage: TemplateChild<Label>,
|
||||
pub stream: Arc<RefCell<Sink>>,
|
||||
pub sink: Arc<RefCell<Sink>>,
|
||||
pub volume_time_stamp: RefCell<Option<SystemTime>>,
|
||||
}
|
||||
|
||||
|
|
@ -47,3 +50,49 @@ impl PreferencesGroupImpl for SinkEntry {}
|
|||
impl ObjectImpl for SinkEntry {}
|
||||
|
||||
impl WidgetImpl for SinkEntry {}
|
||||
|
||||
impl TAudioEntryImpl<Sink> for SinkEntry {
|
||||
fn name(&self) -> &TemplateChild<ActionRow> {
|
||||
&self.reset_sink_name
|
||||
}
|
||||
|
||||
fn selected_audio_object(&self) -> &TemplateChild<CheckButton> {
|
||||
&self.reset_selected_sink
|
||||
}
|
||||
|
||||
fn mute(&self) -> &TemplateChild<Button> {
|
||||
&self.reset_sink_mute
|
||||
}
|
||||
|
||||
fn volume_slider(&self) -> &TemplateChild<Scale> {
|
||||
&self.reset_volume_slider
|
||||
}
|
||||
|
||||
fn volume_percentage(&self) -> &TemplateChild<Label> {
|
||||
&self.reset_volume_percentage
|
||||
}
|
||||
|
||||
fn audio_object(&self) -> Arc<RefCell<Sink>> {
|
||||
self.sink.clone()
|
||||
}
|
||||
|
||||
fn volume_time_stamp(&self) -> &RefCell<Option<SystemTime>> {
|
||||
&self.volume_time_stamp
|
||||
}
|
||||
|
||||
fn set_volume_fn(&self) -> &'static DBusFunction {
|
||||
&SETVOLUME
|
||||
}
|
||||
|
||||
fn set_audio_object_fn(&self) -> &'static DBusFunction {
|
||||
&SETDEFAULT
|
||||
}
|
||||
|
||||
fn set_mute_fn(&self) -> &'static DBusFunction {
|
||||
&SETMUTE
|
||||
}
|
||||
|
||||
fn icons(&self) -> &AudioIcons {
|
||||
&ICONS
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue