diff --git a/lib/sugar/activity/activity.py b/lib/sugar/activity/activity.py
index f6dbd37..0a3dd40 100644
|
a
|
b
|
|
| 675 | 675 | if self.canvas and self.canvas.window: |
| 676 | 676 | self._preview.take_screenshot(self.canvas.window) |
| 677 | 677 | |
| | 678 | def sync_data(self): |
| | 679 | """Sync the activity data to the Journal. |
| | 680 | |
| | 681 | This method is called when we shutdown, reboot or suspend the laptop. |
| | 682 | """ |
| | 683 | if self._jobject: |
| | 684 | self.save() |
| | 685 | |
| 678 | 686 | def save(self): |
| 679 | 687 | """Request that the activity is saved to the Journal. |
| 680 | 688 | |
diff --git a/lib/sugar/activity/activityservice.py b/lib/sugar/activity/activityservice.py
index c884fcb..82a63f0 100644
|
a
|
b
|
|
| 68 | 68 | def TakeScreenshot(self): |
| 69 | 69 | self._activity.take_screenshot() |
| 70 | 70 | |
| | 71 | @dbus.service.method(_ACTIVITY_INTERFACE) |
| | 72 | def SyncData(self): |
| | 73 | self._activity.sync_data() |
| | 74 | |
diff --git a/shell/model/homemodel.py b/shell/model/homemodel.py
index 44d5417..332d4df 100644
|
a
|
b
|
|
| 147 | 147 | self._active_activity = home_activity |
| 148 | 148 | self.emit('active-activity-changed', self._active_activity) |
| 149 | 149 | |
| | 150 | def sync_activity_data(self): |
| | 151 | """Sync all the running activities to the datastore |
| | 152 | |
| | 153 | This is used to not loose any date when we shutdown or |
| | 154 | reboot the laptop. |
| | 155 | """ |
| | 156 | for act in self._activities: |
| | 157 | if act.get_type() != 'org.laptop.JournalActivity': |
| | 158 | if act: |
| | 159 | service = act.get_service() |
| | 160 | if service: |
| | 161 | service.SyncData() |
| | 162 | |
| 150 | 163 | def __iter__(self): |
| 151 | 164 | return iter(self._activities) |
| 152 | 165 | |
diff --git a/shell/shellservice.py b/shell/shellservice.py
index 458f941..5cccc98 100644
|
a
|
b
|
|
| 64 | 64 | dbus.service.Object.__init__(self, bus_name, _DBUS_PATH) |
| 65 | 65 | |
| 66 | 66 | @dbus.service.method(_DBUS_SHELL_IFACE, |
| | 67 | in_signature="", out_signature="") |
| | 68 | def SyncActivityData(self): |
| | 69 | self._home_model.sync_activity_data() |
| | 70 | |
| | 71 | @dbus.service.method(_DBUS_SHELL_IFACE, |
| 67 | 72 | in_signature="s", out_signature="b") |
| 68 | 73 | def ActivateActivity(self, activity_id): |
| 69 | 74 | host = self._shell.get_activity(activity_id) |
diff --git a/shell/view/home/HomeBox.py b/shell/view/home/HomeBox.py
index 8764887..069080c 100644
|
a
|
b
|
|
| 183 | 183 | model = self._shell.get_model() |
| 184 | 184 | model.props.state = ShellModel.STATE_SHUTDOWN |
| 185 | 185 | |
| | 186 | home_model = self._shell.get_model().get_home() |
| | 187 | home_model.sync_activity_data() |
| | 188 | |
| 186 | 189 | pm = self._get_power_manager() |
| 187 | 190 | |
| 188 | 191 | hw_manager = hardwaremanager.get_manager() |
| … |
… |
|
| 197 | 200 | model = self._shell.get_model() |
| 198 | 201 | model.props.state = ShellModel.STATE_SHUTDOWN |
| 199 | 202 | |
| | 203 | home_model = self._shell.get_model().get_home() |
| | 204 | home_model.sync_activity_data() |
| | 205 | |
| 200 | 206 | pm = self._get_power_manager() |
| 201 | 207 | |
| 202 | 208 | hw_manager = hardwaremanager.get_manager() |