introduced a utility function to reduce code duplication.

2008-08-17  Sven Neumann  <sven@gimp.org>

	* app/plug-in/gimpplugin-progress.c
	(gimp_plug_in_progress_cancel_callback): introduced a utility
	function to reduce code duplication.

	* app/pdb/gimppdb.c (gimp_pdb_execute_procedure_by_name): 
changed
	to use g_error_new_literal().


svn path=/trunk/; revision=26616
This commit is contained in:
Sven Neumann 2008-08-17 11:00:41 +00:00 committed by Sven Neumann
parent 42c315a782
commit 51d56e3a43
3 changed files with 28 additions and 17 deletions

View File

@ -1,3 +1,12 @@
2008-08-17 Sven Neumann <sven@gimp.org>
* app/plug-in/gimpplugin-progress.c
(gimp_plug_in_progress_cancel_callback): introduced a utility
function to reduce code duplication.
* app/pdb/gimppdb.c (gimp_pdb_execute_procedure_by_name): changed
to use g_error_new_literal().
2008-08-17 Martin Nordholts <martinn@svn.gnome.org>
* app/display/gimpdisplayshell-callbacks.c

View File

@ -427,10 +427,9 @@ gimp_pdb_execute_procedure_by_name (GimpPDB *pdb,
if (error_msg)
{
GError *pdb_error = g_error_new (GIMP_PDB_ERROR,
GIMP_PDB_INTERNAL_ERROR,
"%s", error_msg);
GError *pdb_error = g_error_new_literal (GIMP_PDB_ERROR,
GIMP_PDB_INTERNAL_ERROR,
error_msg);
g_warning ("%s: %s", G_STRFUNC, error_msg);
g_free (error_msg);

View File

@ -320,6 +320,20 @@ gimp_plug_in_progress_cancel (GimpPlugIn *plug_in,
/* private functions */
static GValueArray *
get_cancel_return_values (GimpProcedure *procedure)
{
GValueArray *return_vals;
GError *error;
error = g_error_new_literal (GIMP_PDB_ERROR, GIMP_PDB_CANCELLED,
_("Cancelled"));
return_vals = gimp_procedure_get_return_values (procedure, FALSE, error);
g_error_free (error);
return return_vals;
}
static void
gimp_plug_in_progress_cancel_callback (GimpProgress *progress,
GimpPlugIn *plug_in)
@ -329,13 +343,8 @@ gimp_plug_in_progress_cancel_callback (GimpProgress *progress,
if (proc_frame->main_loop)
{
GError *error = g_error_new (GIMP_PDB_ERROR, GIMP_PDB_CANCELLED,
"%s", _("Cancelled"));
proc_frame->return_vals =
gimp_procedure_get_return_values (proc_frame->procedure, FALSE, error);
g_error_free (error);
get_cancel_return_values (proc_frame->procedure);
}
for (list = plug_in->temp_proc_frames; list; list = g_list_next (list))
@ -344,14 +353,8 @@ gimp_plug_in_progress_cancel_callback (GimpProgress *progress,
if (proc_frame->main_loop)
{
GError *error = g_error_new (GIMP_PDB_ERROR, GIMP_PDB_CANCELLED,
"%s", _("Cancelled"));
proc_frame->return_vals =
gimp_procedure_get_return_values (proc_frame->procedure,
FALSE, error);
g_value_set_enum (proc_frame->return_vals->values, GIMP_PDB_CANCEL);
get_cancel_return_values (proc_frame->procedure);
}
}