sugarlabs/sugar — pull request #34 by godiard (2013-06-20 04:02:28+00:00)
Title: Implement filter by mime types used by activities in the objectchooser

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.

As this change modify the dbus signature, a dbus method was added,
keeping the old one for backward compatibility, for use of non python
activities.

Signed-off-by: Gonzalo Odiard