[Sugar-devel] Web Activity lifecycle and storage

Manuel Quiñones manuq at laptop.org
Mon Aug 5 12:35:52 EDT 2013


2013/8/5 Daniel Narvaez <dwnarvaez at gmail.com>:
> On 5 August 2013 17:36, Manuel Quiñones <manuq at laptop.org> wrote:
>>
>> Thanks for the hints Daniel,
>>
>> 2013/8/3 Daniel Narvaez <dwnarvaez at gmail.com>:
>> > On 3 August 2013 02:26, Manuel Quiñones <manuq at laptop.org> wrote:
>> >>
>> >>
>> >> The problem is: how could the activity process wait for the datastore
>> >> write to finish?  If the WnckWindow close is called [1], the activity
>> >> process ends.  Unless you connect a callback to 'delete-event' [2] and
>> >> handle the destroy() yourself [3] .  Which is what GTK activities do
>> >> to store before closing.
>> >
>> >
>> > The shell currently does
>> >
>> > activity.get_window().close()
>> >
>> > We could
>> >
>> > 1 Add a close method to Activity directly. That would emit a close
>> > signal
>> > and call get_window().close() only if the signal didn't return True.
>>
>> That's nice.  I was trying to keep the patch as unaggressive as
>> possible.  Calling close() instead of get_window().close() implies
>> changing a few files in shell, but I think that's OK.
>
>
> Yeah, I think it's OK. We have a lot of time left before final release and
> these wouldn't be invasive changes, despite touching a few files.
>
>>
>> > 2 Apisocket would connect to that signal, send the stop notification to
>> > the
>> > web activity and return True.
>> > 3 On stop the activity would first save state, then call
>> > activity.close().
>>
>> That should be only for web activities, so I'll need to let shell
>> Activity know if it is a web activity or not.  I've been trying to
>> prevent that, but I don't see other option.
>>
>
> Where do you need to know if it's a web activity exactly? 3 is in js code, 2
> is apisocket which only knows about web activities.

In shell Activity.close(), to do the close directly if it is not a web
activity.  If it is a web activity, emit the signal.  You said:

> call get_window().close() only if the signal didn't return True

but I would add: "or if it is not a web activity"

-- 
.. manuq ..


More information about the Sugar-devel mailing list