pnmixer-rust/src/ui_tray_icon.rs

21 lines
543 B
Rust
Raw Normal View History

2017-06-29 12:55:07 +00:00
use app_state::*;
use gtk::prelude::*;
use gtk;
pub fn init_tray_icon(appstate: &AppS) {
let ref tray_icon = appstate.status_icon;
let popup_window: gtk::Window =
appstate.builder_popup.get_object("popup_window").unwrap();
tray_icon.connect_activate(move |_| if popup_window.get_visible() {
2017-06-29 21:35:39 +00:00
popup_window.hide();
} else {
popup_window.show_now();
});
2017-06-29 12:55:07 +00:00
tray_icon.set_visible(true);
}