#!/usr/bin/python3
#--------------------#
# AboutDialog dialog #
#--------------------#

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

class AboutDialog(Gtk.AboutDialog):
    def __init__(self):
        logo = GdkPixbuf.Pixbuf.new_from_file_at_size("/usr/share/ddcopy/data/icons/logo.svg", 64, 64)

        Gtk.AboutDialog.__init__(self)
        self.set_title("")
        self.set_name("")
        self.set_comments("PCLinuxOS Community Development")
        self.set_version("Version 0.3.3")
        self.set_website("http://www.pclinuxos.com/")
        self.set_authors(["Community member Upgreyed\n\n© 2023 WTFPL"])
        self.set_logo(logo)

        # Connect to the "response" signal
        self.connect("response", self.on_response)

    def on_response(self, dialog, response_id):
        # Check if the "Ok" button was clicked
        if response_id == Gtk.ResponseType.OK:
            # Execute /usr/bin/ddcopy
            subprocess.run(['/usr/bin/ddcopy'])

        # Destroy the dialog window to close it
        self.destroy()

aboutdialog = AboutDialog()
aboutdialog.run()
