[gedit/gnome-3-8] Bug 659437 - Only save modified documents in external tools



commit f04e98131f7e07a9ca064b08061633216ff5ffcc
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 f05c515..ddc6ead 100644
--- a/plugins/externaltools/tools/functions.py
+++ b/plugins/externaltools/tools/functions.py
@@ -219,6 +219,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 = {}
 
@@ -228,7 +235,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]