[glom] AppWindow_WithDoc::on_menu_file_saveas(): Remove dead code.



commit 4dd6282f8997187844821e7ffe2771b6703e0e9a
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Dec 3 09:59:59 2014 +0100

    AppWindow_WithDoc::on_menu_file_saveas(): Remove dead code.
    
    This was left over from before GtkFileChooser did its own warning
    about replacing files.
    Found by Coverity Scan.

 glom/bakery/appwindow_withdoc.cc |   43 ++++++++++++++-----------------------
 1 files changed, 16 insertions(+), 27 deletions(-)
---
diff --git a/glom/bakery/appwindow_withdoc.cc b/glom/bakery/appwindow_withdoc.cc
index c19b6b8..acceef7 100644
--- a/glom/bakery/appwindow_withdoc.cc
+++ b/glom/bakery/appwindow_withdoc.cc
@@ -228,38 +228,27 @@ void AppWindow_WithDoc::on_menu_file_saveas()
     //Enforce the file extension:
     file_uri = m_pDocument->get_file_uri_with_extension(file_uri);
 
-    bool bUseThisFileUri = true;
+    m_pDocument->set_file_uri(file_uri, true); //true = enforce file extension
+    const bool bTest = m_pDocument->save();
 
-    //Save to this filepath:
-    if(bUseThisFileUri)
+    if(!bTest)
     {
-      m_pDocument->set_file_uri(file_uri, true); //true = enforce file extension
-      const bool bTest = m_pDocument->save();
-
-      if(!bTest)
-      {
-        ui_warning(_("Save failed."), _("There was an error while saving the file. Your changes have not 
been saved."));
-      }
-      else
-      {
-        //Disable Save and SaveAs menu items:
-        after_successful_save();
-      }
-
-      update_window_title();
-
-
-      //Close if this save was a result of a File|Close or File|Exit:.
-      //if(bTest && m_bCloseAfterSave) //Don't close if the save failed.
-      //{
-      //  on_menu_file_close(); //This could be the second time, but now there are no unsaved changes.
-      //}
+      ui_warning(_("Save failed."), _("There was an error while saving the file. Your changes have not been 
saved."));
     }
     else
     {
-      //Let the user choose a different file path,
-      //because he decided not to overwrite the 1st one.
-      offer_saveas(); //recursive.
+      //Disable Save and SaveAs menu items:
+      after_successful_save();
+    }
+
+    update_window_title();
+
+
+    //Close if this save was a result of a File|Close or File|Exit:.
+    //if(bTest && m_bCloseAfterSave) //Don't close if the save failed.
+    //{
+    //  on_menu_file_close(); //This could be the second time, but now there are no unsaved changes.
+    //}
     }
   }
   else


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