learn gtk_widget_class_bind_template_callback() ? (windows.c line 78)

This commit is contained in:
Jean Sirmai 2024-05-26 08:21:47 +02:00
parent fc1ee6b7f8
commit 52053f917c
Signed by: jean
GPG Key ID: FB3115C340E057E3
2 changed files with 9 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<interface> <interface>
<!-- interface-name gem-graph.ui --> <!-- interface-name gem-graph.ui -->
<requires lib="gtk" version="4.6"/> <requires lib="gtk" version="4.6"/>
<!--template class="GemGraphClientWindow" parent="GtkApplicationWindow"--> <template class="GemGraphClientWindow" parent="GtkApplicationWindow">
<property name="default-height">960</property> <property name="default-height">960</property>
<property name="default-width">1920</property> <property name="default-width">1920</property>
<property name="icon-name">application-x-executable</property> <property name="icon-name">application-x-executable</property>
@ -244,7 +244,7 @@
</child> </child>
</object> </object>
</child> </child>
<!--/template--> </template>
<menu id="main_menu"> <menu id="main_menu">
<section> <section>

View File

@ -75,6 +75,10 @@ static void gem_graph_client_window_class_init(GemGraphClientWindowClass *klass)
bytes = g_bytes_new_take(contents, len); bytes = g_bytes_new_take(contents, len);
gtk_widget_class_set_template(GTK_WIDGET_CLASS(klass), bytes); gtk_widget_class_set_template(GTK_WIDGET_CLASS(klass), bytes);
// https://docs.gtk.org/gtk4/class.Widget.html#building-composite-widgets-from-template-xml TODO Learn !
// gtk_widget_class_bind_template_callback_full (GtkToggleButton, ui_toggle_sidebar, "clicked"); // "main_button_sidebar"
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_titlebar); gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_titlebar);
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_stack); gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, main_stack);
gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, side_stack); gtk_widget_class_bind_template_child(widget_class, GemGraphClientWindow, side_stack);
@ -97,6 +101,9 @@ static void gem_graph_client_window_init(GemGraphClientWindow *self)
window = self; window = self;
} }
// https://docs.gtk.org/gtk4/class.Widget.html#building-composite-widgets-from-template-xml
static void gtk_widget_class_dispose_template() {} // TODO ?
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
void ui_set_stack(int mode) void ui_set_stack(int mode)