mirror of https://github.com/GNOME/gimp.git
app/plug-in/gimppluginprocedure.[ch] moved error handling for asynchronous
2008-08-21 Sven Neumann <sven@gimp.org> * app/plug-in/gimppluginprocedure.[ch] * app/plug-in/gimptemporaryprocedure.c: moved error handling for asynchronous procedure calls to a central place. Use the plug-in label instead of the procedure name for the error message. svn path=/trunk/; revision=26703
This commit is contained in:
parent
c908bfc3fc
commit
2b1bf9b77a
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
|||
2008-08-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/plug-in/gimppluginprocedure.[ch]
|
||||
* app/plug-in/gimptemporaryprocedure.c: moved error handling for
|
||||
asynchronous procedure calls to a central place. Use the plug-in
|
||||
label instead of the procedure name for the error message.
|
||||
|
||||
2008-08-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/script-fu/script-fu-scripts.c
|
||||
* plug-ins/script-fu/script-fu-interface.[ch]: changed to actually
|
||||
return a meaningful return status when a script-fu procedure is run.
|
||||
|
||||
2008-08-21 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/plug-in/gimppluginprocedure.c
|
||||
|
|
|
@ -233,36 +233,9 @@ gimp_plug_in_procedure_execute_async (GimpProcedure *procedure,
|
|||
|
||||
if (return_vals)
|
||||
{
|
||||
switch (g_value_get_enum (&return_vals->values[0]))
|
||||
{
|
||||
case GIMP_PDB_SUCCESS:
|
||||
break;
|
||||
|
||||
case GIMP_PDB_CALLING_ERROR:
|
||||
if (return_vals->n_values > 1 &&
|
||||
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||
_("Calling error for procedure '%s':\n"
|
||||
"%s"),
|
||||
gimp_object_get_name (GIMP_OBJECT (procedure)),
|
||||
g_value_get_string (&return_vals->values[1]));
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_PDB_EXECUTION_ERROR:
|
||||
if (return_vals->n_values > 1 &&
|
||||
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||
_("Execution error for procedure '%s':\n"
|
||||
"%s"),
|
||||
gimp_object_get_name (GIMP_OBJECT (procedure)),
|
||||
g_value_get_string (&return_vals->values[1]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_plug_in_procedure_handle_return_values (plug_in_procedure,
|
||||
gimp, progress,
|
||||
return_vals);
|
||||
g_value_array_free (return_vals);
|
||||
}
|
||||
}
|
||||
|
@ -987,3 +960,49 @@ gimp_plug_in_procedure_set_thumb_loader (GimpPlugInProcedure *proc,
|
|||
|
||||
proc->thumb_loader = g_strdup (thumb_loader);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_plug_in_procedure_handle_return_values (GimpPlugInProcedure *proc,
|
||||
Gimp *gimp,
|
||||
GimpProgress *progress,
|
||||
GValueArray *return_vals)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PLUG_IN_PROCEDURE (proc));
|
||||
g_return_if_fail (return_vals != NULL);
|
||||
|
||||
if (! return_vals->n_values > 0 ||
|
||||
G_VALUE_TYPE (&return_vals->values[0]) != GIMP_TYPE_PDB_STATUS_TYPE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (g_value_get_enum (&return_vals->values[0]))
|
||||
{
|
||||
case GIMP_PDB_SUCCESS:
|
||||
break;
|
||||
|
||||
case GIMP_PDB_CALLING_ERROR:
|
||||
if (return_vals->n_values > 1 &&
|
||||
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||
_("Calling error for '%s':\n"
|
||||
"%s"),
|
||||
gimp_plug_in_procedure_get_label (proc),
|
||||
g_value_get_string (&return_vals->values[1]));
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_PDB_EXECUTION_ERROR:
|
||||
if (return_vals->n_values > 1 &&
|
||||
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||
_("Execution error for '%s':\n"
|
||||
"%s"),
|
||||
gimp_plug_in_procedure_get_label (proc),
|
||||
g_value_get_string (&return_vals->values[1]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,5 +130,11 @@ void gimp_plug_in_procedure_set_mime_type (GimpPlugInProcedure
|
|||
void gimp_plug_in_procedure_set_thumb_loader(GimpPlugInProcedure *proc,
|
||||
const gchar *thumbnailer);
|
||||
|
||||
void gimp_plug_in_procedure_handle_return_values (GimpPlugInProcedure *proc,
|
||||
Gimp *gimp,
|
||||
GimpProgress *progress,
|
||||
|
||||
GValueArray *return_vals);
|
||||
|
||||
|
||||
#endif /* __GIMP_PLUG_IN_PROCEDURE_H__ */
|
||||
|
|
|
@ -109,45 +109,21 @@ gimp_temporary_procedure_execute_async (GimpProcedure *procedure,
|
|||
GValueArray *args,
|
||||
GimpObject *display)
|
||||
{
|
||||
GValueArray *return_vals;
|
||||
GimpTemporaryProcedure *temp_procedure = GIMP_TEMPORARY_PROCEDURE (procedure);
|
||||
GValueArray *return_vals;
|
||||
|
||||
return_vals = gimp_plug_in_manager_call_run_temp (gimp->plug_in_manager,
|
||||
context, progress,
|
||||
GIMP_TEMPORARY_PROCEDURE (procedure),
|
||||
temp_procedure,
|
||||
args);
|
||||
|
||||
if (return_vals)
|
||||
{
|
||||
switch (g_value_get_enum (&return_vals->values[0]))
|
||||
{
|
||||
case GIMP_PDB_SUCCESS:
|
||||
break;
|
||||
|
||||
case GIMP_PDB_CALLING_ERROR:
|
||||
if (return_vals->n_values > 1 &&
|
||||
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||
_("Calling error for procedure '%s':\n"
|
||||
"%s"),
|
||||
gimp_object_get_name (GIMP_OBJECT (procedure)),
|
||||
g_value_get_string (&return_vals->values[1]));
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_PDB_EXECUTION_ERROR:
|
||||
if (return_vals->n_values > 1 &&
|
||||
G_VALUE_HOLDS_STRING (&return_vals->values[1]))
|
||||
{
|
||||
gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
|
||||
_("Execution error for procedure '%s':\n"
|
||||
"%s"),
|
||||
gimp_object_get_name (GIMP_OBJECT (procedure)),
|
||||
g_value_get_string (&return_vals->values[1]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
GimpPlugInProcedure *proc = GIMP_PLUG_IN_PROCEDURE (procedure);
|
||||
|
||||
gimp_plug_in_procedure_handle_return_values (proc,
|
||||
gimp, progress,
|
||||
return_vals);
|
||||
g_value_array_free (return_vals);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue