Implement filter by mime types used by activities in the objectchooser #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Add a optative parameter filter_type to ObjectChooser constructor.
Constants to define the different filter types are defined in
sugar-toolkit-gtk3 patch. If is equals to 'mime_by_activity'
the parameter what_filter should be a bundle_id,
and the filter will be set to the collection of mime types
the activity can manage, as configured in the activity.info file.
The title in the toolbar is changed, and the what_filter combo
is not visible when this parameter is used.
If filter_type have a invalid value, a exeception is throw,
if is not used, the filter type is guessed based on the what_filter
parameter as before.
A example of use is:
from sugar3.graphics.objectchooser import ObjectChooser
from sugar3.graphics.objectchooser import FILTER_TYPE_MIME_BY_ACTIVITY
chooser = ObjectChooser(parent=self, what_filter=self.get_bundle_id(),
filter_type=FILTER_TYPE_MIME_BY_ACTIVITY)
This patch need a change in sugar-toolkit-gtk3 because a parameter was
added.
Signed-off-by: Gonzalo Odiard gonzalo@laptop.org