[gimp] libgimpwidgets: use accessors for GtkAdjustment members
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: use accessors for GtkAdjustment members
- Date: Tue, 19 Oct 2010 16:38:03 +0000 (UTC)
commit 9e28a0406b29fdd792c5cf178ba425f2ee60c766
Author: Michael Natterer <mitch gimp org>
Date: Tue Oct 19 18:37:00 2010 +0200
libgimpwidgets: use accessors for GtkAdjustment members
so it builds with GSEAL_ENABLE. Also keep around the adjustments as
GtkAdjustment not GtkObject to avoid casting all the time.
libgimpwidgets/gimpsizeentry.c | 62 ++++++++++++++++++++++-----------------
1 files changed, 35 insertions(+), 27 deletions(-)
---
diff --git a/libgimpwidgets/gimpsizeentry.c b/libgimpwidgets/gimpsizeentry.c
index a137c91..fe207d6 100644
--- a/libgimpwidgets/gimpsizeentry.c
+++ b/libgimpwidgets/gimpsizeentry.c
@@ -24,8 +24,6 @@
#include <string.h>
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
@@ -87,13 +85,13 @@ struct _GimpSizeEntryField
gdouble lower;
gdouble upper;
- GtkObject *value_adjustment;
+ GtkAdjustment *value_adjustment;
GtkWidget *value_spinbutton;
gdouble value;
gdouble min_value;
gdouble max_value;
- GtkObject *refval_adjustment;
+ GtkAdjustment *refval_adjustment;
GtkWidget *refval_spinbutton;
gdouble refval;
gdouble min_refval;
@@ -322,7 +320,7 @@ gimp_size_entry_new (gint number_of_fields,
gsef->refval_digits : ((unit == GIMP_UNIT_PERCENT) ?
2 : GIMP_SIZE_ENTRY_DIGITS (unit)));
- gsef->value_spinbutton = gimp_spin_button_new (&gsef->value_adjustment,
+ gsef->value_spinbutton = gimp_spin_button_new ((GtkObject **) &gsef->value_adjustment,
gsef->value,
gsef->min_value,
gsef->max_value,
@@ -354,7 +352,7 @@ gimp_size_entry_new (gint number_of_fields,
if (gse->show_refval)
{
gsef->refval_spinbutton =
- gimp_spin_button_new (&gsef->refval_adjustment,
+ gimp_spin_button_new ((GtkObject **) &gsef->refval_adjustment,
gsef->refval,
gsef->min_refval, gsef->max_refval,
1.0, 10.0, 0.0, 1.0, gsef->refval_digits);
@@ -447,8 +445,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
(gse->update_policy == GIMP_SIZE_ENTRY_UPDATE_SIZE) ? 0 : 3;
gsef->stop_recursion = 0;
- gsef->value_adjustment =
- GTK_OBJECT (gtk_spin_button_get_adjustment (value_spinbutton));
+ gsef->value_adjustment = gtk_spin_button_get_adjustment (value_spinbutton);
gsef->value_spinbutton = GTK_WIDGET (value_spinbutton);
g_signal_connect (gsef->value_adjustment, "value-changed",
G_CALLBACK (gimp_size_entry_value_callback),
@@ -459,8 +456,7 @@ gimp_size_entry_add_field (GimpSizeEntry *gse,
if (gse->show_refval)
{
- gsef->refval_adjustment =
- GTK_OBJECT (gtk_spin_button_get_adjustment (refval_spinbutton));
+ gsef->refval_adjustment = gtk_spin_button_get_adjustment (refval_spinbutton);
gsef->refval_spinbutton = GTK_WIDGET (refval_spinbutton);
g_signal_connect (gsef->refval_adjustment, "value-changed",
G_CALLBACK (gimp_size_entry_refval_callback),
@@ -662,11 +658,16 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gsef->min_value = lower;
gsef->max_value = upper;
- GTK_ADJUSTMENT (gsef->value_adjustment)->lower = gsef->min_value;
- GTK_ADJUSTMENT (gsef->value_adjustment)->upper = gsef->max_value;
+ g_object_freeze_notify (G_OBJECT (gsef->value_adjustment));
+
+ gtk_adjustment_set_lower (gsef->value_adjustment, gsef->min_value);
+ gtk_adjustment_set_upper (gsef->value_adjustment, gsef->max_value);
if (gsef->stop_recursion) /* this is a hack (but useful ;-) */
- return;
+ {
+ g_object_thaw_notify (G_OBJECT (gsef->value_adjustment));
+ return;
+ }
gsef->stop_recursion++;
switch (gsef->gse->update_policy)
@@ -717,6 +718,8 @@ gimp_size_entry_set_value_boundaries (GimpSizeEntry *gse,
gsef->stop_recursion--;
gimp_size_entry_set_value (gse, field, gsef->value);
+
+ g_object_thaw_notify (G_OBJECT (gsef->value_adjustment));
}
/**
@@ -782,8 +785,7 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
break;
}
if (gsef->gse->show_refval)
- gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment),
- gsef->refval);
+ gtk_adjustment_set_value (gsef->refval_adjustment, gsef->refval);
break;
case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION:
@@ -791,8 +793,7 @@ gimp_size_entry_update_value (GimpSizeEntryField *gsef,
CLAMP (value * gimp_unit_get_factor (gsef->gse->unit),
gsef->min_refval, gsef->max_refval);
if (gsef->gse->show_refval)
- gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment),
- gsef->refval);
+ gtk_adjustment_set_value (gsef->refval_adjustment, gsef->refval);
break;
default:
@@ -832,7 +833,7 @@ gimp_size_entry_set_value (GimpSizeEntry *gse,
value = CLAMP (value, gsef->min_value, gsef->max_value);
- gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment), value);
+ gtk_adjustment_set_value (gsef->value_adjustment, value);
gimp_size_entry_update_value (gsef, value);
}
@@ -885,12 +886,19 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
if (gse->show_refval)
{
- GTK_ADJUSTMENT (gsef->refval_adjustment)->lower = gsef->min_refval;
- GTK_ADJUSTMENT (gsef->refval_adjustment)->upper = gsef->max_refval;
+ g_object_freeze_notify (G_OBJECT (gsef->refval_adjustment));
+
+ gtk_adjustment_set_lower (gsef->refval_adjustment, gsef->min_refval);
+ gtk_adjustment_set_upper (gsef->refval_adjustment, gsef->max_refval);
}
if (gsef->stop_recursion) /* this is a hack (but useful ;-) */
- return;
+ {
+ if (gse->show_refval)
+ g_object_thaw_notify (G_OBJECT (gsef->refval_adjustment));
+
+ return;
+ }
gsef->stop_recursion++;
switch (gsef->gse->update_policy)
@@ -941,6 +949,9 @@ gimp_size_entry_set_refval_boundaries (GimpSizeEntry *gse,
gsef->stop_recursion--;
gimp_size_entry_set_refval (gse, field, gsef->refval);
+
+ if (gse->show_refval)
+ g_object_thaw_notify (G_OBJECT (gsef->refval_adjustment));
}
/**
@@ -1041,16 +1052,14 @@ gimp_size_entry_update_refval (GimpSizeEntryField *gsef,
gsef->min_value, gsef->max_value);
break;
}
- gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment),
- gsef->value);
+ gtk_adjustment_set_value (gsef->value_adjustment, gsef->value);
break;
case GIMP_SIZE_ENTRY_UPDATE_RESOLUTION:
gsef->value =
CLAMP (refval / gimp_unit_get_factor (gsef->gse->unit),
gsef->min_value, gsef->max_value);
- gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->value_adjustment),
- gsef->value);
+ gtk_adjustment_set_value (gsef->value_adjustment, gsef->value);
break;
default:
@@ -1087,8 +1096,7 @@ gimp_size_entry_set_refval (GimpSizeEntry *gse,
refval = CLAMP (refval, gsef->min_refval, gsef->max_refval);
if (gse->show_refval)
- gtk_adjustment_set_value (GTK_ADJUSTMENT (gsef->refval_adjustment),
- refval);
+ gtk_adjustment_set_value (gsef->refval_adjustment, refval);
gimp_size_entry_update_refval (gsef, refval);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]