[pitivi] UI: Revert enable when needed. Change button on message dialog



commit d4e35103aab2ea4fb750dc6552eef32997856414
Author: Pier Carteri <pier carteri gmail com>
Date:   Fri Jun 18 23:27:06 2010 +0200

    UI: Revert enable when needed. Change button on message dialog
    
    Fixes #586023

 pitivi/projectmanager.py |    2 +-
 pitivi/ui/mainwindow.py  |   12 ++++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index 1fcca6e..ff7a97c 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -188,7 +188,7 @@ class ProjectManager(Signallable, Loggable):
         """ discard all unsaved changes and reload current open project """
         #no running project or
         #project has not been modified
-        if self.current is None \
+        if self.current.uri is None \
            or not self.current.hasUnsavedModifications(): 
             return True
 
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 3e308b5..ffc6e31 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -346,8 +346,7 @@ class PitiviMainWindow(gtk.Window, Loggable):
                 "SecondForward", "SecondBackward", "EdgeForward",
                 "EdgeBackward", "Preferences"]:
                 action.set_sensitive(True)
-            elif action_name in ["NewProject", "SaveProjectAs", "OpenProject",
-                                            "RevertToSavedProject"]:
+            elif action_name in ["NewProject", "SaveProjectAs", "OpenProject"]:
                 if instance.settings.fileSupportEnabled:
                     action.set_sensitive(True)
             elif action_name == "SaveProject":
@@ -829,14 +828,16 @@ class PitiviMainWindow(gtk.Window, Loggable):
             dialog = gtk.MessageDialog(self,
                                 gtk.DIALOG_MODAL,
                                 gtk.MESSAGE_WARNING,
-                                gtk.BUTTONS_YES_NO,
+                                gtk.BUTTONS_NONE,
                                 _("Do you want to reload current project?")
                                 )
             dialog.set_icon_name("pitivi")
+            dialog.add_buttons(gtk.STOCK_REVERT_TO_SAVED, gtk.RESPONSE_YES,
+                                 gtk.STOCK_CANCEL, gtk.RESPONSE_NO)
             dialog.set_title(_("Revert to saved project"))
             dialog.set_resizable(False)
             dialog.set_property("secondary-text", 
-                                            _("All unsaved changes will be lost")
+                                            _("All unsaved changes will be lost.")
                                         )
             dialog.set_default_response(gtk.RESPONSE_NO)
             response = dialog.run()
@@ -933,6 +934,9 @@ class PitiviMainWindow(gtk.Window, Loggable):
         dirty = action_log.dirty()
         save_action = self.actiongroup.get_action("SaveProject")
         save_action.set_sensitive(dirty)
+        if self.app.current.uri is not None:
+            revert_action = self.actiongroup.get_action("RevertToSavedProject")
+            revert_action.set_sensitive(dirty)
         self.app.current.setModificationState(dirty)
 
         redo_action = self.actiongroup.get_action("Redo")



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