diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2024-08-23 21:36:25 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2024-08-23 21:36:25 (GMT) |
commit | c863d2d9093e7205107b5a6e56bd616c0703d4e4 (patch) | |
tree | 8b7cdd5a95cd79d143d87b98e2074f17e6fd53ee /src/gui/window.c | |
parent | 370311f0a7176aa880dd0a15561c87a324fc111c (diff) |
Restore an About dialog box.
Diffstat (limited to 'src/gui/window.c')
-rw-r--r-- | src/gui/window.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/gui/window.c b/src/gui/window.c index 432a8a1..1f10a15 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -27,7 +27,9 @@ #include "window-int.h" #include "core/panels.h" +#include "dialogs/about.h" #include "panels/welcome.h" +#include "../gtkext/helpers.h" @@ -43,6 +45,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 "A propos de" de la fenetre. */ +static void gtk_framework_window_activate_about(GSimpleAction *, GVariant *, gpointer); + /* Indique le type défini pour une fenêtre graphique principale de Chrysalide. */ @@ -73,8 +78,6 @@ static void gtk_framework_window_class_init(GtkFrameworkWindowClass *class) widget = GTK_WIDGET_CLASS(class); - //g_type_ensure(GTK_TYPE_TILING_GRID); - gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/window.ui"); gtk_widget_class_bind_template_child(widget, GtkFrameworkWindow, grid); @@ -99,6 +102,10 @@ static void gtk_framework_window_class_init(GtkFrameworkWindowClass *class) static void gtk_framework_window_init(GtkFrameworkWindow *window) { + static GActionEntry app_entries[] = { + { "about", gtk_framework_window_activate_about, NULL, NULL, NULL }, + }; + gtk_widget_init_template(GTK_WIDGET(window)); window->settings = g_settings_new(FRAMEWORK_WINDOW_ID); @@ -107,6 +114,10 @@ static void gtk_framework_window_init(GtkFrameworkWindow *window) g_settings_bind(window->settings, "window-height", G_OBJECT(window), "default-height", G_SETTINGS_BIND_DEFAULT); g_settings_bind(window->settings, "window-maximized", G_OBJECT(window), "maximized", G_SETTINGS_BIND_DEFAULT); + g_action_map_add_action_entries(G_ACTION_MAP(window), + app_entries, G_N_ELEMENTS(app_entries), + window); + } @@ -240,6 +251,34 @@ bool gtk_framework_window_create(GtkFrameworkWindow *window, GtkApplication *app /****************************************************************************** * * +* 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 : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_framework_window_activate_about(GSimpleAction *action, GVariant *unused, gpointer _window) +{ + GtkFrameworkWindow *window; /* Fenêtre principale associée */ + GtkWindow *dialog; /* Boîte de dialogue à afficher*/ + + window = _window; + + dialog = gtk_app_about_dialog_new(GTK_WINDOW(window)); + + gtk_window_present(dialog); + +} + + +/****************************************************************************** +* * * Paramètres : window = instance de fenêtre principale à remplir. * * panel = nouveau panneau à afficher. * * * |