File: application.vala

package info (click to toggle)
gnome-metronome 0.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 388 kB
  • sloc: xml: 22; python: 12; makefile: 3
file content (74 lines) | stat: -rw-r--r-- 2,455 bytes parent folder | download
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
/* application.vala
 *
 * Copyright 2020 João Vieira <jvieira.tpt@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */


public class Metronome.Application : Gtk.Application {
    private Gtk.ApplicationWindow window;

    private const ActionEntry[] action_entries = {
        { "about", about },
    };

    public Application () {
        Object (
            application_id: "com.jvieira.tpt.Metronome",
            flags: ApplicationFlags.FLAGS_NONE
        );
    }

    construct {
        add_action_entries (action_entries, this);
    }

    protected override void activate () {
        window = new Metronome.Window (this);
        add_window (window);
    }

    protected override void startup () {
        base.startup ();
        var screen = Gdk.Screen.get_default ();
        var provider = new Gtk.CssProvider ();
        provider.load_from_resource ("/com/jvieira/tpt/Metronome/Adwaita.css");
        Gtk.StyleContext.add_provider_for_screen (screen, provider, 600);
    }

    private void about () {
        Gtk.AboutDialog about_dialog = new Gtk.AboutDialog ();
        about_dialog.destroy_with_parent = true;
        about_dialog.transient_for = window;
        about_dialog.modal = true;

        about_dialog.program_name = "Metronome";
        about_dialog.comments = "A Metronome for GNOME";
        about_dialog.version = "0.1.1";
        about_dialog.logo_icon_name = "com.jvieira.tpt.Metronome";

        about_dialog.website = "https://gitlab.gnome.org/jvieira.tpt/metronome";
        about_dialog.website_label = "Metronome";

        about_dialog.license_type = Gtk.License.GPL_3_0;

        about_dialog.authors = Credits.AUTHORS;
        about_dialog.artists = Credits.ARTISTS;

        about_dialog.present_with_time (Gtk.get_current_event_time ());
    }
}