Skip to content

Commit

Permalink
Display user status online/offline with circles (#40)
Browse files Browse the repository at this point in the history
Adds a display of the user's offline/online status through red and green circles, respectively.
  • Loading branch information
Aristofan-Kif authored Apr 9, 2024
1 parent 02759c5 commit ffacf70
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
1 change: 1 addition & 0 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions main/data/gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
11 changes: 11 additions & 0 deletions main/data/icons/scalable/status/dino-status-offline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions main/data/occupant_list_item.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
15 changes: 7 additions & 8 deletions main/src/ui/occupant_menu/list_row.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand All @@ -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";
}
}

Expand Down

0 comments on commit ffacf70

Please sign in to comment.