summaryrefslogtreecommitdiff
path: root/gtk/gtkadjustment.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-06-28 00:38:20 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-07-05 16:08:54 -0400
commit1ff2076cdde99337752a897cfb11e7f646694237 (patch)
treeb716cb1b03e317efca54cb82a7e249a92026a718 /gtk/gtkadjustment.c
parent98918137a8aa8e2748fbc469ebecce6d1ad9380f (diff)
downloadgtk+-1ff2076cdde99337752a897cfb11e7f646694237.tar.gz
GtkAdjustment: add an auxiliary function
This is going to be used in AtkValue implementations.
Diffstat (limited to 'gtk/gtkadjustment.c')
-rw-r--r--gtk/gtkadjustment.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
index 40329a4ef3..29aa1c9370 100644
--- a/gtk/gtkadjustment.c
+++ b/gtk/gtkadjustment.c
@@ -809,3 +809,47 @@ gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
if (need_emission)
gtk_adjustment_value_changed (adjustment);
}
+
+/**
+ * gtk_adjustment_get_minimum_increment:
+ * @adjustment: a #GtkAdjustment
+ *
+ * Gets the smaller of step increment and page increment.
+ *
+ * Returns: the minimum increment of @adjustment
+ *
+ * Since: 3.2
+ */
+gdouble
+gtk_adjustment_get_minimum_increment (GtkAdjustment *adjustment)
+{
+ GtkAdjustmentPrivate *priv;
+ gdouble minimum_increment;
+
+ g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), 0);
+
+ priv = adjustment->priv;
+
+ if (priv->step_increment != 0 && priv->page_increment != 0)
+ {
+ if (ABS (priv->step_increment) < ABS (priv->page_increment))
+ minimum_increment = priv->step_increment;
+ else
+ minimum_increment = priv->page_increment;
+ }
+ else if (priv->step_increment == 0 && priv->page_increment == 0)
+ {
+ minimum_increment = 0;
+ }
+ else if (priv->step_increment == 0)
+ {
+ minimum_increment = priv->page_increment;
+ }
+ else
+ {
+ minimum_increment = priv->step_increment;
+ }
+
+ return minimum_increment;
+}
+