Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpg@redhat.com>2007-09-20 10:25:12 (GMT)
committer Marco Pesenti Gritti <mpg@redhat.com>2007-09-20 10:25:12 (GMT)
commit0f2a58d737b29fb765c09a2c49135d50f01e25d4 (patch)
treeade3ab997c98f6e11fa9e6279f6033500d459f0e
parentc74276dcdbbd51df8d1a9ec40326cf5e26244267 (diff)
Human readable file names when copying on usb...
Conflicts: NEWS
-rw-r--r--NEWS4
-rw-r--r--sugar/datastore/datastore.py12
2 files changed, 16 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index a623f14..8e5c9e9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+* #3649 Human readable file names on USB. (marco)
+
+Snapshot b8ce5083b7
+
* #3601 Always remove invites from the frame. (cassidy)
Snapshot b8ce5083b7
diff --git a/sugar/datastore/datastore.py b/sugar/datastore/datastore.py
index 40bb1ca..48a3e52 100644
--- a/sugar/datastore/datastore.py
+++ b/sugar/datastore/datastore.py
@@ -27,6 +27,7 @@ from sugar import activity
from sugar.activity.bundle import Bundle
from sugar.activity.activityhandle import ActivityHandle
from sugar.bundle.contentbundle import ContentBundle
+from sugar.objects import mime
class DSMetadata(gobject.GObject):
__gsignals__ = {
@@ -259,6 +260,17 @@ def copy(jobject, mount_point):
new_jobject = jobject.copy()
new_jobject.metadata['mountpoint'] = mount_point
+ if jobject.metadata.has_key('title'):
+ filename = jobject.metadata['title']
+
+ if jobject.metadata.has_key('mime_type'):
+ mime_type = jobject.metadata['mime_type']
+ extension = mime.get_primary_extension(mime_type)
+ if extension:
+ filename += '.' + extension
+
+ new_jobject.metadata['suggested_filename'] = filename
+
# this will cause the file be retrieved from the DS
new_jobject.file_path = jobject.file_path