# 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))


from gi.repository import GObject, Gtk, Gedit
from gpdefs import GETTEXT_PACKAGE
from .store.session import Session
import os.path
    import gettext
        self.combobox.set_entry_text_column(self.NAME_COLUMN)
        self.combobox.connect("changed", self.on_name_combo_changed)

        if current_session is None:
            self.on_name_combo_changed(self.combobox)
        else:
            self._set_combobox_active_by_name(current_session)

        self.dialog.connect('response', self.on_response)

    def _set_combobox_active_by_name(self, option_name):
        model = self.combobox.get_model()
        piter = model.get_iter_first()
        while piter is not None:
            if model.get_value(piter, self.NAME_COLUMN) == option_name:
                self.combobox.set_active_iter(piter)
                return True
            piter = model.iter_next(piter)
        return False

    def on_name_combo_changed(self, combo):
        name = combo.get_child().get_text()
        self['save_button'].set_sensitive(len(name) > 0)

    def on_response(self, dialog, response_id):
        if response_id == Gtk.ResponseType.OK:
            files = [doc.get_file().get_location()
                        for doc in self.parent.get_documents()
                        if doc.get_file().get_location() is not None]
            name = self.combobox.get_child().get_text()

# 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/dialogs.py
from gi.repository import GObject, Gtk, Gedit
from gpdefs import GETTEXT_PACKAGE
from .store.session import Session
import os.path
    import gettext

        self.combobox.set_entry_text_column(self.NAME_COLUMN)
        self.combobox.connect("changed", self.on_name_combo_changed)

        if current_session is None:
            self.on_name_combo_changed(self.combobox)
        else:
            self._set_combobox_active_by_name(current_session)

        self.dialog.connect('response', self.on_response)

    def _set_combobox_active_by_name(self, option_name):
        model = self.combobox.get_model()
        piter = model.get_iter_first()
        while piter is not None:
            if model.get_value(piter, self.NAME_COLUMN) == option_name:
                self.combobox.set_active_iter(piter)
                return True
            piter = model.iter_next(piter)
        return False

    def on_name_combo_changed(self, combo):
        name = combo.get_child().get_text()
        self['save_button'].set_sensitive(len(name) > 0)

    def on_response(self, dialog, response_id):
        if response_id == Gtk.ResponseType.OK:
            files = [doc.get_file().get_location()
                        for doc in self.parent.get_documents()
                        if doc.get_file().get_location() is not None]
            name = self.combobox.get_child().get_text()

            self.sessions.add(Session(name, files))