Implemented deletion of collections

This commit is contained in:
TypoMustakes
2025-10-28 12:05:47 +01:00
parent 0dc6d8432a
commit 667f624229
3 changed files with 7 additions and 1 deletions

View File

@@ -4,4 +4,5 @@ public interface ISecretService
{ {
public List<Secret.Collection> GetCollections(); public List<Secret.Collection> GetCollections();
public void CreateCollection(string label); public void CreateCollection(string label);
public void DeleteCollection(string label);
} }

View File

@@ -22,6 +22,7 @@ public class PasswordStoreService : IPasswordStoreService
public void Delete(uint ID) public void Delete(uint ID)
{ {
secretService.DeleteCollection(Get(ID).DisplayName ?? Get(ID).Path);
repository.Delete(ID); repository.Delete(ID);
} }

View File

@@ -18,7 +18,6 @@ public class SecretService : ISecretService
{ {
Secret.Collection collection = (Secret.Collection)GObject.Internal.InstanceWrapper.WrapHandle<Secret.Collection>(data, false); Secret.Collection collection = (Secret.Collection)GObject.Internal.InstanceWrapper.WrapHandle<Secret.Collection>(data, false);
result.Add(collection); result.Add(collection);
Console.WriteLine($" - {collection.Label}");
}); });
return result; return result;
} }
@@ -27,4 +26,9 @@ public class SecretService : ISecretService
{ {
Secret.Collection.CreateSync(service, label, null, Secret.CollectionCreateFlags.None, null); Secret.Collection.CreateSync(service, label, null, Secret.CollectionCreateFlags.None, null);
} }
public void DeleteCollection(string label)
{
GetCollections().FirstOrDefault(c => c.Label == label).DeleteSync(null);
}
} }