WIP: cleaning... cleaning... cleaning...

This commit is contained in:
Jean Sirmai 2024-01-20 13:57:24 +01:00
parent 930eb27f8a
commit 912f2e5044
Signed by: jean
GPG Key ID: FB3115C340E057E3
3 changed files with 26 additions and 36 deletions

View File

@ -65,7 +65,7 @@ int main(int argc, char **argv)
G_APPLICATION_DEFAULT_FLAGS); G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (on_activate_window_creation), // in : "sand_box_2.c :" g_signal_connect (app, "activate", G_CALLBACK (on_activate_window_creation), // in : "sand_box_2.c :"
"the signal comes from main.c and is displayed by sand_box_2 -> on_activate_window_creation()\n"); "This signal comes from main.c and is displayed by the sand_box window\n");
// Jean 2024-01-20 Je désactive la visualisation de la fenêtre principale // Jean 2024-01-20 Je désactive la visualisation de la fenêtre principale

View File

@ -29,9 +29,6 @@
#include "../../include/base.h" #include "../../include/base.h"
#include "../../include/ui.h" #include "../../include/ui.h"
static void on_button_action (GtkWidget *widget, gpointer data) {if (data) g_print (data);}
static void on_destroy (GtkWidget *widget, gpointer data) { if (data) g_print (data); exit(0);}
static enum { NAME_COLUMN }; static enum { NAME_COLUMN };
/* custom function to fill the model with data */ /* custom function to fill the model with data */
@ -53,35 +50,34 @@ static GtkWidget populate_tree_model (my_store){
static void on_button_action (GtkWidget *widget, gpointer data) {if (data) g_print (data);}
static void on_destroy (GtkWidget *widget, gpointer data) { if (data) g_print (data); exit(0);}
void on_activate_window_creation (GtkApplication *app, gpointer data) { void on_activate_window_creation (GtkApplication *app, gpointer data) {
GtkWidget *my_window_2; GtkWidget *my_window;
GtkWidget *my_box_2; GtkWidget *my_box;
GtkWidget *my_button_2; GtkWidget *my_button;
char *my_window_title_2 = "I'm the second one !"; char *my_window_title = "Hello folks !";
char *my_button_title_2 = "Yep ! And... I'm the second button."; char *my_button_title = "Yep ! I'm the button.";
my_window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW(my_window), my_window_title);
gtk_window_set_default_size (GTK_WINDOW(my_window), 400, 34);
my_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child(GTK_WINDOW(my_window), GTK_WIDGET(my_box));
gtk_widget_show (my_window); // show != present
my_button = gtk_button_new_with_label (my_button_title);
g_signal_connect(G_OBJECT (my_button), "clicked", G_CALLBACK(on_button_action), "button clicked (could use some data)\n");
// g_signal_connect_swapped (my_button, "clicked", G_CALLBACK (gtk_window_close), my_window);
g_signal_connect(G_OBJECT (my_window), "destroy", G_CALLBACK(on_destroy), "closes window using exit(0)\n");
gtk_box_append(GTK_BOX (my_box), GTK_WIDGET(my_button)); // gtk_window_set_child (GTK_WINDOW (my_window), my_button);
// Create a new window
// GtkWidget *window = gtk_application_window_new (app);
// gtk_init();
if (data) g_print (data); if (data) g_print (data);
my_window_2 = gtk_window_new (); printf("-------------------------------------------------------------------------------------------------------------------------------------------\n\
gtk_window_set_title (GTK_WINDOW(my_window_2), my_window_title_2); [sand_box.c > on_activate_window_creation()] > widgets examples are in user/jean/01/GTK4/tree (learning)/The_Gnome_way/demos/gtk-demo <\n");
gtk_window_set_default_size (GTK_WINDOW(my_window_2), 400, 34);
my_box_2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child(GTK_WINDOW(my_window_2), GTK_WIDGET(my_box_2));
gtk_widget_show (my_window_2);
// Create a new button
my_button_2 = gtk_button_new_with_label (my_button_title_2);
// When the button is clicked, close the window passed as an argument
g_signal_connect(G_OBJECT (my_button_2), "clicked", G_CALLBACK(on_button_action), "some data from window 2\n");
g_signal_connect_swapped (my_button_2, "clicked", G_CALLBACK (gtk_window_close), my_window_2);
g_signal_connect(G_OBJECT (my_window_2), "destroy", G_CALLBACK(on_destroy), "window 2 destruction ! (alone <> no exit(0) here)\n");
// gtk_window_set_child (GTK_WINDOW (my_window_2), my_button_2); // < écrase
gtk_box_append(GTK_BOX
(my_box_2), GTK_WIDGET(my_button_2));
// gtk_window_present (GTK_WINDOW (my_window));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -103,7 +99,6 @@ void on_activate_window_creation (GtkApplication *app, gpointer data) {
// https://www.typeerror.org/docs/gtk~4.0/gtksignallistitemfactory // https://www.typeerror.org/docs/gtk~4.0/gtksignallistitemfactory
// https://docs.gtk.org/gtk4/section-list-widget.html < les listes old/new et la discussion // https://docs.gtk.org/gtk4/section-list-widget.html < les listes old/new et la discussion
// https://developer-old.gnome.org/gtk4/stable/GtkListView.html <<< copy that ! // https://developer-old.gnome.org/gtk4/stable/GtkListView.html <<< copy that !
// https://docs.gtk.org/gtk4/section-list-widget.html
// https://docs.gtk.org/gtk4/ctor.TreeListModel.new.html *** // https://docs.gtk.org/gtk4/ctor.TreeListModel.new.html ***
// https://blog.gtk.org/2020/06/08/more-on-lists-in-gtk-4/ *** // https://blog.gtk.org/2020/06/08/more-on-lists-in-gtk-4/ ***
// //

View File

@ -122,11 +122,6 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
// Setup GLArea // Setup GLArea
//XXX TEMP ui_setup_glarea(window->run_glarea, window->run_controls); //XXX TEMP ui_setup_glarea(window->run_glarea, window->run_controls);
// //
printf("--------------------------------------------------------------------------------------\n\
from : gem_graph_client_window_init(GemGraphClientWindow *self) in window.c (line 124)\n\
> widgets examples in user/jean/01/GTK4/tree (learning)/The_Gnome_way/demos/gtk-demo <\n\
--------------------------------------------------------------------------------------\n");
} }
/* Is this used to 'FREE' something and must be retained ? */ /* Is this used to 'FREE' something and must be retained ? */