diff options
| author | fiaxh <git@lightrise.org> | 2025-10-06 00:14:27 +0200 |
|---|---|---|
| committer | fiaxh <git@lightrise.org> | 2025-10-06 00:14:27 +0200 |
| commit | 18f87d11986f1021d98f1be58c89296d852120c3 (patch) | |
| tree | 9606264eee3dac8e8abdc885df4a0a77fee5b278 /main/src/windows/conversation_details.vala | |
| parent | 61f20787151febd54b7271f686bc4f9de5613c15 (diff) | |
Conversation details: Move room configuration to separate tab
Diffstat (limited to 'main/src/windows/conversation_details.vala')
| -rw-r--r-- | main/src/windows/conversation_details.vala | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/main/src/windows/conversation_details.vala b/main/src/windows/conversation_details.vala index bce9c423..d85783a2 100644 --- a/main/src/windows/conversation_details.vala +++ b/main/src/windows/conversation_details.vala @@ -26,6 +26,9 @@ namespace Dino.Ui.ConversationDetails { public StackPage? encryption_stack_page = null; public Box? encryption_box = null; + public StackPage? room_config_stack_page = null; + public Box? room_config_box = null; + public StackPage? member_stack_page = null; public Box? member_box = null; @@ -50,9 +53,10 @@ namespace Dino.Ui.ConversationDetails { model.notify["notification-options"].connect(update_notification_button_visibility); model.notify["notification-is-default"].connect(update_notification_button_visibility); - model.about_rows.items_changed.connect(create_preferences_rows); - model.settings_rows.items_changed.connect(create_preferences_rows); - model.notify["room-configuration-rows"].connect(create_preferences_rows); + model.about_rows.items_changed.connect(populate_about_tab); + model.settings_rows.items_changed.connect(populate_about_tab); + // TODO add_room_configuration_tab_element gets called even after the window is closed + model.notify["room-configuration-rows"].connect(add_room_configuration_tab_element); model.notify["members"].connect(create_members); create_members(); @@ -181,7 +185,7 @@ namespace Dino.Ui.ConversationDetails { add_members_tab_element(list_view); } - private void create_preferences_rows() { + private void populate_about_tab() { var widget = about_box.get_first_child(); while (widget != null) { about_box.remove(widget); @@ -195,7 +199,7 @@ namespace Dino.Ui.ConversationDetails { about_box.append(Util.rows_to_preference_group(model.settings_rows, _("Settings"))); } if (model.room_configuration_rows != null && model.room_configuration_rows.get_n_items() > 0) { - about_box.append(Util.rows_to_preference_group(model.room_configuration_rows, _("Room Configuration"))); + add_room_configuration_tab_element(); } if (model.account_jid != null) { @@ -205,6 +209,24 @@ namespace Dino.Ui.ConversationDetails { } } + public void add_room_configuration_tab_element() { + if (model.room_configuration_rows == null || model.room_configuration_rows.get_n_items() == 0) return; + + if (room_config_stack_page == null) { + room_config_box = new Box(Orientation.VERTICAL, 12) { margin_end = 12, margin_start = 12, margin_top = 18, margin_bottom = 40 }; + var scrolled_window = new ScrolledWindow() { vexpand = true }; + var clamp = new Adw.Clamp(); + clamp.set_child(room_config_box); + scrolled_window.set_child(clamp); + room_config_stack_page = stack.add_child(scrolled_window); + room_config_stack_page.title = _("Room Configuration"); + room_config_stack_page.name = "room_config"; + } + foreach (Adw.PreferencesGroup preferences_group in Util.rows_to_preference_window_split_at_text(model.room_configuration_rows)) { + room_config_box.append(preferences_group); + } + } + public void add_encryption_tab_element(Adw.PreferencesGroup preferences_group) { if (encryption_stack_page == null) { encryption_box = new Box(Orientation.VERTICAL, 12) { margin_end = 12, margin_start = 12, margin_top = 18, margin_bottom = 40 }; |
