diff --git a/callback.c b/callback.c index 82b655d..7a33cbe 100644 --- a/callback.c +++ b/callback.c @@ -8,7 +8,7 @@ void ui_toggle_run_edit() { - if (get_run_edit_mode()) {g_printerr("Can't find self->main_button_run_edit !\n"); return;} + if (!get_run_edit_mode()) {g_printerr("Can't find self->main_button_run_edit !\n"); return;} printf("window.ui_toggle_run_edit() >>> mode = %d", get_run_edit_mode ()); if (get_run_edit_mode()) { gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "system-run-symbolic"); @@ -20,7 +20,7 @@ void ui_toggle_run_edit() printf(" > %d\n", get_run_edit_mode ()); } -void on_togglerunedit_action(GSimpleAction *action, GVariant *parameter, gpointer user_data) { +void on_togglerunedit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data) { // GemGraphClientApplication *self = user_data; // g_assert (GEM_GRAPH_CLIENT_IS_APPLICATION(self)); printf("| >>> callback.on_togglerunedit_action() >>> "); diff --git a/callback.h b/callback.h index 587750f..bede566 100644 --- a/callback.h +++ b/callback.h @@ -1 +1,2 @@ -void on_togglerunedit_action(GSimpleAction *action, GVariant *parameter, gpointer user_data); +void on_togglerunedit_action (GSimpleAction *action, GVariant *parameter, gpointer user_data); +void ui_toggle_run_edit(); diff --git a/contain.c b/contain.c index caa36bf..2929e6e 100644 --- a/contain.c +++ b/contain.c @@ -5,6 +5,7 @@ #include "display.h" #include "contain.h" #include "texts.h" +#include "callback.h" GtkWidget *get_edit_rules_page_new(){ @@ -174,7 +175,6 @@ GtkWidget *get_btt_run_xor_edit() { void window_bar(GtkWindow *window, char *title){ GtkWidget *header_bar = gtk_header_bar_new(); -// gtk_window_set_title (window, title); gtk_window_set_titlebar (window, header_bar); // GtkWidget my_window_controls = *gtk_window_controls_new (GTK_PACK_END); // _START @@ -183,8 +183,12 @@ void window_bar(GtkWindow *window, char *title){ gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "document-edit-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "text-editor-symbolic"); gtk_button_set_icon_name (GTK_BUTTON (get_btt_run_xor_edit()), "system-run-symbolic"); -// gtk_actionable_set_action_name (GTK_ACTIONABLE (get_btt_run_xor_edit()), "app.togglerunedit"); - g_signal_connect (GTK_BUTTON (get_btt_run_xor_edit()), "clicked", G_CALLBACK (on_togglerunedit_action()), NULL); + + g_signal_connect (GTK_BUTTON (get_btt_run_xor_edit()), + "clicked", + G_CALLBACK (on_togglerunedit_action), + NULL); + gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), get_btt_run_xor_edit()); gtk_window_set_titlebar (window, header_bar); diff --git a/hot.c b/hot.c index be8f081..387ff3c 100644 --- a/hot.c +++ b/hot.c @@ -18,7 +18,14 @@ void set_run_edit_mode(int prescribed_mode) {run_edit_mode_val = prescribed_mode int get_run_edit_mode () {return run_edit_mode_val;} static struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;}; -static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child); +static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child){ + if (parent->child) { + struct TreeNode_t *cur = parent->child; + while (cur && cur->next) {cur = cur->next;} + cur->next = child; + } else parent->child = child; +} + static struct TreeNode_t *create_user_tree_node (const gchar* text){ struct TreeNode_t *node = g_malloc0 (sizeof(struct TreeNode_t)); node->text = g_strdup (text); @@ -118,14 +125,6 @@ GListModel* get_user_tree_model (GObject *item, gpointer root){ return get_user_tree_model_child (cur); } -static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child){ - if (parent->child) { - struct TreeNode_t *cur = parent->child; - while (cur && cur->next) {cur = cur->next;} - cur->next = child; - } else parent->child = child; -} - GtkScrolledWindow *get_user_rules_tree (){ struct TreeNode_t *tree_root = create_user_tree_node("root"); let_us_create_a_complex_useless_and_expensive_tree (tree_root);