[gimp] app: require a text in gimp_gegl_progress_connect()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: require a text in gimp_gegl_progress_connect()
- Date: Wed, 11 May 2016 20:52:38 +0000 (UTC)
commit cea4ea6cff6bc091a98dce2f07b8fb1203e59058
Author: Michael Natterer <mitch gimp org>
Date: Wed May 11 22:50:33 2016 +0200
app: require a text in gimp_gegl_progress_connect()
and simplify and fix the progress callback.
app/gegl/gimp-gegl-utils.c | 42 +++++++++++++++++-------------------------
1 files changed, 17 insertions(+), 25 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-utils.c b/app/gegl/gimp-gegl-utils.c
index df916f6..f5de065 100644
--- a/app/gegl/gimp-gegl-utils.c
+++ b/app/gegl/gimp-gegl-utils.c
@@ -77,30 +77,22 @@ gimp_gegl_progress_callback (GObject *object,
gdouble value,
GimpProgress *progress)
{
- const gchar *text;
-
- text = g_object_get_data (object, "gimp-progress-text");
-
- if (text)
+ if (value == 0.0)
{
- if (value == 0.0)
- {
- if (gimp_progress_is_active (progress))
- gimp_progress_set_text (progress, "%s", text);
- else
- gimp_progress_start (progress, FALSE, "%s", text);
-
- return;
- }
- else if (value == 1.0)
- {
- gimp_progress_end (progress);
-
- return;
- }
+ const gchar *text = g_object_get_data (object, "gimp-progress-text");
+
+ if (gimp_progress_is_active (progress))
+ gimp_progress_set_text (progress, "%s", text);
+ else
+ gimp_progress_start (progress, FALSE, "%s", text);
}
+ else
+ {
+ gimp_progress_set_value (progress, value);
- gimp_progress_set_value (progress, value);
+ if (value == 1.0)
+ gimp_progress_end (progress);
+ }
}
void
@@ -110,15 +102,15 @@ gimp_gegl_progress_connect (GeglNode *node,
{
g_return_if_fail (GEGL_IS_NODE (node));
g_return_if_fail (GIMP_IS_PROGRESS (progress));
+ g_return_if_fail (text != NULL);
g_signal_connect (node, "progress",
G_CALLBACK (gimp_gegl_progress_callback),
progress);
- if (text)
- g_object_set_data_full (G_OBJECT (node),
- "gimp-progress-text", g_strdup (text),
- (GDestroyNotify) g_free);
+ g_object_set_data_full (G_OBJECT (node),
+ "gimp-progress-text", g_strdup (text),
+ (GDestroyNotify) g_free);
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]