Debian Codegraph @

src/main.rs

raw
1 // Fragments - main.rs
2 // Copyright (C) 2022-2023 Felix Häcker <[email protected]>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17 #[macro_use]
18 extern crate log;
19 extern crate pretty_env_logger;
20 #[macro_use]
21 extern crate strum_macros;
22
23 use gettextrs::*;
24 use gtk::{gio, glib};
25
26 mod backend;
27 mod model;
28 mod settings;
29 mod ui;
30
31 mod actions;
32 mod app;
33 #[rustfmt::skip]
34 mod config;
35 mod i18n;
36 mod path;
37 mod utils;
38
39 use crate::app::FrgApplication;
40
41 fn main() {
42 // Initialize logger
43 pretty_env_logger::init();
44
45 // Initialize GTK
46 gtk::init().expect("Failed to initialize GTK.");
47
48 // Initialize paths
49 path::init().expect("Unable to create paths.");
50
51 // Setup language / translations
52 setlocale(LocaleCategory::LcAll, "");
53 bindtextdomain(config::PKGNAME, config::LOCALEDIR).unwrap();
54 textdomain(config::PKGNAME).unwrap();
55
56 // Load app resources
57 let path = &format!(
58 "{}/{}/{}.gresource",
59 config::DATADIR,
60 config::PKGNAME,
61 config::APP_ID
62 );
63 let res = gio::Resource::load(path).expect("Could not load resources");
64 gio::resources_register(&res);
65
66 glib::set_application_name(config::NAME);
67
68 // Run app itself
69 FrgApplication::run();
70 }