diff --git a/pkg/client/client.go b/pkg/client/client.go index 435e0ee..3498f57 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -215,10 +215,15 @@ func (client *Client) PropertyGetCollections() ([]string, error) { return nil, errors.New("Error getting property 'Collections': " + err.Error()) } - collections, ok := variant.Value().([]string) + collectionspaths, ok := variant.Value().([]dbus.ObjectPath) if !ok { - return nil, fmt.Errorf("invalid 'Collections' property type. Expected '[]string', got '%T'", variant.Value()) + return nil, fmt.Errorf("invalid 'Collections' property type. Expected '[]dbus.ObjectPath', got '%T'", variant.Value()) + } + + var collections []string + for k := range collectionspaths { + collections = append(collections, string(collectionspaths[k])) } sort.Strings(collections) diff --git a/pkg/client/collection.go b/pkg/client/collection.go index 019c16d..f240476 100644 --- a/pkg/client/collection.go +++ b/pkg/client/collection.go @@ -225,13 +225,18 @@ func (collection *Collection) PropertyGetItems() ([]string, error) { return []string{}, fmt.Errorf("failed to read 'Items' property. Error: %v", err) } - items, ok := variant.Value().([]string) + pathitems, ok := variant.Value().([]dbus.ObjectPath) if !ok { - return []string{}, fmt.Errorf("expected 'Items' to be of type '[]string', got: '%T'", + return []string{}, fmt.Errorf("expected 'Items' to be of type '[]dbus.ObjectPath', got: '%T'", variant.Value()) } + var items []string + for k := range pathitems { + items = append(items, string(pathitems[k])) + } + sort.Strings(items) var collectionItems []string diff --git a/pkg/service/collection-methods.go b/pkg/service/collection-methods.go index 73b6cf8..ce9c443 100644 --- a/pkg/service/collection-methods.go +++ b/pkg/service/collection-methods.go @@ -268,11 +268,11 @@ func (collection *Collection) UpdateModified() { // UpdatePropertyCollections updates dbus property of this collection's items func (collection *Collection) UpdatePropertyCollectionItems() { - var items []string + var items []dbus.ObjectPath collection.ItemsMutex.RLock() for _, item := range collection.Items { - items = append(items, string(item.ObjectPath)) + items = append(items, item.ObjectPath) } collection.ItemsMutex.RUnlock() diff --git a/pkg/service/service-methods.go b/pkg/service/service-methods.go index 0e59b42..19bb446 100644 --- a/pkg/service/service-methods.go +++ b/pkg/service/service-methods.go @@ -246,13 +246,13 @@ func (service *Service) GetItemByPath(itemPath dbus.ObjectPath) *Item { // UpdatePropertyCollections updates dbus properties of Service func (s *Service) UpdatePropertyCollections() { - var collections []string + var collections []dbus.ObjectPath s.CollectionsMutex.RLock() defer s.CollectionsMutex.RUnlock() for _, collection := range s.Collections { - collections = append(collections, string(collection.ObjectPath)) + collections = append(collections, collection.ObjectPath) } PropsService.SetMust("org.freedesktop.Secret.Service",