aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_selector
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/conversation_selector')
-rw-r--r--main/src/ui/conversation_selector/conversation_row.vala2
-rw-r--r--main/src/ui/conversation_selector/list.vala20
-rw-r--r--main/src/ui/conversation_selector/view.vala2
3 files changed, 17 insertions, 7 deletions
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala
index c16da287..6930db67 100644
--- a/main/src/ui/conversation_selector/conversation_row.vala
+++ b/main/src/ui/conversation_selector/conversation_row.vala
@@ -125,7 +125,7 @@ public abstract class ConversationRow : ListBoxRow {
main_revealer.set_reveal_child(false);
closed();
main_revealer.notify["child-revealed"].connect(() => {
- conversation.active = false;
+ stream_interactor.get_module(ConversationManager.IDENTITY).close_conversation(conversation);
disappeared();
});
}
diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala
index d95128f1..dee70e4b 100644
--- a/main/src/ui/conversation_selector/list.vala
+++ b/main/src/ui/conversation_selector/list.vala
@@ -76,6 +76,17 @@ public class List : ListBox {
foreach (ConversationRow row in rows.values) row.update();
return true;
});
+
+ foreach (Conversation conversation in stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations()) {
+ add_conversation(conversation);
+ }
+ realize.connect(() => {
+ ListBoxRow? first_row = get_row_at_index(0);
+ if (first_row != null) {
+ select_row(first_row);
+ row_activated(first_row);
+ }
+ });
}
public override void row_activated(ListBoxRow r) {
@@ -117,15 +128,14 @@ public class List : ListBox {
}
rows[conversation] = row;
add(row);
- row.closed.connect(() => { on_conversation_closed(conversation); });
- row.disappeared.connect(() => { on_conversation_disappeared(conversation); });
+ row.closed.connect(() => { select_next_conversation(conversation); });
+ row.disappeared.connect(() => { remove_conversation(conversation); });
row.main_revealer.set_reveal_child(true);
}
invalidate_sort();
- queue_draw();
}
- private void on_conversation_closed(Conversation conversation) {
+ private void select_next_conversation(Conversation conversation) {
if (get_selected_row() == rows[conversation]) {
int index = rows[conversation].get_index();
ListBoxRow? index_p1 = get_row_at_index(index + 1);
@@ -142,7 +152,7 @@ public class List : ListBox {
}
}
- private void on_conversation_disappeared(Conversation conversation) {
+ private void remove_conversation(Conversation conversation) {
if (rows.has_key(conversation) && !conversation.active) {
remove(rows[conversation]);
rows.unset(conversation);
diff --git a/main/src/ui/conversation_selector/view.vala b/main/src/ui/conversation_selector/view.vala
index 5c1b4dfd..304c6bbe 100644
--- a/main/src/ui/conversation_selector/view.vala
+++ b/main/src/ui/conversation_selector/view.vala
@@ -15,7 +15,7 @@ public class View : Box {
[GtkChild] private ScrolledWindow scrolled;
public View(StreamInteractor stream_interactor) {
- conversation_list = new List(stream_interactor);
+ conversation_list = new List(stream_interactor) { visible=true };
scrolled.add(conversation_list);
search_entry.key_release_event.connect(search_key_release_event);
search_entry.search_changed.connect(search_changed);