Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2013-06-26 08:30:56 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2013-08-05 14:19:28 (GMT)
commitb96e3a8bcba42e0cb0ae5944d21bd94b6b43772b (patch)
tree171d39fd47db92aa1972c80151e8a4c3ebe90fcc
parenta233d26ab9a70b4d2e7cab9edac9fa630328ca51 (diff)
Use the new filter_type parameter in ObjectChooser if available
This feature is available only in sugar 0.100 and better, if is not available use the old mime.GENERIC_TYPE_TEXT filter. This change is related to AU #2439 & SL #4523 Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
-rw-r--r--readactivity.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/readactivity.py b/readactivity.py
index f62ffd3..4fea9a2 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -52,6 +52,8 @@ from sugar3 import profile
from sugar3.datastore import datastore
from sugar3.graphics.objectchooser import ObjectChooser
+from sugar3.graphics.objectchooser import FILTER_TYPE_MIME_BY_ACTIVITY
+
from sugar3.graphics import style
from readtoolbar import EditToolbar
@@ -629,7 +631,15 @@ class ReadActivity(activity.Activity):
"""
if not self._want_document:
return
- chooser = ObjectChooser(None, what_filter=self.get_bundle_id())
+
+ try:
+ chooser = ObjectChooser(parent=self,
+ what_filter=self.get_bundle_id(),
+ filter_type=FILTER_TYPE_MIME_BY_ACTIVITY)
+ except:
+ chooser = ObjectChooser(parent=self,
+ what_filter=mime.GENERIC_TYPE_TEXT)
+
try:
result = chooser.run()
if result == Gtk.ResponseType.ACCEPT: