mirror of https://github.com/GNOME/gimp.git
app: require a text in gimp_gegl_progress_connect()
and simplify and fix the progress callback.
This commit is contained in:
parent
4f0521c7cf
commit
cea4ea6cff
|
@ -77,30 +77,22 @@ gimp_gegl_progress_callback (GObject *object,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
GimpProgress *progress)
|
GimpProgress *progress)
|
||||||
{
|
{
|
||||||
const gchar *text;
|
if (value == 0.0)
|
||||||
|
|
||||||
text = g_object_get_data (object, "gimp-progress-text");
|
|
||||||
|
|
||||||
if (text)
|
|
||||||
{
|
{
|
||||||
if (value == 0.0)
|
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);
|
|
||||||
|
|
||||||
return;
|
if (gimp_progress_is_active (progress))
|
||||||
}
|
gimp_progress_set_text (progress, "%s", text);
|
||||||
else if (value == 1.0)
|
else
|
||||||
{
|
gimp_progress_start (progress, FALSE, "%s", text);
|
||||||
gimp_progress_end (progress);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gimp_progress_set_value (progress, value);
|
||||||
|
|
||||||
gimp_progress_set_value (progress, value);
|
if (value == 1.0)
|
||||||
|
gimp_progress_end (progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -110,15 +102,15 @@ gimp_gegl_progress_connect (GeglNode *node,
|
||||||
{
|
{
|
||||||
g_return_if_fail (GEGL_IS_NODE (node));
|
g_return_if_fail (GEGL_IS_NODE (node));
|
||||||
g_return_if_fail (GIMP_IS_PROGRESS (progress));
|
g_return_if_fail (GIMP_IS_PROGRESS (progress));
|
||||||
|
g_return_if_fail (text != NULL);
|
||||||
|
|
||||||
g_signal_connect (node, "progress",
|
g_signal_connect (node, "progress",
|
||||||
G_CALLBACK (gimp_gegl_progress_callback),
|
G_CALLBACK (gimp_gegl_progress_callback),
|
||||||
progress);
|
progress);
|
||||||
|
|
||||||
if (text)
|
g_object_set_data_full (G_OBJECT (node),
|
||||||
g_object_set_data_full (G_OBJECT (node),
|
"gimp-progress-text", g_strdup (text),
|
||||||
"gimp-progress-text", g_strdup (text),
|
(GDestroyNotify) g_free);
|
||||||
(GDestroyNotify) g_free);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
Loading…
Reference in New Issue