diff options
Diffstat (limited to 'main/src/windows')
| -rw-r--r-- | main/src/windows/conversation_details.vala | 2 | ||||
| -rw-r--r-- | main/src/windows/preferences_window/account_preferences_subpage.vala | 30 | ||||
| -rw-r--r-- | main/src/windows/preferences_window/accounts_preferences_page.vala | 5 | ||||
| -rw-r--r-- | main/src/windows/preferences_window/add_account_dialog.vala | 2 | ||||
| -rw-r--r-- | main/src/windows/preferences_window/change_password_dialog.vala | 3 | ||||
| -rw-r--r-- | main/src/windows/preferences_window/encryption_preferences_page.vala | 2 | ||||
| -rw-r--r-- | main/src/windows/preferences_window/preferences_dialog.vala (renamed from main/src/windows/preferences_window/preferences_window.vala) | 9 |
7 files changed, 25 insertions, 28 deletions
diff --git a/main/src/windows/conversation_details.vala b/main/src/windows/conversation_details.vala index d85783a2..1204a83e 100644 --- a/main/src/windows/conversation_details.vala +++ b/main/src/windows/conversation_details.vala @@ -7,7 +7,7 @@ using Gtk; namespace Dino.Ui.ConversationDetails { [GtkTemplate (ui = "/im/dino/Dino/conversation_details.ui")] - public class Dialog : Adw.Window { + public class Dialog : Adw.Dialog { [GtkChild] public unowned Stack stack; [GtkChild] public unowned Box about_box; [GtkChild] public unowned Button pin_button; diff --git a/main/src/windows/preferences_window/account_preferences_subpage.vala b/main/src/windows/preferences_window/account_preferences_subpage.vala index 92fffa76..7a17fbda 100644 --- a/main/src/windows/preferences_window/account_preferences_subpage.vala +++ b/main/src/windows/preferences_window/account_preferences_subpage.vala @@ -6,10 +6,9 @@ using Gtk; using Gdk; [GtkTemplate (ui = "/im/dino/Dino/preferences_window/account_preferences_subpage.ui")] -public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { +public class Dino.Ui.AccountPreferencesSubpage : Adw.NavigationPage { [GtkChild] public unowned Adw.HeaderBar headerbar; - [GtkChild] public unowned Button back_button; [GtkChild] public unowned AvatarPicture avatar; [GtkChild] public unowned Adw.ActionRow xmpp_address; [GtkChild] public unowned Adw.EntryRow local_alias; @@ -24,19 +23,16 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { [GtkChild] public unowned Button disable_account_button; public Account account { get { return model.selected_account.account; } } - public ViewModel.PreferencesWindow model { get; set; } + public ViewModel.PreferencesDialog model { get; set; } private Binding[] bindings = new Binding[0]; private ulong[] account_notify_ids = new ulong[0]; private ulong alias_entry_changed = 0; construct { + title = "Account"; headerbar.show_title = false; button_container.layout_manager = new NaturalDirectionBoxLayout((BoxLayout)button_container.layout_manager); - back_button.clicked.connect(() => { - var window = (Adw.PreferencesWindow) this.get_root(); - window.pop_subpage(); - }); edit_avatar_button.clicked.connect(() => { show_select_avatar(); }); @@ -52,8 +48,7 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { password_change.activatable_widget = new Label(""); password_change.activated.connect(() => { var dialog = new ChangePasswordDialog(model.get_change_password_dialog_model()); - dialog.set_transient_for((Gtk.Window)this.get_root()); - dialog.present(); + dialog.present((Gtk.Window)this.get_root()); }); enter_password_button.clicked.connect(() => { var dialog = new Adw.MessageDialog((Window)this.get_root(), "Enter password for %s".printf(account.bare_jid.to_string()), null); @@ -157,8 +152,7 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { } private void show_remove_account_dialog() { - Adw.MessageDialog dialog = new Adw.MessageDialog ( - (Window)this.get_root(), + Adw.AlertDialog dialog = new Adw.AlertDialog ( _("Remove account %s?".printf(account.bare_jid.to_string())), "You won't be able to access your conversation history anymore." ); @@ -169,13 +163,19 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { dialog.response.connect((response) => { if (response == "remove") { model.remove_account(account); - // Close the account subpage - var window = (Adw.PreferencesWindow) this.get_root(); - window.pop_subpage(); + + // Close the account subpage. Get the parent-times-x PreferencesDialog, to call pop_subpage() on it. + Widget parent = this.parent; + for (int i = 0; parent != null && i < 20; i++) { + if (parent.get_type() == typeof(Dino.Ui.PreferencesDialog)) { + ((Dino.Ui.PreferencesDialog) parent).pop_subpage(); + } + parent = parent.parent; + } } dialog.close(); }); - dialog.present(); + dialog.present((Window)this.get_root()); } private string get_status_label() { diff --git a/main/src/windows/preferences_window/accounts_preferences_page.vala b/main/src/windows/preferences_window/accounts_preferences_page.vala index 7f4c2f1b..2fe05088 100644 --- a/main/src/windows/preferences_window/accounts_preferences_page.vala +++ b/main/src/windows/preferences_window/accounts_preferences_page.vala @@ -9,7 +9,7 @@ public class Dino.Ui.PreferencesWindowAccounts : Adw.PreferencesPage { public Adw.PreferencesGroup active_accounts; public Adw.PreferencesGroup disabled_accounts; - public ViewModel.PreferencesWindow model { get; set; } + public ViewModel.PreferencesDialog model { get; set; } construct { this.title = _("Accounts"); @@ -36,11 +36,10 @@ public class Dino.Ui.PreferencesWindowAccounts : Adw.PreferencesPage { add_account_button.clicked.connect(() => { Ui.ManageAccounts.AddAccountDialog add_account_dialog = new Ui.ManageAccounts.AddAccountDialog(model.stream_interactor, model.db); - add_account_dialog.set_transient_for((Window)this.get_root()); add_account_dialog.added.connect((account) => { refresh(); }); - add_account_dialog.present(); + add_account_dialog.present((Window)this.get_root()); }); disabled_accounts.visible = false; // Only display disabled section if it contains accounts diff --git a/main/src/windows/preferences_window/add_account_dialog.vala b/main/src/windows/preferences_window/add_account_dialog.vala index 3ca183e1..2568a01e 100644 --- a/main/src/windows/preferences_window/add_account_dialog.vala +++ b/main/src/windows/preferences_window/add_account_dialog.vala @@ -8,7 +8,7 @@ using Xmpp; namespace Dino.Ui.ManageAccounts { [GtkTemplate (ui = "/im/dino/Dino/preferences_window/add_account_dialog.ui")] -public class AddAccountDialog : Adw.Window { +public class AddAccountDialog : Adw.Dialog { public signal void added(Account account); diff --git a/main/src/windows/preferences_window/change_password_dialog.vala b/main/src/windows/preferences_window/change_password_dialog.vala index f0c7dcf9..4a2c136c 100644 --- a/main/src/windows/preferences_window/change_password_dialog.vala +++ b/main/src/windows/preferences_window/change_password_dialog.vala @@ -7,7 +7,7 @@ using Xmpp; namespace Dino.Ui{ [GtkTemplate (ui = "/im/dino/Dino/preferences_window/change_password_dialog.ui")] - public class ChangePasswordDialog : Gtk.Dialog { + public class ChangePasswordDialog : Adw.Dialog { [GtkChild] private unowned Button change_password_button; [GtkChild] private unowned Stack change_password_stack; @@ -20,7 +20,6 @@ namespace Dino.Ui{ private ViewModel.ChangePasswordDialog model; public ChangePasswordDialog(ViewModel.ChangePasswordDialog model) { - Object(use_header_bar : 1); this.model = model; Util.force_error_color(change_password_error_label); diff --git a/main/src/windows/preferences_window/encryption_preferences_page.vala b/main/src/windows/preferences_window/encryption_preferences_page.vala index eec38908..f6f86ca9 100644 --- a/main/src/windows/preferences_window/encryption_preferences_page.vala +++ b/main/src/windows/preferences_window/encryption_preferences_page.vala @@ -10,7 +10,7 @@ public class Dino.Ui.PreferencesWindowEncryption : Adw.PreferencesPage { private Adw.PreferencesGroup accounts_group = new Adw.PreferencesGroup(); private ArrayList<Adw.PreferencesGroup> added_widgets = new ArrayList<Adw.PreferencesGroup>(); - public ViewModel.PreferencesWindow model { get; set; } + public ViewModel.PreferencesDialog model { get; set; } construct { this.add(accounts_group); diff --git a/main/src/windows/preferences_window/preferences_window.vala b/main/src/windows/preferences_window/preferences_dialog.vala index cee4e34e..7a70ca00 100644 --- a/main/src/windows/preferences_window/preferences_window.vala +++ b/main/src/windows/preferences_window/preferences_dialog.vala @@ -5,14 +5,14 @@ using Xmpp.Xep; using Gee; using Gtk; -[GtkTemplate (ui = "/im/dino/Dino/preferences_window/preferences_window.ui")] -public class Dino.Ui.PreferencesWindow : Adw.PreferencesWindow { +[GtkTemplate (ui = "/im/dino/Dino/preferences_window/preferences_dialog.ui")] +public class Dino.Ui.PreferencesDialog : Adw.PreferencesDialog { [GtkChild] public unowned Dino.Ui.PreferencesWindowAccounts accounts_page; [GtkChild] public unowned Dino.Ui.PreferencesWindowEncryption encryption_page; [GtkChild] public unowned Dino.Ui.GeneralPreferencesPage general_page; public Dino.Ui.AccountPreferencesSubpage account_page = new Dino.Ui.AccountPreferencesSubpage(); - [GtkChild] public unowned ViewModel.PreferencesWindow model { get; } + [GtkChild] public unowned ViewModel.PreferencesDialog model { get; } construct { this.bind_property("model", accounts_page, "model", BindingFlags.SYNC_CREATE); @@ -21,8 +21,7 @@ public class Dino.Ui.PreferencesWindow : Adw.PreferencesWindow { accounts_page.account_chosen.connect((account) => { model.selected_account = model.account_details[account]; - this.present_subpage(account_page); -// this.present_subpage(new Adw.NavigationPage(account_page, "Account: %s".printf(account.bare_jid.to_string()))); + this.push_subpage(account_page); }); } }
\ No newline at end of file |
