[gedit] Actually save the *modified* docs before running a tool
- From: Paolo Borelli <pborelli src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Actually save the *modified* docs before running a tool
- Date: Fri, 7 Feb 2014 16:44:28 +0000 (UTC)
commit 6c99bb727a8697e37cd55e0ccf40e4069e65f1ce
Author: Paolo Borelli <pborelli gnome org>
Date: Fri Feb 7 09:59:22 2014 +0100
Actually save the *modified* docs before running a tool
Fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=659437
Based on the analysis by Andrew Fountain
plugins/externaltools/tools/functions.py | 16 +++++-----------
1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/plugins/externaltools/tools/functions.py b/plugins/externaltools/tools/functions.py
index d23b0f7..2aedecd 100644
--- a/plugins/externaltools/tools/functions.py
+++ b/plugins/externaltools/tools/functions.py
@@ -247,25 +247,19 @@ class MultipleDocumentsSaver:
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)
-
+ docs_to_save = [ doc for doc in docs if doc.get_modified() ]
signals = {}
- for doc in docs:
+ for doc in docs_to_save:
signals[doc] = doc.connect('saving', self.on_document_saving)
- if all_docs:
+ if len(docs_to_save) == len(docs) and len(docs) != 0:
Gedit.commands_save_all_documents(window)
else:
- for doc in docs:
+ for doc in docs_to_save:
Gedit.commands_save_document(window, doc)
- for doc in docs:
+ for doc in docs_to_save:
doc.disconnect(signals[doc])
self.run_tool()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]