launcher:: emit created event on applications created.

Change-Id: Ie8e5c4fa3f3acab1faad5107f1837bbeb094e84f
This commit is contained in:
liliqiang 2015-04-10 14:38:23 +08:00
parent e9a810314e
commit 0033c8a619

View File

@ -45,6 +45,7 @@ type Launcher struct {
cancelSearchingChan chan struct{}
pinyinObj PinYinInterface
store *storeApi.DStoreDesktop
appMonitor *fsnotify.Watcher
ItemChanged func(
status string,
@ -285,6 +286,7 @@ func (self *Launcher) itemChangedHandler(ev *fsnotify.FileEvent, name string, in
}()
info[name].renamed <- true
} else if ev.IsCreate() {
self.emitItemChanged(name, SoftwareStatusCreated, info)
go func() {
select {
case <-info[name].renamed:
@ -385,7 +387,8 @@ func (self *Launcher) listenItemChanged() {
if err != nil {
return
}
// FIXME: close watcher.
self.appMonitor = watcher
for _, dir := range dirs {
logger.Info("monitor:", dir)
watcher.Watch(dir)
@ -513,5 +516,9 @@ func (self *Launcher) destroy() {
storeApi.DestroyDStoreDesktop(self.store)
self.store = nil
}
if self.appMonitor != nil {
self.appMonitor.Close()
self.appMonitor = nil
}
dbus.UnInstallObject(self)
}