[gtk+/gtk-3-20] widget-factory: Better progressbar testing
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] widget-factory: Better progressbar testing
- Date: Sat, 3 Dec 2016 17:22:12 +0000 (UTC)
commit 51a6a325d251a5fd747e02f2b1eb8137aa9de291
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Nov 14 08:20:32 2016 -0500
widget-factory: Better progressbar testing
Hook the two top progressbars up to the scale with marks.
Your turn, Lapo.
demos/widget-factory/widget-factory.c | 16 ++++++++++++++++
demos/widget-factory/widget-factory.ui | 3 ++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 087c34e..a19145b 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -1626,6 +1626,16 @@ reset_icon_size (GtkWidget *iv)
}
static void
+adjustment3_value_changed (GtkAdjustment *adj, GtkProgressBar *pbar)
+{
+ double fraction;
+
+ fraction = gtk_adjustment_get_value (adj) / (gtk_adjustment_get_upper (adj) - gtk_adjustment_get_lower
(adj));
+
+ gtk_progress_bar_set_fraction (pbar, fraction);
+}
+
+static void
activate (GApplication *app)
{
GtkBuilder *builder;
@@ -1896,6 +1906,12 @@ activate (GApplication *app)
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "decrease_button");
g_object_set_data (G_OBJECT (widget), "decrease_button", widget2);
+ adj = (GtkAdjustment *)gtk_builder_get_object (builder, "adjustment3");
+ widget = (GtkWidget *)gtk_builder_get_object (builder, "progressbar1");
+ widget2 = (GtkWidget *)gtk_builder_get_object (builder, "progressbar2");
+ g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
+ g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
+
gtk_widget_show_all (GTK_WIDGET (window));
g_object_unref (builder);
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index ba0ff71..d240253 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -103,8 +103,9 @@
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="adjustment3">
+ <property name="lower">0</property>
<property name="upper">4</property>
- <property name="value">1</property>
+ <property name="value">2</property>
<property name="step_increment">1</property>
<property name="page_increment">1</property>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]