diff --git a/callback.c b/callback.c index 5720a7b..1a5e290 100644 --- a/callback.c +++ b/callback.c @@ -1,36 +1,22 @@ #include #include -#include "hot.h" +#include "tree.h" #include "display.h" #include "contain.h" #include "texts.h" +#include "in_depth.h" /******************************************************************************/ -/* W I N D O W (H E A D E R B A R & T W O N O T E B O O K S ) */ +/* M A I N W I N D O W A C T I V A T I O N */ /******************************************************************************/ -void activate (GtkApplication *self, gpointer user_data) +void ui_main_window (GtkApplication *self, gpointer user_data) { - GtkWindow *window = GTK_WINDOW (gtk_application_window_new (self)); - window_header_bar (window, "E coli (with permission from David S. Goodsell, 2009)"); - two_notebooks_in_two_panes (window); - gtk_window_present (GTK_WINDOW (window)); -} - -/******************************************************************************/ -/* B U T T O N S */ -/******************************************************************************/ -void ui_toggle_run_edit (GtkWidget *btt_run_xor_edit, gpointer data) -{ - printf("window.ui_toggle_run_edit() >>> mode = %d", get_run_edit_mode ()); - if (get_run_edit_mode()) { - gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "system-run-symbolic"); - set_run_edit_mode (0); - } else { - gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "document-edit-symbolic"); - set_run_edit_mode (1); - } - printf(" > %d\n", get_run_edit_mode ()); + GtkWindow *main_window = GTK_WINDOW (gtk_application_window_new (self)); + window_header_bar (main_window, + "E coli (with permission from David S. Goodsell, 2009)"); + two_notebooks_in_two_panes (main_window); + gtk_window_present (GTK_WINDOW (main_window)); } /******************************************************************************/ @@ -60,3 +46,19 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory, GObject* obje // } else if (0) printf("[on_bind_user_tree_factory] row == NULL\n"); } +/******************************************************************************/ +/* B U T T O N S */ +/******************************************************************************/ +void ui_toggle_run_edit (GtkWidget *btt_run_xor_edit, gpointer data) +{ + printf("window.ui_toggle_run_edit() >>> mode = %d", get_run_edit_mode ()); + if (get_run_edit_mode()) { + gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "system-run-symbolic"); + set_run_edit_mode (0); + } else { + gtk_button_set_icon_name (GTK_BUTTON (btt_run_xor_edit), "document-edit-symbolic"); + set_run_edit_mode (1); + } + printf(" > %d\n", get_run_edit_mode ()); +} + diff --git a/callback.d b/callback.d deleted file mode 100644 index 3913f5b..0000000 --- a/callback.d +++ /dev/null @@ -1,3 +0,0 @@ -callback.o: callback.c hot.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - display.h contain.h texts.h diff --git a/callback.h b/callback.h index 68f462a..46d6f7c 100644 --- a/callback.h +++ b/callback.h @@ -1,7 +1,7 @@ //#include #include -void activate (GtkApplication *app, gpointer user_data); +void ui_main_window (GtkApplication *app, gpointer user_data); void ui_enable_action (const char *name); void ui_disable_action (const char *name); diff --git a/callback.o b/callback.o deleted file mode 100644 index 79de046..0000000 Binary files a/callback.o and /dev/null differ diff --git a/contain.c b/contain.c index cbd9f51..6ce6ce3 100644 --- a/contain.c +++ b/contain.c @@ -1,7 +1,7 @@ #include #include -#include "hot.h" +#include "tree.h" #include "display.h" #include "contain.h" #include "texts.h" diff --git a/contain.d b/contain.d deleted file mode 100644 index dc2d395..0000000 --- a/contain.d +++ /dev/null @@ -1,3 +0,0 @@ -contain.o: contain.c hot.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - display.h contain.h texts.h callback.h diff --git a/contain.o b/contain.o deleted file mode 100644 index 41e73b9..0000000 Binary files a/contain.o and /dev/null differ diff --git a/display.c b/display.c index ecfd724..d17a59d 100644 --- a/display.c +++ b/display.c @@ -1,7 +1,7 @@ #include #include -#include "hot.h" +#include "tree.h" #include "display.h" #include "contain.h" #include "texts.h" diff --git a/display.d b/display.d deleted file mode 100644 index a8ba66f..0000000 --- a/display.d +++ /dev/null @@ -1,3 +0,0 @@ -display.o: display.c hot.h \ - /gnu/store/fkmpkdav2zmz1k72989bdgpdrfac7rz1-glib-2.78.0/include/glib-2.0/glib.h \ - display.h contain.h texts.h diff --git a/display.o b/display.o deleted file mode 100644 index c707579..0000000 Binary files a/display.o and /dev/null differ diff --git a/hot.d b/hot.d deleted file mode 100644 index c90269a..0000000 --- a/hot.d +++ /dev/null @@ -1 +0,0 @@ -hot.o: hot.c contain.h texts.h callback.h diff --git a/hot.o b/hot.o deleted file mode 100644 index 2bb792f..0000000 Binary files a/hot.o and /dev/null differ diff --git a/in_depth.c b/in_depth.c new file mode 100644 index 0000000..e6e6d53 --- /dev/null +++ b/in_depth.c @@ -0,0 +1,8 @@ +#include +#include + +static int run_edit_mode_val = 0; + +void set_run_edit_mode (int prescribed_mode) {run_edit_mode_val = prescribed_mode;} +int get_run_edit_mode () {return run_edit_mode_val;} + diff --git a/in_depth.h b/in_depth.h new file mode 100644 index 0000000..a3f1cc8 --- /dev/null +++ b/in_depth.h @@ -0,0 +1,6 @@ +#include +#include + +void set_run_edit_mode (int prescribed_mode); +int get_run_edit_mode (); + diff --git a/main.c b/main.c index 69beb76..eb1eb5c 100644 --- a/main.c +++ b/main.c @@ -15,7 +15,7 @@ int main (int argc, char **argv) int status; app = gtk_application_new ("org.jean.GTK4_GG_hack", G_APPLICATION_DEFAULT_FLAGS); - g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); + g_signal_connect (app, "activate", G_CALLBACK (ui_main_window), NULL); status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/main.d b/main.d deleted file mode 100644 index 6c89c45..0000000 --- a/main.d +++ /dev/null @@ -1 +0,0 @@ -main.o: main.c callback.h diff --git a/main.o b/main.o deleted file mode 100644 index 9d48ed0..0000000 Binary files a/main.o and /dev/null differ diff --git a/myprogram b/myprogram deleted file mode 100755 index c186e21..0000000 Binary files a/myprogram and /dev/null differ diff --git a/texts.d b/texts.d deleted file mode 100644 index 18de62c..0000000 --- a/texts.d +++ /dev/null @@ -1 +0,0 @@ -texts.o: texts.c diff --git a/texts.o b/texts.o deleted file mode 100644 index 8ea2834..0000000 Binary files a/texts.o and /dev/null differ diff --git a/hot.c b/tree.c similarity index 97% rename from hot.c rename to tree.c index f7f257b..99c6fbb 100644 --- a/hot.c +++ b/tree.c @@ -12,11 +12,6 @@ // https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management // GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL -static int run_edit_mode_val = 0; - -void set_run_edit_mode(int prescribed_mode) {run_edit_mode_val = prescribed_mode;} -int get_run_edit_mode () {return run_edit_mode_val;} - struct TreeNode_t {gchar *text; struct TreeNode_t *child, *next;}; static void add_child_node (struct TreeNode_t *parent, struct TreeNode_t *child){ diff --git a/hot.h b/tree.h similarity index 100% rename from hot.h rename to tree.h