diff options
author | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-11-02 17:36:15 (GMT) |
---|---|---|
committer | Tomeu Vizoso <tomeu@tomeuvizoso.net> | 2007-11-02 17:36:15 (GMT) |
commit | f0fc4f0500a7a305290f0598ee2600fa16e9cd0e (patch) | |
tree | 98b78aee507b9081dd3e4249fb6c6dfec846399a | |
parent | 203391ea6f55698236b7430e5e408e2f513c2f77 (diff) |
#4380 Add downloaded entries from the school server to the journal.
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | journalactivity.py | 4 | ||||
-rw-r--r-- | misc.py | 11 |
3 files changed, 13 insertions, 3 deletions
@@ -1,3 +1,4 @@ +* #4380 Add downloaded entries from the school server to the journal. (tomeu) * #1941 Implement FocusSearch method for popping up the journal. (rwh) * #3498, #4558 Mount removable devices as utf8. (tomeu) * display standard icon when icon for mime type is not found (erikos) diff --git a/journalactivity.py b/journalactivity.py index 2777bd5..468bfc3 100755 --- a/journalactivity.py +++ b/journalactivity.py @@ -33,6 +33,7 @@ from detailview import DetailView from volumestoolbar import VolumesToolbar import backup import misc +from journalentrybundle import JournalEntryBundle DS_DBUS_SERVICE = 'org.laptop.sugar.DataStore' DS_DBUS_INTERFACE = 'org.laptop.sugar.DataStore' @@ -207,6 +208,9 @@ class JournalActivity(activity.Activity): (jobject.file_path, e)) return + if jobject.metadata['mime_type'] == JournalEntryBundle.MIME_TYPE: + datastore.delete(jobject.object_id) + def set_search(self, search_dict): search_toolbar = self._main_toolbox.search_toolbar if 'query' in search_dict: @@ -27,6 +27,8 @@ from sugar.bundle.contentbundle import ContentBundle from sugar.bundle.bundle import MalformedBundleException, \ ZipExtractException, RegistrationException +from journalentrybundle import JournalEntryBundle + def _get_icon_file_name(icon_name): icon_theme = gtk.icon_theme_get_default() info = icon_theme.lookup_icon(icon_name, gtk.ICON_SIZE_LARGE_TOOLBAR, 0) @@ -123,8 +125,6 @@ def get_date(jobject): return _('No date') def get_bundle(jobject): - if not jobject.is_bundle(): - return None if jobject.file_path == '': # Probably a download-in-progress return None @@ -132,8 +132,13 @@ def get_bundle(jobject): try: if jobject.is_activity_bundle(): return ActivityBundle(jobject.file_path) - else: + elif jobject.is_content_bundle(): return ContentBundle(jobject.file_path) + elif jobject.metadata['mime_type'] == JournalEntryBundle.MIME_TYPE: + return JournalEntryBundle(jobject.file_path) + else: + return None except MalformedBundleException, e: logging.warning('Incorrect bundle: %r' % e) return None + |