I have the following test code that contains segments of Gtk and Libhandy libraries.
#include <gtk/gtk.h>
#include <stdio.h>
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
int main(int argc,char *argv[])
{
gtk_init(&argc,&argv);
GtkBuilder * builder = gtk_builder_new();
gtk_builder_add_from_resource(builder,
"/progname/interface/product-window.ui", NULL);
GtkWidget * window = GTK_WIDGET(gtk_builder_get_object(builder, "CcWindow"));
HdyLeaflet * leaflet = HDY_LEAFLET(gtk_builder_get_object(builder, "main_leaflet"));
GtkStack * stack = GTK_STACK(gtk_builder_get_object(builder, "stack"));
GtkWidget * swindow = GTK_WIDGET(gtk_builder_get_object(builder, "swindow"));
//hdy_leaflet_set_visible_child(leaflet, stack);
gtk_stack_set_visible_child(stack, swindow);
gtk_widget_show_all(window);
gtk_main();
g_object_unref(builder);
g_object_unref(window);
return 0;
}
The .ui file it uses is this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="libhandy" version="0.0"/>
<object class="GtkApplicationWindow" id="CcWindow">
<property name="can-focus">False</property>
<property name="window-position">center</property>
<property name="default-width">980</property>
<property name="default-height">640</property>
<signal name="key-press-event" handler="window_key_press_event_cb" object="CcWindow" after="yes" swapped="yes"/>
<signal name="map-event" handler="window_map_event_cb" object="CcWindow" swapped="yes"/>
<signal name="notify::window" handler="gdk_window_set_cb" object="CcWindow" swapped="yes"/>
<child>
<object class="HdyLeaflet" id="main_leaflet">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="visible-child">stack</property>
<property name="transition-type">slide</property>
<signal name="notify::folded" handler="on_main_leaflet_folded_changed_cb" object="CcWindow" swapped="yes"/>
<child>
<object class="GtkStack" id="stack">
<property name="width-request">360</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkScrolledWindow" id="swindow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<object class="HdyClamp">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child>
<!-- n-columns=1 n-rows=40 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="row-spacing">15</property>
<property name="column-spacing">7</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkFileChooserButton" id="product_picture_id">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">????????? ????</property>
<property name="width-chars">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="placeholder-text" translatable="yes">????????? ID</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…