aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2023-12-08 02:02:29 +0100
committerMiquel Lionel <lionel@les-miquelots.net>2023-12-08 02:05:58 +0100
commitdd47d26cd7d08fa1efb9c4f70a33fc0c1a1223d0 (patch)
tree0de80df63e45d7596f1185a914fe8e89d928ea9a
parent85ea7e50083be4be11a675c83835e2f1f957d0dc (diff)
downloaddino-dd47d26cd7d08fa1efb9c4f70a33fc0c1a1223d0.tar.gz
dino-dd47d26cd7d08fa1efb9c4f70a33fc0c1a1223d0.zip
Show roster presence status on new chat windownice-presence
should close #139
-rw-r--r--main/data/add_conversation/list_row.ui15
-rw-r--r--main/src/ui/add_conversation/conference_list.vala1
-rw-r--r--main/src/ui/add_conversation/list_row.vala17
3 files changed, 32 insertions, 1 deletions
diff --git a/main/data/add_conversation/list_row.ui b/main/data/add_conversation/list_row.ui
index b8a97174..ae9790f2 100644
--- a/main/data/add_conversation/list_row.ui
+++ b/main/data/add_conversation/list_row.ui
@@ -31,6 +31,19 @@
</object>
</child>
<child>
+ <object class="GtkLabel" id="status_label">
+ <property name="max_width_chars">1</property>
+ <property name="ellipsize">end</property>
+ <property name="hexpand">1</property>
+ <property name="use_markup">1</property>
+ <property name="xalign">0</property>
+ <layout>
+ <property name="column">0</property>
+ <property name="row">1</property>
+ </layout>
+ </object>
+ </child>
+ <child>
<object class="GtkLabel" id="via_label">
<property name="max_width_chars">1</property>
<property name="ellipsize">end</property>
@@ -41,7 +54,7 @@
</attributes>
<layout>
<property name="column">0</property>
- <property name="row">1</property>
+ <property name="row">2</property>
</layout>
</object>
</child>
diff --git a/main/src/ui/add_conversation/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala
index 0b630ae4..0d840472 100644
--- a/main/src/ui/add_conversation/conference_list.vala
+++ b/main/src/ui/add_conversation/conference_list.vala
@@ -103,6 +103,7 @@ internal class ConferenceListRow : ListRow {
this.account = account;
this.bookmark = bookmark;
+ status_label.visible = false;
name_label.label = bookmark.name != null && bookmark.name != "" ? bookmark.name : bookmark.jid.to_string();
if (stream_interactor.get_accounts().size > 1) {
via_label.label = "via " + account.bare_jid.to_string();
diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala
index c5e344d0..8ba9c4cd 100644
--- a/main/src/ui/add_conversation/list_row.vala
+++ b/main/src/ui/add_conversation/list_row.vala
@@ -11,6 +11,7 @@ public class ListRow : Widget {
public Grid outer_grid;
public AvatarPicture picture;
public Label name_label;
+ public Label status_label;
public Label via_label;
public Jid? jid;
@@ -21,6 +22,7 @@ public class ListRow : Widget {
outer_grid = (Grid) builder.get_object("outer_grid");
picture = (AvatarPicture) builder.get_object("picture");
name_label = (Label) builder.get_object("name_label");
+ status_label = (Label) builder.get_object("status_label");
via_label = (Label) builder.get_object("via_label");
this.layout_manager = new BinLayout();
@@ -46,6 +48,21 @@ public class ListRow : Widget {
}
name_label.label = display_name;
picture.model = new ViewModel.CompatAvatarPictureModel(stream_interactor).set_conversation(conv);
+ Gee.List<Jid>? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(jid, account);
+ if (full_jids != null){
+ for (int i = 0; i < full_jids.size; i++) {
+ Jid full_jid = full_jids[i];
+ string? presence_str = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jid, account);
+ switch(presence_str){
+ case "online": status_label.label = "<span color='green'>" + _("Online") + "</span>"; break;
+ case "xa": status_label.label = "<span color='orange'>" + _("Extended Away") + "</span>"; break;
+ case "away": status_label.label = "<span color='orange'>" + _("Away") + "</span>"; break;
+ case "chat": status_label.label = "<span color='cyan'>" + _("Chatting") +"</span>"; break;
+ case "dnd": status_label.label = "<span color='red'>" + _("Do not disturb") + "</span>"; break;
+ }
+ }
+ }
+ else status_label.label = "<span color='grey'>Offline</span>";
}
public override void dispose() {