Skip to content
This repository has been archived by the owner on Jun 17, 2024. It is now read-only.

Commit

Permalink
Set bold style for user name with CSS (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter committed Jul 23, 2023
1 parent 1c79e2b commit 1da4520
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions data/Userbox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
* SPDX-License-Identifier: GPL-2.0-or-later
* SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io)
*/

.fullname-label {
font-weight: 700;
}
1 change: 1 addition & 0 deletions data/session.gresource.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<gresources>
<gresource prefix="/io/elementary/wingpanel/session">
<file compressed= "true">Indicator.css</file>
<file compressed= "true">Userbox.css</file>
<file alias="16x16/actions/system-suspend-symbolic.svg" compressed="true" preprocess="xml-stripblanks">system-suspend-symbolic.svg</file>
</gresource>
</gresources>
14 changes: 11 additions & 3 deletions src/Widgets/UserBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
public class Session.Widgets.Userbox : Gtk.ListBoxRow {
private const int ICON_SIZE = 48;

private static Gtk.CssProvider provider;

public Act.User? user { get; construct; default = null; }
public string fullname { get; construct set; }
public UserState state { get; private set; }
Expand All @@ -42,12 +44,18 @@ public class Session.Widgets.Userbox : Gtk.ListBoxRow {
Object (fullname: _("Guest"));
}

static construct {
provider = new Gtk.CssProvider ();
provider.load_from_resource ("io/elementary/wingpanel/session/Userbox.css");
}

construct {
fullname_label = new Gtk.Label ("<b>%s</b>".printf (fullname)) {
use_markup = true,
fullname_label = new Gtk.Label (fullname) {
valign = Gtk.Align.END,
halign = Gtk.Align.START
};
fullname_label.get_style_context ().add_class ("fullname-label");
fullname_label.get_style_context ().add_provider (provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);

status_label = new Gtk.Label (null) {
valign = Gtk.Align.START,
Expand Down Expand Up @@ -125,7 +133,7 @@ public class Session.Widgets.Userbox : Gtk.ListBoxRow {
return;
}

fullname_label.label = "<b>%s</b>".printf (user.real_name);
fullname_label.label = user.real_name;
avatar.set_image_load_func (avatar_image_load_func);
}

Expand Down

0 comments on commit 1da4520

Please sign in to comment.