#!/usr/local/bin/python3.12
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
#   Catfish - a versatile file searching tool
#   Copyright (C) 2007-2012 Christian Dywan <christian@twotoasts.de>
#   Copyright (C) 2012-2022 Sean Davis <bluesabre@xfce.org>
#
#   This program is free software: you can redistribute it and/or modify it
#   under the terms of the GNU General Public License version 2, as published
#   by the Free Software Foundation.
#
#   This program is distributed in the hope that it will be useful, but
#   WITHOUT ANY WARRANTY; without even the implied warranties of
#   MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
#   PURPOSE.  See the GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License along
#   with this program.  If not, see <https://www.gnu.org/licenses/>.

import os
import sys

PREFIX = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))

import locale
locale.textdomain('catfish')
locale.bindtextdomain('catfish', os.path.join(PREFIX, 'share/locale'))

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

# Check GTK Version, minimum required is 3.10
if Gtk.check_version(3, 10, 0):
    print("Gtk version too old, version 3.10 required.")
    sys.exit(1)

# Prepend project site-packages directory to python search path if needed
import site
if PREFIX not in site.PREFIXES:
    site.PREFIXES.insert(0, PREFIX)
    site.main()
    sys.path.insert(0, sys.path.pop())

import catfish
catfish.main()
