widget-factory: Add a reset button to the notification

Change the initial value to something that is not a multiple of 3, so
that dismissing the notification on reset makes sense. Let's use 50
because that is already being used elsewhere.

https://bugzilla.gnome.org/show_bug.cgi?id=734614
This commit is contained in:
Debarshi Ray 2014-08-11 23:14:34 +02:00
parent 5d8efb43bc
commit a397824e9b
2 changed files with 19 additions and 1 deletions

View File

@ -144,6 +144,13 @@ dismiss (GtkWidget *button)
gtk_revealer_set_reveal_child (GTK_REVEALER (w), FALSE);
}
static void
spin_value_reset (GtkWidget *button, GtkAdjustment *adjustment)
{
gtk_adjustment_set_value (adjustment, 50.0);
dismiss (button);
}
static gint pulse_time = 250;
static gint pulse_entry_mode = 0;
@ -626,6 +633,10 @@ activate (GApplication *app)
g_signal_connect (adj, "value-changed", G_CALLBACK (update_pulse_time), widget);
update_pulse_time (adj, widget);
widget = (GtkWidget *)gtk_builder_get_object (builder, "page2reset");
adj = (GtkAdjustment *) gtk_builder_get_object (builder, "adjustment2");
g_signal_connect (widget, "clicked", G_CALLBACK (spin_value_reset), adj);
widget = (GtkWidget *)gtk_builder_get_object (builder, "page2dismiss");
g_signal_connect (widget, "clicked", G_CALLBACK (dismiss), NULL);

View File

@ -89,7 +89,7 @@
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">1000</property>
<property name="lower">1</property>
<property name="value">42</property>
<property name="value">50</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
@ -1985,6 +1985,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
<property name="label">NEWS!</property>
</object>
</child>
<child>
<object class="GtkButton" id="page2reset">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Reset</property>
</object>
</child>
<child>
<object class="GtkButton" id="page2dismiss">
<property name="visible">True</property>