bilelmoussaoui / oo7

James Bond went on a new mission as a Secret Service provider
https://bilelmoussaoui.github.io/oo7/oo7/
MIT License
63 stars 12 forks source link

New gnome keyring #73

Open bilelmoussaoui opened 7 months ago

bilelmoussaoui commented 7 months ago

Switches #56 to use a branch from this repo so we can easily collaborate on it.

progress to-date:

warusadura commented 7 months ago

Does it make sense to store the session along with an Item. As in,

pub struct Item {
    inner: RwLock<portal::Item>,
    path: OwnedObjectPath,
    keyring: Arc<Keyring>,
    locked: bool,
    session: OwnedObjectPath,
}

and then, store the same session inside Collection,

pub struct Collection {
    keyring: Arc<Keyring>,
    pub(crate) items: RwLock<Vec<super::item::Item>>,
    alias: RwLock<String>,
    label: String,
    locked: AtomicBool,
    created: Duration,
    modified: Duration,
    path: OwnedObjectPath,
    sessions: Vec<OwnedObjectPath>,
}

with this way we get access to all the available sessions and we can retrieve a session based on an objectpath. wdyt?

bilelmoussaoui commented 7 months ago

Does it make sense to store the session along with an Item. As in,

pub struct Item {
    inner: RwLock<portal::Item>,
    path: OwnedObjectPath,
    keyring: Arc<Keyring>,
    locked: bool,
    session: OwnedObjectPath,
}

and then, store the same session inside Collection,

pub struct Collection {
    keyring: Arc<Keyring>,
    pub(crate) items: RwLock<Vec<super::item::Item>>,
    alias: RwLock<String>,
    label: String,
    locked: AtomicBool,
    created: Duration,
    modified: Duration,
    path: OwnedObjectPath,
    sessions: Vec<OwnedObjectPath>,
}

with this way we get access to all the available sessions and we can retrieve a session based on an objectpath. wdyt?

Storing the session is required yes, but not just it ObjectPath. Instead you need to store the Sesssion itself which would contain more information than just the object path. Ideally we can store it as HashMap<OwnedObjectPath, Session>, same thing for collections & items I would say.

warusadura commented 5 months ago

Note: dropped following commits due to this change and rebased.