summaryrefslogtreecommitdiff
path: root/gtk/gtkadjustment.c
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-05-03 19:13:24 +0000
committerTim Janik <timj@src.gnome.org>1998-05-03 19:13:24 +0000
commit5c9af6b5aa97417b6ec52018d30cf11790560110 (patch)
tree99053372cdbbb6940bc7f970d4337445e591181c /gtk/gtkadjustment.c
parent19bbe0557f255fe37c19666f434705295a71d750 (diff)
downloadgtk+-5c9af6b5aa97417b6ec52018d30cf11790560110.tar.gz
new function to set the adjustments value without causing a current
Sun May 3 19:45:09 1998 Tim Janik <timj@gtk.org> * gtk/gtkadjustment.c (gtk_adjustment_assimilate_value): new function to set the adjustments value without causing a current emission of "value_changed" to be restarted. * gtk/gtksignal.c: added new functions to retrive the number of existing emissions for a certain signal. (gtk_signal_n_emissions): new function. (gtk_signal_n_emissions_by_name): new function.
Diffstat (limited to 'gtk/gtkadjustment.c')
-rw-r--r--gtk/gtkadjustment.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
index b921cc146e..bcf2ff1b17 100644
--- a/gtk/gtkadjustment.c
+++ b/gtk/gtkadjustment.c
@@ -132,17 +132,31 @@ gtk_adjustment_set_value (GtkAdjustment *adjustment,
{
adjustment->value = value;
- gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
+ gtk_adjustment_value_changed (adjustment);
}
}
void
+gtk_adjustment_assimilate_value (GtkAdjustment *adjustment,
+ gfloat value)
+{
+ g_return_if_fail (adjustment != NULL);
+ g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+ if (gtk_signal_n_emissions (GTK_OBJECT (adjustment),
+ adjustment_signals[VALUE_CHANGED]))
+ adjustment->value = CLAMP (value, adjustment->lower, adjustment->upper);
+ else
+ gtk_adjustment_set_value (adjustment, value);
+}
+
+void
gtk_adjustment_changed (GtkAdjustment *adjustment)
{
g_return_if_fail (adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "changed");
+ gtk_signal_emit (GTK_OBJECT (adjustment), adjustment_signals[CHANGED]);
}
void
@@ -151,7 +165,7 @@ gtk_adjustment_value_changed (GtkAdjustment *adjustment)
g_return_if_fail (adjustment != NULL);
g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
- gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
+ gtk_signal_emit (GTK_OBJECT (adjustment), adjustment_signals[VALUE_CHANGED]);
}
void
@@ -181,5 +195,5 @@ gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
}
if (need_emission)
- gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
+ gtk_adjustment_value_changed (adjustment);
}