Commit 96a6a007 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Don't let each terminating plug-in procedure end its progress, because

2006-11-02  Michael Natterer  <mitch@gimp.org>

	Don't let each terminating plug-in procedure end its progress,
	because that progress may still be in use by another plug-in.

	* app/plug-in/gimpplugin-progress.[ch]
	(gimp_plug_in_progress_attach)
	(gimp_plug_in_progress_detach): new functions which maintain
	a simple attach count for a GimpProgress

	* app/plug-in/gimpplugin-progress.c
	* app/plug-in/gimppluginprocframe.c: call attach() when setting
	proc_frame->progress. Call detach() in gimp_plug_in_progress_end()
	and only call gimp_progress_end() if detaching lowered the attach
	count to 0.
parent ad3ecb0a
2006-11-02 Michael Natterer <mitch@gimp.org>
Don't let each terminating plug-in procedure end its progress,
because that progress may still be in use by another plug-in.
* app/plug-in/gimpplugin-progress.[ch]
(gimp_plug_in_progress_attach)
(gimp_plug_in_progress_detach): new functions which maintain
a simple attach count for a GimpProgress
* app/plug-in/gimpplugin-progress.c
* app/plug-in/gimppluginprocframe.c: call attach() when setting
proc_frame->progress. Call detach() in gimp_plug_in_progress_end()
and only call gimp_progress_end() if detaching lowered the attach
count to 0.
2006-11-02 Sven Neumann <sven@gimp.org>
* plug-ins/common/flarefx.c (flare_center_create)
......
......@@ -45,6 +45,44 @@ static void gimp_plug_in_progress_cancel_callback (GimpProgress *progress,
/* public functions */
gint
gimp_plug_in_progress_attach (GimpProgress *progress)
{
gint attach_count;
g_return_val_if_fail (GIMP_IS_PROGRESS (progress), 0);
attach_count =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (progress),
"plug-in-progress-attach-count"));
attach_count++;
g_object_set_data (G_OBJECT (progress), "plug-in-progress-attach-count",
GINT_TO_POINTER (attach_count));;
return attach_count;
}
gint
gimp_plug_in_progress_detach (GimpProgress *progress)
{
gint attach_count;
g_return_val_if_fail (GIMP_IS_PROGRESS (progress), 0);
attach_count =
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (progress),
"plug-in-progress-attach-count"));
attach_count--;
g_object_set_data (G_OBJECT (progress), "plug-in-progress-attach-count",
GINT_TO_POINTER (attach_count));;
return attach_count;
}
void
gimp_plug_in_progress_start (GimpPlugIn *plug_in,
const gchar *message,
......@@ -67,6 +105,8 @@ gimp_plug_in_progress_start (GimpPlugIn *plug_in,
proc_frame->progress_created = TRUE;
g_object_ref (proc_frame->progress);
gimp_plug_in_progress_attach (proc_frame->progress);
}
}
......@@ -113,7 +153,8 @@ gimp_plug_in_progress_end (GimpPlugIn *plug_in)
proc_frame->progress_cancel_id = 0;
}
if (gimp_progress_is_active (proc_frame->progress))
if (gimp_plug_in_progress_detach (proc_frame->progress) < 1 &&
gimp_progress_is_active (proc_frame->progress))
gimp_progress_end (proc_frame->progress);
if (proc_frame->progress_created)
......@@ -237,6 +278,8 @@ gimp_plug_in_progress_install (GimpPlugIn *plug_in,
"callback-name", progress_callback,
NULL);
gimp_plug_in_progress_attach (proc_frame->progress);
return TRUE;
}
......
......@@ -22,23 +22,26 @@
#define __GIMP_PLUG_IN_PROGRESS_H__
void gimp_plug_in_progress_start (GimpPlugIn *plug_in,
const gchar *message,
GimpObject *display);
void gimp_plug_in_progress_end (GimpPlugIn *plug_in);
void gimp_plug_in_progress_set_text (GimpPlugIn *plug_in,
const gchar *message);
void gimp_plug_in_progress_set_value (GimpPlugIn *plug_in,
gdouble percentage);
void gimp_plug_in_progress_pulse (GimpPlugIn *plug_in);
guint32 gimp_plug_in_progress_get_window (GimpPlugIn *plug_in);
gint gimp_plug_in_progress_attach (GimpProgress *progress);
gint gimp_plug_in_progress_detach (GimpProgress *progress);
gboolean gimp_plug_in_progress_install (GimpPlugIn *plug_in,
const gchar *progress_callback);
gboolean gimp_plug_in_progress_uninstall (GimpPlugIn *plug_in,
const gchar *progress_callback);
gboolean gimp_plug_in_progress_cancel (GimpPlugIn *plug_in,
const gchar *progress_callback);
void gimp_plug_in_progress_start (GimpPlugIn *plug_in,
const gchar *message,
GimpObject *display);
void gimp_plug_in_progress_end (GimpPlugIn *plug_in);
void gimp_plug_in_progress_set_text (GimpPlugIn *plug_in,
const gchar *message);
void gimp_plug_in_progress_set_value (GimpPlugIn *plug_in,
gdouble percentage);
void gimp_plug_in_progress_pulse (GimpPlugIn *plug_in);
guint32 gimp_plug_in_progress_get_window (GimpPlugIn *plug_in);
gboolean gimp_plug_in_progress_install (GimpPlugIn *plug_in,
const gchar *progress_callback);
gboolean gimp_plug_in_progress_uninstall (GimpPlugIn *plug_in,
const gchar *progress_callback);
gboolean gimp_plug_in_progress_cancel (GimpPlugIn *plug_in,
const gchar *progress_callback);
#endif /* __GIMP_PLUG_IN_PROGRESS_H__ */
......@@ -77,6 +77,9 @@ gimp_plug_in_proc_frame_init (GimpPlugInProcFrame *proc_frame,
proc_frame->progress = progress ? g_object_ref (progress) : NULL;
proc_frame->progress_created = FALSE;
proc_frame->progress_cancel_id = 0;
if (progress)
gimp_plug_in_progress_attach (progress);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment