diff --git a/data/mlm.gresource.xml b/data/mlm.gresource.xml index 2cab5378623d53b8f26c3ecfba1f5be3e80b5c56..b24f07a0e09212b65dd3565d2a7e61330c8254d4 100644 --- a/data/mlm.gresource.xml +++ b/data/mlm.gresource.xml @@ -3,5 +3,7 @@ mlm.css mlm.ui + mlm.svg + shortcuts.ui diff --git a/data/shortcuts.ui b/data/shortcuts.ui new file mode 100644 index 0000000000000000000000000000000000000000..57c5d70dd0d75f7392b8e0edc594a11a707c41ff --- /dev/null +++ b/data/shortcuts.ui @@ -0,0 +1,79 @@ + + + + + diff --git a/meson.build b/meson.build index 04992ce9f83b3b283ec3963394fe76b63075621f..08f6efdb8401ed30667fb0fbb0742d70dac71c08 100644 --- a/meson.build +++ b/meson.build @@ -134,7 +134,8 @@ mlm_gui_sources = [ 'src/application/encoder.vala', 'src/application/main.vala', 'src/application/media.vala', - 'src/application/player.vala' + 'src/application/player.vala', + 'src/application/shortcuts-window.vala' ] mlm_gui_dependencies = [ diff --git a/src/application/application-window.vala b/src/application/application-window.vala index df4dffa9508c34bb302213aceb4dc8eb2c57f639..9e26092058b0907210968c792b5e820fdc0f20cd 100644 --- a/src/application/application-window.vala +++ b/src/application/application-window.vala @@ -157,6 +157,8 @@ namespace MLM { [GtkChild] private Gtk.Label filename_label; + /* The shortcuts dialog. */ + private ShortcutsWindow shortcuts; /* The MLM application. */ private Application mlm; /* The file tags. */ @@ -462,6 +464,15 @@ namespace MLM { "wrap-license", true); } + /** + * Shows the shortcuts dialog. + */ + public void show_shortcuts_dialog() { + if (shortcuts == null) + shortcuts = new ShortcutsWindow(); + shortcuts.show_all(); + } + /* Selects an image from a file. */ private uint8[]? select_image(string title) { var dialog = diff --git a/src/application/application.vala b/src/application/application.vala index d8c1c58f159947fa0490432adbcc820d65190c46..912515d6b5f8a9d4aaf3353ad3ef5e1abbcd0871 100644 --- a/src/application/application.vala +++ b/src/application/application.vala @@ -90,6 +90,11 @@ namespace MLM { action.activate.connect(stop_encoder); add_action(action); + action = new GLib.SimpleAction("shortcuts", null); + action.activate.connect(shortcuts); + add_action(action); + set_accels_for_action("app.shortcuts", new string[]{"T"}); + action = new GLib.SimpleAction("about", null); action.activate.connect(about); add_action(action); @@ -242,6 +247,11 @@ namespace MLM { tags.update(); } + /* The shortcuts action. */ + private void shortcuts() { + window.show_shortcuts_dialog(); + } + /* Compares two files by path. */ private int compare_files_by_path(GLib.File a, GLib.File b) { return a.get_path().collate(b.get_path()); diff --git a/src/application/shortcuts-window.vala b/src/application/shortcuts-window.vala new file mode 100644 index 0000000000000000000000000000000000000000..96c5ce398e3be4c171f08cc2a44bde47ada0b1cf --- /dev/null +++ b/src/application/shortcuts-window.vala @@ -0,0 +1,27 @@ +/* + * This file is part of mlm. + * + * Copyright © 2016-2018 Canek Peláez Valdés + * + * 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 . + */ + +namespace MLM { + + /** + * Class for shortcuts windows. + */ + [GtkTemplate (ui = "/mx/unam/MLM/shortcuts.ui")] + public class ShortcutsWindow : Gtk.ShortcutsWindow {} +}