introducing widget/init.c
This commit is contained in:
parent
7fcc2ed094
commit
a9b4874956
|
@ -38,9 +38,9 @@
|
|||
/* W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
void widget_topbar_fix_main_window (GtkApplication *app);
|
||||
void widget_topbar_fix_dialog_window (GtkApplication *app);
|
||||
void widget_topbar_fix_text_window (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_dialog_window (GtkWindow *main_window,
|
||||
|
@ -48,9 +48,9 @@ void widget_topbar_design_dialog_window (GtkWindow *main_window,
|
|||
void widget_topbar_design_text_window (GtkWindow *main_window,
|
||||
GtkWindow *text_window);
|
||||
|
||||
void *widget_topbar_rec_main_window();
|
||||
GtkWindow *widget_topbar_rec_dialog_window();
|
||||
GtkWindow *widget_topbar_rec_text_window();
|
||||
void *widget_topbar_get_main_window();
|
||||
void *widget_topbar_get_dialog_window();
|
||||
void *widget_topbar_get_text_window();
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
|
15
src/main.c
15
src/main.c
|
@ -136,16 +136,17 @@
|
|||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||
|
||||
return status;
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
|
|
32
src/signal.c
32
src/signal.c
|
@ -57,23 +57,19 @@ static void on_auto_notification (const char *message)
|
|||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
void on_windows_activation (GtkApplication *app,
|
||||
gpointer no_user_data)
|
||||
{
|
||||
widget_topbar_fix_main_window (app);
|
||||
widget_topbar_design_main_window (GTK_WINDOW (widget_topbar_rec_main_window ()));
|
||||
widget_create_main_window (app);
|
||||
widget_topbar_design_main_window (GTK_WINDOW (widget_topbar_get_main_window ()));
|
||||
|
||||
widget_topbar_fix_dialog_window (app);
|
||||
widget_topbar_design_dialog_window (GTK_WINDOW (widget_topbar_rec_main_window ()),
|
||||
widget_topbar_rec_dialog_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_topbar_fix_text_window (app);
|
||||
widget_topbar_design_text_window (GTK_WINDOW (widget_topbar_rec_main_window ()),
|
||||
widget_topbar_rec_text_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()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,17 +249,17 @@ static void switch_STATE_RULES_DATA()
|
|||
switch (fsm_get_STATE_RULES_DATA()) {
|
||||
|
||||
case (STATE) :
|
||||
gtk_window_set_child (GTK_WINDOW (widget_topbar_rec_main_window ()),
|
||||
gtk_window_set_child (GTK_WINDOW (widget_topbar_get_main_window ()),
|
||||
GTK_WIDGET (widget_rec_state_page()));
|
||||
break;
|
||||
|
||||
case (RULES) :
|
||||
gtk_window_set_child (GTK_WINDOW (widget_topbar_rec_main_window ()),
|
||||
gtk_window_set_child (GTK_WINDOW (widget_topbar_get_main_window ()),
|
||||
GTK_WIDGET (widget_rec_rules_page()));
|
||||
break;
|
||||
|
||||
case (DATA) :
|
||||
gtk_window_set_child (GTK_WINDOW (widget_topbar_rec_main_window ()),
|
||||
gtk_window_set_child (GTK_WINDOW (widget_topbar_get_main_window ()),
|
||||
GTK_WIDGET (widget_rec_stock_page()));
|
||||
break;
|
||||
|
||||
|
@ -286,7 +282,7 @@ void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
|
|||
"text-editor-symbolic");
|
||||
|
||||
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
|
||||
// gtk_window_present (GTK_WINDOW (widget_topbar_rec_dialog_window())); // works once only !
|
||||
// gtk_window_present (GTK_WINDOW (widget_topbar_get_dialog_window())); // works once only !
|
||||
|
||||
fsm_set_EXEC_EDIT (EDIT);
|
||||
}
|
||||
|
@ -398,14 +394,14 @@ void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
|
|||
|
||||
void on_clicked_search (GtkWidget *btt_menu, gpointer list_box) {
|
||||
// next line presents the text_window and works only once.\nIt should present a menu.\n"); // TODO
|
||||
gtk_window_present (GTK_WINDOW (widget_topbar_rec_text_window()));
|
||||
gtk_window_present (GTK_WINDOW (widget_topbar_get_text_window()));
|
||||
}
|
||||
|
||||
void on_clicked_HOME (GtkWidget *btt_reset, gpointer data)
|
||||
{
|
||||
printf ("callback.on_clicked_HOME() button presents the dialog_window\
|
||||
( :- ) but it works only once.\n"); // TODO
|
||||
gtk_window_present (GTK_WINDOW (widget_topbar_rec_dialog_window()));
|
||||
gtk_window_present (GTK_WINDOW (widget_topbar_get_dialog_window()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* *
|
||||
* Gem-graph client *
|
||||
* *
|
||||
* Callbacks header *
|
||||
* *
|
||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
|
||||
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
|
||||
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
|
||||
* *
|
||||
* This file is part of Gem-graph. *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU Affero General Public License *
|
||||
* as published by the Free Software Foundation, *
|
||||
* either version 3 of the License, *
|
||||
* or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; *
|
||||
* without even the implied warranty of MERCHANTABILITY *
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
|
||||
#include "../../include/widget.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
static GtkWindow *main_window, *dialog_window, *text_window;
|
||||
|
||||
void *widget_topbar_get_main_window() { return main_window; }
|
||||
void *widget_topbar_get_dialog_window() { return dialog_window; }
|
||||
void *widget_topbar_get_text_window() { return 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)); }
|
||||
|
||||
|
|
@ -35,7 +35,9 @@
|
|||
#define LOWER_COMPARTMENT_PARTITION 1300
|
||||
|
||||
/* L'image de l'état de l'espace (au centre) est entourée par trois panneaux:
|
||||
* Si on les nomme selon leur fonction,
|
||||
* "haut", "milieu", "bas"
|
||||
*
|
||||
* ou encore, si l'on nomme ces panneaux selon leur fonction:
|
||||
*
|
||||
* - CONTROL ou EDIT en bas permet de contrôler / choisir un état et / ou de l'éditer
|
||||
* en mode EDIT, seuls les outils d'édition de l'état sont disponibles
|
||||
|
|
|
@ -36,27 +36,8 @@
|
|||
#define H_TEXT_WINDOW 1000
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* G E T + S E T A L L W I N D O W S */
|
||||
/******************************************************************************/
|
||||
|
||||
static GtkWindow *main_window, *dialog_window, *text_window;
|
||||
static GtkButton *btt_STATE, *btt_RULES, *btt_DATA;
|
||||
|
||||
void *widget_topbar_rec_main_window() { return main_window; }
|
||||
GtkWindow *widget_topbar_rec_dialog_window() { return dialog_window; }
|
||||
GtkWindow *widget_topbar_rec_text_window() { return text_window; }
|
||||
|
||||
void widget_topbar_fix_main_window (GtkApplication *app)
|
||||
{ main_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||
|
||||
void widget_topbar_fix_dialog_window (GtkApplication *app)
|
||||
{ dialog_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||
|
||||
void widget_topbar_fix_text_window (GtkApplication *app)
|
||||
{ text_window = GTK_WINDOW (gtk_application_window_new (app)); }
|
||||
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* T E X T W I N D O W */
|
||||
|
@ -122,7 +103,7 @@ void widget_topbar_design_dialog_window (GtkWindow *main_window, GtkWindow *dial
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
/* M A I N W I N D O W H E A D C E N T E R */
|
||||
/* M A I N W I N D O W T O P B A R ( C E N T E R ) */
|
||||
/******************************************************************************/
|
||||
|
||||
static GtkWidget *window_header_bar (GtkWindow *window);
|
||||
|
@ -151,7 +132,7 @@ static GtkWidget *window_header_bar (GtkWindow *window)
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
/* M A I N W I N D O W H E A D L E F T */
|
||||
/* M A I N W I N D O W T O P B A R ( L E F T ) */
|
||||
/******************************************************************************/
|
||||
|
||||
static void window_header_bar_left (GtkWidget *header_bar)
|
||||
|
@ -190,7 +171,7 @@ static void window_header_bar_left (GtkWidget *header_bar)
|
|||
|
||||
|
||||
/******************************************************************************/
|
||||
/* M A I N W I N D O W H E A D R I G H T */
|
||||
/* M A I N W I N D O W T O P B A R ( R I G H T ) */
|
||||
/******************************************************************************/
|
||||
|
||||
static void connect(GApplication *app, gpointer *data) { puts("Connect menu item clicked.\n"); }
|
||||
|
|
Loading…
Reference in New Issue