aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_selector/groupchat_row.vala25
-rw-r--r--main/src/ui/conversation_titlebar.vala18
2 files changed, 27 insertions, 16 deletions
diff --git a/main/src/ui/conversation_selector/groupchat_row.vala b/main/src/ui/conversation_selector/groupchat_row.vala
index 598902cc..07dabf06 100644
--- a/main/src/ui/conversation_selector/groupchat_row.vala
+++ b/main/src/ui/conversation_selector/groupchat_row.vala
@@ -8,10 +8,15 @@ public class GroupchatRow : ConversationRow {
base(stream_interactor, conversation);
has_tooltip = true;
set_tooltip_text(conversation.counterpart.bare_jid.to_string());
- set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor))
- .set_greyscale(true)
- .draw_conversation(stream_interactor, conversation), image.scale_factor);
+ update_avatar();
+
x_button.clicked.connect(on_x_button_clicked);
+ stream_interactor.get_module(MucManager.IDENTITY).left.connect(() => {
+ Idle.add(() => {
+ update_avatar();
+ return false;
+ });
+ });
}
@@ -21,15 +26,21 @@ public class GroupchatRow : ConversationRow {
}
public override void network_connection(bool connected) {
- set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor))
- .set_greyscale(!connected ||
- stream_interactor.get_module(MucManager.IDENTITY).get_nick(conversation.counterpart, conversation.account) == null) // TODO better currently joined
- .draw_conversation(stream_interactor, conversation), image.scale_factor);
+ update_avatar();
}
private void on_x_button_clicked() {
stream_interactor.get_module(MucManager.IDENTITY).part(conversation.account, conversation.counterpart);
}
+
+ private void update_avatar() {
+ ConnectionManager.ConnectionState connection_state = stream_interactor.connection_manager.get_state(conversation.account);
+ bool is_joined = stream_interactor.get_module(MucManager.IDENTITY).is_joined(conversation.counterpart, conversation.account);
+
+ set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor))
+ .set_greyscale(connection_state != ConnectionManager.ConnectionState.CONNECTED || !is_joined)
+ .draw_conversation(stream_interactor, conversation), image.scale_factor);
+ }
}
} \ No newline at end of file
diff --git a/main/src/ui/conversation_titlebar.vala b/main/src/ui/conversation_titlebar.vala
index 70a376f1..b1db3604 100644
--- a/main/src/ui/conversation_titlebar.vala
+++ b/main/src/ui/conversation_titlebar.vala
@@ -20,11 +20,17 @@ public class ConversationTitlebar : Gtk.HeaderBar {
public ConversationTitlebar(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
- stream_interactor.get_module(MucManager.IDENTITY).groupchat_subject_set.connect((account, jid, subject) => {
- Idle.add(() => { on_groupchat_subject_set(account, jid, subject); return false; });
- });
create_conversation_menu();
create_encryption_menu();
+
+ stream_interactor.get_module(MucManager.IDENTITY).subject_set.connect((account, jid, subject) => {
+ Idle.add(() => {
+ if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
+ update_subtitle(subject);
+ }
+ return false;
+ });
+ });
}
public void initialize_for_conversation(Conversation conversation) {
@@ -118,12 +124,6 @@ public class ConversationTitlebar : Gtk.HeaderBar {
encryption_button.set_popover(menu);
encryption_button.set_image(new Image.from_icon_name("changes-allow-symbolic", IconSize.BUTTON));
}
-
- private void on_groupchat_subject_set(Account account, Jid jid, string subject) {
- if (conversation != null && conversation.counterpart.equals_bare(jid) && conversation.account.equals(account)) {
- update_subtitle(subject);
- }
- }
}
} \ No newline at end of file