Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show content bundles on home screen #50

Merged
merged 1 commit into from Jul 4, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/jarabe/desktop/activitieslist.py
Expand Up @@ -32,7 +32,6 @@
from sugar3.graphics.xocolor import XoColor
from sugar3.graphics.alert import Alert
from sugar3.graphics.palettemenu import PaletteMenuItem
from sugar3.bundle.activitybundle import ActivityBundle

from jarabe.model import bundleregistry
from jarabe.view.palettes import ActivityPalette
Expand Down Expand Up @@ -227,8 +226,6 @@ def __activity_removed_cb(self, activity_registry, activity_info):
return

def _add_activity(self, activity_info):
if not isinstance(activity_info, ActivityBundle):
return
if activity_info.get_bundle_id() == 'org.laptop.JournalActivity':
return

Expand Down
7 changes: 0 additions & 7 deletions src/jarabe/desktop/favoritesview.py
Expand Up @@ -35,7 +35,6 @@
from sugar3.activity import activityfactory
from sugar3 import dispatch
from sugar3.datastore import datastore
from sugar3.bundle.activitybundle import ActivityBundle

from jarabe.view.palettes import JournalPalette
from jarabe.view.palettes import CurrentActivityPalette
Expand Down Expand Up @@ -158,8 +157,6 @@ def __settings_changed_cb(self, **kwargs):
self.set_layout(self._layout)
registry = bundleregistry.get_registry()
for info in registry:
if not isinstance(info, ActivityBundle):
continue
if registry.is_bundle_favorite(info.get_bundle_id(),
info.get_activity_version()):
self._add_activity(info)
Expand Down Expand Up @@ -292,8 +289,6 @@ def __connect_to_bundle_registry_cb(self):
registry = bundleregistry.get_registry()

for info in registry:
if not isinstance(info, ActivityBundle):
continue
if registry.is_bundle_favorite(info.get_bundle_id(),
info.get_activity_version()):
self._add_activity(info)
Expand All @@ -312,8 +307,6 @@ def _add_activity(self, activity_info):
icon.show()

def __activity_added_cb(self, activity_registry, activity_info):
if not isinstance(activity_info, ActivityBundle):
return
registry = bundleregistry.get_registry()
if registry.is_bundle_favorite(activity_info.get_bundle_id(),
activity_info.get_activity_version()):
Expand Down
30 changes: 13 additions & 17 deletions src/jarabe/journal/misc.py
Expand Up @@ -182,24 +182,9 @@ def resume(metadata, bundle_id=None, force_bundle_downgrade=False):

# Are we launching a bundle?
if ds_bundle is not None and bundle_id is None:
uri = None
activity_bundle_id = None

if is_activity_bundle(metadata):
activity_bundle_id = ds_bundle.get_bundle_id()
if is_content_bundle(metadata):
activities = _get_activities_for_mime('text/html')
if len(activities) == 0:
logging.warning('No activity can open HTML content bundles')
return

activity_bundle_id = activities[0].get_bundle_id()
uri = ds_bundle.get_start_uri()
logging.debug('Launching content bundle with uri %s', uri)

activity_bundle = registry.get_bundle(activity_bundle_id)
activity_bundle = registry.get_bundle(ds_bundle.get_bundle_id())
if activity_bundle is not None:
launch(activity_bundle, uri=uri)
launch(activity_bundle)
return

# Otherwise we are launching a regular journal entry
Expand Down Expand Up @@ -232,6 +217,17 @@ def launch(bundle, activity_id=None, object_id=None, uri=None, color=None,
logging.debug('launch bundle_id=%s activity_id=%s object_id=%s uri=%s',
bundle.get_bundle_id(), activity_id, object_id, uri)

if isinstance(bundle, ContentBundle):
# Content bundles are a special case: we treat them as launching
# Browse with a specific URI.
uri = bundle.get_start_uri()
activities = _get_activities_for_mime('text/html')
if len(activities) == 0:
logging.error("No browser available for content bundle")
return
bundle = activities[0]
logging.debug('Launching content bundle with uri %s', uri)

shell_model = shell.get_model()
activity = shell_model.get_activity_by_id(activity_id)
if activity is not None:
Expand Down