[gedit] Bug 659437 - Only save modified documents in external tools



commit 4400072ed9f7711b31d5280e8ac49d40a5ad9b01
Author: Garrett Regier <garrettregier gmail com>
Date:   Tue Jun 18 04:36:31 2013 -0700

    Bug 659437 - Only save modified documents in external tools

 plugins/externaltools/tools/functions.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/plugins/externaltools/tools/functions.py b/plugins/externaltools/tools/functions.py
index e7bf04b..f58fc21 100644
--- a/plugins/externaltools/tools/functions.py
+++ b/plugins/externaltools/tools/functions.py
@@ -237,6 +237,13 @@ class MultipleDocumentsSaver:
             docs = window.get_documents()
         else:
             docs = [window.get_active_document()]
+
+        for i in range(len(docs)):
+            doc = docs[i]
+
+            if doc.get_modified():
+                all_docs = False
+                docs.remove(doc)
             
         signals = {}
 
@@ -246,7 +253,8 @@ class MultipleDocumentsSaver:
         if all_docs:
             Gedit.commands.save_all_documents(window)
         else:
-            Gedit.commands_save_document(window, docs[0])
+            for doc in docs:
+                Gedit.commands_save_document(window, doc)
 
         for doc in docs:
             doc.disconnect(signals[doc])


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