aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/CMakeLists.txt16
-rw-r--r--main/data/gresource.xml12
-rw-r--r--main/data/manage_accounts/account_row.ui33
-rw-r--r--main/data/manage_accounts/dialog.ui248
-rw-r--r--main/data/preferences_window/account_preferences_subpage.ui (renamed from main/data/preferences_window_account.ui)0
-rw-r--r--main/data/preferences_window/add_account_dialog.ui (renamed from main/data/manage_accounts/add_account_dialog.ui)0
-rw-r--r--main/data/preferences_window/general_preferences_page.ui (renamed from main/data/preferences_window_general.ui)0
-rw-r--r--main/data/preferences_window/preferences_window.ui (renamed from main/data/preferences_window.ui)0
-rw-r--r--main/meson.build4
-rw-r--r--main/src/ui/manage_accounts/account_row.vala41
-rw-r--r--main/src/ui/manage_accounts/dialog.vala241
-rw-r--r--main/src/windows/preferences_window/account_preferences_subpage.vala2
-rw-r--r--main/src/windows/preferences_window/add_account_dialog.vala (renamed from main/src/ui/manage_accounts/add_account_dialog.vala)2
-rw-r--r--main/src/windows/preferences_window/encryption_preferences_page.vala1
-rw-r--r--main/src/windows/preferences_window/general_preferences_page.vala2
-rw-r--r--main/src/windows/preferences_window/preferences_window.vala2
16 files changed, 17 insertions, 587 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 2a32d23f..13111de8 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -60,6 +60,11 @@ set(RESOURCE_LIST
add_conversation/list_row.ui
add_conversation/select_jid_fragment.ui
+ preferences_window/account_preferences_subpage.ui
+ preferences_window/add_account_dialog.ui
+ preferences_window/general_preferences_page.ui
+ preferences_window/preferences_window.ui
+
account_picker_row.ui
call_widget.ui
chat_input.ui
@@ -77,9 +82,6 @@ set(RESOURCE_LIST
join_room_dialog2.ui
conversation_content_view/item_metadata_header.ui
conversation_content_view/view.ui
- manage_accounts/account_row.ui
- manage_accounts/add_account_dialog.ui
- manage_accounts/dialog.ui
menu_add.ui
menu_app.ui
menu_conversation.ui
@@ -87,9 +89,6 @@ set(RESOURCE_LIST
message_item_widget_edit_mode.ui
occupant_list.ui
occupant_list_item.ui
- preferences_window.ui
- preferences_window_account.ui
- preferences_window_general.ui
quote.ui
search_autocomplete.ui
unified_main_content.ui
@@ -214,10 +213,6 @@ SOURCES
src/ui/conversation_titlebar/search_entry.vala
src/ui/conversation_titlebar/conversation_titlebar.vala
- src/ui/manage_accounts/account_row.vala
- src/ui/manage_accounts/add_account_dialog.vala
- src/ui/manage_accounts/dialog.vala
-
src/ui/occupant_menu/list.vala
src/ui/occupant_menu/list_row.vala
src/ui/occupant_menu/view.vala
@@ -245,6 +240,7 @@ SOURCES
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/encryption_preferences_page.vala
src/windows/preferences_window/general_preferences_page.vala
src/windows/preferences_window/preferences_window.vala
diff --git a/main/data/gresource.xml b/main/data/gresource.xml
index 647f5116..304fa7a4 100644
--- a/main/data/gresource.xml
+++ b/main/data/gresource.xml
@@ -54,12 +54,15 @@
<file>icons/scalable/status/dino-tick-symbolic.svg</file>
<file>icons/scalable/status/dino-video-off-symbolic.svg</file>
<file>icons/scalable/status/dino-video-symbolic.svg</file>
+
+ <file>preferences_window/account_preferences_subpage.ui</file>
+ <file>preferences_window/add_account_dialog.ui</file>
+ <file>preferences_window/general_preferences_page.ui</file>
+ <file>preferences_window/preferences_window.ui</file>
+
<file>join_room_dialog.ui</file>
<file>join_room_dialog1.ui</file>
<file>join_room_dialog2.ui</file>
- <file>manage_accounts/account_row.ui</file>
- <file>manage_accounts/add_account_dialog.ui</file>
- <file>manage_accounts/dialog.ui</file>
<file>menu_add.ui</file>
<file>menu_app.ui</file>
<file>menu_conversation.ui</file>
@@ -68,9 +71,6 @@
<file>occupant_list.ui</file>
<file>occupant_list_item.ui</file>
<file>quote.ui</file>
- <file>preferences_window.ui</file>
- <file>preferences_window_account.ui</file>
- <file>preferences_window_general.ui</file>
<file>search_autocomplete.ui</file>
<file>style-dark.css</file>
<file>style.css</file>
diff --git a/main/data/manage_accounts/account_row.ui b/main/data/manage_accounts/account_row.ui
deleted file mode 100644
index 91891b91..00000000
--- a/main/data/manage_accounts/account_row.ui
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk" version="4.0"/>
- <template class="DinoUiManageAccountsAccountRow">
- <child>
- <object class="GtkGrid">
- <property name="margin-start">6</property>
- <property name="margin-end">6</property>
- <property name="margin-top">6</property>
- <property name="margin-bottom">6</property>
- <property name="column-spacing">6</property>
- <child>
- <object class="DinoUiAvatarPicture" id="picture">
- <property name="height-request">40</property>
- <property name="width-request">40</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="jid_label">
- <property name="xalign">0</property>
- <property name="hexpand">1</property>
- </object>
- </child>
- <child>
- <object class="GtkImage" id="icon">
- <property name="visible">False</property>
- <property name="icon-name">dialog-warning-symbolic</property>
- </object>
- </child>
- </object>
- </child>
- </template>
-</interface>
diff --git a/main/data/manage_accounts/dialog.ui b/main/data/manage_accounts/dialog.ui
deleted file mode 100644
index 4931507c..00000000
--- a/main/data/manage_accounts/dialog.ui
+++ /dev/null
@@ -1,248 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
- <requires lib="gtk" version="4.0"/>
- <template class="DinoUiManageAccountsDialog">
- <property name="title" translatable="1">Accounts</property>
- <property name="width-request">700</property>
- <property name="height-request">400</property>
- <property name="modal">True</property>
- <child type="titlebar">
- <object class="GtkHeaderBar"/>
- </child>
- <child internal-child="content_area">
- <object class="GtkBox">
- <child>
- <object class="GtkStack" id="main_stack">
- <child>
- <object class="GtkStackPage">
- <property name="name">accounts_exist</property>
- <property name="child">
- <object class="GtkBox">
- <property name="focusable">1</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <child>
- <object class="GtkBox">
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="margin-start">15</property>
- <property name="margin-end">15</property>
- <property name="margin-top">15</property>
- <property name="margin-bottom">15</property>
- <property name="spacing">20</property>
- <child>
- <object class="GtkBox">
- <property name="orientation">vertical</property>
- <property name="width-request">250</property>
- <property name="vexpand">1</property>
- <property name="hexpand">0</property>
- <child>
- <object class="GtkScrolledWindow">
-<!-- <property name="shadow-type">in</property>-->
- <property name="hexpand">1</property>
- <property name="vexpand">1</property>
- <property name="child">
- <object class="GtkBox">
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkListBox" id="account_list">
- <property name="hexpand">1</property>
- <property name="vexpand">1</property>
- </object>
- </child>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkBox">
- <property name="css-classes">toolbar</property>
- <style>
- <class name="inline-toolbar"/>
- </style>
- <child>
- <object class="GtkButton" id="add_account_button">
- <property name="icon-name">list-add-symbolic</property>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="remove_account_button">
- <property name="icon-name">list-remove-symbolic</property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkGrid" id="settings_list">
- <property name="hexpand">1</property>
- <property name="vexpand">1</property>
- <property name="column-spacing">10</property>
- <property name="row-spacing">5</property>
- <child>
- <object class="GtkBox">
- <property name="halign">end</property>
- <child>
- <object class="GtkBox"/>
- </child>
- <child>
- <object class="GtkButton" id="image_button">
- <property name="has-frame">False</property>
- <style>
- <class name="image-button"/>
- </style>
- <child>
- <object class="DinoUiAvatarPicture" id="picture">
- <property name="height-request">50</property>
- <property name="width-request">50</property>
- </object>
- </child>
- </object>
- </child>
- <layout>
- <property name="column">0</property>
- <property name="row">0</property>
- <property name="row-span">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="jid_label">
- <property name="xalign">0</property>
- <property name="yalign">1</property>
- <attributes>
- <attribute name="weight" value="PANGO_WEIGHT_BOLD"></attribute>
- </attributes>
- <layout>
- <property name="column">1</property>
- <property name="row">0</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel" id="state_label">
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">1</property>
- <property name="row">1</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkSwitch" id="active_switch">
- <property name="halign">end</property>
- <property name="valign">center</property>
- <layout>
- <property name="column">2</property>
- <property name="row">0</property>
- <property name="row-span">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">Password</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="DinoUiUtilEntryLabelHybrid" id="password_hybrid">
- <property name="xalign">0</property>
- <property name="width_request">200</property>
- <property name="visibility">False</property>
- <layout>
- <property name="column">1</property>
- <property name="row">2</property>
- <property name="column-span">2</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">Local alias</property>
- <property name="xalign">1</property>
- <style>
- <class name="dim-label"/>
- </style>
- <layout>
- <property name="column">0</property>
- <property name="row">3</property>
- </layout>
- </object>
- </child>
- <child>
- <object class="DinoUiUtilEntryLabelHybrid" id="alias_hybrid">
- <property name="xalign">0</property>
- <property name="width_request">200</property>
-` <layout>
- <property name="column">1</property>
- <property name="row">3</property>
- <property name="column-span">2</property>
- </layout>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- </property>
- </object>
- </child>
- <child>
- <object class="GtkStackPage">
- <property name="name">no_accounts</property>
- <property name="child">
- <object class="GtkBox">
- <property name="orientation">vertical</property>
- <property name="spacing">10</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkImage">
- <property name="icon-name">system-users-symbolic</property>
- <property name="pixel-size">72</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="label" translatable="1">No accounts configured</property>
- <style>
- <class name="dim-label"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="no_accounts_add">
- <property name="label" translatable="1">Add an account</property>
- <property name="halign">center</property>
- <style>
- <class name="text-button"/>
- <class name="suggested-action"/>
- </style>
- </object>
- </child>
- </object>
- </property>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- </template>
-</interface>
diff --git a/main/data/preferences_window_account.ui b/main/data/preferences_window/account_preferences_subpage.ui
index e0fa4f76..e0fa4f76 100644
--- a/main/data/preferences_window_account.ui
+++ b/main/data/preferences_window/account_preferences_subpage.ui
diff --git a/main/data/manage_accounts/add_account_dialog.ui b/main/data/preferences_window/add_account_dialog.ui
index 243004d6..243004d6 100644
--- a/main/data/manage_accounts/add_account_dialog.ui
+++ b/main/data/preferences_window/add_account_dialog.ui
diff --git a/main/data/preferences_window_general.ui b/main/data/preferences_window/general_preferences_page.ui
index 33d1a2c9..33d1a2c9 100644
--- a/main/data/preferences_window_general.ui
+++ b/main/data/preferences_window/general_preferences_page.ui
diff --git a/main/data/preferences_window.ui b/main/data/preferences_window/preferences_window.ui
index d262dd76..d262dd76 100644
--- a/main/data/preferences_window.ui
+++ b/main/data/preferences_window/preferences_window.ui
diff --git a/main/meson.build b/main/meson.build
index 9292fbac..a2902dbd 100644
--- a/main/meson.build
+++ b/main/meson.build
@@ -69,9 +69,6 @@ sources = files(
'src/ui/global_search.vala',
'src/ui/main_window.vala',
'src/ui/main_window_controller.vala',
- 'src/ui/manage_accounts/account_row.vala',
- 'src/ui/manage_accounts/add_account_dialog.vala',
- 'src/ui/manage_accounts/dialog.vala',
'src/ui/notifier_freedesktop.vala',
'src/ui/notifier_gnotifications.vala',
'src/ui/occupant_menu/list.vala',
@@ -95,6 +92,7 @@ sources = files(
'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/encryption_preferences_page.vala',
'src/windows/preferences_window/general_preferences_page.vala',
'src/windows/preferences_window/preferences_window.vala',
diff --git a/main/src/ui/manage_accounts/account_row.vala b/main/src/ui/manage_accounts/account_row.vala
deleted file mode 100644
index ae734b83..00000000
--- a/main/src/ui/manage_accounts/account_row.vala
+++ /dev/null
@@ -1,41 +0,0 @@
-using Gtk;
-
-using Dino.Entities;
-
-namespace Dino.Ui.ManageAccounts {
-
-[GtkTemplate (ui = "/im/dino/Dino/manage_accounts/account_row.ui")]
-public class AccountRow : Gtk.ListBoxRow {
-
- [GtkChild] public unowned AvatarPicture picture;
- [GtkChild] public unowned Label jid_label;
- [GtkChild] public unowned Image icon;
-
- public Account account;
- private StreamInteractor stream_interactor;
-
- public AccountRow(StreamInteractor stream_interactor, Account account) {
- this.stream_interactor = stream_interactor;
- this.account = account;
- picture.model = new ViewModel.CompatAvatarPictureModel(stream_interactor).add_participant(new Conversation(account.bare_jid, account, Conversation.Type.CHAT), account.bare_jid);
- jid_label.set_label(account.bare_jid.to_string());
-
- stream_interactor.connection_manager.connection_error.connect((account, error) => {
- if (account.equals(this.account)) {
- update_warning_icon();
- }
- });
- stream_interactor.connection_manager.connection_state_changed.connect((account, state) => {
- if (account.equals(this.account)) {
- update_warning_icon();
- }
- });
- }
-
- private void update_warning_icon() {
- ConnectionManager.ConnectionError? error = stream_interactor.connection_manager.get_error(account);
- icon.visible = (error != null);
- }
-}
-
-}
diff --git a/main/src/ui/manage_accounts/dialog.vala b/main/src/ui/manage_accounts/dialog.vala
deleted file mode 100644
index b67f3a49..00000000
--- a/main/src/ui/manage_accounts/dialog.vala
+++ /dev/null
@@ -1,241 +0,0 @@
-using Gdk;
-using Gee;
-using Gtk;
-using Markup;
-
-using Dino.Entities;
-using Xmpp;
-
-namespace Dino.Ui.ManageAccounts {
-
-[GtkTemplate (ui = "/im/dino/Dino/manage_accounts/dialog.ui")]
-public class Dialog : Gtk.Dialog {
-
- public signal void account_enabled(Account account);
- public signal void account_disabled(Account account);
-
- [GtkChild] public unowned Stack main_stack;
- [GtkChild] public unowned ListBox account_list;
- [GtkChild] public unowned Button no_accounts_add;
- [GtkChild] public unowned Button add_account_button;
- [GtkChild] public unowned Button remove_account_button;
- [GtkChild] public unowned AvatarPicture picture;
- [GtkChild] public unowned Button image_button;
- [GtkChild] public unowned Label jid_label;
- [GtkChild] public unowned Label state_label;
- [GtkChild] public unowned Switch active_switch;
- [GtkChild] public unowned Util.EntryLabelHybrid password_hybrid;
- [GtkChild] public unowned Util.EntryLabelHybrid alias_hybrid;
- [GtkChild] public unowned Grid settings_list;
-
- private Database db;
- private StreamInteractor stream_interactor;
- private Account? selected_account;
-
- construct {
- Util.force_error_color(state_label, ".is_error");
- account_list.row_selected.connect(on_account_list_row_selected);
- add_account_button.clicked.connect(show_add_account_dialog);
- no_accounts_add.clicked.connect(show_add_account_dialog);
- remove_account_button.clicked.connect(() => {
- AccountRow? account_row = account_list.get_selected_row() as AccountRow;
- if (selected_account != null) remove_account(account_row);
- });
- image_button.clicked.connect(show_select_avatar);
- alias_hybrid.entry.changed.connect(() => { selected_account.alias = alias_hybrid.text; });
- password_hybrid.entry.changed.connect(() => { selected_account.password = password_hybrid.text; });
-
- Util.LabelHybridGroup label_hybrid_group = new Util.LabelHybridGroup();
- label_hybrid_group.add(alias_hybrid);
- label_hybrid_group.add(password_hybrid);
-
- main_stack.set_visible_child_name("no_accounts");
-
- int row_index = 4;
- int16 default_top_padding = new Gtk.Button().get_style_context().get_padding().top + 1;
- Application app = GLib.Application.get_default() as Application;
- foreach (Plugins.AccountSettingsEntry e in app.plugin_registry.account_settings_entries) {
- Widget? widget = e.get_widget(Plugins.WidgetType.GTK4) as Widget;
- if (widget == null) continue;
-
- Label label = new Label(e.name) { xalign=1, yalign=0 };
- label.add_css_class("dim-label");
- label.margin_top = e.label_top_padding == -1 ? default_top_padding : e.label_top_padding;
- settings_list.attach(label, 0, row_index);
-
- settings_list.attach(widget, 1, row_index, 2);
- row_index++;
- }
- }
-
- public Dialog(StreamInteractor stream_interactor, Database db) {
- Object(use_header_bar : 1);
- this.db = db;
- this.stream_interactor = stream_interactor;
- foreach (Account account in db.get_accounts()) {
- add_account(account);
- }
-
- stream_interactor.get_module(AvatarManager.IDENTITY).received_avatar.connect(on_received_avatar);
- stream_interactor.connection_manager.connection_error.connect((account, error) => {
- if (account.equals(selected_account)) {
- update_status_label(account);
- }
- });
- stream_interactor.connection_manager.connection_state_changed.connect((account, state) => {
- if (account.equals(selected_account)) {
- update_status_label(account);
- }
- });
-
- if (account_list.get_row_at_index(0) != null) account_list.select_row(account_list.get_row_at_index(0));
- }
-
- public AccountRow add_account(Account account) {
- AccountRow account_item = new AccountRow (stream_interactor, account);
- account_list.append(account_item);
- main_stack.set_visible_child_name("accounts_exist");
- return account_item;
- }
-
- private void show_add_account_dialog() {
- AddAccountDialog add_account_dialog = new AddAccountDialog(stream_interactor, db);
- add_account_dialog.set_transient_for(this);
- add_account_dialog.added.connect((account) => {
- AccountRow account_item = add_account(account);
- account_list.select_row(account_item);
- account_list.queue_draw();
- });
- add_account_dialog.present();
- }
-
- private void remove_account(AccountRow account_item) {
- Gtk.MessageDialog msg = new Gtk.MessageDialog (
- this, Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL,
- Gtk.MessageType.WARNING, Gtk.ButtonsType.OK_CANCEL,
- _("Remove account %s?"), account_item.jid_label.get_text());
- 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) {
- account_list.remove(account_item);
- if (account_item.account.enabled) account_disabled(account_item.account);
- account_item.account.remove();
- if (account_list.get_row_at_index(0) != null) {
- account_list.select_row(account_list.get_row_at_index(0));
- } else {
- main_stack.set_visible_child_name("no_accounts");
- }
- }
- msg.close();
- });
- msg.present();
- }
-
- private void on_account_list_row_selected(ListBoxRow? row) {
- AccountRow? account_item = row as AccountRow;
- if (account_item != null) {
- selected_account = account_item.account;
- populate_grid_data(account_item.account);
- }
- }
-
- private void show_select_avatar() {
- FileChooserNative chooser = new FileChooserNative(_("Select avatar"), this, FileChooserAction.OPEN, _("Select"), _("Cancel"));
- FileFilter filter = new FileFilter();
- foreach (PixbufFormat pixbuf_format in Pixbuf.get_formats()) {
- foreach (string mime_type in pixbuf_format.get_mime_types()) {
- filter.add_mime_type(mime_type);
- }
- }
- filter.set_filter_name(_("Images"));
- chooser.add_filter(filter);
-
- filter = new FileFilter();
- filter.set_filter_name(_("All files"));
- filter.add_pattern("*");
- chooser.add_filter(filter);
-
- chooser.response.connect(() => {
- string uri = chooser.get_file().get_path();
- stream_interactor.get_module(AvatarManager.IDENTITY).publish(selected_account, uri);
- });
-
- chooser.show();
- }
-
- private bool change_account_state(bool state) {
- selected_account.enabled = state;
- if (state) {
- account_enabled(selected_account);
- } else {
- account_disabled(selected_account);
- }
- return false;
- }
-
- private void on_received_avatar(Jid jid, Account account) {
- if (selected_account.equals(account) && jid.equals(account.bare_jid)) {
- picture.model = new ViewModel.CompatAvatarPictureModel(stream_interactor).add_participant(new Conversation(account.bare_jid, account, Conversation.Type.CHAT), account.bare_jid);
- }
- }
-
- private void populate_grid_data(Account account) {
- active_switch.state_set.disconnect(change_account_state);
-
- picture.model = new ViewModel.CompatAvatarPictureModel(stream_interactor).add_participant(new Conversation(account.bare_jid, account, Conversation.Type.CHAT), account.bare_jid);
- active_switch.set_active(account.enabled);
- jid_label.label = account.bare_jid.to_string();
-
- alias_hybrid.text = account.alias ?? "";
- password_hybrid.entry.input_purpose = InputPurpose.PASSWORD;
- password_hybrid.text = account.password;
-
- update_status_label(account);
-
- active_switch.state_set.connect(change_account_state);
-
- Application app = GLib.Application.get_default() as Application;
- foreach (Plugins.AccountSettingsEntry e in app.plugin_registry.account_settings_entries) {
- e.set_account(account);
- }
- }
-
- private void update_status_label(Account account) {
- state_label.label = "";
- ConnectionManager.ConnectionError? error = stream_interactor.connection_manager.get_error(account);
- if (error != null) {
- state_label.label = get_connection_error_description(error);
- state_label.add_css_class("is_error");
- } else {
- ConnectionManager.ConnectionState state = stream_interactor.connection_manager.get_state(account);
- switch (state) {
- case ConnectionManager.ConnectionState.CONNECTING:
- state_label.label = _("Connecting…"); break;
- case ConnectionManager.ConnectionState.CONNECTED:
- state_label.label = _("Connected"); break;
- case ConnectionManager.ConnectionState.DISCONNECTED:
- state_label.label = _("Disconnected"); break;
- }
- state_label.remove_css_class("is_error");
- }
- }
-
- private string get_connection_error_description(ConnectionManager.ConnectionError error) {
- switch (error.source) {
- case ConnectionManager.ConnectionError.Source.SASL:
- return _("Wrong password");
- case ConnectionManager.ConnectionError.Source.TLS:
- return _("Invalid TLS certificate");
- }
- if (error.identifier != null) {
- return _("Error") + ": " + error.identifier;
- } else {
- return _("Error");
- }
- }
-}
-
-}
diff --git a/main/src/windows/preferences_window/account_preferences_subpage.vala b/main/src/windows/preferences_window/account_preferences_subpage.vala
index a462666d..e0896158 100644
--- a/main/src/windows/preferences_window/account_preferences_subpage.vala
+++ b/main/src/windows/preferences_window/account_preferences_subpage.vala
@@ -5,7 +5,7 @@ using Gee;
using Gtk;
using Gdk;
-[GtkTemplate (ui = "/im/dino/Dino/preferences_window_account.ui")]
+[GtkTemplate (ui = "/im/dino/Dino/preferences_window/account_preferences_subpage.ui")]
public class Dino.Ui.AccountPreferencesSubpage : Gtk.Box {
[GtkChild] public unowned Adw.HeaderBar headerbar;
diff --git a/main/src/ui/manage_accounts/add_account_dialog.vala b/main/src/windows/preferences_window/add_account_dialog.vala
index 3700849f..00acb6aa 100644
--- a/main/src/ui/manage_accounts/add_account_dialog.vala
+++ b/main/src/windows/preferences_window/add_account_dialog.vala
@@ -7,7 +7,7 @@ using Xmpp;
namespace Dino.Ui.ManageAccounts {
-[GtkTemplate (ui = "/im/dino/Dino/manage_accounts/add_account_dialog.ui")]
+[GtkTemplate (ui = "/im/dino/Dino/preferences_window/add_account_dialog.ui")]
public class AddAccountDialog : Adw.Window {
public signal void added(Account account);
diff --git a/main/src/windows/preferences_window/encryption_preferences_page.vala b/main/src/windows/preferences_window/encryption_preferences_page.vala
index 7477e6cd..eec38908 100644
--- a/main/src/windows/preferences_window/encryption_preferences_page.vala
+++ b/main/src/windows/preferences_window/encryption_preferences_page.vala
@@ -4,7 +4,6 @@ using Xmpp.Xep;
using Gee;
using Gtk;
-//[GtkTemplate (ui = "/im/dino/Dino/preferences_window_encryption.ui")]
public class Dino.Ui.PreferencesWindowEncryption : Adw.PreferencesPage {
private DropDown drop_down = null;
diff --git a/main/src/windows/preferences_window/general_preferences_page.vala b/main/src/windows/preferences_window/general_preferences_page.vala
index 7aa6c2bd..6f8dd771 100644
--- a/main/src/windows/preferences_window/general_preferences_page.vala
+++ b/main/src/windows/preferences_window/general_preferences_page.vala
@@ -7,7 +7,7 @@ public class Dino.Ui.ViewModel.GeneralPreferencesPage : Object {
public bool convert_emojis { get; set; }
}
-[GtkTemplate (ui = "/im/dino/Dino/preferences_window_general.ui")]
+[GtkTemplate (ui = "/im/dino/Dino/preferences_window/general_preferences_page.ui")]
public class Dino.Ui.GeneralPreferencesPage : Adw.PreferencesPage {
[GtkChild] private unowned Switch typing_switch;
[GtkChild] private unowned Switch marker_switch;
diff --git a/main/src/windows/preferences_window/preferences_window.vala b/main/src/windows/preferences_window/preferences_window.vala
index e34261e9..1a75aa0a 100644
--- a/main/src/windows/preferences_window/preferences_window.vala
+++ b/main/src/windows/preferences_window/preferences_window.vala
@@ -5,7 +5,7 @@ using Xmpp.Xep;
using Gee;
using Gtk;
-[GtkTemplate (ui = "/im/dino/Dino/preferences_window.ui")]
+[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;