#!/usr/bin/python3
#
# Merengue: Cambalache view process
#
# Copyright (C) 2021  Juan Pablo Ugarte
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation;
# version 2.1 of the License.
#
# library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
# Authors:
#   Juan Pablo Ugarte <juanpablougarte@gmail.com>
#
# SPDX-License-Identifier: LGPL-2.1-only
#

import os
import gi
import sys
import signal

merenguedir = "/usr/lib/python3.13/site-packages/cambalache/priv"

sys.path.insert(1, merenguedir)
signal.signal(signal.SIGINT, signal.SIG_DFL)

from gi.repository import GLib

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print(f"Usage: {sys.argv[0]} gtkversion command_socket", file=sys.stderr)
        exit()

    version = sys.argv[1]
    command_socket = sys.argv[2]

    gi.require_version("Gdk", version)
    gi.require_version("Gtk", version)

    from merengue import MrgApplication
    app = MrgApplication(command_socket=command_socket)
    app.run([])
