aboutsummaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/CMakeLists.txt1
-rw-r--r--main/data/add_conversation/list_row.ui9
-rw-r--r--main/data/gresource.xml1
-rw-r--r--main/data/icons/scalable/status/dino-status-offline.svg6
-rw-r--r--main/src/ui/add_conversation/conference_list.vala1
-rw-r--r--main/src/ui/add_conversation/list_row.vala27
6 files changed, 45 insertions, 0 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 437a84b9..c488fc28 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -46,6 +46,7 @@ set(RESOURCE_LIST
icons/scalable/status/dino-status-chat.svg
icons/scalable/status/dino-status-dnd.svg
icons/scalable/status/dino-status-online.svg
+ icons/scalable/status/dino-status-offline.svg
icons/scalable/status/dino-tick-symbolic.svg
icons/scalable/status/dino-video-off-symbolic.svg
icons/scalable/status/dino-video-symbolic.svg
diff --git a/main/data/add_conversation/list_row.ui b/main/data/add_conversation/list_row.ui
index b8a97174..d829dc3a 100644
--- a/main/data/add_conversation/list_row.ui
+++ b/main/data/add_conversation/list_row.ui
@@ -15,6 +15,15 @@
</object>
</child>
<child>
+ <object class="GtkImage" id="status_dot">
+ <property name="pixel-size">10</property>
+ <layout>
+ <property name="column">1</property>
+ <property name="row">0</property>
+ </layout>
+ </object>
+ </child>
+ <child>
<object class="GtkGrid">
<property name="valign">center</property>
<property name="orientation">vertical</property>
diff --git a/main/data/gresource.xml b/main/data/gresource.xml
index 503503c9..404e9902 100644
--- a/main/data/gresource.xml
+++ b/main/data/gresource.xml
@@ -46,6 +46,7 @@
<file>icons/scalable/status/dino-status-chat.svg</file>
<file>icons/scalable/status/dino-status-dnd.svg</file>
<file>icons/scalable/status/dino-status-online.svg</file>
+ <file>icons/scalable/status/dino-status-offline.svg</file>
<file>icons/scalable/status/dino-tick-symbolic.svg</file>
<file>icons/scalable/status/dino-video-off-symbolic.svg</file>
<file>icons/scalable/status/dino-video-symbolic.svg</file>
diff --git a/main/data/icons/scalable/status/dino-status-offline.svg b/main/data/icons/scalable/status/dino-status-offline.svg
new file mode 100644
index 00000000..58f75de2
--- /dev/null
+++ b/main/data/icons/scalable/status/dino-status-offline.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="28.222mm" height="28.222mm" version="1.1" viewBox="0 0 99.999997 99.999997" xmlns="http://www.w3.org/2000/svg">
+ <g transform="translate(-62.857 -678.08)">
+ <circle cx="112.86" cy="728.08" r="50" style="fill-rule:evenodd;fill:grey;"/>
+ </g>
+</svg> \ No newline at end of file
diff --git a/main/src/ui/add_conversation/conference_list.vala b/main/src/ui/add_conversation/conference_list.vala
index 0b630ae4..bf6191fa 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_dot.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..8e4cbb9b 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 Image status_dot;
public Label via_label;
public Jid? jid;
@@ -21,14 +22,39 @@ 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_dot = (Image) builder.get_object("status_dot");
via_label = (Label) builder.get_object("via_label");
+
this.layout_manager = new BinLayout();
outer_grid.set_parent(this);
}
public ListRow() {}
+ private void set_status_dot(StreamInteractor stream_interactor, Jid jid, Account account){
+ Gee.List<Jid>? full_jids = stream_interactor.get_module(PresenceManager.IDENTITY).get_full_jids(jid, account);
+ string presence_str = null;
+ if (full_jids != null){
+ int devices = 0;
+ string newline_if_more_devices;
+ for (int i = 0; i < full_jids.size; i++) {
+ Jid full_jid = full_jids[i];
+ presence_str = stream_interactor.get_module(PresenceManager.IDENTITY).get_last_show(full_jid, account);
+ if(presence_str != null) devices += 1;
+ newline_if_more_devices = devices > 1 ? "\r\n" : "";
+ switch(presence_str){
+ case "dnd": this.status_dot.set_from_icon_name("dino-status-dnd"); i = full_jids.size; break; // dnd detected = marked as dnd for all devices
+ case "online": this.status_dot.set_from_icon_name("dino-status-online"); i = full_jids.size; break;
+ case "away": this.status_dot.set_from_icon_name("dino-status-away"); break;
+ case "xa": this.status_dot.set_from_icon_name("dino-status-away"); break;
+ case "chat": this.status_dot.set_from_icon_name("dino-status-chat"); break;
+ }
+ }
+ }
+ else status_dot.set_from_icon_name("dino-status-offline");
+ }
+
public ListRow.from_jid(StreamInteractor stream_interactor, Jid jid, Account account, bool show_account) {
this.jid = jid;
this.account = account;
@@ -46,6 +72,7 @@ public class ListRow : Widget {
}
name_label.label = display_name;
picture.model = new ViewModel.CompatAvatarPictureModel(stream_interactor).set_conversation(conv);
+ set_status_dot(stream_interactor, jid, account);
}
public override void dispose() {