Commit 0faadef3 authored by Matthias Clasen's avatar Matthias Clasen

widget-factory: Add a scale to the gear menu

This tests the custom menuitem support, and lets you
control the transition duration for the main stack.
parent af6c3017
Pipeline #224744 passed with stages
in 16 minutes and 6 seconds
......@@ -91,6 +91,16 @@ change_theme_state (GSimpleAction *action,
static GtkWidget *page_stack;
static void
transition_speed_changed (GtkRange *range,
gpointer data)
{
double value;
value = gtk_range_get_value (range);
gtk_stack_set_transition_duration (GTK_STACK (page_stack), (int)value);
}
static void
change_transition_state (GSimpleAction *action,
GVariant *state,
......@@ -2022,6 +2032,7 @@ activate (GApplication *app)
"validate_more_details", (GCallback)validate_more_details,
"mode_switch_state_set", (GCallback)mode_switch_state_set,
"level_scale_value_changed", (GCallback)level_scale_value_changed,
"transition_speed_changed", (GCallback)transition_speed_changed,
NULL);
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="gear_menu">
<menu id="gear_menu_model">
<section>
<item>
<attribute name="label" translatable="yes">Get Busy</attribute>
......@@ -40,6 +40,9 @@
<attribute name="label" translatable="yes">Transition Pages</attribute>
<attribute name="action">win.transition</attribute>
</item>
<item>
<attribute name="custom">transition-speed</attribute>
</item>
</section>
<section>
<item>
......@@ -444,7 +447,26 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
<property name="menu-model">gear_menu</property>
<property name="popover">
<object class="GtkPopoverMenu" id="gear_menu">
<property name="menu-model">gear_menu_model</property>
<child type="transition-speed">
<object class="GtkScale">
<property name="adjustment">
<object class="GtkAdjustment">
<property name="lower">0</property>
<property name="upper">1000</property>
<property name="value">250</property>
<property name="step-increment">50</property>
<property name="page-increment">50</property>
<property name="page-size">0</property>
</object>
</property>
<signal name="value-changed" handler="transition_speed_changed"/>
</object>
</child>
</object>
</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
......
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