in src/ui/views.ui_create_tree(), we don't want to add another tree into the GtkStack page Run when it is selected

This commit is contained in:
Jean Sirmai 2024-05-24 08:54:34 +02:00
parent 3dc26b226d
commit 93eefa54c7
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 28 additions and 41 deletions

View File

@ -63,8 +63,8 @@ void ui_disable_action(const char *name);
//
// Actions
//
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_quit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_about_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_preferences_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_togglesidebar_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);
void on_editmode_action (GSimpleAction *action, GVariant *parameter, gpointer user_data);

View File

@ -228,7 +228,7 @@ GtkWidget *create_axis_slider(int axis)
label = gtk_label_new(text);
gtk_box_append(GTK_BOX(box), label);
gtk_widget_show(label);
gtk_widget_set_visible (label, TRUE);
adj = gtk_adjustment_new(0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
g_signal_connect(adj, "value-changed",
@ -237,9 +237,9 @@ GtkWidget *create_axis_slider(int axis)
slider = gtk_scale_new(GTK_ORIENTATION_HORIZONTAL, adj);
gtk_box_append(GTK_BOX(box), slider);
gtk_widget_set_hexpand(slider, TRUE);
gtk_widget_show(slider);
gtk_widget_set_visible (slider, TRUE);
gtk_widget_show(box);
gtk_widget_set_visible (box, TRUE);
return box;
}
@ -313,7 +313,7 @@ bool ui_setup_glarea(int target_mode, GtkWidget *target_widget)
//stack_index_size);
gtk_box_append(GTK_BOX(target_widget), gl_area);
gtk_widget_show(GTK_WIDGET(gl_area));
gtk_widget_set_visible (GTK_WIDGET (gl_area), TRUE);
// Create sliders
for(int i = 0; i < N_AXIS; i++)

View File

@ -66,7 +66,7 @@ static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child)
static void create_experimental_tree (struct TreeNode_t *tree_root) // AD HOC XXX & no free()
{
struct TreeNode_t *a = create_tree_node("We, the users"); add_child_node(tree_root, a);
struct TreeNode_t *a = create_tree_node("We, the people");add_child_node(tree_root, a);
struct TreeNode_t *b = create_tree_node("in Order to"); add_child_node(tree_root, b);
struct TreeNode_t *c = create_tree_node("do establish"); add_child_node(tree_root, c);
struct TreeNode_t *aa = create_tree_node("aware of"); add_child_node(a, aa);
@ -174,6 +174,14 @@ char* ui_tree_create_model_func (GObject *item, gpointer root)
void ui_create_tree (GtkWidget *target_widget)
{
assert(target_widget);
printf("in src/ui/views.ui_create_tree (GtkWidget *w) : %s > %s > %s > %s\n",\
gtk_widget_get_name (GTK_WIDGET (gtk_widget_get_root (target_widget))),\
gtk_widget_get_name (gtk_widget_get_parent (target_widget)),\
gtk_widget_get_name (target_widget),\
gtk_widget_get_name (gtk_widget_get_first_child (target_widget))
);
// We don't want to add another tree in another scrolled_window into the current GtkBox, so :
if (gtk_widget_get_first_child (target_widget)) return;
GtkStringList *model;
GtkTreeListModel *tree_model;

View File

@ -114,51 +114,30 @@ void ui_set_stack(int mode)
// Switch on the first letter of the mode, because switch is soooo simple :)
switch(mode) {
case EDIT_MODE:/*
gtk_stack_set_visible_child_full(window->main_stack,
"edition",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);*/
gtk_stack_set_visible_child_full(window->side_stack,
"edition",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_menu_button_set_icon_name(window->main_button_mode,
"document-edit-symbolic");
case EDIT_MODE:
// gtk_stack_set_visible_child_full(window->main_stack, "edition", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack, "edition", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_menu_button_set_icon_name(window->main_button_mode, "document-edit-symbolic");
ui_setup_glarea(EDIT_MODE, GTK_WIDGET(window->edition_glarea_box));
break;
case RUN_MODE:
gtk_stack_set_visible_child_full(window->main_stack,
"run",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack,
"run",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_menu_button_set_icon_name(window->main_button_mode,
"system-run-symbolic");
gtk_stack_set_visible_child_full(window->main_stack, "run", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack, "run", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_menu_button_set_icon_name(window->main_button_mode, "system-run-symbolic");
ui_setup_glarea(RUN_MODE, GTK_WIDGET(window->run_glarea_box));
ui_create_tree (GTK_WIDGET (window->run_conditions_tree_box));
break;
case PRESENTATION_MODE:
gtk_stack_set_visible_child_full(window->main_stack,
"presentation",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack,
"presentation",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_menu_button_set_icon_name(window->main_button_mode,
"x-office-presentation-symbolic");
ui_setup_glarea(PRESENTATION_MODE,
GTK_WIDGET(window->presentation_glarea_box));
// gtk_stack_set_visible_child_full(window->main_stack, "presentation", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack, "presentation", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_menu_button_set_icon_name(window->main_button_mode, "x-office-presentation-symbolic");
ui_setup_glarea(PRESENTATION_MODE, GTK_WIDGET(window->presentation_glarea_box));
break;
case HOME_MODE:
gtk_stack_set_visible_child_full(window->main_stack,
"home",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack,
"home",
GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->main_stack, "home", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_stack_set_visible_child_full(window->side_stack, "home", GTK_STACK_TRANSITION_TYPE_CROSSFADE);
gtk_paned_set_position(window->main_paned, 0);
gtk_menu_button_set_icon_name(window->main_button_mode,
"user-home-symbolic");
gtk_menu_button_set_icon_name(window->main_button_mode, "user-home-symbolic");
break;
default:
break;