app/plug-in/gimpplugin.[ch] (struct GimpPlugIn) move the error_handler

2008-08-19  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/gimpplugin.[ch] (struct GimpPlugIn)
	* app/plug-in/gimppluginprocframe.[ch] (struct GimpPlugInProcFrame):
	move the error_handler from the plug-in to the proc-frame.

	* app/plug-in/gimppluginprocframe.c
	* app/plug-in/gimpplugin-message.c: changed accordingly.


svn path=/trunk/; revision=26661
This commit is contained in:
Michael Natterer 2008-08-19 08:24:48 +00:00 committed by Michael Natterer
parent 6ec759e812
commit 960b30cd9e
6 changed files with 47 additions and 25 deletions

View File

@ -1,3 +1,12 @@
2008-08-19 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimpplugin.[ch] (struct GimpPlugIn)
* app/plug-in/gimppluginprocframe.[ch] (struct GimpPlugInProcFrame):
move the error_handler from the plug-in to the proc-frame.
* app/plug-in/gimppluginprocframe.c
* app/plug-in/gimpplugin-message.c: changed accordingly.
2008-08-19 Sven Neumann <sven@gimp.org>
* libgimpbase/gimpbase.def

View File

@ -407,17 +407,18 @@ gimp_plug_in_handle_tile_get (GimpPlugIn *plug_in,
}
static void
gimp_plug_in_handle_proc_error (GimpPlugIn *plug_in,
GimpProgress *progress,
const gchar *name,
const GError *error)
gimp_plug_in_handle_proc_error (GimpPlugIn *plug_in,
GimpPlugInProcFrame *proc_frame,
const gchar *name,
const GError *error)
{
switch (gimp_plug_in_get_error_handler (plug_in))
switch (proc_frame->error_handler)
{
case GIMP_PDB_ERROR_HANDLER_INTERNAL:
if (error->domain == GIMP_PDB_ERROR)
{
gimp_message (plug_in->manager->gimp, G_OBJECT (progress),
gimp_message (plug_in->manager->gimp,
G_OBJECT (proc_frame->progress),
GIMP_MESSAGE_ERROR,
_("Calling error for procedure '%s':\n"
"%s"),
@ -425,7 +426,8 @@ gimp_plug_in_handle_proc_error (GimpPlugIn *plug_in,
}
else
{
gimp_message (plug_in->manager->gimp, G_OBJECT (progress),
gimp_message (plug_in->manager->gimp,
G_OBJECT (proc_frame->progress),
GIMP_MESSAGE_ERROR,
_("Execution error for procedure '%s':\n"
"%s"),
@ -536,7 +538,7 @@ gimp_plug_in_handle_proc_run (GimpPlugIn *plug_in,
if (error)
{
gimp_plug_in_handle_proc_error (plug_in, proc_frame->progress,
gimp_plug_in_handle_proc_error (plug_in, proc_frame,
canonical, error);
g_error_free (error);
}

View File

@ -162,8 +162,6 @@ gimp_plug_in_init (GimpPlugIn *plug_in)
plug_in->temp_proc_frames = NULL;
plug_in->error_handler = GIMP_PDB_ERROR_HANDLER_INTERNAL;
plug_in->plug_in_def = NULL;
}
@ -944,18 +942,30 @@ void
gimp_plug_in_set_error_handler (GimpPlugIn *plug_in,
GimpPDBErrorHandler handler)
{
GimpPlugInProcFrame *proc_frame;
g_return_if_fail (GIMP_IS_PLUG_IN (plug_in));
plug_in->error_handler = handler;
proc_frame = gimp_plug_in_get_proc_frame (plug_in);
if (proc_frame)
proc_frame->error_handler = handler;
}
GimpPDBErrorHandler
gimp_plug_in_get_error_handler (GimpPlugIn *plug_in)
{
GimpPlugInProcFrame *proc_frame;
g_return_val_if_fail (GIMP_IS_PLUG_IN (plug_in),
GIMP_PDB_ERROR_HANDLER_INTERNAL);
return plug_in->error_handler;
proc_frame = gimp_plug_in_get_proc_frame (plug_in);
if (proc_frame)
return proc_frame->error_handler;
return GIMP_PDB_ERROR_HANDLER_INTERNAL;
}
void

View File

@ -68,8 +68,6 @@ struct _GimpPlugIn
GList *temp_proc_frames;
GimpPDBErrorHandler error_handler;
GimpPlugInDef *plug_in_def; /* Valid during query() and init() */
};

View File

@ -81,6 +81,7 @@ 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;
proc_frame->error_handler = GIMP_PDB_ERROR_HANDLER_INTERNAL;
if (progress)
gimp_plug_in_progress_attach (progress);

View File

@ -24,23 +24,25 @@
struct _GimpPlugInProcFrame
{
gint ref_count;
gint ref_count;
GimpContext *main_context;
GList *context_stack;
GimpContext *main_context;
GList *context_stack;
GimpProcedure *procedure;
GMainLoop *main_loop;
GimpProcedure *procedure;
GMainLoop *main_loop;
GValueArray *return_vals;
GValueArray *return_vals;
GimpProgress *progress;
gboolean progress_created;
gulong progress_cancel_id;
GimpProgress *progress;
gboolean progress_created;
gulong progress_cancel_id;
GimpPDBErrorHandler error_handler;
/* lists of things to clean up on dispose */
GList *image_cleanups;
GList *item_cleanups;
GList *image_cleanups;
GList *item_cleanups;
};