Skip to content

Commit

Permalink
GradeLabel: cleanup, gtk4 prep
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Aug 28, 2024
1 parent adc9093 commit 867cd55
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
9 changes: 8 additions & 1 deletion data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@
* Boston, MA 02110-1301 USA
*/

.grade {
grade {
color: #fff;
background-color: alpha(#333, 0.9);
border-radius: 50%;
box-shadow: 0 1px shade(@colorBackground, 1.15);
min-height: 76px;
min-width: 76px;
}

grade label {
font-weight: bold;
margin-top: 20px;
}

.results {
Expand Down
29 changes: 15 additions & 14 deletions src/GradeLabel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
* SPDX-FileCopyrightText: 2017-2024 Danielle Foré (https://github.com/danirabbit)
*/

public class GradeLabel : Gtk.Grid {
private Gtk.Image icon;
public class GradeLabel : Gtk.Box {
private Gtk.Image image;

public string level { get; construct; }
public bool pass {
set {
if (value) {
icon.icon_name = "object-select-symbolic";
image.icon_name = "object-select-symbolic";
} else {
icon.icon_name = "window-close-symbolic";
image.icon_name = "window-close-symbolic";
}
}
}
Expand All @@ -27,19 +27,20 @@ public class GradeLabel : Gtk.Grid {
);
}

class construct {
set_css_name ("grade");
}

construct {
var level = new Gtk.Label ("<small><b>%s</b></small>".printf (level));
level.margin_top = 20;
level.width_request = 76;
level.use_markup = true;
var level = new Gtk.Label ("%s".printf (level)) {
use_markup = true
};
level.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL);

icon = new Gtk.Image ();
icon.icon_size = Gtk.IconSize.LARGE_TOOLBAR;
icon.icon_name = "object-select-symbolic";
image = new Gtk.Image.from_icon_name ("object-select-symbolic", LARGE_TOOLBAR);

orientation = Gtk.Orientation.VERTICAL;
get_style_context ().add_class ("grade");
orientation = VERTICAL;
add (level);
add (icon);
add (image);
}
}

0 comments on commit 867cd55

Please sign in to comment.