2022-07-22 12:29:32 +00:00
|
|
|
# window.py
|
|
|
|
#
|
2022-08-11 08:16:44 +00:00
|
|
|
# Change the look of Adwaita, with ease
|
2022-08-15 23:21:28 +00:00
|
|
|
# Copyright (C) 2022 Gradience Team
|
2022-07-22 12:29:32 +00:00
|
|
|
#
|
2022-08-11 08:16:44 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2022-08-11 16:39:52 +00:00
|
|
|
#
|
2022-08-11 08:16:44 +00:00
|
|
|
# This program 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 General Public License for more details.
|
2022-08-11 16:39:52 +00:00
|
|
|
#
|
2022-08-11 08:16:44 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2022-07-22 12:29:32 +00:00
|
|
|
|
|
|
|
from gi.repository import Gtk, Adw
|
|
|
|
|
2022-08-13 10:27:59 +00:00
|
|
|
from .constants import rootdir
|
2022-08-11 16:39:52 +00:00
|
|
|
|
2022-08-13 10:24:16 +00:00
|
|
|
|
|
|
|
@Gtk.Template(resource_path=f"{rootdir}/ui/app_type_dialog.ui")
|
2022-08-19 19:17:12 +00:00
|
|
|
class GradienceAppTypeDialog(Adw.MessageDialog):
|
|
|
|
__gtype_name__ = "GradienceAppTypeDialog"
|
2022-07-22 12:29:32 +00:00
|
|
|
|
|
|
|
gtk4_app_type = Gtk.Template.Child("gtk4-app-type")
|
|
|
|
gtk3_app_type = Gtk.Template.Child("gtk3-app-type")
|
|
|
|
|
2022-08-11 16:39:52 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
heading,
|
|
|
|
body,
|
|
|
|
ok_response_name,
|
|
|
|
ok_response_label,
|
|
|
|
ok_response_appearance,
|
2022-09-07 15:52:50 +00:00
|
|
|
**kwargs,
|
2022-08-11 16:39:52 +00:00
|
|
|
):
|
2022-07-22 12:29:32 +00:00
|
|
|
super().__init__(**kwargs)
|
|
|
|
self.set_heading(heading)
|
|
|
|
self.set_body(body)
|
|
|
|
|
2022-07-25 14:35:40 +00:00
|
|
|
self.add_response("cancel", _("Cancel"))
|
2022-07-22 12:29:32 +00:00
|
|
|
self.add_response(ok_response_name, ok_response_label)
|
|
|
|
self.set_response_appearance(ok_response_name, ok_response_appearance)
|
|
|
|
self.set_default_response("cancel")
|
|
|
|
self.set_close_response("cancel")
|
|
|
|
|
|
|
|
def get_app_types(self):
|
|
|
|
return {
|
|
|
|
"gtk4": self.gtk4_app_type.get_active(),
|
2022-08-11 16:39:52 +00:00
|
|
|
"gtk3": self.gtk3_app_type.get_active(),
|
2022-07-22 12:29:32 +00:00
|
|
|
}
|