コード例 #1
0
func (m *ItemManager) GetAllTimeInstalled() (map[ItemId]int64, error) {
	infos := map[ItemId]int64{}
	var err error
	for id, _ := range m.itemTable {
		infos[id] = 0
	}

	store, err := storeApi.NewDStoreDesktop("com.deepin.store.Api", "/com/deepin/store/Api")
	if err != nil {
		return infos, fmt.Errorf("create store api failed: %v", err)
	}
	defer storeApi.DestroyDStoreDesktop(store)

	datasStr, err := store.GetAllDesktops()
	if err != nil {
		return infos, fmt.Errorf("get all desktops' info failed: %v", err)
	}

	datas := [][]interface{}{}
	err = json.Unmarshal([]byte(datasStr), &datas)
	if err != nil {
		return infos, err
	}

	for _, data := range datas {
		id := GenId(data[0].(string))
		t := int64(data[1].(float64))
		infos[id] = t
	}

	return infos, err
}
コード例 #2
0
func (self *ItemManager) GetAllNewInstalledApps() ([]ItemId, error) {
	ids := []ItemId{}
	store, err := storeApi.NewDStoreDesktop("com.deepin.store.Api", "/com/deepin/store/Api")
	if err != nil {
		return ids, fmt.Errorf("create store api failed: %v", err)
	}
	defer storeApi.DestroyDStoreDesktop(store)

	dataStr, err := store.GetNewDesktops()
	if err != nil {
		return ids, err
	}

	datas := [][]interface{}{}
	err = json.Unmarshal([]byte(dataStr), &datas)
	if err != nil {
		return ids, err
	}

	for _, data := range datas {
		id := GenId(data[0].(string))
		ids = append(ids, id)
	}
	return ids, nil
}
コード例 #3
0
func (self *ItemManager) MarkLaunched(_id ItemId) error {
	store, err := storeApi.NewDStoreDesktop("com.deepin.store.Api", "/com/deepin/store/Api")
	if err != nil {
		return fmt.Errorf("create store api failed: %v", err)
	}
	defer storeApi.DestroyDStoreDesktop(store)

	_, ok := store.MarkLaunched(string(_id))
	return ok
}
コード例 #4
0
ファイル: launcher.go プロジェクト: felixonmars/dde-daemon
func (self *Launcher) destroy() {
	if self.setting != nil {
		self.setting.destroy()
		launcher.setting = nil
	}
	if self.store != nil {
		storeApi.DestroyDStoreDesktop(self.store)
		self.store = nil
	}
	if self.appMonitor != nil {
		self.appMonitor.Close()
		self.appMonitor = nil
	}
	dbus.UnInstallObject(self)
}