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.
This commit is contained in:
Matthias Clasen 2016-02-27 23:12:15 -05:00
parent 98a36955fe
commit 87554eb57a
2 changed files with 26 additions and 1 deletions

View File

@ -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");

View File

@ -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>