[postr] Preserve the model state when load a session (#530105)



commit 7a51363cfa6561576a8d5a8a1eee841309ccffcf
Author: David Ignacio <deignacio gmail com>
Date:   Sun Nov 8 21:05:08 2009 -0300

    Preserve the model state when load a session (#530105)
    
    Preserve the model's dirty state through loading an upload state.
    Obviously the load will dirty the model, but that should be ignored
    since that data has already been saved.  (#530105)
    
    Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>

 src/postr.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/postr.py b/src/postr.py
index fa3c2a9..b3fff6a 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -1065,6 +1065,10 @@ class Postr(UniqueApp):
                             should_ignore_photosets = True
                         confirm_dialog.destroy()
 
+                # the model's dirty state should not be changed
+                # when loading an upload set.
+                model_was_dirty = self.model.dirty()
+
                 index_offset = self.model.iter_n_children(None)
                 index = 0
                 while source.has_key(str(index)):
@@ -1074,6 +1078,13 @@ class Postr(UniqueApp):
                                                    should_ignore_photosets)
                     index += 1
                 source.close()
+
+                # obviously a load will make the model dirty, but that
+                # information is already saved, so ensure that the model
+                # is only dirty after a load if it was dirty before
+                if not model_was_dirty:
+                    self.model.markClean()
+
         dialog.destroy()
 
     def _unmarshal_and_import_row(self, index, row, should_ignore_photosets):



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