Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit 80e913ba4af35dae32ce41f627177031d8794676

  • avatar
  • Ajay Garg <ajay @activit…ntral.com>
  • Sun May 12 06:28:19 EDT 2013
sdxo#3220: Now, activity-usage time will be updated, when an activity-window is exited.

Signed-off-by: Ajay Garg <ajay@activitycentral.com>
  
213213 registry.connect('bundle-changed', self.__activity_changed_cb)
214214 registry.connect('bundle-removed', self.__activity_removed_cb)
215215
216 def refresh_model(self):
217 self._model.clear()
218
219 registry = bundleregistry.get_registry()
220 for info in registry:
221 self._add_activity(info)
222
216223 def __activity_added_cb(self, activity_registry, activity_info):
217224 self._add_activity(activity_info)
218225
255255 if activity_info.get_bundle_id() == 'org.laptop.JournalActivity':
256256 return
257257
258 timestamp = activity_info.get_installation_time()
258 timestamp = os.stat(activity_info._path).st_mtime
259259 version = activity_info.get_activity_version()
260260
261261 registry = bundleregistry.get_registry()
  
1717
1818import logging
1919import time
20import os
2021
2122from gi.repository import GConf
2223from gi.repository import Wnck
2828import dbus
2929
3030from sugar3 import dispatch
31from sugar3 import util
3132from sugar3.graphics.xocolor import XoColor
3233from gi.repository import SugarExt
3334
600600 xid = window.get_xid()
601601 activity = self._get_activity_by_xid(xid)
602602 if activity is not None:
603
604 # Now, update the modification-time on the filesystem,
605 # and in the activities-list.
606 #
607 bundle_path = activity._activity_info.get_path()
608 current_timestamp = time.time()
609
610 # 1. On filesystem.
611 os.utime(bundle_path, (os.stat(bundle_path).st_mtime, current_timestamp))
612
613 # 2. On the activities-list.
614 from jarabe.desktop.homewindow import get_instance
615 activities_model = get_instance()._home_box._list_view._tree_view.get_model()
616 activities_model.refresh_model()
617
603618 activity.remove_window_by_xid(xid)
604619 if activity.get_window() is None:
605620 logging.debug('last window gone - remove activity %s',