From f17926329915fcd8f95e00ab042d1a22ea2b7371 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 6 Oct 2025 18:17:17 +0200 Subject: Use AdwDialog for conversation details and preferences --- main/src/ui/application.vala | 12 +- main/src/ui/chat_input/chat_input_controller.vala | 4 +- main/src/ui/conversation_details.vala | 7 +- main/src/ui/conversation_titlebar/menu_entry.vala | 4 +- main/src/ui/main_window_controller.vala | 3 +- main/src/view_model/preferences_dialog.vala | 129 +++++++++++++++++++++ main/src/view_model/preferences_window.vala | 129 --------------------- main/src/windows/conversation_details.vala | 2 +- .../account_preferences_subpage.vala | 30 ++--- .../accounts_preferences_page.vala | 5 +- .../preferences_window/add_account_dialog.vala | 2 +- .../preferences_window/change_password_dialog.vala | 3 +- .../encryption_preferences_page.vala | 2 +- .../preferences_window/preferences_dialog.vala | 27 +++++ .../preferences_window/preferences_window.vala | 28 ----- 15 files changed, 191 insertions(+), 196 deletions(-) create mode 100644 main/src/view_model/preferences_dialog.vala delete mode 100644 main/src/view_model/preferences_window.vala create mode 100644 main/src/windows/preferences_window/preferences_dialog.vala delete mode 100644 main/src/windows/preferences_window/preferences_window.vala (limited to 'main/src') diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index ffdd2df3..b0473c16 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -153,9 +153,9 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application { string stack_value = variant.get_child_value(1).get_string(); - var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor, window); + var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor); conversation_details.stack.visible_child_name = stack_value; - conversation_details.present(); + conversation_details.present(window); }); add_action(open_conversation_details_action); @@ -251,16 +251,16 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application { } private void show_preferences_window() { - Ui.PreferencesWindow dialog = new Ui.PreferencesWindow() { transient_for = window }; + Ui.PreferencesDialog dialog = new Ui.PreferencesDialog(); dialog.model.populate(db, stream_interactor); - dialog.present(); + dialog.present(window); } private void show_preferences_account_window(Account account) { - Ui.PreferencesWindow dialog = new Ui.PreferencesWindow() { transient_for = window }; + Ui.PreferencesDialog dialog = new Ui.PreferencesDialog(); dialog.model.populate(db, stream_interactor); dialog.accounts_page.account_chosen(account); - dialog.present(); + dialog.present(window); } private void show_about_window() { diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala index 07499aa4..660f29bb 100644 --- a/main/src/ui/chat_input/chat_input_controller.vala +++ b/main/src/ui/chat_input/chat_input_controller.vala @@ -56,8 +56,8 @@ public class ChatInputController : Object { status_description_label.activate_link.connect((uri) => { if (uri == OPEN_CONVERSATION_DETAILS_URI){ - var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor, (Window)chat_input.get_root()); - conversation_details.present(); + var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor); + conversation_details.present((Window)chat_input.get_root()); } return true; }); diff --git a/main/src/ui/conversation_details.vala b/main/src/ui/conversation_details.vala index a1b7a9ce..404f357d 100644 --- a/main/src/ui/conversation_details.vala +++ b/main/src/ui/conversation_details.vala @@ -189,20 +189,19 @@ namespace Dino.Ui.ConversationDetails { } } - public Dialog setup_dialog(Conversation conversation, StreamInteractor stream_interactor, Window parent) { - var dialog = new Dialog() { transient_for = parent }; + public Dialog setup_dialog(Conversation conversation, StreamInteractor stream_interactor) { + var dialog = new Dialog(); var model = new Model.ConversationDetails(); model.populate(stream_interactor, conversation); bind_dialog(model, dialog.model, stream_interactor); set_about_rows(model, dialog.model, stream_interactor); - dialog.close_request.connect(() => { + dialog.closed.connect(() => { // Only send the config form if something was changed if (model.data_form_bak != null && model.data_form_bak != model.data_form.stanza_node.to_string()) { stream_interactor.get_module(MucManager.IDENTITY).set_config_form.begin(conversation.account, conversation.counterpart, model.data_form); } - return false; }); Plugins.ContactDetails contact_details = new Plugins.ContactDetails(); diff --git a/main/src/ui/conversation_titlebar/menu_entry.vala b/main/src/ui/conversation_titlebar/menu_entry.vala index ca8c23b3..798c2a63 100644 --- a/main/src/ui/conversation_titlebar/menu_entry.vala +++ b/main/src/ui/conversation_titlebar/menu_entry.vala @@ -42,8 +42,8 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object { } private void open_conversation_details() { - var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor, (Window)button.get_root()); - conversation_details.present(); + var conversation_details = ConversationDetails.setup_dialog(conversation, stream_interactor); + conversation_details.present((Window)button.get_root()); } public Object? get_widget(Plugins.WidgetType type) { diff --git a/main/src/ui/main_window_controller.vala b/main/src/ui/main_window_controller.vala index 118eb73b..93b9fd69 100644 --- a/main/src/ui/main_window_controller.vala +++ b/main/src/ui/main_window_controller.vala @@ -66,8 +66,7 @@ public class MainWindowController : Object { window.welcome_placeholder.primary_button.clicked.connect(() => { ManageAccounts.AddAccountDialog dialog = new ManageAccounts.AddAccountDialog(stream_interactor, db); - dialog.set_transient_for(app.get_active_window()); - dialog.present(); + dialog.present(app.get_active_window()); }); window.accounts_placeholder.primary_button.clicked.connect(() => { app.activate_action("preferences", null); }); window.conversation_selector.conversation_selected.connect((conversation) => select_conversation(conversation)); diff --git a/main/src/view_model/preferences_dialog.vala b/main/src/view_model/preferences_dialog.vala new file mode 100644 index 00000000..c09c650a --- /dev/null +++ b/main/src/view_model/preferences_dialog.vala @@ -0,0 +1,129 @@ +using Dino.Entities; +using Xmpp; +using Xmpp.Xep; +using Gee; + +public class Dino.Ui.ViewModel.PreferencesDialog : Object { + public signal void update(); + + public HashMap account_details = new HashMap(Account.hash_func, Account.equals_func); + public AccountDetails selected_account { get; set; } + public Gtk.SingleSelection active_accounts_selection { get; default=new Gtk.SingleSelection(new GLib.ListStore(typeof(ViewModel.AccountDetails))); } + + public StreamInteractor stream_interactor; + public Database db; + + public GeneralPreferencesPage general_page { get; set; default=new GeneralPreferencesPage(); } + + public void populate(Database db, StreamInteractor stream_interactor) { + this.db = db; + this.stream_interactor = stream_interactor; + + stream_interactor.connection_manager.connection_error.connect((account, error) => { + var account_detail = account_details[account]; + if (account_details != null) { + account_detail.connection_error = error; + } + }); + stream_interactor.connection_manager.connection_state_changed.connect((account, state) => { + var account_detail = account_details[account]; + if (account_details != null) { + account_detail.connection_state = state; + account_detail.connection_error = stream_interactor.connection_manager.get_error(account); + } + }); + stream_interactor.account_added.connect(update_data); + stream_interactor.account_removed.connect(update_data); + + bind_general_page(); + update_data(); + } + + private void update_data() { + // account_details should hold the correct set of accounts (add or remove some if needed), but do not override remaining ones (would destroy bindings) + var current_accounts = db.get_accounts(); + var remove_accounts = new ArrayList(); + foreach (var account in account_details.keys) { + if (!current_accounts.contains(account)) remove_accounts.add(account); + } + foreach (var account in remove_accounts) { + account_details.unset(account); + } + foreach (var account in current_accounts) { + if (!account_details.has_key(account)) { + account_details[account] = new AccountDetails(account, stream_interactor); + } + if (selected_account == null && account.enabled) selected_account = account_details[account]; + } + + // Update account picker model with currently active accounts + var list_model = (GLib.ListStore) active_accounts_selection.model; + list_model.remove_all(); + foreach (var account in stream_interactor.get_accounts()) { + list_model.append(new ViewModel.AccountDetails(account, stream_interactor)); + } + + update(); + } + + public void set_avatar_uri(Account account, string uri) { + stream_interactor.get_module(AvatarManager.IDENTITY).publish(account, uri); + } + + public void remove_avatar(Account account) { + stream_interactor.get_module(AvatarManager.IDENTITY).unset_avatar(account); + } + + public void remove_account(Account account) { + stream_interactor.disconnect_account.begin(account, () => { + account.remove(); + update_data(); + }); + } + + public void reconnect_account(Account account) { + stream_interactor.disconnect_account.begin(account, () => { + stream_interactor.connect_account(account); + }); + } + + public void enable_disable_account(Account account) { + if (account.enabled) { + account.enabled = false; + stream_interactor.disconnect_account.begin(account); + } else { + account.enabled = true; + stream_interactor.connect_account(account); + } + update_data(); + } + + public ChangePasswordDialog get_change_password_dialog_model() { + return new ChangePasswordDialog() { + account = selected_account.account, + stream_interactor = stream_interactor + }; + } + + private void bind_general_page() { + var settings = Dino.Application.get_default().settings; + settings.bind_property("send-typing", general_page, "send-typing", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + settings.bind_property("send-marker", general_page, "send-marker", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + settings.bind_property("notifications", general_page, "notifications", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + settings.bind_property("convert-utf8-smileys", general_page, "convert-emojis", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); + } +} + +public class Dino.Ui.ViewModel.ChangePasswordDialog : Object { + public Entities.Account account { get; set; } + public StreamInteractor stream_interactor { get; set; } + + public async string? change_password(string new_password) { + var res = yield stream_interactor.get_module(Register.IDENTITY).change_password(account, new_password); + if (res == null) { + account.password = new_password; + } + return res; + } +} + diff --git a/main/src/view_model/preferences_window.vala b/main/src/view_model/preferences_window.vala deleted file mode 100644 index 7d967605..00000000 --- a/main/src/view_model/preferences_window.vala +++ /dev/null @@ -1,129 +0,0 @@ -using Dino.Entities; -using Xmpp; -using Xmpp.Xep; -using Gee; - -public class Dino.Ui.ViewModel.PreferencesWindow : Object { - public signal void update(); - - public HashMap account_details = new HashMap(Account.hash_func, Account.equals_func); - public AccountDetails selected_account { get; set; } - public Gtk.SingleSelection active_accounts_selection { get; default=new Gtk.SingleSelection(new GLib.ListStore(typeof(ViewModel.AccountDetails))); } - - public StreamInteractor stream_interactor; - public Database db; - - public GeneralPreferencesPage general_page { get; set; default=new GeneralPreferencesPage(); } - - public void populate(Database db, StreamInteractor stream_interactor) { - this.db = db; - this.stream_interactor = stream_interactor; - - stream_interactor.connection_manager.connection_error.connect((account, error) => { - var account_detail = account_details[account]; - if (account_details != null) { - account_detail.connection_error = error; - } - }); - stream_interactor.connection_manager.connection_state_changed.connect((account, state) => { - var account_detail = account_details[account]; - if (account_details != null) { - account_detail.connection_state = state; - account_detail.connection_error = stream_interactor.connection_manager.get_error(account); - } - }); - stream_interactor.account_added.connect(update_data); - stream_interactor.account_removed.connect(update_data); - - bind_general_page(); - update_data(); - } - - private void update_data() { - // account_details should hold the correct set of accounts (add or remove some if needed), but do not override remaining ones (would destroy bindings) - var current_accounts = db.get_accounts(); - var remove_accounts = new ArrayList(); - foreach (var account in account_details.keys) { - if (!current_accounts.contains(account)) remove_accounts.add(account); - } - foreach (var account in remove_accounts) { - account_details.unset(account); - } - foreach (var account in current_accounts) { - if (!account_details.has_key(account)) { - account_details[account] = new AccountDetails(account, stream_interactor); - } - if (selected_account == null && account.enabled) selected_account = account_details[account]; - } - - // Update account picker model with currently active accounts - var list_model = (GLib.ListStore) active_accounts_selection.model; - list_model.remove_all(); - foreach (var account in stream_interactor.get_accounts()) { - list_model.append(new ViewModel.AccountDetails(account, stream_interactor)); - } - - update(); - } - - public void set_avatar_uri(Account account, string uri) { - stream_interactor.get_module(AvatarManager.IDENTITY).publish(account, uri); - } - - public void remove_avatar(Account account) { - stream_interactor.get_module(AvatarManager.IDENTITY).unset_avatar(account); - } - - public void remove_account(Account account) { - stream_interactor.disconnect_account.begin(account, () => { - account.remove(); - update_data(); - }); - } - - public void reconnect_account(Account account) { - stream_interactor.disconnect_account.begin(account, () => { - stream_interactor.connect_account(account); - }); - } - - public void enable_disable_account(Account account) { - if (account.enabled) { - account.enabled = false; - stream_interactor.disconnect_account.begin(account); - } else { - account.enabled = true; - stream_interactor.connect_account(account); - } - update_data(); - } - - public ChangePasswordDialog get_change_password_dialog_model() { - return new ChangePasswordDialog() { - account = selected_account.account, - stream_interactor = stream_interactor - }; - } - - private void bind_general_page() { - var settings = Dino.Application.get_default().settings; - settings.bind_property("send-typing", general_page, "send-typing", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - settings.bind_property("send-marker", general_page, "send-marker", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - settings.bind_property("notifications", general_page, "notifications", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - settings.bind_property("convert-utf8-smileys", general_page, "convert-emojis", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL); - } -} - -public class Dino.Ui.ViewModel.ChangePasswordDialog : Object { - public Entities.Account account { get; set; } - public StreamInteractor stream_interactor { get; set; } - - public async string? change_password(string new_password) { - var res = yield stream_interactor.get_module(Register.IDENTITY).change_password(account, new_password); - if (res == null) { - account.password = new_password; - } - return res; - } -} - 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 added_widgets = new ArrayList(); - 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_dialog.vala b/main/src/windows/preferences_window/preferences_dialog.vala new file mode 100644 index 00000000..7a70ca00 --- /dev/null +++ b/main/src/windows/preferences_window/preferences_dialog.vala @@ -0,0 +1,27 @@ +using Gdk; +using Dino.Entities; +using Xmpp; +using Xmpp.Xep; +using Gee; +using Gtk; + +[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.PreferencesDialog model { get; } + + construct { + this.bind_property("model", accounts_page, "model", BindingFlags.SYNC_CREATE); + this.bind_property("model", account_page, "model", BindingFlags.SYNC_CREATE); + this.bind_property("model", encryption_page, "model", BindingFlags.SYNC_CREATE); + + accounts_page.account_chosen.connect((account) => { + model.selected_account = model.account_details[account]; + this.push_subpage(account_page); + }); + } +} \ No newline at end of file diff --git a/main/src/windows/preferences_window/preferences_window.vala b/main/src/windows/preferences_window/preferences_window.vala deleted file mode 100644 index cee4e34e..00000000 --- a/main/src/windows/preferences_window/preferences_window.vala +++ /dev/null @@ -1,28 +0,0 @@ -using Gdk; -using Dino.Entities; -using Xmpp; -using Xmpp.Xep; -using Gee; -using Gtk; - -[GtkTemplate (ui = "/im/dino/Dino/preferences_window/preferences_window.ui")] -public class Dino.Ui.PreferencesWindow : Adw.PreferencesWindow { - [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; } - - construct { - this.bind_property("model", accounts_page, "model", BindingFlags.SYNC_CREATE); - this.bind_property("model", account_page, "model", BindingFlags.SYNC_CREATE); - this.bind_property("model", encryption_page, "model", BindingFlags.SYNC_CREATE); - - 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()))); - }); - } -} \ No newline at end of file -- cgit v1.3