Commit 515dcbb1 authored by Michael Natterer's avatar Michael Natterer 😴

libgimp: remove gimp_get_pdb_error()

parent dcf648dd
Pipeline #105306 passed with stages
in 22 minutes
......@@ -290,7 +290,6 @@ EXPORTS
gimp_get_parasite
gimp_get_parasite_list
gimp_get_pdb
gimp_get_pdb_error
gimp_get_plug_in
gimp_get_progname
gimp_getpid
......
......@@ -64,7 +64,6 @@ static gboolean gimp_write (GIOChannel *channel,
gpointer user_data);
static gboolean gimp_flush (GIOChannel *channel,
gpointer user_data);
static void gimp_set_pdb_error (GimpValueArray *return_vals);
GIOChannel *_gimp_readchannel = NULL;
......@@ -75,9 +74,6 @@ static gulong write_buffer_index = 0;
static GimpPlugInInfo PLUG_IN_INFO = { 0, };
static GimpPDBStatusType pdb_error_status = GIMP_PDB_SUCCESS;
static gchar *pdb_error_message = NULL;
/**
* gimp_main_legacy:
......@@ -302,60 +298,9 @@ gimp_run_procedure_array (const gchar *name,
gimp_wire_destroy (&msg);
gimp_set_pdb_error (return_values);
return return_values;
}
/**
* gimp_get_pdb_error:
*
* Retrieves the error message from the last procedure call.
*
* If a procedure call fails, then it might pass an error message with
* the return values. Plug-ins that are using the libgimp C wrappers
* don't access the procedure return values directly. Thus libgimp
* stores the error message and makes it available with this
* function. The next procedure call unsets the error message again.
*
* The returned string is owned by libgimp and must not be freed or
* modified.
*
* Returns: the error message
*
* Since: 2.6
**/
const gchar *
gimp_get_pdb_error (void)
{
ASSERT_NO_PLUG_IN_EXISTS (G_STRFUNC);
if (pdb_error_message && strlen (pdb_error_message))
return pdb_error_message;
switch (pdb_error_status)
{
case GIMP_PDB_SUCCESS:
/* procedure executed successfully */
return _("success");
case GIMP_PDB_EXECUTION_ERROR:
/* procedure execution failed */
return _("execution error");
case GIMP_PDB_CALLING_ERROR:
/* procedure called incorrectly */
return _("calling error");
case GIMP_PDB_CANCEL:
/* procedure execution cancelled */
return _("cancelled");
default:
return "invalid return status";
}
}
void
_gimp_legacy_initialize (const GimpPlugInInfo *info,
GIOChannel *read_channel,
......@@ -857,35 +802,3 @@ gimp_flush (GIOChannel *channel,
return TRUE;
}
static void
gimp_set_pdb_error (GimpValueArray *return_values)
{
g_clear_pointer (&pdb_error_message, g_free);
pdb_error_status = GIMP_PDB_SUCCESS;
if (gimp_value_array_length (return_values) > 0)
{
pdb_error_status =
g_value_get_enum (gimp_value_array_index (return_values, 0));
switch (pdb_error_status)
{
case GIMP_PDB_SUCCESS:
case GIMP_PDB_PASS_THROUGH:
break;
case GIMP_PDB_EXECUTION_ERROR:
case GIMP_PDB_CALLING_ERROR:
case GIMP_PDB_CANCEL:
if (gimp_value_array_length (return_values) > 1)
{
GValue *value = gimp_value_array_index (return_values, 1);
if (G_VALUE_HOLDS_STRING (value))
pdb_error_message = g_value_dup_string (value);
}
break;
}
}
}
......@@ -259,11 +259,6 @@ void gimp_install_procedure (const gchar *name,
GimpValueArray * gimp_run_procedure_array (const gchar *name,
const GimpValueArray *arguments);
/* Retrieve the error message and return status for the last procedure
* call.
*/
const gchar * gimp_get_pdb_error (void);
/* gimp_plugin API that should now be done by using GimpProcedure
*/
......
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