gimp r26616 - in trunk: . app/pdb app/plug-in



Author: neo
Date: Sun Aug 17 11:00:41 2008
New Revision: 26616
URL: http://svn.gnome.org/viewvc/gimp?rev=26616&view=rev

Log:
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().



Modified:
   trunk/ChangeLog
   trunk/app/pdb/gimppdb.c
   trunk/app/plug-in/gimpplugin-progress.c

Modified: trunk/app/pdb/gimppdb.c
==============================================================================
--- trunk/app/pdb/gimppdb.c	(original)
+++ trunk/app/pdb/gimppdb.c	Sun Aug 17 11:00:41 2008
@@ -427,10 +427,9 @@
 
       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);
 

Modified: trunk/app/plug-in/gimpplugin-progress.c
==============================================================================
--- trunk/app/plug-in/gimpplugin-progress.c	(original)
+++ trunk/app/plug-in/gimpplugin-progress.c	Sun Aug 17 11:00:41 2008
@@ -320,6 +320,20 @@
 
 /*  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 @@
 
   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 @@
 
       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);
         }
     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]