aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2025-10-06 18:17:17 +0200
committerfiaxh <git@lightrise.org>2025-10-06 18:17:17 +0200
commitf17926329915fcd8f95e00ab042d1a22ea2b7371 (patch)
tree3e740e85246e097b9f1a767b24a450f772af44d1 /main
parent18f87d11986f1021d98f1be58c89296d852120c3 (diff)
Use AdwDialog for conversation details and preferences
Diffstat (limited to 'main')
-rw-r--r--main/data/conversation_details.ui6
-rw-r--r--main/data/gresource.xml2
-rw-r--r--main/data/preferences_window/account_preferences_subpage.ui225
-rw-r--r--main/data/preferences_window/add_account_dialog.ui6
-rw-r--r--main/data/preferences_window/change_password_dialog.ui124
-rw-r--r--main/data/preferences_window/preferences_dialog.ui (renamed from main/data/preferences_window/preferences_window.ui)10
-rw-r--r--main/meson.build4
-rw-r--r--main/src/ui/application.vala12
-rw-r--r--main/src/ui/chat_input/chat_input_controller.vala4
-rw-r--r--main/src/ui/conversation_details.vala7
-rw-r--r--main/src/ui/conversation_titlebar/menu_entry.vala4
-rw-r--r--main/src/ui/main_window_controller.vala3
-rw-r--r--main/src/view_model/preferences_dialog.vala (renamed from main/src/view_model/preferences_window.vala)2
-rw-r--r--main/src/windows/conversation_details.vala2
-rw-r--r--main/src/windows/preferences_window/account_preferences_subpage.vala30
-rw-r--r--main/src/windows/preferences_window/accounts_preferences_page.vala5
-rw-r--r--main/src/windows/preferences_window/add_account_dialog.vala2
-rw-r--r--main/src/windows/preferences_window/change_password_dialog.vala3
-rw-r--r--main/src/windows/preferences_window/encryption_preferences_page.vala2
-rw-r--r--main/src/windows/preferences_window/preferences_dialog.vala (renamed from main/src/windows/preferences_window/preferences_window.vala)9
20 files changed, 231 insertions, 231 deletions
diff --git a/main/data/conversation_details.ui b/main/data/conversation_details.ui
index d3ab4990..021eb901 100644
--- a/main/data/conversation_details.ui
+++ b/main/data/conversation_details.ui
@@ -3,9 +3,9 @@
<requires lib="gtk" version="4.0"/>
<object class="DinoUiViewModelConversationDetails" id="model"/>
<template class="DinoUiConversationDetailsDialog">
- <property name="default-width">600</property>
- <property name="default-height">590</property>
- <property name="modal">True</property>
+ <property name="content-width">600</property>
+ <property name="content-height">600</property>
+ <property name="follows-content-size">False</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
diff --git a/main/data/gresource.xml b/main/data/gresource.xml
index e39295c4..e459dfd3 100644
--- a/main/data/gresource.xml
+++ b/main/data/gresource.xml
@@ -60,7 +60,7 @@
<file>preferences_window/add_account_dialog.ui</file>
<file>preferences_window/change_password_dialog.ui</file>
<file>preferences_window/general_preferences_page.ui</file>
- <file>preferences_window/preferences_window.ui</file>
+ <file>preferences_window/preferences_dialog.ui</file>
<file>join_room_dialog.ui</file>
<file>join_room_dialog1.ui</file>
diff --git a/main/data/preferences_window/account_preferences_subpage.ui b/main/data/preferences_window/account_preferences_subpage.ui
index 0615428c..d9bdd076 100644
--- a/main/data/preferences_window/account_preferences_subpage.ui
+++ b/main/data/preferences_window/account_preferences_subpage.ui
@@ -2,100 +2,59 @@
<interface>
<requires lib="gtk" version="4.0"/>
<template class="DinoUiAccountPreferencesSubpage">
- <property name="orientation">vertical</property>
<child>
- <object class="AdwHeaderBar" id="headerbar">
- <style>
- <class name="flat"/>
- </style>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkButton" id="back_button">
- <property name="icon-name">go-previous-symbolic</property>
+ <object class="AdwHeaderBar" id="headerbar">
+ <style>
+ <class name="flat"/>
+ </style>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkScrolledWindow">
- <property name="vexpand">True</property>
- <property name="hexpand">True</property>
<child>
- <object class="AdwClamp">
+ <object class="GtkScrolledWindow">
+ <property name="vexpand">True</property>
+ <property name="hexpand">True</property>
<child>
- <object class="GtkBox">
- <property name="margin-top">24</property>
- <property name="margin-bottom">24</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="spacing">24</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkOverlay">
- <property name="halign">center</property>
- <property name="child">
- <object class="DinoUiAvatarPicture" id="avatar">
- <property name="height-request">144</property>
- <property name="width-request">144</property>
- </object>
- </property>
- <child type="overlay">
- <object class="GtkBox" id="avatar_menu_box">
- <property name="opacity">0.9</property>
- <property name="margin-end">6</property>
- <property name="margin-bottom">6</property>
- <property name="halign">end</property>
- <property name="valign">end</property>
- <style>
- <class name="card"/>
- <class name="toolbar"/>
- <class name="overlay-toolbar"/>
- </style>
- <child>
- <object class="GtkButton" id="edit_avatar_button">
- <property name="icon-name">document-edit-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="remove_avatar_button">
- <property name="icon-name">user-trash-symbolic</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <object class="AdwClamp">
<child>
- <object class="AdwPreferencesGroup">
- <child>
- <object class="AdwActionRow" id="xmpp_address">
- <property name="title" translatable="yes">XMPP Address</property>
- <property name="subtitle_selectable">True</property>
- <style>
- <class name="property"/>
- </style>
- </object>
- </child>
- <child>
- <object class="AdwEntryRow" id="local_alias">
- <property name="title" translatable="yes">Local alias</property>
- </object>
- </child>
+ <object class="GtkBox">
+ <property name="margin-top">24</property>
+ <property name="margin-bottom">24</property>
+ <property name="margin-start">12</property>
+ <property name="margin-end">12</property>
+ <property name="spacing">24</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="AdwActionRow" id="password_change">
- <property name="title" translatable="yes">Password</property>
- <child type="suffix">
- <object class="GtkBox">
- <property name="opacity">0.7</property>
- <property name="spacing">6</property>
- <property name="orientation">horizontal</property>
+ <object class="GtkOverlay">
+ <property name="halign">center</property>
+ <property name="child">
+ <object class="DinoUiAvatarPicture" id="avatar">
+ <property name="height-request">144</property>
+ <property name="width-request">144</property>
+ </object>
+ </property>
+ <child type="overlay">
+ <object class="GtkBox" id="avatar_menu_box">
+ <property name="opacity">0.9</property>
+ <property name="margin-end">6</property>
+ <property name="margin-bottom">6</property>
+ <property name="halign">end</property>
+ <property name="valign">end</property>
+ <style>
+ <class name="card"/>
+ <class name="toolbar"/>
+ <class name="overlay-toolbar"/>
+ </style>
<child>
- <object class="GtkLabel">
- <property name="label">•••••</property>
+ <object class="GtkButton" id="edit_avatar_button">
+ <property name="icon-name">document-edit-symbolic</property>
</object>
</child>
<child>
- <object class="GtkImage">
- <property name="icon-name">go-next-symbolic</property>
+ <object class="GtkButton" id="remove_avatar_button">
+ <property name="icon-name">user-trash-symbolic</property>
</object>
</child>
</object>
@@ -103,43 +62,83 @@
</object>
</child>
<child>
- <object class="AdwActionRow" id="connection_status">
- <property name="title" translatable="yes">Connection status</property>
- <style>
- <class name="property"/>
- </style>
- <child type="suffix">
- <object class="GtkButton" id="enter_password_button">
- <property name="label">Enter password</property>
- <property name="valign">center</property>
- <property name="visible">False</property>
+ <object class="AdwPreferencesGroup">
+ <child>
+ <object class="AdwActionRow" id="xmpp_address">
+ <property name="title" translatable="yes">XMPP Address</property>
+ <property name="subtitle_selectable">True</property>
+ <style>
+ <class name="property"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="AdwEntryRow" id="local_alias">
+ <property name="title" translatable="yes">Local alias</property>
+ </object>
+ </child>
+ <child>
+ <object class="AdwActionRow" id="password_change">
+ <property name="title" translatable="yes">Password</property>
+ <child type="suffix">
+ <object class="GtkBox">
+ <property name="opacity">0.7</property>
+ <property name="spacing">6</property>
+ <property name="orientation">horizontal</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="label">•••••</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkImage">
+ <property name="icon-name">go-next-symbolic</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="AdwActionRow" id="connection_status">
+ <property name="title" translatable="yes">Connection status</property>
+ <style>
+ <class name="property"/>
+ </style>
+ <child type="suffix">
+ <object class="GtkButton" id="enter_password_button">
+ <property name="label">Enter password</property>
+ <property name="valign">center</property>
+ <property name="visible">False</property>
+ </object>
+ </child>
</object>
</child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkBox" id="button_container">
- <property name="halign">center</property>
- <property name="spacing">24</property>
- <child>
- <object class="GtkButton" id="disable_account_button">
- <property name="label" translatable="1">Disable account</property>
- <property name="halign">center</property>
- <style>
- <class name="pill"/>
- </style>
</object>
</child>
<child>
- <object class="GtkButton" id="remove_account_button">
- <property name="label" translatable="1">Remove account</property>
+ <object class="GtkBox" id="button_container">
<property name="halign">center</property>
- <style>
- <class name="pill"/>
- <class name="destructive-action"/>
- </style>
+ <property name="spacing">24</property>
+ <child>
+ <object class="GtkButton" id="disable_account_button">
+ <property name="label" translatable="1">Disable account</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="pill"/>
+ </style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="remove_account_button">
+ <property name="label" translatable="1">Remove account</property>
+ <property name="halign">center</property>
+ <style>
+ <class name="pill"/>
+ <class name="destructive-action"/>
+ </style>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/main/data/preferences_window/add_account_dialog.ui b/main/data/preferences_window/add_account_dialog.ui
index 243004d6..362e493c 100644
--- a/main/data/preferences_window/add_account_dialog.ui
+++ b/main/data/preferences_window/add_account_dialog.ui
@@ -2,9 +2,9 @@
<interface>
<requires lib="gtk" version="4.0"/>
<template class="DinoUiManageAccountsAddAccountDialog">
- <property name="default_width">450</property>
- <property name="default_height">260</property>
- <property name="modal">True</property>
+ <property name="content-width">450</property>
+ <property name="content-height">260</property>
+ <property name="follows-content-size">False</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
diff --git a/main/data/preferences_window/change_password_dialog.ui b/main/data/preferences_window/change_password_dialog.ui
index 350d2a2d..05feda60 100644
--- a/main/data/preferences_window/change_password_dialog.ui
+++ b/main/data/preferences_window/change_password_dialog.ui
@@ -3,78 +3,84 @@
<requires lib="gtk" version="4.0"/>
<template class="DinoUiChangePasswordDialog">
<property name="title" translatable="1">Change password</property>
- <property name="default-width">430</property>
- <property name="default-height">270</property>
- <property name="modal">True</property>
- <child type="titlebar">
- <object class="GtkHeaderBar">
- <property name="show-title-buttons">False</property>
+ <property name="content-width">430</property>
+ <property name="content-height">270</property>
+ <property name="follows-content-size">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkButton" id="cancel_button">
- <property name="label" translatable="yes">Cancel</property>
- </object>
- </child>
- <child type="end">
- <object class="GtkButton" id="change_password_button">
- <property name="sensitive">0</property>
- <style>
- <class name="suggested-action"/>
- </style>
+ <object class="AdwHeaderBar">
+ <property name="show-end-title-buttons">False</property>
+ <property name="show-start-title-buttons">False</property>
<child>
- <object class="GtkStack" id="change_password_stack">
+ <object class="GtkButton" id="cancel_button">
+ <property name="label" translatable="yes">Cancel</property>
+ </object>
+ </child>
+ <child type="end">
+ <object class="GtkButton" id="change_password_button">
+ <property name="sensitive">0</property>
+ <style>
+ <class name="suggested-action"/>
+ </style>
<child>
- <object class="GtkStackPage">
- <property name="name">label</property>
- <property name="child">
- <object class="GtkLabel" >
- <property name="label" translatable="1">Change</property>
+ <object class="GtkStack" id="change_password_stack">
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">label</property>
+ <property name="child">
+ <object class="GtkLabel" >
+ <property name="label" translatable="1">Change</property>
+ </object>
+ </property>
</object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkStackPage">
- <property name="name">spinner</property>
- <property name="child">
- <object class="GtkSpinner">
- <property name="spinning">True</property>
+ </child>
+ <child>
+ <object class="GtkStackPage">
+ <property name="name">spinner</property>
+ <property name="child">
+ <object class="GtkSpinner">
+ <property name="spinning">True</property>
+ </object>
+ </property>
</object>
- </property>
+ </child>
</object>
</child>
</object>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="AdwPreferencesPage">
<child>
- <object class="AdwPreferencesGroup">
- <child>
- <object class="AdwPasswordEntryRow" id="current_password_entry">
- <property name="title" translatable="yes">Current password</property>
- </object>
- </child>
- <child>
- <object class="AdwPasswordEntryRow" id="new_password_entry">
- <property name="title" translatable="yes">New password</property>
- </object>
- </child>
- <child>
- <object class="AdwPasswordEntryRow" id="confirm_new_password_entry">
- <property name="title" translatable="yes">Confirm password</property>
- </object>
- </child>
+ <object class="AdwPreferencesPage">
<child>
- <object class="GtkLabel" id="change_password_error_label">
- <property name="halign">center</property>
- <property name="hexpand">True</property>
- <property name="margin-top">7</property>
- <attributes>
- <attribute name="scale" value="0.9"></attribute>
- </attributes>
+ <object class="AdwPreferencesGroup">
+ <child>
+ <object class="AdwPasswordEntryRow" id="current_password_entry">
+ <property name="title" translatable="yes">Current password</property>
+ </object>
+ </child>
+ <child>
+ <object class="AdwPasswordEntryRow" id="new_password_entry">
+ <property name="title" translatable="yes">New password</property>
+ </object>
+ </child>
+ <child>
+ <object class="AdwPasswordEntryRow" id="confirm_new_password_entry">
+ <property name="title" translatable="yes">Confirm password</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="change_password_error_label">
+ <property name="halign">center</property>
+ <property name="hexpand">True</property>
+ <property name="margin-top">7</property>
+ <attributes>
+ <attribute name="scale" value="0.9"></attribute>
+ </attributes>
+ </object>
+ </child>
</object>
</child>
</object>
diff --git a/main/data/preferences_window/preferences_window.ui b/main/data/preferences_window/preferences_dialog.ui
index 0b9abd84..323a4968 100644
--- a/main/data/preferences_window/preferences_window.ui
+++ b/main/data/preferences_window/preferences_dialog.ui
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk" version="4.0"/>
- <object class="DinoUiViewModelPreferencesWindow" id="model" />
- <template class="DinoUiPreferencesWindow">
- <property name="default-width">700</property>
- <property name="default-height">550</property>
- <property name="modal">True</property>
+ <object class="DinoUiViewModelPreferencesDialog" id="model" />
+ <template class="DinoUiPreferencesDialog">
+ <property name="content-width">700</property>
+ <property name="content-height">550</property>
+ <property name="follows-content-size">False</property>
<child>
<object class="DinoUiPreferencesWindowAccounts" id="accounts_page">
<property name="title" translatable="yes">Accounts</property>
diff --git a/main/meson.build b/main/meson.build
index 9553d7e0..3f5701bc 100644
--- a/main/meson.build
+++ b/main/meson.build
@@ -88,15 +88,15 @@ sources = files(
'src/ui/widgets/natural_size_increase.vala',
'src/view_model/account_details.vala',
'src/view_model/conversation_details.vala',
+ 'src/view_model/preferences_dialog.vala',
'src/view_model/preferences_row.vala',
- 'src/view_model/preferences_window.vala',
'src/windows/preferences_window/account_preferences_subpage.vala',
'src/windows/preferences_window/accounts_preferences_page.vala',
'src/windows/preferences_window/add_account_dialog.vala',
'src/windows/preferences_window/change_password_dialog.vala',
'src/windows/preferences_window/encryption_preferences_page.vala',
'src/windows/preferences_window/general_preferences_page.vala',
- 'src/windows/preferences_window/preferences_window.vala',
+ 'src/windows/preferences_window/preferences_dialog.vala',
'src/windows/conversation_details.vala',
)
sources += gnome.compile_resources(
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_window.vala b/main/src/view_model/preferences_dialog.vala
index 7d967605..c09c650a 100644
--- a/main/src/view_model/preferences_window.vala
+++ b/main/src/view_model/preferences_dialog.vala
@@ -3,7 +3,7 @@ using Xmpp;
using Xmpp.Xep;
using Gee;
-public class Dino.Ui.ViewModel.PreferencesWindow : Object {
+public class Dino.Ui.ViewModel.PreferencesDialog : Object {
public signal void update();
public HashMap<Account, AccountDetails> account_details = new HashMap<Account, AccountDetails>(Account.hash_func, Account.equals_func);
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