From 270b2feba510ccb565cf2cc57ba71fef39e1a199 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 19 Jun 2024 10:24:35 +0200 Subject: [PATCH] WIP: toujours perdu entre stack, stack_child et stack_page (les noms sont mal choisis) --- contain.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/contain.c b/contain.c index 9f8053b..0dedbc4 100644 --- a/contain.c +++ b/contain.c @@ -168,28 +168,31 @@ void window_header_bar (GtkWindow *main_window, char *title){ GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); gtk_window_set_titlebar (main_window, header_bar); - gpointer no_local_data = NULL; GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ()); gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "system-run-symbolic"); gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-performance-symbolic"); - g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), no_local_data); + g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_EXEC_EDIT), NULL); GtkWidget *any_Label = GTK_WIDGET (gtk_label_new (" | ")); // https://docs.gtk.org/gtk4/class.Stack.html - GtkWidget *a_stack = gtk_stack_new (); GtkWidget *a_switcher = gtk_stack_switcher_new (); + GtkWidget *a_stack = gtk_stack_new (); + GtkStackPage* stack_child_space = gtk_stack_add_child (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box())); + GtkStackPage* stack_child_rules = gtk_stack_add_child (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new())); + GtkStackPage* stack_child_data = gtk_stack_add_child (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new())); + gtk_stack_switcher_set_stack (GTK_STACK_SWITCHER (a_switcher), GTK_STACK (a_stack)); gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box()), "a_name", "space"); gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new()), "another_name", "rules"); gtk_stack_add_titled (GTK_STACK (a_stack), GTK_WIDGET (get_measures_page_new()), "a_third_name", "data analysis"); // gtk_stack_page_set_visible (*self, TRUE); +// gtk_window_set_child (main_window, GTK_WIDGET (gtk_stack_get_visible_child (GTK_STACK (a_stack)))); gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_STATE_VIEW_box())); gtk_stack_set_visible_child (GTK_STACK (a_stack), GTK_WIDGET (get_edit_rules_page_new())); - - gtk_window_set_child (main_window, GTK_WIDGET (gtk_stack_get_visible_child (GTK_STACK (a_stack)))); + gtk_widget_set_visible (GTK_WIDGET (get_edit_rules_page_new()), TRUE); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_XOR_EXEC_EDIT)); gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (any_Label));