aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_selector/conversation_selector.vala4
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala31
2 files changed, 18 insertions, 17 deletions
diff --git a/main/src/ui/conversation_selector/conversation_selector.vala b/main/src/ui/conversation_selector/conversation_selector.vala
index 869f6403..9276148b 100644
--- a/main/src/ui/conversation_selector/conversation_selector.vala
+++ b/main/src/ui/conversation_selector/conversation_selector.vala
@@ -71,7 +71,6 @@ public class ConversationSelector : ListBox {
row = new ConversationSelectorRow(stream_interactor, conversation);
rows[conversation] = row;
add(row);
- row.closed.connect(() => { select_fallback_conversation(conversation); });
row.main_revealer.set_reveal_child(true);
}
invalidate_sort();
@@ -91,9 +90,10 @@ public class ConversationSelector : ListBox {
}
}
- private void remove_conversation(Conversation conversation) {
+ private async void remove_conversation(Conversation conversation) {
select_fallback_conversation(conversation);
if (rows.has_key(conversation)) {
+ yield rows[conversation].colapse();
remove(rows[conversation]);
rows.unset(conversation);
}
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index 421ebd75..705aad29 100644
--- a/main/src/ui/conversation_selector/conversation_selector_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -12,8 +12,6 @@ namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/Dino/conversation_selector/conversation_row.ui")]
public class ConversationSelectorRow : ListBoxRow {
- public signal void closed();
-
[GtkChild] protected AvatarImage image;
[GtkChild] protected Label name_label;
[GtkChild] protected Label time_label;
@@ -51,9 +49,6 @@ public class ConversationSelectorRow : ListBoxRow {
});
break;
case Conversation.Type.GROUPCHAT:
- closed.connect(() => {
- stream_interactor.get_module(MucManager.IDENTITY).part(conversation.account, conversation.counterpart);
- });
stream_interactor.get_module(MucManager.IDENTITY).room_name_set.connect((account, jid, room_name) => {
if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
update_name_label();
@@ -93,7 +88,9 @@ public class ConversationSelectorRow : ListBoxRow {
});
last_content_item = stream_interactor.get_module(ContentItemStore.IDENTITY).get_latest(conversation);
- x_button.clicked.connect(close_conversation);
+ x_button.clicked.connect(() => {
+ stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation);
+ });
image.set_conversation(stream_interactor, conversation);
conversation.notify["read-up-to"].connect(update_read);
@@ -112,6 +109,19 @@ public class ConversationSelectorRow : ListBoxRow {
update_read();
}
+ public async void colapse() {
+ main_revealer.set_transition_type(RevealerTransitionType.SLIDE_UP);
+ main_revealer.set_reveal_child(false);
+
+ // Animations can be diabled (=> child_revealed immediately false). Wait for completion in case they're enabled.
+ if (main_revealer.child_revealed) {
+ main_revealer.notify["child-revealed"].connect(() => {
+ Idle.add(colapse.callback);
+ });
+ yield;
+ }
+ }
+
protected void update_name_label() {
name_label.label = Util.get_conversation_display_name(stream_interactor, conversation);
}
@@ -209,15 +219,6 @@ public class ConversationSelectorRow : ListBoxRow {
return box;
}
- private void close_conversation() {
- main_revealer.set_transition_type(RevealerTransitionType.SLIDE_UP);
- main_revealer.set_reveal_child(false);
- closed();
- main_revealer.notify["child-revealed"].connect(() => {
- stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation);
- });
- }
-
public override void state_flags_changed(StateFlags flags) {
StateFlags curr_flags = get_state_flags();
if ((curr_flags & StateFlags.PRELIGHT) != 0) {