[pitivi] undo: Remove unuseful clean logic



commit 8f419d83aeab4534c49cee3429d1489f217681c7
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Apr 3 05:54:57 2016 +0200

    undo: Remove unuseful clean logic
    
    A lot of clean logic is used currently only to clean
    UndoableActionStacks's done_actions, populated when the action is
    recorded, and undone_actions, populated when the action is undone.
    It might be useful for garbage collection but currently it does not
    look like a problem. This paves the way towards discarding these
    objects instead of reusing them.
    
    Differential Revision: https://phabricator.freedesktop.org/D859

 pitivi/application.py |    5 +----
 pitivi/undo/undo.py   |   21 ---------------------
 2 files changed, 1 insertions(+), 25 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 511569c..f1d3818 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -145,7 +145,6 @@ class Pitivi(Gtk.Application, Loggable):
         self.action_log.connect("commit", self._actionLogCommit)
         self.action_log.connect("undo", self._actionLogUndo)
         self.action_log.connect("redo", self._actionLogRedo)
-        self.action_log.connect("cleaned", self._actionLogCleaned)
         self.timeline_log_observer = TimelineLogObserver(self.action_log)
         self.project_log_observer = ProjectLogObserver(self.action_log)
 
@@ -270,6 +269,7 @@ class Pitivi(Gtk.Application, Loggable):
 
     def _newProjectLoaded(self, unused_project_manager, project):
         self.action_log.clean()
+        self._syncDoUndo(self.action_log)
 
         self.timeline_log_observer.startObserving(project.timeline)
         self.project_log_observer.startObserving(project)
@@ -363,9 +363,6 @@ class Pitivi(Gtk.Application, Loggable):
     def _actionLogRedo(self, action_log, unused_stack):
         self._syncDoUndo(action_log)
 
-    def _actionLogCleaned(self, action_log):
-        self._syncDoUndo(action_log)
-
     def _syncDoUndo(self, action_log):
         # TODO: Remove this once we revisit undo/redo T3360
         can_undo = in_devel()
diff --git a/pitivi/undo/undo.py b/pitivi/undo/undo.py
index 7c10b9d..6a2d531 100644
--- a/pitivi/undo/undo.py
+++ b/pitivi/undo/undo.py
@@ -63,10 +63,6 @@ class UndoableAction(GObject.Object, Loggable):
     def undo(self):
         raise NotImplementedError()
 
-    def clean(self):
-        # Meant to be overridden by UndoableActionStack?
-        pass
-
     def asScenarioAction(self):
         raise NotImplementedError()
 
@@ -92,10 +88,6 @@ class UndoableActionStack(UndoableAction):
     Simply a stack of UndoableAction objects.
     """
 
-    __gsignals__ = {
-        "cleaned": (GObject.SIGNAL_RUN_LAST, None, ()),
-    }
-
     def __init__(self, action_group_name, finalizing_action=None):
         UndoableAction.__init__(self)
         self.action_group_name = action_group_name
@@ -128,13 +120,6 @@ class UndoableActionStack(UndoableAction):
         if self.finalizing_action:
             self.finalizing_action.do()
 
-    def clean(self):
-        actions = self.done_actions + self.undone_actions
-        self.undone_actions = []
-        self.done_actions = []
-        self._runAction(actions, "clean")
-        self.emit("cleaned")
-
 
 class UndoableActionLog(GObject.Object, Loggable):
 
@@ -149,7 +134,6 @@ class UndoableActionLog(GObject.Object, Loggable):
         "commit": (GObject.SIGNAL_RUN_LAST, None, (object,)),
         "undo": (GObject.SIGNAL_RUN_LAST, None, (object,)),
         "redo": (GObject.SIGNAL_RUN_LAST, None, (object,)),
-        "cleaned": (GObject.SIGNAL_RUN_LAST, None, ()),
     }
 
     def __init__(self, app=None):
@@ -256,14 +240,9 @@ class UndoableActionLog(GObject.Object, Loggable):
         self.emit("redo", stack)
 
     def clean(self):
-        stacks = self.redo_stacks + self.undo_stacks
         self.redo_stacks = []
         self.undo_stacks = []
 
-        for stack in stacks:
-            self._run(stack.clean)
-        self.emit("cleaned")
-
     def _takeSnapshot(self):
         return list(self.undo_stacks)
 


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