# Path: mcomix/constants.py
# APPNAME = 'MComix'
# VERSION = '0.98-SVN'
# HOME_DIR = tools.get_home_directory()
# CONFIG_DIR = tools.get_config_directory()
# DATA_DIR = tools.get_data_directory()
# BASE_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# THUMBNAIL_PATH = os.path.join(HOME_DIR, '.thumbnails/normal')
# LIBRARY_DATABASE_PATH = os.path.join(DATA_DIR, 'library.db')
# LASTPAGE_DATABASE_PATH = os.path.join(DATA_DIR, 'lastreadpage.db')
# LIBRARY_COVERS_PATH = os.path.join(DATA_DIR, 'library_covers')
# PREFERENCE_PATH = os.path.join(CONFIG_DIR, 'preferences.conf')
# KEYBINDINGS_PATH = os.path.join(CONFIG_DIR, 'keybindings-gtk.rc')
# KEYBINDINGS_CONF_PATH = os.path.join(CONFIG_DIR, 'keybindings.conf')
# BOOKMARK_PICKLE_PATH = os.path.join(DATA_DIR, 'bookmarks.pickle')
# FILEINFO_PICKLE_PATH = os.path.join(DATA_DIR, 'file.pickle')
# PREFERENCE_PICKLE_PATH = os.path.join(CONFIG_DIR, 'preferences.pickle')
# ZOOM_MODE_BEST, ZOOM_MODE_WIDTH, ZOOM_MODE_HEIGHT, ZOOM_MODE_MANUAL = range(4)
# ZIP, RAR, TAR, GZIP, BZIP2, PDF, SEVENZIP, LHA = range(8)
# NORMAL_CURSOR, GRAB_CURSOR, WAIT_CURSOR, NO_CURSOR = range(4)
# LIBRARY_DRAG_EXTERNAL_ID, LIBRARY_DRAG_BOOK_ID, LIBRARY_DRAG_COLLECTION_ID = range(3)
# RESPONSE_REVERT_TO_DEFAULT = 3
# RESPONSE_REMOVE = 4
# RESPONSE_IMPORT = 5
# RESPONSE_SAVE_AS = 6
# RESPONSE_REPLACE = 7
# RESPONSE_NEW = 8
# STATUS_PAGE, STATUS_RESOLUTION, STATUS_PATH, STATUS_FILENAME, STATUS_FILENUMBER = \
#     1, 2, 4, 8, 16
# SHOW_DOUBLE_AS_ONE_TITLE, SHOW_DOUBLE_AS_ONE_WIDE = 1, 2
# MAX_LIBRARY_COVER_SIZE = 500
# SORT_NAME, SORT_PATH, SORT_SIZE, SORT_LAST_MODIFIED = 1, 2, 3, 4
# SORT_DESCENDING, SORT_ASCENDING = 1, 2
# STORE_LAST_PATH, STORE_LAST_PATH_AND_PAGE = 1, 2
# SIZE_HUGE, SIZE_LARGE, SIZE_NORMAL, SIZE_SMALL, SIZE_TINY = MAX_LIBRARY_COVER_SIZE, 300, 250, 125, 80
# ACCEPTED_COMMENT_EXTENSIONS = ['txt', 'nfo', 'xml']
# SUPPORTED_IMAGE_REGEX = re.compile(r'\.(jpg|jpeg|png|gif|tif|tiff|bmp|ppm|pgm|pbm)\s*$', re.I)
# SUPPORTED_ARCHIVE_REGEX = re.compile(r'\.(cbz|cbr|cbt|zip|rar|tar|gz|bz2|bzip2|7z|lza|lzh)\s*$', re.I)
# ZIP_FORMATS = (
#         ('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/x-cbz'),
#         ('*.zip', '*.cbz'))
# RAR_FORMATS = (
#         ('application/x-rar', 'application/x-cbr'),
#         ('*.rar', '*.cbr'))
# TAR_FORMATS = (
#         ('application/x-tar', 'application/x-gzip', 'application/x-bzip2', 'application/x-cbt'),
#         ('*.tar', '*.gz', '*.bz2', '*.bzip2', '*.cbt'))
# SZIP_FORMATS = (
#         ('application/x-7z-compressed', 'application/x-cb7'),
#         ('*.7z', '*.cb7'))
# LHA_FORMATS = (
#         ('application/x-lzh', 'application/x-lha', 'application/x-lzh-compressed'),
#         ('*.lha', '*.lzh'))
# MISSING_IMAGE_ICON = None
#         MISSING_IMAGE_ICON = _missing_icon_pixbuf.scale_simple(
#                 128, 128, gtk.gdk.INTERP_TILES)
# def SZIP_AVAILABLE():
# def RAR_AVAILABLE():
# def LHA_AVAILABLE():
# 
# Path: mcomix/bookmark_menu_item.py
# class _Bookmark(gtk.ImageMenuItem):
#     def __init__(self, window, file_handler, name, path, page, numpages, archive_type, date_added):
#     def __str__(self):
#     def _load(self, *args):
#     def same_path(self, path):
#     def same_page(self, page):
#     def to_row(self):
#     def pack(self):
#     def clone(self):
#     def __eq__(self, other):


import gtk
import gobject
from mcomix import constants
from mcomix import bookmark_menu_item
        bookmark._load()

    def _sort_model(self, treemodel, iter1, iter2, user_data):
        """ Custom sort function to sort to model entries based on the
        BookmarkMenuItem's fields specified in @C{user_data}. This is a list
        of field names. """
        if iter1 == iter2:
            return 0
        if iter1 is None:
            return 1
        elif iter2 is None:
            return -1

        bookmark1 = treemodel.get_value(iter1, 5)
        bookmark2 = treemodel.get_value(iter2, 5)

        for field in user_data:
            result = cmp(getattr(bookmark1, field),
                getattr(bookmark2, field))
            if result != 0:
                return result

        # If the loop didn't return, both entries are equal.
        return 0

    def _response(self, dialog, response):

        if response == gtk.RESPONSE_CLOSE:
            self._close()


# Path: mcomix/constants.py
# APPNAME = 'MComix'
# VERSION = '0.98-SVN'
# HOME_DIR = tools.get_home_directory()
# CONFIG_DIR = tools.get_config_directory()
# DATA_DIR = tools.get_data_directory()
# BASE_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# THUMBNAIL_PATH = os.path.join(HOME_DIR, '.thumbnails/normal')
# LIBRARY_DATABASE_PATH = os.path.join(DATA_DIR, 'library.db')
# LASTPAGE_DATABASE_PATH = os.path.join(DATA_DIR, 'lastreadpage.db')
# LIBRARY_COVERS_PATH = os.path.join(DATA_DIR, 'library_covers')
# PREFERENCE_PATH = os.path.join(CONFIG_DIR, 'preferences.conf')
# KEYBINDINGS_PATH = os.path.join(CONFIG_DIR, 'keybindings-gtk.rc')
# KEYBINDINGS_CONF_PATH = os.path.join(CONFIG_DIR, 'keybindings.conf')
# BOOKMARK_PICKLE_PATH = os.path.join(DATA_DIR, 'bookmarks.pickle')
# FILEINFO_PICKLE_PATH = os.path.join(DATA_DIR, 'file.pickle')
# PREFERENCE_PICKLE_PATH = os.path.join(CONFIG_DIR, 'preferences.pickle')
# ZOOM_MODE_BEST, ZOOM_MODE_WIDTH, ZOOM_MODE_HEIGHT, ZOOM_MODE_MANUAL = range(4)
# ZIP, RAR, TAR, GZIP, BZIP2, PDF, SEVENZIP, LHA = range(8)
# NORMAL_CURSOR, GRAB_CURSOR, WAIT_CURSOR, NO_CURSOR = range(4)
# LIBRARY_DRAG_EXTERNAL_ID, LIBRARY_DRAG_BOOK_ID, LIBRARY_DRAG_COLLECTION_ID = range(3)
# RESPONSE_REVERT_TO_DEFAULT = 3
# RESPONSE_REMOVE = 4
# RESPONSE_IMPORT = 5
# RESPONSE_SAVE_AS = 6
# RESPONSE_REPLACE = 7
# RESPONSE_NEW = 8
# STATUS_PAGE, STATUS_RESOLUTION, STATUS_PATH, STATUS_FILENAME, STATUS_FILENUMBER = \
#     1, 2, 4, 8, 16
# SHOW_DOUBLE_AS_ONE_TITLE, SHOW_DOUBLE_AS_ONE_WIDE = 1, 2
# MAX_LIBRARY_COVER_SIZE = 500
# SORT_NAME, SORT_PATH, SORT_SIZE, SORT_LAST_MODIFIED = 1, 2, 3, 4
# SORT_DESCENDING, SORT_ASCENDING = 1, 2
# STORE_LAST_PATH, STORE_LAST_PATH_AND_PAGE = 1, 2
# SIZE_HUGE, SIZE_LARGE, SIZE_NORMAL, SIZE_SMALL, SIZE_TINY = MAX_LIBRARY_COVER_SIZE, 300, 250, 125, 80
# ACCEPTED_COMMENT_EXTENSIONS = ['txt', 'nfo', 'xml']
# SUPPORTED_IMAGE_REGEX = re.compile(r'\.(jpg|jpeg|png|gif|tif|tiff|bmp|ppm|pgm|pbm)\s*$', re.I)
# SUPPORTED_ARCHIVE_REGEX = re.compile(r'\.(cbz|cbr|cbt|zip|rar|tar|gz|bz2|bzip2|7z|lza|lzh)\s*$', re.I)
# ZIP_FORMATS = (
#         ('application/x-zip', 'application/zip', 'application/x-zip-compressed', 'application/x-cbz'),
#         ('*.zip', '*.cbz'))
# RAR_FORMATS = (
#         ('application/x-rar', 'application/x-cbr'),
#         ('*.rar', '*.cbr'))
# TAR_FORMATS = (
#         ('application/x-tar', 'application/x-gzip', 'application/x-bzip2', 'application/x-cbt'),
#         ('*.tar', '*.gz', '*.bz2', '*.bzip2', '*.cbt'))
# SZIP_FORMATS = (
#         ('application/x-7z-compressed', 'application/x-cb7'),
#         ('*.7z', '*.cb7'))
# LHA_FORMATS = (
#         ('application/x-lzh', 'application/x-lha', 'application/x-lzh-compressed'),
#         ('*.lha', '*.lzh'))
# MISSING_IMAGE_ICON = None
#         MISSING_IMAGE_ICON = _missing_icon_pixbuf.scale_simple(
#                 128, 128, gtk.gdk.INTERP_TILES)
# def SZIP_AVAILABLE():
# def RAR_AVAILABLE():
# def LHA_AVAILABLE():
# 
# Path: mcomix/bookmark_menu_item.py
# class _Bookmark(gtk.ImageMenuItem):
#     def __init__(self, window, file_handler, name, path, page, numpages, archive_type, date_added):
#     def __str__(self):
#     def _load(self, *args):
#     def same_path(self, path):
#     def same_page(self, page):
#     def to_row(self):
#     def pack(self):
#     def clone(self):
#     def __eq__(self, other):


# Path: mcomix/bookmark_dialog.py
import gtk
import gobject
from mcomix import constants
from mcomix import bookmark_menu_item

        bookmark._load()

    def _sort_model(self, treemodel, iter1, iter2, user_data):
        """ Custom sort function to sort to model entries based on the
        BookmarkMenuItem's fields specified in @C{user_data}. This is a list
        of field names. """
        if iter1 == iter2:
            return 0
        if iter1 is None:
            return 1
        elif iter2 is None:
            return -1

        bookmark1 = treemodel.get_value(iter1, 5)
        bookmark2 = treemodel.get_value(iter2, 5)

        for field in user_data:
            result = cmp(getattr(bookmark1, field),
                getattr(bookmark2, field))
            if result != 0:
                return result

        # If the loop didn't return, both entries are equal.
        return 0

    def _response(self, dialog, response):

        if response == gtk.RESPONSE_CLOSE:
            self._close()


        elif response == constants.RESPONSE_REMOVE: