[Dextrose] [PATCH sugar] Journal: display entries that have no title on storage devices #10533

Aleksey Lim alsroot at member.fsf.org
Thu Feb 3 18:56:50 EST 2011


From: Simon Schampijer <simon at schampijer.de>

When copying an entry to the storage device we set the title
(filename) to _('Untitled').

Conversion from 0.82 entries: If an entry has no title we set
it to _('Untitled') and rename the file accordingly,
taking care of creating a unique filename.
---
 src/jarabe/journal/model.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/journal/model.py b/src/jarabe/journal/model.py
index 98b7f09..81d115e 100644
--- a/src/jarabe/journal/model.py
+++ b/src/jarabe/journal/model.py
@@ -23,6 +23,7 @@ import shutil
 from stat import S_IFLNK, S_IFMT, S_IFDIR, S_IFREG
 import re
 from operator import itemgetter
+from gettext import gettext as _
 
 import gobject
 import dbus
@@ -540,6 +541,8 @@ def write(metadata, file_path='', update_mtime=True, transfer_ownership=True):
             raise ValueError('Entries without a file cannot be copied to '
                              'removable devices')
 
+        if metadata['title'] == '':
+            metadata['title'] = _('Untitled')
         file_name = _get_file_name(metadata['title'], metadata['mime_type'])
         file_name = _get_unique_file_name(metadata['mountpoint'], file_name)
 
-- 
1.7.3.4



More information about the Dextrose mailing list