gimp r26703 - in trunk: . app/plug-in
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26703 - in trunk: . app/plug-in
- Date: Thu, 21 Aug 2008 18:09:42 +0000 (UTC)
Author: neo
Date: Thu Aug 21 18:09:41 2008
New Revision: 26703
URL: http://svn.gnome.org/viewvc/gimp?rev=26703&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/app/plug-in/gimppluginprocedure.c
trunk/app/plug-in/gimppluginprocedure.h
trunk/app/plug-in/gimptemporaryprocedure.c
Modified: trunk/app/plug-in/gimppluginprocedure.c
==============================================================================
--- trunk/app/plug-in/gimppluginprocedure.c (original)
+++ trunk/app/plug-in/gimppluginprocedure.c Thu Aug 21 18:09:41 2008
@@ -233,36 +233,9 @@
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 @@
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;
+ }
+}
Modified: trunk/app/plug-in/gimppluginprocedure.h
==============================================================================
--- trunk/app/plug-in/gimppluginprocedure.h (original)
+++ trunk/app/plug-in/gimppluginprocedure.h Thu Aug 21 18:09:41 2008
@@ -130,5 +130,11 @@
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__ */
Modified: trunk/app/plug-in/gimptemporaryprocedure.c
==============================================================================
--- trunk/app/plug-in/gimptemporaryprocedure.c (original)
+++ trunk/app/plug-in/gimptemporaryprocedure.c Thu Aug 21 18:09:41 2008
@@ -109,45 +109,21 @@
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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]