[Dextrose] [PATCH] Downgrading activities not allowed. (SL #2164)

Aleksey Lim alsroot at member.fsf.org
Sat Dec 11 11:02:10 EST 2010


Reviewed-by: Aleksey Lim <alsroot at member.fsf.org>

On Fri, Dec 10, 2010 at 11:56:39AM -0300, Martin Abente wrote:
> From: shanjit at seeta.in <shanjit at seeta.in>
> 
> diff --git a/src/jarabe/journal/misc.py b/src/jarabe/journal/misc.py
> index 6e3cb95..ec1f53d 100644
> --- a/src/jarabe/journal/misc.py
> +++ b/src/jarabe/journal/misc.py
> @@ -229,6 +229,35 @@ def resume(metadata, bundle_id=None):
>          else:
>              activityfactory.create_with_object_id(bundle, object_id)
>  
> +def _launch_bundle(bundle):
> +    registry = bundleregistry.get_registry()
> +    logging.debug('activityfactory.creating bundle with id %r',
> +                       bundle.get_bundle_id())
> +    installed_bundle = registry.get_bundle(bundle.get_bundle_id())
> +    if installed_bundle:
> +        activityfactory.create(installed_bundle)
> +    else:
> +        logging.error('Bundle %r is not installed.',
> +                    bundle.get_bundle_id())
> +
> +def _downgrade_option_alert(bundle):
> +    alert = ConfirmationAlert()
> +    alert.props.title = _('Older Version Of %s Activity') % (bundle.get_name())

> +    alert.props.msg = _('Do you want to downgrade to version %s\
> +    ') % (bundle.get_activity_version())
-----
> +    alert.props.msg = _('Do you want to downgrade to version %s') % \
> +            bundle.get_activity_version()
a typo

> +    alert.connect('response', _downgrade_alert_response_cb, bundle)
> +    journalwindow.get_journal_window().add_alert(alert)
> +    alert.show()
> +
> +def _downgrade_alert_response_cb(alert, response_id, bundle):
> +    if response_id is gtk.RESPONSE_OK:
> +        journalwindow.get_journal_window().remove_alert(alert)
> +        registry = bundleregistry.get_registry()
> +        registry.install(bundle, force_downgrade=True)
> +        _launch_bundle(bundle)
> +    elif response_id is gtk.RESPONSE_CANCEL:
> +        journalwindow.get_journal_window().remove_alert(alert)
> +
>  def is_activity_bundle(metadata):
>      mime_type = metadata.get('mime_type', '')
>      return mime_type == ActivityBundle.MIME_TYPE or \

-- 
Aleksey


More information about the Dextrose mailing list