Display user status online/offline with circles (#40)

Adds a display of the user's offline/online status through red and green circles, respectively.
This commit is contained in:
Andrei Voronin 2024-04-09 15:04:52 +03:00 committed by GitHub
parent 02759c59f7
commit ffacf70a4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 14 deletions

View file

@ -49,6 +49,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

View file

@ -51,6 +51,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>

View file

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<svg width="99.999997" height="99.999997" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" version="1.1">
<g class="layer">
<title>Layer 1</title>
<g id="svg_1">
<circle cx="50" cy="51" fill="#ff0000" fill-rule="evenodd" id="svg_2" r="50" stroke="#ff0000"/>
<path d="m20,51l60,0" fill="#ff0000" id="svg_3" stroke="#ff0000" stroke-linecap="round" stroke-width="15"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 444 B

View file

@ -15,7 +15,8 @@
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="max_width_chars">1</property>
<property name="width-chars">20</property>
<property name="max-width-chars">40</property>
<property name="ellipsize">end</property>
<property name="hexpand">1</property>
<property name="xalign">0</property>
@ -26,11 +27,8 @@
</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="xalign">0</property>
<object class="GtkImage" id="status_image">
<property name="pixel-size">12</property>
<layout>
<property name="column">2</property>
<property name="row">0</property>

View file

@ -10,10 +10,7 @@ public class ListRow : Object {
private Grid main_grid;
private AvatarPicture picture;
public Label name_label;
// TODO: use something more visual for status
public Label status;
public Image status_image;
public Conversation? conversation;
public Jid? jid;
@ -22,8 +19,10 @@ public class ListRow : Object {
main_grid = (Grid) builder.get_object("main_grid");
picture = (AvatarPicture) builder.get_object("picture");
name_label = (Label) builder.get_object("name_label");
status = (Label) builder.get_object("status_label");
status.label = "(unknown)";
status_image = (Image) builder.get_object("status_image");
main_grid.set_column_spacing(10);
main_grid.set_column_homogeneous(false);
main_grid.set_baseline_row(1);
}
public ListRow(StreamInteractor stream_interactor, Conversation conversation, Jid jid) {
@ -44,11 +43,11 @@ public class ListRow : Object {
}
public void set_online() {
status.label = ("");
status_image.icon_name = "dino-status-online";
}
public void set_offline() {
status.label = ("(offline)");
status_image.icon_name = "dino-status-offline";
}
}