--- app/actions/file-commands.c.orig	2012-07-17 22:57:40.000000000 +0200
+++ app/actions/file-commands.c	2012-11-23 00:49:55.000000000 +0100
@@ -17,6 +17,7 @@
 
 #include "config.h"
 
+#include <stdlib.h> /* for system() */
 #include <string.h>
 
 #include <gegl.h>
@@ -237,8 +238,29 @@
            ! GIMP_GUI_CONFIG (image->gimp->config)->trust_dirty_flag) ||
           uri == NULL)
         {
-          GimpPlugInProcedure *save_proc = gimp_image_get_save_proc (image);
-
+          GimpPlugInProcedure *save_proc;
+          gboolean change_save_stat;
+          gboolean overwrite;
+                    
+          /* skip if the image is not dirty and is not xcf or imported
+             meaning: new images are saved anyway
+           */
+          if (! gimp_image_is_dirty (image) && (uri || gimp_image_get_imported_uri (image))) {
+            break;
+          }
+          
+          if (gimp_image_imported_is_savable (image)) {
+            uri = gimp_image_get_imported_uri (image);
+            save_proc = file_procedure_find (image->gimp->plug_in_manager->export_procs,
+                                             uri, NULL);
+            change_save_stat = FALSE;
+            overwrite = TRUE;
+          } else {
+            save_proc = gimp_image_get_save_proc (image);
+            change_save_stat = TRUE;
+            overwrite = FALSE;
+          }
+          
           if (uri && ! save_proc)
             {
               save_proc =
@@ -252,7 +274,12 @@
                                                    gimp, image, uri,
                                                    save_proc,
                                                    GIMP_RUN_WITH_LAST_VALS,
-                                                   TRUE, FALSE, FALSE, TRUE);
+                                                   change_save_stat,
+                                                   overwrite, FALSE,
+                                                   TRUE);              
+              if (gimp_image_imported_is_savable (image))
+                gimp_image_clean_all (image);
+              
               break;
             }
 
--- app/file/file-save.c.orig	2012-07-17 22:57:42.000000000 +0200
+++ app/file/file-save.c	2012-11-22 01:03:59.000000000 +0100
@@ -84,6 +84,7 @@
   gchar             *filename;
   gint32             image_ID;
   gint32             drawable_ID;
+  gboolean           imported_is_savable;
 
   g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_PDB_CALLING_ERROR);
   g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_PDB_CALLING_ERROR);
@@ -103,6 +104,9 @@
     return GIMP_PDB_EXECUTION_ERROR;
 
   filename = file_utils_filename_from_uri (uri);
+  
+  /* test if we have an non-xcf imported image which is savable via File -> Save */
+  imported_is_savable = gimp_image_imported_is_savable (image);
 
   if (filename)
     {
@@ -194,9 +198,14 @@
            * at the same time, so stop consider it as imported now
            * that we consider it exported.
            */
-          gimp_image_set_imported_uri (image, NULL);
-
+          /* do this only if the imported image is not savable. 
+           * for more informatation, see gimp_image_imported_is_savable ()
+           */
+          if (!imported_is_savable) {
+            gimp_image_set_imported_uri (image, NULL);
+          }
           gimp_image_export_clean_all (image);
+          
         }
 
       if (export_backward || export_forward)

--- app/core/gimpimage.h.orig	2012-07-17 22:57:42.000000000 +0200
+++ app/core/gimpimage.h	2012-11-22 00:50:49.000000000 +0100
@@ -487,5 +487,7 @@
 
 const gchar   * gimp_image_get_string_untitled   (void);
 
+/* test if a non-xcf image can be saved via File -> Save */
+gboolean        gimp_image_imported_is_savable   (GimpImage *image);
 
 #endif /* __GIMP_IMAGE_H__ */

--- app/core/gimpimage.c.orig	2012-07-17 22:57:42.000000000 +0200
+++ app/core/gimpimage.c	2012-11-26 00:15:33.000000000 +0100
@@ -4190,3 +4190,19 @@ gimp_image_invalidate_previews (GimpImag
   gimp_item_stack_invalidate_previews (layers);
   gimp_item_stack_invalidate_previews (channels);
 }
+
+/* test if a non-xcf image can be saved via File -> Save */
+
+gboolean gimp_image_imported_is_savable (GimpImage *image)
+{
+  GimpCoreConfig   *config;
+  gboolean retval = FALSE;
+
+  config = image->gimp->config;  
+  if (config->save_xcf_only)
+    return FALSE;
+  
+  retval = gimp_image_get_imported_uri (image) && (gimp_image_get_n_layers (image) == 1);
+  
+  return retval;
+}

--- app/config/gimpcoreconfig.h.orig	2012-03-12 20:18:38.000000000 +0100
+++ app/config/gimpcoreconfig.h	2012-11-25 20:25:54.000000000 +0100
@@ -87,6 +87,7 @@ struct _GimpCoreConfig
   GimpColorConfig        *color_management;
   GimpColorProfilePolicy  color_profile_policy;
   gboolean                save_document_history;
+  gboolean                save_xcf_only;
   GimpRGB                 quick_mask_color;
   gboolean                use_gegl;
 };

--- app/config/gimpcoreconfig.c.orig	2012-05-08 08:05:45.000000000 +0200
+++ app/config/gimpcoreconfig.c	2012-11-25 20:25:58.000000000 +0100
@@ -100,6 +100,7 @@ enum
   PROP_COLOR_MANAGEMENT,
   PROP_COLOR_PROFILE_POLICY,
   PROP_SAVE_DOCUMENT_HISTORY,
+  PROP_SAVE_XCF_ONLY,
   PROP_QUICK_MASK_COLOR,
   PROP_USE_GEGL,
 
@@ -434,6 +435,10 @@ gimp_core_config_class_init (GimpCoreCon
                                     SAVE_DOCUMENT_HISTORY_BLURB,
                                     TRUE,
                                     GIMP_PARAM_STATIC_STRINGS);
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SAVE_XCF_ONLY,
+                                    "save-xcf-only", SAVE_XCF_ONLY_BLURB,
+                                    FALSE,
+                                    GIMP_PARAM_STATIC_STRINGS);
   GIMP_CONFIG_INSTALL_PROP_RGB (object_class, PROP_QUICK_MASK_COLOR,
                                 "quick-mask-color", QUICK_MASK_COLOR_BLURB,
                                 TRUE, &red,
@@ -716,6 +721,9 @@ gimp_core_config_set_property (GObject  
     case PROP_SAVE_DOCUMENT_HISTORY:
       core_config->save_document_history = g_value_get_boolean (value);
       break;
+    case PROP_SAVE_XCF_ONLY:
+      core_config->save_xcf_only = g_value_get_boolean (value);
+      break;
     case PROP_QUICK_MASK_COLOR:
       gimp_value_get_rgb (value, &core_config->quick_mask_color);
       break;
@@ -888,6 +896,9 @@ gimp_core_config_get_property (GObject  
     case PROP_SAVE_DOCUMENT_HISTORY:
       g_value_set_boolean (value, core_config->save_document_history);
       break;
+    case PROP_SAVE_XCF_ONLY:
+      g_value_set_boolean (value, core_config->save_xcf_only);
+      break;
     case PROP_QUICK_MASK_COLOR:
       gimp_value_set_rgb (value, &core_config->quick_mask_color);
       break;

--- app/config/gimprc-blurbs.h.orig	2012-05-08 08:05:45.000000000 +0200
+++ app/config/gimprc-blurbs.h	2012-11-25 20:24:05.000000000 +0100
@@ -305,6 +305,10 @@ N_("Remember the current tool, pattern, 
 N_("Keep a permanent record of all opened and saved files in the Recent " \
    "Documents list.")
 
+#define SAVE_XCF_ONLY_BLURB \
+"Force to save only in XCF image format." \
+"Uncheck to allow all image formats to be saved via the 'File - Save' menu entry"
+
 #define SAVE_SESSION_INFO_BLURB \
 N_("Save the positions and sizes of the main dialogs when GIMP exits.")
 
--- app/dialogs/preferences-dialog.c.orig	2012-05-08 08:05:45.000000000 +0200
+++ app/dialogs/preferences-dialog.c	2012-11-25 20:26:00.000000000 +0100
@@ -1566,6 +1566,11 @@ prefs_dialog_new (Gimp       *gimp,
                           _("Confirm closing of unsa_ved images"),
                           GTK_BOX (vbox2));
 
+  prefs_check_button_add (object, "save-xcf-only",
+                          "Force to save only in XCF image format",
+                          GTK_BOX (vbox2));
+
+  
   g_object_unref (size_group);
   size_group = NULL;
 
--- etc/gimprc.orig	2012-08-23 20:01:14.000000000 +0200
+++ etc/gimprc	2012-11-25 20:25:35.000000000 +0100
@@ -304,6 +304,12 @@
 # 
 # (save-document-history yes)
 
+# Force to save only in XCF image format.
+# 'No' will allow all image formats to be saved via the 'File - Save' menu entry
+# Possible values are yes and no.
+#
+# (save-xcf-only no)
+
 # Sets the default quick mask color.  The color is specified in the form
 # (color-rgba red green blue alpha) with channel values as floats in the
 # range of 0.0 to 1.0.
