2020-10-08 09:15:40 -04:00
|
|
|
#![allow(deprecated)]
|
|
|
|
use gtk::prelude::*;
|
|
|
|
mod ui;
|
|
|
|
mod builder;
|
|
|
|
mod error;
|
|
|
|
mod rowdata;
|
|
|
|
mod dbus_client;
|
2021-10-04 05:57:20 -04:00
|
|
|
|
2020-10-08 09:15:40 -04:00
|
|
|
use libcitadel::CommandLine;
|
|
|
|
use ui::Ui;
|
|
|
|
|
|
|
|
pub use error::{Result,Error};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let application =
|
2021-10-04 05:57:20 -04:00
|
|
|
gtk::Application::new(Some("com.subgraph.citadel-installer"), Default::default());
|
2020-10-08 09:15:40 -04:00
|
|
|
|
|
|
|
application.connect_activate(|app| {
|
|
|
|
if !(CommandLine::live_mode() || CommandLine::install_mode()) {
|
|
|
|
let dialog = gtk::MessageDialog::new(
|
|
|
|
None::<>k::Window>,
|
|
|
|
gtk::DialogFlags::empty(),
|
|
|
|
gtk::MessageType::Error,
|
|
|
|
gtk::ButtonsType::Cancel,
|
2021-01-15 09:00:20 -05:00
|
|
|
"Citadel Installer can only be run during install mode");
|
2020-10-08 09:15:40 -04:00
|
|
|
dialog.run();
|
|
|
|
} else {
|
|
|
|
match Ui::build(app) {
|
|
|
|
Ok(ui) => {
|
|
|
|
ui.assistant.show_all();
|
|
|
|
ui.start();
|
|
|
|
},
|
|
|
|
Err(err) => {
|
|
|
|
println!("Could not start application: {:?}", err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2021-10-04 05:57:20 -04:00
|
|
|
application.run();
|
2020-10-08 09:15:40 -04:00
|
|
|
}
|