# Path: plugins/sessionsaver/sessionsaver/store/session.py
# class Session(object):
#     def __init__(self, name, files = None):
#         super(Session, self).__init__()
#         self.name = name
#         if files is None:
#             files = []
#         self.files = files
# 
#     def __lt__(self, session):
#         return (self.name.lower() < session.name.lower())
# 
#     def __eq__(self, session):
#         return (self.name.lower() == session.name.lower())
# 
#     def add_file(self, filename):
#         self.files.append(Gio.file_new_for_uri(filename))


import os.path
from gi.repository import GObject, GLib, Gio
from .session import Session
                             (GObject.TYPE_PYOBJECT,)),
        "session-removed":  (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
                            (GObject.TYPE_PYOBJECT,))
    }

    def __init__(self):
        super(SessionStore, self).__init__()
        self._sessions = []

    def __iter__(self):
        return iter(self._sessions)

    def __getitem__(self, index):
        return self._sessions[index]

    def __getslice__(self, i, j):
        return self._sessions[i:j]

    def __len__(self):
        return len(self._sessions)

    def do_session_added(self, session):
        self._sessions.append(session)
        self._sessions.sort()

    def do_session_changed(self, session):
        index = self._sessions.index(session)
        self._sessions[index] = session

    def add(self, session):

# Path: plugins/sessionsaver/sessionsaver/store/session.py
# class Session(object):
#     def __init__(self, name, files = None):
#         super(Session, self).__init__()
#         self.name = name
#         if files is None:
#             files = []
#         self.files = files
# 
#     def __lt__(self, session):
#         return (self.name.lower() < session.name.lower())
# 
#     def __eq__(self, session):
#         return (self.name.lower() == session.name.lower())
# 
#     def add_file(self, filename):
#         self.files.append(Gio.file_new_for_uri(filename))


# Path: plugins/sessionsaver/sessionsaver/store/sessionstore.py
import os.path
from gi.repository import GObject, GLib, Gio
from .session import Session

                             (GObject.TYPE_PYOBJECT,)),
        "session-removed":  (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
                            (GObject.TYPE_PYOBJECT,))
    }

    def __init__(self):
        super(SessionStore, self).__init__()
        self._sessions = []

    def __iter__(self):
        return iter(self._sessions)

    def __getitem__(self, index):
        return self._sessions[index]

    def __getslice__(self, i, j):
        return self._sessions[i:j]

    def __len__(self):
        return len(self._sessions)

    def do_session_added(self, session):
        self._sessions.append(session)
        self._sessions.sort()

    def do_session_changed(self, session):
        index = self._sessions.index(session)
        self._sessions[index] = session

    def add(self, session):

        assert isinstance(session, Session)