Commit 8b58d08b authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

example: Use HdyDeck in complex dialog demo

Signed-off-by: Alexander Mikhaylenko's avatarAlexander Mikhaylenko <alexm@gnome.org>
parent 964b1ddc
......@@ -209,15 +209,15 @@ dialog_action_clicked_cb (GtkButton *btn,
}
static void
dialog_complex_deeper_clicked_cb (GtkStack *stack)
dialog_complex_deeper_clicked_cb (HdyDeck *deck)
{
gtk_stack_set_visible_child_name (stack, "sub");
hdy_deck_set_visible_child_name (deck, "sub");
}
static void
dialog_complex_back_clicked_cb (GtkStack *stack)
dialog_complex_back_clicked_cb (HdyDeck *deck)
{
gtk_stack_set_visible_child_name (stack, "main");
hdy_deck_navigate (deck, HDY_NAVIGATION_DIRECTION_BACK);
}
static void
......@@ -225,14 +225,14 @@ dialog_complex_clicked_cb (GtkButton *btn,
HdyDemoWindow *self)
{
g_autoptr (GtkBuilder) builder = gtk_builder_new_from_resource ("/sm/puri/handy/demo/ui/hdy-dialog-complex-example.ui");
GtkWidget *dlg, *back, *deeper, *stack;
GtkWidget *dlg, *back, *deeper, *deck;
dlg = GTK_WIDGET (gtk_builder_get_object (builder, "dialog"));
back = GTK_WIDGET (gtk_builder_get_object (builder, "back"));
deeper = GTK_WIDGET (gtk_builder_get_object (builder, "deeper"));
stack = GTK_WIDGET (gtk_builder_get_object (builder, "content_stack"));
g_signal_connect_swapped (deeper, "clicked", G_CALLBACK (dialog_complex_deeper_clicked_cb), stack);
g_signal_connect_swapped (back, "clicked", G_CALLBACK (dialog_complex_back_clicked_cb), stack);
deck = GTK_WIDGET (gtk_builder_get_object (builder, "content_deck"));
g_signal_connect_swapped (deeper, "clicked", G_CALLBACK (dialog_complex_deeper_clicked_cb), deck);
g_signal_connect_swapped (back, "clicked", G_CALLBACK (dialog_complex_back_clicked_cb), deck);
gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (self));
gtk_widget_show (dlg);
......
......@@ -11,10 +11,9 @@
<object class="HdyTitleBar">
<property name="visible">True</property>
<child>
<object class="GtkStack">
<object class="HdyDeck" id="title_deck">
<property name="visible">True</property>
<property name="transition-type">slide-left-right</property>
<property name="visible-child-name" bind-source="content_stack" bind-property="visible-child-name" bind-flags="sync-create|bidirectional"/>
<property name="transition-type">over</property>
<signal name="notify::visible-child" handler="notify_header_visible_child_cb" swapped="no"/>
<child>
<object class="HdyHeaderBar" id="header_bar">
......@@ -71,11 +70,12 @@
<property name="visible">True</property>
<property name="border_width">0</property>
<child>
<object class="GtkStack" id="content_stack">
<object class="HdyDeck" id="content_deck">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<property name="transition_type">slide-left-right</property>
<property name="transition-type">over</property>
<property name="can-swipe-back">True</property>
<child>
<object class="GtkButton" id="deeper">
<property name="visible">True</property>
......@@ -112,4 +112,10 @@
</object>
</child>
</object>
<object class="HdySwipeGroup">
<swipeables>
<swipeable name="title_deck"/>
<swipeable name="content_deck"/>
</swipeables>
</object>
</interface>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment