Commit f2b58a7a authored by Adrien Plazas's avatar Adrien Plazas
Browse files

example: Put the content in a scrolled window

This ensures the example can fit windows of any height.

This also makes the stack containing the content non vertically
homogeneous so the scrollbar appears only on examples needing it, while
keeping it horizontally homogeneous for to keep when the leaflets will
be folded consistent.
parent d8189a64
Pipeline #2504 passed with stage
in 2 minutes and 54 seconds
......@@ -112,7 +112,7 @@ example_window_notify_visible_child_cb (GObject *sender,
GParamSpec *pspec,
ExampleWindow *self)
{
hdy_leaflet_set_visible_child (self->content_box, GTK_WIDGET (self->stack));
hdy_leaflet_set_visible_child_name (self->content_box, "content");
update_header_bar (self);
}
......@@ -120,7 +120,7 @@ static void
example_window_back_clicked_cb (GtkWidget *sender,
ExampleWindow *self)
{
hdy_leaflet_set_visible_child (self->content_box, GTK_WIDGET (self->sidebar));
hdy_leaflet_set_visible_child_name (self->content_box, "sidebar");
}
static void
......@@ -328,6 +328,6 @@ example_window_init (ExampleWindow *self)
gtk_widget_init_template (GTK_WIDGET (self));
gtk_list_box_set_header_func (self->column_listbox, list_box_separator_header_func, NULL, NULL);
hdy_leaflet_set_visible_child (self->content_box, GTK_WIDGET (self->stack));
hdy_leaflet_set_visible_child_name (self->content_box, "content");
update_header_bar (self);
}
......@@ -152,57 +152,34 @@
</object>
</child>
<child>
<object class="GtkStack" id="stack">
<object class="GtkScrolledWindow">
<property name="hscrollbar_policy">never</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="notify::visible-child" handler="notify_visible_child_cb" after="yes" swapped="no"/>
<child>
<object class="GtkBox" id="welcome">
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<property name="vhomogeneous">False</property>
<signal name="notify::visible-child" handler="notify_visible_child_cb" after="yes" swapped="no"/>
<child>
<object class="GtkImage" id="icon">
<object class="GtkBox" id="welcome">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="margin_bottom">18</property>
<property name="pixel_size">128</property>
<property name="icon_name">phone-symbolic</property>
<property name="icon_size">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<child>
<object class="GtkLabel" id="label">
<object class="GtkImage" id="icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0.5</property>
<property name="halign">center</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">Welcome to Handy</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="2"/>
</attributes>
<property name="valign">center</property>
<property name="margin_bottom">18</property>
<property name="pixel_size">128</property>
<property name="icon_name">phone-symbolic</property>
<property name="icon_size">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="expand">False</property>
......@@ -211,14 +188,49 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="empty-state-label">
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0.5</property>
<property name="label" translatable="yes">This is a tour of the widgets the library has to offer.</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="use_markup">True</property>
<property name="orientation">vertical</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<child>
<object class="GtkLabel" id="label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0.5</property>
<property name="halign">center</property>
<property name="margin_bottom">12</property>
<property name="label" translatable="yes">Welcome to Handy</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="empty-state-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="opacity">0.5</property>
<property name="label" translatable="yes">This is a tour of the widgets the library has to offer.</property>
<property name="justify">center</property>
<property name="wrap">True</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
......@@ -228,419 +240,339 @@
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="name">welcome</property>
<property name="title">Welcome</property>
</packing>
</child>
</object>
<packing>
<property name="name">welcome</property>
<property name="title">Welcome</property>
</packing>
</child>
<child>
<object class="HdyColumn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="maximum-width">300</property>
<property name="linear-growth-width">300</property>
<property name="margin-top">32</property>
<property name="margin-bottom">32</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkBox" id="box_dialer">
<object class="HdyColumn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="valign">center</property>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<property name="maximum-width">300</property>
<property name="linear-growth-width">300</property>
<property name="margin-top">32</property>
<property name="margin-bottom">32</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<child>
<object class="GtkLabel" id="display">
<object class="GtkBox" id="box_dialer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="single_line_mode">True</property>
<attributes>
<attribute name="scale" value="1.6"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HdyDialer" id="dialer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">10</property>
<property name="hexpand">True</property>
<property name="row_spacing">8</property>
<property name="valign">center</property>
<signal name="deleted" handler="deleted_cb" after="yes" swapped="no"/>
<signal name="submitted" handler="submitted_cb" after="yes" swapped="no"/>
<signal name="symbol-clicked" handler="symbol_clicked_cb" after="yes" swapped="no"/>
<property name="hexpand">True</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="display">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="single_line_mode">True</property>
<attributes>
<attribute name="scale" value="1.6"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="HdyDialer" id="dialer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">10</property>
<property name="hexpand">True</property>
<property name="row_spacing">8</property>
<property name="valign">center</property>
<signal name="deleted" handler="deleted_cb" after="yes" swapped="no"/>
<signal name="submitted" handler="submitted_cb" after="yes" swapped="no"/>
<signal name="symbol-clicked" handler="symbol_clicked_cb" after="yes" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="name">dialer</property>
<property name="title">Dialer</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box_arrows">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="HdyArrows" id="arrows">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="count">3</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
<property name="name">dialer</property>
<property name="title">Dialer</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<object class="GtkBox" id="box_arrows">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">6</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Number of arrows</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<object class="HdyArrows" id="arrows">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Animation duration</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">0</property>
<property name="input_purpose">digits</property>
<property name="adjustment">adj_arrows_count</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="input_purpose">digits</property>
<property name="adjustment">adj_arrows_duration</property>
<property name="climb_rate">250</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
<property name="value">1000</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="count">3</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFrame">
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<property name="margin_top">6</property>
<property name="row_spacing">3</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Number of arrows</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Animation duration</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">0</property>
<property name="input_purpose">digits</property>
<property name="adjustment">adj_arrows_count</property>
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="input_purpose">digits</property>
<property name="adjustment">adj_arrows_duration</property>
<property name="climb_rate">250</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
<property name="value">1000</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkAlignment">
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="left_padding">12</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkButtonBox">
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<child>
<object class="GtkRadioButton" id="btn_arrows_up">
<property name="label" translatable="yes">Up</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="btn_arrows_up_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="btn_arrows_down">
<property name="label" translatable="yes">Down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">btn_arrows_up</property>
<signal name="toggled" handler="btn_arrows_down_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="btn_arrows_left">
<property name="label" translatable="yes">Left</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">btn_arrows_up</property>
<signal name="toggled" handler="btn_arrows_left_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<property name="left_padding">12</property>
<child>
<object class="GtkRadioButton" id="btn_arrows_right">
<property name="label" translatable="yes">Right</property>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">btn_arrows_up</property>
<signal name="toggled" handler="btn_arrows_right_toggled_cb" swapped="no"/>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="layout_style">start</property>
<child>
<object class="GtkRadioButton" id="btn_arrows_up">
<property name="label" translatable="yes">Up</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="btn_arrows_up_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="btn_arrows_down">
<property name="label" translatable="yes">Down</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">btn_arrows_up</property>
<signal name="toggled" handler="btn_arrows_down_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="btn_arrows_left">
<property name="label" translatable="yes">Left</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">btn_arrows_up</property>
<signal name="toggled" handler="btn_arrows_left_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="btn_arrows_right">
<property name="label" translatable="yes">Right</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">btn_arrows_up</property>
<signal name="toggled" handler="btn_arrows_right_toggled_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
</child>
</object>
</child>
<child type="label_item">
<placeholder/>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>