[gimp] app, libgimpwidgets: don't set unchanged object properties again
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app, libgimpwidgets: don't set unchanged object properties again
- Date: Thu, 19 Jun 2014 00:04:41 +0000 (UTC)
commit 77a515dd0f452fa93b3c398087ad0a15bea159b0
Author: Michael Natterer <mitch gimp org>
Date: Thu Jun 19 02:01:10 2014 +0200
app, libgimpwidgets: don't set unchanged object properties again
gimp_prop_adjustment_callback(): compare the property's current value
before setting it.
app/widgets/gimppropwidgets.c | 49 ++++++++++++++++++++++++++++++++-----
libgimpwidgets/gimppropwidgets.c | 49 ++++++++++++++++++++++++++++++++-----
2 files changed, 84 insertions(+), 14 deletions(-)
---
diff --git a/app/widgets/gimppropwidgets.c b/app/widgets/gimppropwidgets.c
index 8635b31..88b9c6a 100644
--- a/app/widgets/gimppropwidgets.c
+++ b/app/widgets/gimppropwidgets.c
@@ -611,31 +611,66 @@ gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
if (G_IS_PARAM_SPEC_INT (param_spec))
{
- g_object_set (config, param_spec->name, (gint) value, NULL);
+ gint v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (gint) value)
+ g_object_set (config, param_spec->name, (gint) value, NULL);
}
else if (G_IS_PARAM_SPEC_UINT (param_spec))
{
- g_object_set (config, param_spec->name, (guint) value, NULL);
+ guint v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (guint) value)
+ g_object_set (config, param_spec->name, (guint) value, NULL);
}
else if (G_IS_PARAM_SPEC_LONG (param_spec))
{
- g_object_set (config, param_spec->name, (glong) value, NULL);
+ glong v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (glong) value)
+ g_object_set (config, param_spec->name, (glong) value, NULL);
}
else if (G_IS_PARAM_SPEC_ULONG (param_spec))
{
- g_object_set (config, param_spec->name, (gulong) value, NULL);
+ gulong v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (gulong) value)
+ g_object_set (config, param_spec->name, (gulong) value, NULL);
}
else if (G_IS_PARAM_SPEC_INT64 (param_spec))
{
- g_object_set (config, param_spec->name, (gint64) value, NULL);
+ gint64 v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (gint64) value)
+ g_object_set (config, param_spec->name, (gint64) value, NULL);
}
else if (G_IS_PARAM_SPEC_UINT64 (param_spec))
{
- g_object_set (config, param_spec->name, (guint64) value, NULL);
+ guint64 v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (guint64) value)
+ g_object_set (config, param_spec->name, (guint64) value, NULL);
}
else if (G_IS_PARAM_SPEC_DOUBLE (param_spec))
{
- g_object_set (config, param_spec->name, value, NULL);
+ gdouble v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != value)
+ g_object_set (config, param_spec->name, value, NULL);
}
}
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index 53977eb..45bd400 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -1389,31 +1389,66 @@ gimp_prop_adjustment_callback (GtkAdjustment *adjustment,
if (G_IS_PARAM_SPEC_INT (param_spec))
{
- g_object_set (config, param_spec->name, (gint) value, NULL);
+ gint v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (gint) value)
+ g_object_set (config, param_spec->name, (gint) value, NULL);
}
else if (G_IS_PARAM_SPEC_UINT (param_spec))
{
- g_object_set (config, param_spec->name, (guint) value, NULL);
+ guint v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (guint) value)
+ g_object_set (config, param_spec->name, (guint) value, NULL);
}
else if (G_IS_PARAM_SPEC_LONG (param_spec))
{
- g_object_set (config, param_spec->name, (glong) value, NULL);
+ glong v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (glong) value)
+ g_object_set (config, param_spec->name, (glong) value, NULL);
}
else if (G_IS_PARAM_SPEC_ULONG (param_spec))
{
- g_object_set (config, param_spec->name, (gulong) value, NULL);
+ gulong v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (gulong) value)
+ g_object_set (config, param_spec->name, (gulong) value, NULL);
}
else if (G_IS_PARAM_SPEC_INT64 (param_spec))
{
- g_object_set (config, param_spec->name, (gint64) value, NULL);
+ gint64 v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (gint64) value)
+ g_object_set (config, param_spec->name, (gint64) value, NULL);
}
else if (G_IS_PARAM_SPEC_UINT64 (param_spec))
{
- g_object_set (config, param_spec->name, (guint64) value, NULL);
+ guint64 v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != (guint64) value)
+ g_object_set (config, param_spec->name, (guint64) value, NULL);
}
else if (G_IS_PARAM_SPEC_DOUBLE (param_spec))
{
- g_object_set (config, param_spec->name, value, NULL);
+ gdouble v;
+
+ g_object_get (config, param_spec->name, &v, NULL);
+
+ if (v != value)
+ g_object_set (config, param_spec->name, value, NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]