[Sugar-devel] [PATCH Browse 1/2] Fix Stopping if downloads are in progress

Lucian Branescu lucian.branescu at gmail.com
Mon May 23 12:28:04 EDT 2011


I gave you commit and review rights. Feel free to commit the two
patches yourself, removing me as a bottleneck.

On 23 May 2011 17:14, Lucian Branescu <lucian.branescu at gmail.com> wrote:
> Looks good, although it'd be nice at some point for Sugar itself to
> manage force closes better.
>
> Wouldn't it be better if I gave you commit rights on mainline instead?
>
> On 23 May 2011 16:30, Rafael Ortiz <rafael at activitycentral.com> wrote:
>>
>>
>> On Sat, May 21, 2011 at 10:24 AM, Sascha Silbe <silbe at activitycentral.com>
>> wrote:
>>>
>>> sugar.activity.activity.Activity.close() doesn't take a force parameter.
>>> Instead we need to make sure can_close() returns True the next time and
>>> call
>>> close() without parameters.
>>>
>>> The user-visible effect was that they needed to use Stop twice (once to
>>> stop
>>> the pending downloads and a second time to close Browse).
>>>
>>> Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
>>> ---
>>>  webactivity.py |    9 +++++++--
>>>  1 files changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/webactivity.py b/webactivity.py
>>> index b444861..5f1ea5e 100644
>>> --- a/webactivity.py
>>> +++ b/webactivity.py
>>> @@ -184,6 +184,7 @@ class WebActivity(activity.Activity):
>>>
>>>         _logger.debug('Starting the web activity')
>>>
>>> +        self._force_close = False
>>>         self._tabbed_view = TabbedView()
>>>
>>>         _set_accept_languages()
>>> @@ -601,7 +602,9 @@ class WebActivity(activity.Activity):
>>>         return buf
>>>
>>>     def can_close(self):
>>> -        if downloadmanager.can_quit():
>>> +        if self._force_close:
>>> +            return True
>>> +        elif downloadmanager.can_quit():
>>>             return True
>>>         else:
>>>             alert = Alert()
>>> @@ -616,6 +619,7 @@ class WebActivity(activity.Activity):
>>>             alert.connect('response', self.__inprogress_response_cb)
>>>             alert.show()
>>>             self.present()
>>> +            return False
>>>
>>>     def __inprogress_response_cb(self, alert, response_id):
>>>         self.remove_alert(alert)
>>> @@ -623,8 +627,9 @@ class WebActivity(activity.Activity):
>>>             logging.debug('Keep on')
>>>         elif response_id == gtk.RESPONSE_OK:
>>>             logging.debug('Stop downloads and quit')
>>> +            self._force_close = True
>>>             downloadmanager.remove_all_downloads()
>>> -            self.close(force=True)
>>> +            self.close()
>>>
>>>     def get_document_path(self, async_cb, async_err_cb):
>>>         browser = self._tabbed_view.props.current_browser
>>> --
>>> 1.7.4.1
>>
>> Applied and tested, works as expected thanks.
>> Can you apply to mainline ?.
>>>
>>> _______________________________________________
>>> Sugar-devel mailing list
>>> Sugar-devel at lists.sugarlabs.org
>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>
>>
>


More information about the Sugar-devel mailing list