1 /*
2  * This file is part of Siril, an astronomy image processor.
3  * Copyright (C) 2005-2011 Francois Meyer (dulle at free.fr)
4  * Copyright (C) 2012-2021 team free-astro (see more in AUTHORS file)
5  * Reference site is https://free-astro.org/index.php/Siril
6  *
7  * Siril is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * Siril is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with Siril. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #include "core/siril.h"
22 #include "core/proto.h"
23 #include "gui/utils.h"
24 #include "core/siril_app_dirs.h"
25 
26 #include "core/siril_cmd_help.h"
27 
siril_cmd_help_keyboard_shortcuts(GtkWindow * window)28 void siril_cmd_help_keyboard_shortcuts(GtkWindow *window) {
29 	static GtkWidget *shortcuts_window;
30 	char *shortcutfile = g_build_filename(siril_get_system_data_dir(), SHORTCUTS_UI, NULL);
31 
32 	if (shortcuts_window == NULL) {
33 		GtkBuilder *s_builder;
34 
35 		s_builder = gtk_builder_new_from_file(shortcutfile);
36 		shortcuts_window = GTK_WIDGET(gtk_builder_get_object (s_builder, "shortcuts-siril"));
37 
38 		g_signal_connect(shortcuts_window, "destroy",
39 				G_CALLBACK (gtk_widget_destroyed), &shortcuts_window);
40 
41 		g_object_unref(s_builder);
42 	}
43 
44 	if (GTK_WINDOW(window)
45 			!= gtk_window_get_transient_for(GTK_WINDOW(shortcuts_window))) {
46 		gtk_window_set_transient_for(GTK_WINDOW(shortcuts_window),
47 				GTK_WINDOW(window));
48 	}
49 
50 	gtk_widget_show_all(shortcuts_window);
51 	gtk_window_present(GTK_WINDOW(shortcuts_window));
52 }
53