Add non-CSD alternative for more windows

This commit is contained in:
fiaxh 2019-02-20 23:08:30 +01:00
parent cc7b0aa7bd
commit 161e4c1986
8 changed files with 17 additions and 9 deletions

View file

@ -4,7 +4,7 @@
<property name="modal">True</property> <property name="modal">True</property>
<child type="titlebar"> <child type="titlebar">
<object class="GtkHeaderBar"> <object class="GtkHeaderBar">
<property name="title" translatable="yes">Preferences</property> <property name="title" translatable="yes">Settings</property>
<property name="show_close_button">True</property> <property name="show_close_button">True</property>
<property name="visible">True</property> <property name="visible">True</property>
</object> </object>

View file

@ -134,6 +134,10 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
set_accels_for_action("app.add_conference", new string[]{"<Ctrl>G"}); set_accels_for_action("app.add_conference", new string[]{"<Ctrl>G"});
} }
public bool use_csd() {
return Environment.get_variable("GTK_CSD") != "0";
}
private void show_accounts_window() { private void show_accounts_window() {
ManageAccounts.Dialog dialog = new ManageAccounts.Dialog(stream_interactor, db); ManageAccounts.Dialog dialog = new ManageAccounts.Dialog(stream_interactor, db);
dialog.set_transient_for(get_active_window()); dialog.set_transient_for(get_active_window());

View file

@ -30,12 +30,14 @@ public class Dialog : Gtk.Dialog {
} }
public Dialog(StreamInteractor stream_interactor, Conversation conversation) { public Dialog(StreamInteractor stream_interactor, Conversation conversation) {
Object(use_header_bar : 1); Object(use_header_bar : Util.use_csd() ? 1 : 0);
this.stream_interactor = stream_interactor; this.stream_interactor = stream_interactor;
this.conversation = conversation; this.conversation = conversation;
title = conversation.type_ == Conversation.Type.GROUPCHAT ? _("Conference Details") : _("Contact Details"); title = conversation.type_ == Conversation.Type.GROUPCHAT ? _("Conference Details") : _("Contact Details");
(get_header_bar() as HeaderBar).set_subtitle(Util.get_conversation_display_name(stream_interactor, conversation)); if (Util.use_csd()) {
(get_header_bar() as HeaderBar).set_subtitle(Util.get_conversation_display_name(stream_interactor, conversation));
}
setup_top(); setup_top();
contact_details.add.connect(add_entry); contact_details.add.connect(add_entry);

View file

@ -78,7 +78,7 @@ public class Dialog : Gtk.Dialog {
} }
public Dialog(StreamInteractor stream_interactor, Database db) { public Dialog(StreamInteractor stream_interactor, Database db) {
Object(use_header_bar : 1); Object(use_header_bar : Util.use_csd() ? 1 : 0);
this.db = db; this.db = db;
this.stream_interactor = stream_interactor; this.stream_interactor = stream_interactor;
foreach (Account account in db.get_accounts()) { foreach (Account account in db.get_accounts()) {

View file

@ -13,7 +13,7 @@ class SettingsDialog : Dialog {
Dino.Entities.Settings settings = Dino.Application.get_default().settings; Dino.Entities.Settings settings = Dino.Application.get_default().settings;
public SettingsDialog() { public SettingsDialog() {
Object(use_header_bar : 1); Object(use_header_bar : Util.use_csd() ? 1 : 0);
typing_checkbutton.active = settings.send_typing; typing_checkbutton.active = settings.send_typing;
marker_checkbutton.active = settings.send_marker; marker_checkbutton.active = settings.send_marker;

View file

@ -265,7 +265,7 @@ public int get_only_emoji_count(string markup_text) {
} }
public bool use_csd() { public bool use_csd() {
return Environment.get_variable("GTK_CSD") != "0"; return (GLib.Application.get_default() as Application).use_csd();
} }
} }

View file

@ -31,12 +31,14 @@ public class ContactDetailsDialog : Gtk.Dialog {
[GtkChild] private Popover qrcode_popover; [GtkChild] private Popover qrcode_popover;
public ContactDetailsDialog(Plugin plugin, Account account, Jid jid) { public ContactDetailsDialog(Plugin plugin, Account account, Jid jid) {
Object(use_header_bar : 1); Object(use_header_bar : Environment.get_variable("GTK_CSD") != "0" ? 1 : 0);
this.plugin = plugin; this.plugin = plugin;
this.account = account; this.account = account;
this.jid = jid; this.jid = jid;
(get_header_bar() as HeaderBar).set_subtitle(jid.bare_jid.to_string()); if (Environment.get_variable("GTK_CSD") != "0") {
(get_header_bar() as HeaderBar).set_subtitle(jid.bare_jid.to_string());
}
int identity_id = plugin.db.identity.get_id(account.id); int identity_id = plugin.db.identity.get_id(account.id);
if (identity_id < 0) return; if (identity_id < 0) return;

View file

@ -29,7 +29,7 @@ public class ManageKeyDialog : Gtk.Dialog {
private int current_response; private int current_response;
public ManageKeyDialog(Row device, Database db) { public ManageKeyDialog(Row device, Database db) {
Object(use_header_bar : 1); Object(use_header_bar : Environment.get_variable("GTK_CSD") != "0" ? 1 : 0);
this.device = device; this.device = device;
this.db = db; this.db = db;