gimp r27716 - in trunk: . libgimp



Author: neo
Date: Tue Nov 25 08:20:56 2008
New Revision: 27716
URL: http://svn.gnome.org/viewvc/gimp?rev=27716&view=rev

Log:
2008-11-25  Sven Neumann  <sven gimp org>

	* libgimp/gimpexport.c: minor code cleanup.



Modified:
   trunk/ChangeLog
   trunk/libgimp/gimpexport.c

Modified: trunk/libgimp/gimpexport.c
==============================================================================
--- trunk/libgimp/gimpexport.c	(original)
+++ trunk/libgimp/gimpexport.c	Tue Nov 25 08:20:56 2008
@@ -207,6 +207,13 @@
   g_free (layers);
 }
 
+static void
+export_void (gint32  image_ID,
+             gint32 *drawable_ID)
+{
+  /* do nothing */
+}
+
 
 /* a set of predefined actions */
 
@@ -351,6 +358,27 @@
 };
 
 
+static ExportFunc
+export_action_get_func (const ExportAction *action)
+{
+  if (action->choice == 0 && action->default_action)
+    return action->default_action;
+
+  if (action->choice == 1 && action->alt_action)
+    return action->alt_action;
+
+  return export_void;
+}
+
+static void
+export_action_perform (const ExportAction *action,
+                       gint32              image_ID,
+                       gint32             *drawable_ID)
+{
+  export_action_get_func (action) (image_ID, drawable_ID);
+}
+
+
 /* dialog functions */
 
 static void
@@ -637,7 +665,6 @@
                    GimpExportCapabilities  capabilities)
 {
   GSList            *actions = NULL;
-  GSList            *list;
   GimpImageBaseType  type;
   gint32             i;
   gint32             n_layers;
@@ -879,6 +906,8 @@
 
   if (retval == GIMP_EXPORT_EXPORT)
     {
+      GSList *list;
+
       *image_ID = gimp_image_duplicate (*image_ID);
       *drawable_ID = gimp_image_get_active_layer (*image_ID);
 
@@ -886,12 +915,7 @@
 
       for (list = actions; list; list = list->next)
         {
-          ExportAction *action = list->data;
-
-          if (action->choice == 0 && action->default_action)
-            action->default_action (*image_ID, drawable_ID);
-          else if (action->choice == 1 && action->alt_action)
-            action->alt_action (*image_ID, drawable_ID);
+          export_action_perform (list->data, *image_ID, drawable_ID);
         }
     }
 



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