main.c : g_signal_connect (app, activate, G_CALLBACK (on_windows_activation), NULL); << see init.c

This commit is contained in:
Jean Sirmai 2024-07-21 11:35:00 +02:00
parent 9d1298ca7a
commit 27a3f54851
Signed by: jean
GPG Key ID: FB3115C340E057E3
6 changed files with 8 additions and 34 deletions

View File

@ -40,10 +40,6 @@
void widget_create_windows (GtkApplication *app); void widget_create_windows (GtkApplication *app);
void widget_create_main_window (GtkApplication *app);
void widget_create_dialog_window (GtkApplication *app);
void widget_create_text_window (GtkApplication *app);
void widget_topbar_design_main_window (GtkWindow *main_window); void widget_topbar_design_main_window (GtkWindow *main_window);
void widget_topbar_design_dialog_window (GtkWindow *main_window, void widget_topbar_design_dialog_window (GtkWindow *main_window,
GtkWindow *dialog_window); GtkWindow *dialog_window);

View File

@ -146,7 +146,6 @@ int main (int argc, char **argv)
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
if (0) widget_create_windows (app); // < Erreur de segmentation
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);

View File

@ -56,23 +56,6 @@ static void on_auto_notification (const char *message)
} }
void on_windows_activation (GtkApplication *app,
gpointer no_user_data)
{
widget_create_main_window (app);
widget_topbar_design_main_window (GTK_WINDOW (widget_topbar_get_main_window ()));
widget_create_dialog_window (app);
widget_topbar_design_dialog_window (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WINDOW (widget_topbar_get_dialog_window()));
widget_create_text_window (app);
widget_topbar_design_text_window (GTK_WINDOW (widget_topbar_get_main_window ()),
GTK_WINDOW (widget_topbar_get_text_window()));
}
/******************************************************************************/ /******************************************************************************/
/* T R E E */ /* T R E E */
/******************************************************************************/ /******************************************************************************/

View File

@ -42,8 +42,11 @@ void *widget_topbar_get_main_window() { return main_window; }
void *widget_topbar_get_dialog_window() { return dialog_window; } void *widget_topbar_get_dialog_window() { return dialog_window; }
void *widget_topbar_get_text_window() { return text_window; } void *widget_topbar_get_text_window() { return text_window; }
void widget_create_windows (GtkApplication *app) void on_windows_activation (GtkApplication *app)
{ {
// g_application_activate (G_APPLICATION (app)); < how ? > in main.c is
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
main_window = GTK_WINDOW (gtk_application_window_new (app)); main_window = GTK_WINDOW (gtk_application_window_new (app));
dialog_window = GTK_WINDOW (gtk_application_window_new (app)); dialog_window = GTK_WINDOW (gtk_application_window_new (app));
text_window = GTK_WINDOW (gtk_application_window_new (app)); text_window = GTK_WINDOW (gtk_application_window_new (app));
@ -53,13 +56,3 @@ void widget_create_windows (GtkApplication *app)
widget_topbar_design_text_window (main_window, text_window); widget_topbar_design_text_window (main_window, text_window);
} }
void widget_create_main_window (GtkApplication *app)
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
void widget_create_dialog_window (GtkApplication *app)
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
void widget_create_text_window (GtkApplication *app)
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }

View File

@ -67,7 +67,8 @@ static GtkBox *rec_XYZ_box()
gtk_box_append (XYZ_scrollbar_box, scroll_Z); gtk_box_append (XYZ_scrollbar_box, scroll_Z);
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer") gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
GtkWidget *btt_reset = gtk_toggle_button_new_with_label ("reset"); GtkWidget *btt_reset = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_reset), "view-refresh-symbolic");
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z"))); gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z")));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box)); gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset)); gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset));

View File

@ -110,6 +110,7 @@ static GtkWidget *window_header_bar (GtkWindow *window);
static void window_header_bar_left (GtkWidget *header_bar); static void window_header_bar_left (GtkWidget *header_bar);
static void window_header_bar_right (GtkWidget *header_bar); static void window_header_bar_right (GtkWidget *header_bar);
void widget_topbar_design_main_window (GtkWindow *main_window) void widget_topbar_design_main_window (GtkWindow *main_window)
{ {
GtkWidget *header_bar = window_header_bar (main_window); GtkWidget *header_bar = window_header_bar (main_window);
@ -120,6 +121,7 @@ void widget_topbar_design_main_window (GtkWindow *main_window)
gtk_window_present (GTK_WINDOW (main_window)); gtk_window_present (GTK_WINDOW (main_window));
} }
static GtkWidget *window_header_bar (GtkWindow *window) static GtkWidget *window_header_bar (GtkWindow *window)
{ {
char *title = "E coli (with permission from David S. Goodsell, 2009)"; char *title = "E coli (with permission from David S. Goodsell, 2009)";