From bf6db3fa3403e40ffaad64ad97d257add86b2ec9 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Wed, 25 Jan 2023 19:05:38 +0100 Subject: [PATCH] Mode changing ! --- src/ui/window.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/ui/window.c b/src/ui/window.c index e49182e..4ca6c5b 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -262,6 +262,7 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self) void uiWindowStackChange(const char *mode) { + if (window->main_stack == NULL) { g_printerr("Can't find self->main_stack !\n"); return; @@ -276,6 +277,28 @@ void uiWindowStackChange(const char *mode) gtk_stack_set_visible_child_full(window->side_stack, mode, GTK_STACK_TRANSITION_TYPE_CROSSFADE); + + // Switch on the first letter of the mode, because switch is soooo simple :) + switch(mode[0]) { + case 'e': + gtk_menu_button_set_icon_name(window->main_button_mode, + "document-edit-symbolic"); + break; + case 'r': + gtk_menu_button_set_icon_name(window->main_button_mode, + "system-run-symbolic"); + break; + case 'p': + gtk_menu_button_set_icon_name(window->main_button_mode, + "x-office-presentation-symbolic"); + break; + case 'h': + gtk_menu_button_set_icon_name(window->main_button_mode, + "user-home-symbolic"); + break; + default: + break; + } } void uiWindowSendNotification(const char *message)