WIP: reorganization : create 'in_depth.c'

This commit is contained in:
Jean Sirmai 2024-06-02 22:49:16 +02:00
parent 391941d200
commit 4ba96fbe23
Signed by: jean
GPG Key ID: FB3115C340E057E3
22 changed files with 43 additions and 44 deletions

View File

@ -1,36 +1,22 @@
#include <stdio.h> #include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
#include "hot.h" #include "tree.h"
#include "display.h" #include "display.h"
#include "contain.h" #include "contain.h"
#include "texts.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)); GtkWindow *main_window = GTK_WINDOW (gtk_application_window_new (self));
window_header_bar (window, "E coli (with permission from David S. Goodsell, 2009)"); window_header_bar (main_window,
two_notebooks_in_two_panes (window); "E coli (with permission from David S. Goodsell, 2009)");
gtk_window_present (GTK_WINDOW (window)); two_notebooks_in_two_panes (main_window);
} gtk_window_present (GTK_WINDOW (main_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 ());
} }
/******************************************************************************/ /******************************************************************************/
@ -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"); // } 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 ());
}

View File

@ -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

View File

@ -1,7 +1,7 @@
//#include <stdio.h> //#include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
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_enable_action (const char *name);
void ui_disable_action (const char *name); void ui_disable_action (const char *name);

Binary file not shown.

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
#include "hot.h" #include "tree.h"
#include "display.h" #include "display.h"
#include "contain.h" #include "contain.h"
#include "texts.h" #include "texts.h"

View File

@ -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

BIN
contain.o

Binary file not shown.

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
#include "hot.h" #include "tree.h"
#include "display.h" #include "display.h"
#include "contain.h" #include "contain.h"
#include "texts.h" #include "texts.h"

View File

@ -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

BIN
display.o

Binary file not shown.

1
hot.d
View File

@ -1 +0,0 @@
hot.o: hot.c contain.h texts.h callback.h

BIN
hot.o

Binary file not shown.

8
in_depth.c Normal file
View File

@ -0,0 +1,8 @@
#include <gtk-4.0/gtk/gtk.h>
#include <assert.h>
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;}

6
in_depth.h Normal file
View File

@ -0,0 +1,6 @@
#include <gtk-4.0/gtk/gtk.h>
#include <assert.h>
void set_run_edit_mode (int prescribed_mode);
int get_run_edit_mode ();

2
main.c
View File

@ -15,7 +15,7 @@ int main (int argc, char **argv)
int status; int status;
app = gtk_application_new ("org.jean.GTK4_GG_hack", G_APPLICATION_DEFAULT_FLAGS); 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); status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app); g_object_unref (app);

1
main.d
View File

@ -1 +0,0 @@
main.o: main.c callback.h

BIN
main.o

Binary file not shown.

BIN
myprogram

Binary file not shown.

View File

@ -1 +0,0 @@
texts.o: texts.c

BIN
texts.o

Binary file not shown.

View File

@ -12,11 +12,6 @@
// https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management // https://docs.gtk.org/gtk4/class.Widget.html#height-for-width-geometry-management
// GTK_ORIENTATION_VERTICAL GTK_ORIENTATION_HORIZONTAL // 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;}; 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){

View File