diff options
author | fiaxh <git@lightrise.org> | 2024-09-16 22:45:47 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2024-09-16 22:45:47 +0200 |
commit | b09556f03349b51d95c14d1046add355a4754e01 (patch) | |
tree | 1743eb40f7afc989c100efab2053c6e960278783 | |
parent | 65404b24424b2c554c611b24e9ddf7e12ce1a9f4 (diff) | |
download | dino-b09556f03349b51d95c14d1046add355a4754e01.tar.gz dino-b09556f03349b51d95c14d1046add355a4754e01.zip |
Preferences Window: Small improvements
-rw-r--r-- | main/data/preferences_window/account_preferences_subpage.ui | 7 | ||||
-rw-r--r-- | main/src/windows/preferences_window/account_preferences_subpage.vala | 28 |
2 files changed, 15 insertions, 20 deletions
diff --git a/main/data/preferences_window/account_preferences_subpage.ui b/main/data/preferences_window/account_preferences_subpage.ui index e0fa4f76..fa273053 100644 --- a/main/data/preferences_window/account_preferences_subpage.ui +++ b/main/data/preferences_window/account_preferences_subpage.ui @@ -75,13 +75,8 @@ </object> </child> <child> - <object class="AdwActionRow" id="local_alias"> + <object class="AdwEntryRow" id="local_alias"> <property name="title" translatable="yes">Local alias</property> - <child type="suffix"> - <object class="GtkEntry" id="local_alias_entry"> - <property name="valign">center</property> - </object> - </child> </object> </child> <child> diff --git a/main/src/windows/preferences_window/account_preferences_subpage.vala b/main/src/windows/preferences_window/account_preferences_subpage.vala index e0896158..d6ddb2b4 100644 --- a/main/src/windows/preferences_window/account_preferences_subpage.vala +++ b/main/src/windows/preferences_window/account_preferences_subpage.vala @@ -12,8 +12,7 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { [GtkChild] public unowned Button back_button; [GtkChild] public unowned AvatarPicture avatar; [GtkChild] public unowned Adw.ActionRow xmpp_address; - [GtkChild] public unowned Adw.ActionRow local_alias; // TODO replace with EntryRow once we require Adw 1.2 - [GtkChild] public unowned Entry local_alias_entry; + [GtkChild] public unowned Adw.EntryRow local_alias; [GtkChild] public unowned Adw.ActionRow connection_status; [GtkChild] public unowned Button enter_password_button; [GtkChild] public unowned Box avatar_menu_box; @@ -152,25 +151,26 @@ public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box { } private void show_remove_account_dialog() { - Gtk.MessageDialog msg = new Gtk.MessageDialog ( - (Window)this.get_root(), Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL, - Gtk.MessageType.WARNING, Gtk.ButtonsType.OK_CANCEL, - _("Remove account %s?"), account.bare_jid.to_string()); - msg.secondary_text = "You won't be able to access your conversation history anymore."; // TODO remove history! - Button ok_button = msg.get_widget_for_response(ResponseType.OK) as Button; - ok_button.label = _("Remove"); - ok_button.add_css_class("destructive-action"); - msg.response.connect((response) => { - if (response == ResponseType.OK) { + Adw.MessageDialog dialog = new Adw.MessageDialog ( + (Window)this.get_root(), + _("Remove account %s?".printf(account.bare_jid.to_string())), + "You won't be able to access your conversation history anymore." + ); + // TODO remove history! + dialog.add_response("cancel", "Cancel"); + dialog.add_response("remove", "Remove"); + dialog.set_response_appearance("remove", Adw.ResponseAppearance.DESTRUCTIVE); + dialog.response.connect((response) => { + if (response == "remove") { model.remove_account(account); // Close the account subpage var window = (Adw.PreferencesWindow) this.get_root(); window.close_subpage(); // window.pop_subpage(); } - msg.close(); + dialog.close(); }); - msg.present(); + dialog.present(); } private string get_status_label() { |