diff options
author | fiaxh <git@mx.ax.lt> | 2017-09-01 12:42:14 +0200 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-09-01 13:26:31 +0200 |
commit | addd5a013fe2e957e228ec4c670359c701745184 (patch) | |
tree | ea77e2e50d398e06e4a5c6279cb5dd91ab30bfd0 /main/src/ui/conversation_selector/chat_row.vala | |
parent | dc26841b9ea1e65dedbc916257f70e7f768f724b (diff) | |
download | dino-addd5a013fe2e957e228ec4c670359c701745184.tar.gz dino-addd5a013fe2e957e228ec4c670359c701745184.zip |
Show last message sender in conversation list
Diffstat (limited to 'main/src/ui/conversation_selector/chat_row.vala')
-rw-r--r-- | main/src/ui/conversation_selector/chat_row.vala | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/main/src/ui/conversation_selector/chat_row.vala b/main/src/ui/conversation_selector/chat_row.vala index 0a8737f1..73636a19 100644 --- a/main/src/ui/conversation_selector/chat_row.vala +++ b/main/src/ui/conversation_selector/chat_row.vala @@ -2,7 +2,6 @@ using Gdk; using Gee; using Gtk; -using Xmpp; using Dino.Entities; namespace Dino.Ui.ConversationSelector { @@ -16,36 +15,24 @@ public class ChatRow : ConversationRow { tooltip.set_custom(generate_tooltip()); return true; }); - update_avatar(); - } - - public override void on_show_received(Show show) { - update_avatar(); + stream_interactor.get_module(RosterManager.IDENTITY).updated_roster_item.connect((account, jid, roster_item) => { + if (conversation.account.equals(account) && conversation.counterpart.equals(jid)) { + update_name_label(); + update_avatar(); + } + }); } - public override void network_connection(bool connected) { - if (!connected) { - set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor)).set_greyscale(true).draw_conversation(stream_interactor, conversation), image.scale_factor); + protected override void update_message_label() { + base.update_message_label(); + if (last_message != null && last_message.direction == Message.DIRECTION_SENT) { + nick_label.visible = true; + nick_label.label = _("Me") + ": "; } else { - update_avatar(); + nick_label.label = ""; } } - public void on_updated_roster_item(Roster.Item roster_item) { - if (roster_item.name != null) { - display_name = roster_item.name; - update_name(); - } - update_avatar(); - } - - public void update_avatar() { - ArrayList<Jid> full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(conversation.counterpart, conversation.account); - set_avatar((new AvatarGenerator(AVATAR_SIZE, AVATAR_SIZE, image.scale_factor)) - .set_greyscale(full_jids == null) - .draw_conversation(stream_interactor, conversation), image.scale_factor); - } - private Widget generate_tooltip() { Builder builder = new Builder.from_resource("/im/dino/conversation_selector/chat_row_tooltip.ui"); Box main_box = builder.get_object("main_box") as Box; |