2017-06-27 22:23:12 +00:00
|
|
|
use gtk;
|
2017-07-01 22:03:21 +00:00
|
|
|
use audio::Audio;
|
2017-07-04 19:15:11 +00:00
|
|
|
use ui_tray_icon::TrayIcon;
|
2017-07-02 16:11:56 +00:00
|
|
|
|
2017-06-27 22:23:12 +00:00
|
|
|
|
2017-06-28 15:53:19 +00:00
|
|
|
|
2017-06-30 15:24:26 +00:00
|
|
|
// TODO: destructors
|
2017-06-29 12:55:07 +00:00
|
|
|
|
2017-06-29 13:50:24 +00:00
|
|
|
// TODO: glade stuff, config, alsacard
|
2017-06-27 22:23:12 +00:00
|
|
|
pub struct AppS {
|
2017-06-30 15:24:26 +00:00
|
|
|
pub gui: Gui,
|
2017-07-01 22:03:21 +00:00
|
|
|
pub audio: Audio,
|
2017-06-30 15:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl AppS {
|
|
|
|
pub fn new() -> AppS {
|
2017-07-04 14:54:16 +00:00
|
|
|
let builder_popup_window = gtk::Builder::new_from_string(include_str!(
|
|
|
|
"../data/ui/popup-window.glade"
|
|
|
|
));
|
|
|
|
let builder_popup_menu = gtk::Builder::new_from_string(
|
|
|
|
include_str!("../data/ui/popup-menu.glade"),
|
|
|
|
);
|
2017-07-02 17:08:17 +00:00
|
|
|
|
2017-06-30 15:24:26 +00:00
|
|
|
return AppS {
|
2017-07-04 14:54:16 +00:00
|
|
|
gui: Gui::new(builder_popup_window, builder_popup_menu),
|
|
|
|
audio: Audio::new(None, Some(String::from("Master"))).unwrap(),
|
|
|
|
};
|
2017-06-30 15:24:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub struct Gui {
|
2017-07-04 19:15:11 +00:00
|
|
|
pub tray_icon: TrayIcon,
|
2017-06-30 15:24:26 +00:00
|
|
|
pub popup_window: PopupWindow,
|
2017-07-01 14:55:35 +00:00
|
|
|
pub popup_menu: PopupMenu,
|
2017-07-02 17:08:17 +00:00
|
|
|
/* prefs_dialog is dynamically created and destroyed */
|
2017-06-30 15:24:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Gui {
|
2017-07-04 14:54:16 +00:00
|
|
|
pub fn new(
|
|
|
|
builder_popup_window: gtk::Builder,
|
|
|
|
builder_popup_menu: gtk::Builder,
|
|
|
|
) -> Gui {
|
2017-06-30 15:24:26 +00:00
|
|
|
return Gui {
|
2017-07-04 19:15:11 +00:00
|
|
|
tray_icon: TrayIcon::new().unwrap(),
|
2017-07-04 14:54:16 +00:00
|
|
|
popup_window: PopupWindow::new(builder_popup_window),
|
|
|
|
popup_menu: PopupMenu::new(builder_popup_menu),
|
|
|
|
};
|
2017-06-30 15:24:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-07-04 14:54:16 +00:00
|
|
|
create_builder_item!(
|
|
|
|
PopupWindow,
|
|
|
|
popup_window: gtk::Window,
|
|
|
|
vol_scale_adj: gtk::Adjustment,
|
|
|
|
vol_scale: gtk::Scale,
|
|
|
|
mute_check: gtk::CheckButton
|
|
|
|
);
|
2017-07-02 16:11:56 +00:00
|
|
|
|
|
|
|
|
2017-07-04 14:54:16 +00:00
|
|
|
create_builder_item!(
|
|
|
|
PopupMenu,
|
|
|
|
menu_window: gtk::Window,
|
|
|
|
menubar: gtk::MenuBar,
|
|
|
|
menu: gtk::Menu,
|
|
|
|
about_item: gtk::MenuItem,
|
|
|
|
prefs_item: gtk::MenuItem
|
|
|
|
);
|