2017-07-01 14:55:35 +00:00
|
|
|
use app_state::*;
|
|
|
|
use gtk::prelude::*;
|
|
|
|
use std::rc::Rc;
|
|
|
|
use gtk;
|
2017-07-02 17:08:17 +00:00
|
|
|
use ui_prefs_dialog::*;
|
2017-07-01 14:55:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
|
|
|
|
|
|
|
|
|
|
|
pub fn init_popup_menu(appstate: Rc<AppS>) {
|
|
|
|
|
|
|
|
/* about_item.connect_activate_link */
|
|
|
|
{
|
|
|
|
let apps = appstate.clone();
|
2017-07-04 14:54:16 +00:00
|
|
|
let about_item = &appstate.clone().gui.popup_menu.about_item;
|
|
|
|
about_item.connect_activate(
|
|
|
|
move |_| { on_about_item_activate(&apps); },
|
|
|
|
);
|
2017-07-01 14:55:35 +00:00
|
|
|
}
|
2017-07-02 16:11:56 +00:00
|
|
|
|
|
|
|
/* about_item.connect_activate_link */
|
|
|
|
{
|
2017-07-04 14:54:16 +00:00
|
|
|
let prefs_item = &appstate.clone().gui.popup_menu.prefs_item;
|
|
|
|
prefs_item.connect_activate(
|
|
|
|
move |_| { on_prefs_item_activate(appstate.clone()); },
|
|
|
|
);
|
2017-07-02 16:11:56 +00:00
|
|
|
}
|
2017-07-01 14:55:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn on_about_item_activate(appstate: &AppS) {
|
|
|
|
let popup_menu = &appstate.gui.popup_menu.menu_window;
|
|
|
|
let about_dialog = create_about_dialog();
|
|
|
|
about_dialog.set_skip_taskbar_hint(true);
|
|
|
|
about_dialog.set_transient_for(popup_menu);
|
|
|
|
about_dialog.run();
|
|
|
|
about_dialog.destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn create_about_dialog() -> gtk::AboutDialog {
|
|
|
|
let about_dialog: gtk::AboutDialog = gtk::AboutDialog::new();
|
|
|
|
|
2017-07-04 14:54:16 +00:00
|
|
|
about_dialog.set_license(Some(
|
|
|
|
"PNMixer is free software; you can redistribute it and/or modify it
|
2017-07-01 14:55:35 +00:00
|
|
|
under the terms of the GNU General Public License v3 as published
|
|
|
|
by the Free Software Foundation.
|
|
|
|
|
|
|
|
PNMixer is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with PNMixer; if not, write to the Free Software Foundation,
|
2017-07-04 14:54:16 +00:00
|
|
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.",
|
|
|
|
));
|
2017-07-01 14:55:35 +00:00
|
|
|
about_dialog.set_copyright(Some("Copyright © 2017 Julian Ospald"));
|
|
|
|
about_dialog.set_authors(&["Julian Ospald"]);
|
|
|
|
about_dialog.set_artists(&["Paul Davey"]);
|
|
|
|
about_dialog.set_program_name("pnmixer-rs");
|
|
|
|
about_dialog.set_logo_icon_name("pnmixer");
|
|
|
|
about_dialog.set_version(VERSION);
|
|
|
|
about_dialog.set_website("https://github.com/hasufell/pnmixer-rust");
|
|
|
|
about_dialog.set_comments("A mixer for the system tray");
|
|
|
|
|
|
|
|
return about_dialog;
|
|
|
|
}
|
2017-07-02 16:11:56 +00:00
|
|
|
|
|
|
|
|
2017-07-02 17:08:17 +00:00
|
|
|
fn on_prefs_item_activate(appstate: Rc<AppS>) {
|
2017-07-02 16:11:56 +00:00
|
|
|
/* TODO: only create if needed */
|
2017-07-02 17:08:17 +00:00
|
|
|
show_prefs_dialog(appstate);
|
2017-07-02 16:11:56 +00:00
|
|
|
}
|