[pitivi/ges: 238/287] Show the time for the unsaved changes confirmation dialog
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges: 238/287] Show the time for the unsaved changes confirmation dialog
- Date: Thu, 15 Mar 2012 16:45:51 +0000 (UTC)
commit 4499155a2a179b4a8c766e630e9d7c99b1669a50
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date: Sun Jan 22 21:11:11 2012 -0500
Show the time for the unsaved changes confirmation dialog
Fixes bug #608108
pitivi/mainwindow.py | 18 ++++++++++++++----
pitivi/project.py | 2 ++
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index dfe42a7..be2f8cf 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -30,6 +30,7 @@ import gst
import ges
import webbrowser
+from time import time
from urllib import unquote
from gettext import gettext as _
from gtk import RecentManager
@@ -41,8 +42,8 @@ from pitivi.effects import EffectListWidget
from pitivi.medialibrary import MediaLibraryWidget, MediaLibraryError
from pitivi.utils.misc import show_user_manual
-from pitivi.utils.ui import SPACING, info_name, FILESOURCE_TUPLE, URI_TUPLE, \
- TYPE_URI_LIST, TYPE_PITIVI_FILESOURCE
+from pitivi.utils.ui import info_name, beautify_time_delta, SPACING,\
+ FILESOURCE_TUPLE, URI_TUPLE, TYPE_URI_LIST, TYPE_PITIVI_FILESOURCE
from pitivi.utils.timeline import Zoomable
from pitivi.timeline.timeline import Timeline
@@ -795,8 +796,17 @@ class PitiviMainWindow(gtk.Window, Loggable):
secondary.set_line_wrap(True)
secondary.set_use_markup(True)
secondary.set_alignment(0, 0.5)
- secondary.props.label = _("If you don't save some of your "
- "changes will be lost")
+
+ if project.uri:
+ path = unquote(project.uri).split("file://")[1]
+ last_saved = max(os.path.getmtime(path), projectManager.time_loaded)
+ time_delta = time() - last_saved
+ secondary.props.label = _("If you don't save, "
+ "the changes from the last %s will be lost."
+ % beautify_time_delta(time_delta))
+ else:
+ secondary.props.label = _("If you don't save, "
+ "your changes will be lost.")
# put the text in a vbox
vbox = gtk.VBox(False, SPACING * 2)
diff --git a/pitivi/project.py b/pitivi/project.py
index 4feabd5..a66452d 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -30,6 +30,7 @@ import gtk
import gio
import gobject
+from time import time
from datetime import datetime
from gettext import gettext as _
from urlparse import urlparse
@@ -234,6 +235,7 @@ class ProjectManager(Signallable, Loggable):
else:
self.current.disconnect = True
self.emit("new-project-loaded", self.current)
+ self.time_loaded = time()
return True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]