diff options
Diffstat (limited to 'src/gui/window.c')
-rw-r--r-- | src/gui/window.c | 82 |
1 files changed, 81 insertions, 1 deletions
diff --git a/src/gui/window.c b/src/gui/window.c index dbe7e87..e14ecf7 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -33,7 +33,6 @@ #include "panels/welcome.h" #include "../gtkext/grid.h" #include "../gtkext/helpers.h" -#include "../gtkext/statusstack.h" @@ -106,6 +105,7 @@ static void gtk_framework_window_class_init(GtkFrameworkWindowClass *class) gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/window.ui"); gtk_widget_class_bind_template_child(widget, GtkFrameworkWindow, grid); + gtk_widget_class_bind_template_child(widget, GtkFrameworkWindow, status); /* 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); @@ -148,6 +148,8 @@ 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); + window->main = NULL; + g_action_map_add_action_entries(G_ACTION_MAP(window), app_entries, G_N_ELEMENTS(app_entries), window); @@ -206,6 +208,8 @@ static void gtk_framework_window_dispose(GObject *object) g_clear_object(&window->settings); + g_clear_object(&window->main); + G_OBJECT_CLASS(gtk_framework_window_parent_class)->dispose(object); } @@ -488,6 +492,31 @@ static void gtk_framework_window_activate_about(GSimpleAction *action, GVariant /****************************************************************************** * * +* Paramètres : window = instance de fenêtre principale à consulter. * +* * +* Description : Fournit une référence à la barre de statut intégrée. * +* * +* Retour : Composant GTK en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkStatusStack *gtk_framework_window_get_status_stack(const GtkFrameworkWindow *window) +{ + GtkStatusStack *result; /* Instance à retourner */ + + result = window->status; + ref_object(result); + + return result; + +} + + + +/****************************************************************************** +* * * Paramètres : window = instance de fenêtre principale à remplir. * * panel = nouveau panneau à afficher. * * * @@ -506,6 +535,7 @@ void gtk_framework_window_add(GtkFrameworkWindow *window, /* __steal */GtkTiledP guint count; /* Nombre d'élements présents */ guint i; /* Boucle de parcours */ GtkWidget *widget; /* Composant à intégrer */ + FrameworkPanelPersonality personality; /* Propriétés du panneau */ @@ -538,4 +568,54 @@ void gtk_framework_window_add(GtkFrameworkWindow *window, /* __steal */GtkTiledP } + /* Mise à jour des liens vers un panneau principal */ + + personality = get_framework_panel_personality(G_OBJECT_TYPE(panel)); + + if (personality & FPP_MAIN_PANEL) + gtk_framework_window_notify_new_main_panel_state(window, panel, true); + + else + { + if (window->main != NULL) + gtk_tiled_panel_notify_new_main_panel_state(panel, window->main, true); + } + +} + + +/****************************************************************************** +* * +* Paramètres : window = instance de fenêtre principale à manipuler. * +* main = panneau principal visé par l'opération. * +* activated = nature du changement de statut : ajout, retrait ?* +* * +* Description : Note un ajout ou un retrait de panneau principal. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void gtk_framework_window_notify_new_main_panel_state(GtkFrameworkWindow *window, GtkTiledPanel *main, bool activated) +{ + if (activated) + { + g_clear_object(&window->main); + + window->main = main; + ref_object(main); + + } + + else + { + if (main == window->main) + g_clear_object(&window->main); + + } + + gtk_tiling_grid_notify_new_main_panel_state(window->grid, main, activated); + } |