src/widget/main_window/design.c adding a title and a button in the header_bar
==3275== LEAK SUMMARY: ==3275== definitely lost: 3,728 bytes in 52 blocks ==3275== indirectly lost: 8,112 bytes in 337 blocks no gtk_._unref() functions used In previous valgrind report: ==23744== LEAK SUMMARY: ==23744== definitely lost: 5,008 bytes in 54 blocks ==23744== indirectly lost: 16,151 bytes in 673 blocks reproducible result
This commit is contained in:
parent
e684cf9a1b
commit
794418e208
|
@ -143,7 +143,8 @@ enum fsm_enum_log_source {
|
|||
SRC_CONTENT, /**< MAIN, APP, WIDGETS, SIGNAL */ MAIN, APP, WIDGETS, SIGNAL,
|
||||
WINDOW, /**< MAIN, DIALOG, MODAL, TEXT */
|
||||
MAIN_WINDOW, DIALOG_WINDOW, MODAL_WINDOW, TEXT_WINDOW,
|
||||
TOPBAR, /**< LEFT, CENTER, RIGHT */ TOPBAR_LEFT, TOPBAR_CENTER, TOPBAR_RIGHT,
|
||||
HEADER_BAR, /**< LEFT, CENTER, RIGHT */ HEADER_BAR_LEFT, HEADER_BAR_CENTER,
|
||||
HEADER_BAR_RIGHT,
|
||||
PAGE, /**< SYNTH, STATE, RULES, [USER TREE], [SELECTED_RULE], MEASURES, RESULTS */
|
||||
SYNTH_PAGE, STATE_PAGE, RULES_PAGE, MEASURES_PAGE, RESULTS_PAGE,
|
||||
SYNTHESIS, /**< GLAREA, CAMERA, CONTROLS, RESULTS (duplicates from other pages) */
|
||||
|
|
|
@ -31,3 +31,5 @@
|
|||
void on_app_activation (GtkApplication *app);
|
||||
void widget_design_main_window (GtkWindow *main_window, GtkApplication *app);
|
||||
gboolean on_window_close_request (GtkWindow *main_window, gpointer user_data);
|
||||
void on_toggle_exec_edit (GtkWidget *btt_XOR_EXEC_EDIT, gpointer user_data);
|
||||
|
||||
|
|
|
@ -33,6 +33,20 @@
|
|||
#include "../../../include/widget.h"
|
||||
#include "../../../include/fsm.h"
|
||||
|
||||
/**
|
||||
* every "on_" function is to go in "signal.c" (not yet implemented)
|
||||
*
|
||||
* @param *toggled_button
|
||||
* @param user_data
|
||||
*/
|
||||
void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
|
||||
{
|
||||
fsm_add_log (INFO, BUTTON, "signal", "toggle exec edit()",
|
||||
"flip status request + bell 😇️ gdk_display_beep()");
|
||||
|
||||
gdk_display_beep (gdk_display_get_default());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Main window design()
|
||||
*
|
||||
|
@ -41,22 +55,34 @@
|
|||
*/
|
||||
void widget_design_main_window (GtkWindow *main_window, GtkApplication *app)
|
||||
{
|
||||
fsm_add_log (INFO, TOPBAR, "widget/main_window/design",
|
||||
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
|
||||
|
||||
gpointer no_local_data = NULL;
|
||||
|
||||
fsm_add_log (INFO, HEADER_BAR_LEFT, "widget/main_window/design",
|
||||
__func__, "start of design");
|
||||
|
||||
/* GtkWidget *topbar = GTK_WIDGET (gtk_header_bar_new ()); */
|
||||
|
||||
/* char *title = "E coli (with permission from David S. Goodsell, 2009)"; */
|
||||
/* gtk_header_bar_set_title_widget (GTK_HEADER_BAR (topbar), */
|
||||
/* gtk_label_new (title)); */
|
||||
char *title = "E coli (with permission from David S. Goodsell, 2009)";
|
||||
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar),
|
||||
gtk_label_new (title));
|
||||
|
||||
GtkWidget *e_coli = GTK_WIDGET (gtk_picture_new_for_filename
|
||||
("./docs/showcase/E coli (Goodsell).png"));
|
||||
|
||||
gtk_window_set_child (main_window, e_coli);
|
||||
|
||||
GtkButton *btt_XOR_EXEC_EDIT = GTK_BUTTON (gtk_toggle_button_new ());
|
||||
gtk_button_set_icon_name (btt_XOR_EXEC_EDIT, "power-profile-balanced-rtl-symbolic");
|
||||
g_signal_connect (btt_XOR_EXEC_EDIT, "clicked", G_CALLBACK (on_toggle_exec_edit),
|
||||
no_local_data);
|
||||
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar),
|
||||
GTK_WIDGET (btt_XOR_EXEC_EDIT));
|
||||
|
||||
gtk_window_set_titlebar (main_window, GTK_WIDGET (header_bar));
|
||||
|
||||
// g_object_unref (e_coli);
|
||||
|
||||
fsm_add_log (INFO, TOPBAR, "widget/main_window/design",
|
||||
__func__, "end of design -> present");
|
||||
fsm_add_log (INFO, HEADER_BAR_LEFT, "widget/main_window/design",
|
||||
__func__, "end of design -> present");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue