diff options
Diffstat (limited to 'src/gui/window.c')
-rw-r--r-- | src/gui/window.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/gui/window.c b/src/gui/window.c index 2680c89..a11e8aa 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -28,6 +28,7 @@ #include "window-int.h" #include "core/panels.h" #include "dialogs/about.h" +#include "dialogs/preferences.h" #include "panels/welcome.h" #include "../gtkext/helpers.h" #include "../gtkext/statusstack.h" @@ -46,6 +47,9 @@ static void gtk_framework_window_dispose(GtkFrameworkWindow *); /* Procède à la libération totale de la mémoire. */ static void gtk_framework_window_finalize(GtkFrameworkWindow *); +/* Réagit à une activation du menu "Préférences" de la fenetre. */ +static void gtk_framework_window_activate_preferences(GSimpleAction *, GVariant *, gpointer); + /* Réagit à une activation du menu "A propos de" de la fenetre. */ static void gtk_framework_window_activate_about(GSimpleAction *, GVariant *, gpointer); @@ -88,6 +92,8 @@ static void gtk_framework_window_class_init(GtkFrameworkWindowClass *class) /* Active une action native (cf. https://docs.gtk.org/gtk4/class.Window.html#actions) */ gtk_widget_class_add_binding_action(widget, GDK_KEY_Q, GDK_CONTROL_MASK, "window.close", NULL); + gtk_widget_class_add_binding_action(widget, GDK_KEY_comma, GDK_CONTROL_MASK, "win.preferences", NULL); + } @@ -106,6 +112,7 @@ static void gtk_framework_window_class_init(GtkFrameworkWindowClass *class) static void gtk_framework_window_init(GtkFrameworkWindow *window) { static GActionEntry app_entries[] = { + { "preferences", gtk_framework_window_activate_preferences, NULL, NULL, NULL }, { "about", gtk_framework_window_activate_about, NULL, NULL, NULL }, }; @@ -258,6 +265,34 @@ bool gtk_framework_window_create(GtkFrameworkWindow *window, GtkApplication *app * unused = adresse non utilisée ici. * * _window = instance de fenêtre principale à manipuler. * * * +* Description : Réagit à une activation du menu "Préférences" de la fenetre. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_framework_window_activate_preferences(GSimpleAction *action, GVariant *unused, gpointer _window) +{ + GtkFrameworkWindow *window; /* Fenêtre principale associée */ + GtkWindow *dialog; /* Boîte de dialogue à afficher*/ + + window = _window; + + dialog = gtk_preferences_dialog_new(GTK_WINDOW(window)); + + gtk_window_present(dialog); + +} + + +/****************************************************************************** +* * +* Paramètres : action = désignation de l'action concernée par l'appel. * +* unused = adresse non utilisée ici. * +* _window = instance de fenêtre principale à manipuler. * +* * * Description : Réagit à une activation du menu "A propos de" de la fenetre. * * * * Retour : - * |