>From the user point of view: in Sugar there is no need to save. Data storage is done automatically.
How is that implemented in GTK? Activity developers override write_file. Then the method is called when the activity is stopped or when it goes to the background. On stop, the activity process ends only after the storage is done. So we agreed in forwarding notifications from Sugar to the web activity to get the same behaviour as in GTK, and I've been trying to implement this: https://github.com/sugarlabs/sugar-web/pull/63#issuecomment-21576917 As Daniel N proposed, I've been looking at the state changes of the window management, and I did implement 'pause' and 'resume' with that: Sugar Shell changes: https://github.com/manuq/sugar-1/compare/lifecycle Sugar Web changes: https://github.com/manuq/sugar-web/compare/lifecycle But trying to do 'stop' (and 'start', but let's talk about stop) is more tricky, and I'm blocked. 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. [1] https://developer.gnome.org/libwnck/stable/WnckWindow.html#wnck-window-close [2] https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/activity/activity.py#L296 [3] https://github.com/sugarlabs/sugar-toolkit-gtk3/blob/master/src/sugar3/activity/activity.py#L919 Any hint? Maybe we should go one layer below, to the toolkit, instead of trying to handle this from the shell window management? -- .. manuq .. _______________________________________________ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel