-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Application.vala
74 lines (62 loc) · 2.22 KB
/
Application.vala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2016-2024 elementary, Inc. (https://elementary.io)
*
* Authored by: Corentin Noël <corentin@elementary.io>
*/
public class Installer.App : Gtk.Application {
public const OptionEntry[] INSTALLER_OPTIONS = {
{ "test", 't', 0, OptionArg.NONE, out test_mode, "Non-destructive test mode", null},
{ null }
};
public static bool test_mode;
public App () {
Object (
application_id: "io.elementary.installer",
flags: ApplicationFlags.FLAGS_NONE
);
}
construct {
GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (application_id, Build.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (application_id, "UTF-8");
GLib.Intl.textdomain (application_id);
add_main_option_entries (INSTALLER_OPTIONS);
}
public override void startup () {
base.startup ();
var css_provider = new Gtk.CssProvider ();
css_provider.load_from_resource ("io/elementary/installer/Application.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
css_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
var css_fallback = new Gtk.CssProvider ();
css_fallback.load_from_resource ("io/elementary/installer/disk-bar-fallback.css");
Gtk.StyleContext.add_provider_for_screen (
Gdk.Screen.get_default (),
css_fallback,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
);
}
public override void activate () {
var window = new MainWindow () {
deletable = false,
default_height = 600,
default_width = 850,
icon_name = application_id,
title = _("Install %s").printf (Utils.get_pretty_name ())
};
window.show_all ();
add_window (window);
inhibit (
get_active_window (),
Gtk.ApplicationInhibitFlags.IDLE | Gtk.ApplicationInhibitFlags.SUSPEND,
_("operating system is being installed")
);
}
}
public static int main (string[] args) {
return new Installer.App ().run (args);
}