From 6a182ba313026b93d54a9d2246a0ab68894c6833 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 6 Jan 2023 17:24:52 +0100 Subject: [PATCH] Only use Adw.AboutWindow for Adwaita >= 1.2 --- main/CMakeLists.txt | 3 +++ main/src/ui/application.vala | 36 +++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index c133a399..de5f2667 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -111,6 +111,9 @@ set(MAIN_DEFINITIONS) if(GTK4_VERSION VERSION_GREATER_EQUAL "4.6") set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} GTK_4_6) endif() +if(Adwaita_VERSION VERSION_GREATER_EQUAL "1.2") + set(MAIN_DEFINITIONS ${MAIN_DEFINITIONS} Adw_1_2) +endif() vala_precompile(MAIN_VALA_C SOURCES diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index b810852c..8e252dc6 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -272,24 +272,30 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application { case "0.3": version = @"$version - Theikenmeer"; break; } } - Adw.AboutWindow about = new Adw.AboutWindow(); - about.destroy_with_parent = true; - about.transient_for = window; - about.modal = true; - about.title = _("About Dino"); - - about.application_icon = "im.dino.Dino"; - about.application_name = "Dino"; - about.version = version; - about.comments = "Dino. Communicating happiness."; - about.website = "https://dino.im/"; - about.copyright = "Copyright © 2016-2022 - Dino Team"; - about.license_type = License.GPL_3_0; +#if Adw_1_2 + Adw.AboutWindow about_window = new Adw.AboutWindow(); + about_window.application_icon = "im.dino.Dino"; + about_window.application_name = "Dino"; +#else + Gtk.AboutDialog about_window = new Gtk.AboutDialog(); + about_window.logo_icon_name = "im.dino.Dino"; + about_window.program_name = "Dino"; + about_window.website_label = "dino.im"; +#endif + about_window.destroy_with_parent = true; + about_window.transient_for = window; + about_window.modal = true; + about_window.title = _("About Dino"); + about_window.version = version; + about_window.comments = "Dino. Communicating happiness."; + about_window.website = "https://dino.im/"; + about_window.copyright = "Copyright © 2016-2022 - Dino Team"; + about_window.license_type = License.GPL_3_0; if (!use_csd()) { - about.set_titlebar(null); + about_window.set_titlebar(null); } - about.present(); + about_window.present(); } private void show_join_muc_dialog(Account? account, string jid) {