From 80498c7e37170f993bb94d9c1234a2972c0692ac Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 5 Mar 2021 12:21:04 -0600 Subject: [PATCH] Adjust ShortcutsWindow + AboutDialog for non-CSD mode --- main/src/ui/application.vala | 39 +++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 17d67e9e..4576e7d9 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -185,7 +185,16 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { SimpleAction open_shortcuts_action = new SimpleAction("open_shortcuts", null); open_shortcuts_action.activate.connect((variant) => { Builder builder = new Builder.from_resource("/im/dino/Dino/shortcuts.ui"); - var dialog = (ShortcutsWindow) builder.get_object("shortcuts-window"); + ShortcutsWindow dialog = (ShortcutsWindow) builder.get_object("shortcuts-window"); + if (!use_csd()) { + // Hack to prevent CRITICAL in Gtk when trying to destroy non-existant headerbar + Widget shortcuts_hack = dialog.get_titlebar(); + dialog.destroy.connect_after(() => { + shortcuts_hack = null; + }); + dialog.set_titlebar(null); + } + dialog.title = _("Keyboard Shortcuts"); dialog.set_transient_for(get_active_window()); dialog.present(); }); @@ -217,15 +226,25 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { case "0.2": version = @"$version - Mexican Caribbean Coral Reefs"; break; } } - show_about_dialog(get_active_window(), - logo_icon_name: "im.dino.Dino", - program_name: "Dino", - version: version, - comments: "Dino. Communicating happiness.", - website: "https://dino.im/", - website_label: "dino.im", - copyright: "Copyright © 2016-2020 - Dino Team", - license_type: License.GPL_3_0); + Gtk.AboutDialog dialog = new Gtk.AboutDialog(); + dialog.destroy_with_parent = true; + dialog.transient_for = window; + dialog.modal = true; + dialog.title = _("About Dino"); + + dialog.logo_icon_name = "im.dino.Dino"; + dialog.program_name = "Dino"; + dialog.version = version; + dialog.comments = "Dino. Communicating happiness."; + dialog.website = "https://dino.im/"; + dialog.website_label = "dino.im"; + dialog.copyright = "Copyright © 2016-2021 - Dino Team"; + dialog.license_type = License.GPL_3_0; + + if (!use_csd()) { + dialog.set_titlebar(null); + } + dialog.present(); } private void show_join_muc_dialog(Account? account, string jid) {