summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2016-02-27 23:12:15 -0500
committerMatthias Clasen <mclasen@redhat.com>2016-02-27 23:12:15 -0500
commit87554eb57a101aa6a2e2f3a7a6ff5eaa09a5ede8 (patch)
treeda5ffec013ba0065a3b27925e858d0d088e6b0da /demos
parent98a36955fec680b05675c7a6ba738897e65a37c9 (diff)
downloadgtk+-87554eb57a101aa6a2e2f3a7a6ff5eaa09a5ede8.tar.gz
widget-factory: Make the sliding opt-in
The sliding is a little disorienting, so turn it off by default and add a checkbutton for it in the gear menu.
Diffstat (limited to 'demos')
-rw-r--r--demos/widget-factory/widget-factory.c22
-rw-r--r--demos/widget-factory/widget-factory.ui5
2 files changed, 26 insertions, 1 deletions
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index baa7c43040..087c34e00f 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -38,6 +38,25 @@ change_theme_state (GSimpleAction *action,
g_simple_action_set_state (action, state);
}
+static GtkWidget *page_stack;
+
+static void
+change_transition_state (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GtkStackTransitionType transition;
+
+ if (g_variant_get_boolean (state))
+ transition = GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT;
+ else
+ transition = GTK_STACK_TRANSITION_TYPE_NONE;
+
+ gtk_stack_set_transition_type (GTK_STACK (page_stack), transition);
+
+ g_simple_action_set_state (action, state);
+}
+
static gboolean
get_idle (gpointer data)
{
@@ -1621,6 +1640,7 @@ activate (GApplication *app)
GtkCssProvider *provider;
static GActionEntry win_entries[] = {
{ "dark", NULL, NULL, "false", change_theme_state },
+ { "transition", NULL, NULL, "false", change_transition_state },
{ "search", activate_search, NULL, NULL, NULL },
{ "delete", activate_delete, NULL, NULL, NULL },
{ "busy", get_busy, NULL, NULL, NULL },
@@ -1757,6 +1777,8 @@ activate (GApplication *app)
g_signal_connect (stack, "notify::visible-child-name", G_CALLBACK (page_changed_cb), NULL);
page_changed_cb (stack, NULL, NULL);
+ page_stack = stack;
+
dialog = (GtkWidget *)gtk_builder_get_object (builder, "preference_dialog");
g_signal_connect (dialog, "response", G_CALLBACK (close_dialog), NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "preference_dialog_button");
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 2cd966c283..42fedcb015 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -11,6 +11,10 @@
<attribute name="label" translatable="yes">Dark Theme</attribute>
<attribute name="action">win.dark</attribute>
</item>
+ <item>
+ <attribute name="label" translatable="yes">Slide Pages</attribute>
+ <attribute name="action">win.transition</attribute>
+ </item>
</section>
</menu>
<menu id="dinner_menu">
@@ -433,7 +437,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<object class="GtkStack" id="toplevel_stack">
<property name="visible">1</property>
<property name="transition-duration">1000</property>
- <property name="transition-type">slide-left-right</property>
<child>
<object class="GtkBox" id="page1">
<property name="visible">1</property>