Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions src/components/sidebar/pages/system_page.vala
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ namespace Singularity.SidebarPages {
logo_box.margin_top = 12;
logo_box.margin_bottom = 4;
logo_box.halign = Align.CENTER;
var logo = new Image.from_icon_name("computer-symbolic");
logo.icon_name = get_distro_icon_name();
logo.pixel_size = 96;
logo.add_css_class("accent-color");
logo_box.append(logo);
logo_box.append(build_distro_logo(96));
add_widget(logo_box);
var device_group = new PreferencesGroup();
hostname_row = new EntryRow(_("Device Name"));
Expand Down Expand Up @@ -239,6 +235,26 @@ namespace Singularity.SidebarPages {
}
}

private Widget build_distro_logo(int size) {
var icon_name = get_distro_icon_name();
var display = Gdk.Display.get_default();
if (icon_name == "computer-symbolic" || display == null) {
var image = new Image.from_icon_name(icon_name);
image.pixel_size = size;
image.add_css_class("accent-color");
return image;
}
var paintable = Gtk.IconTheme.get_for_display(display).lookup_icon(
icon_name, null, size, 2, TextDirection.NONE, 0);
var picture = new Picture.for_paintable(paintable);
picture.content_fit = ContentFit.CONTAIN;
picture.can_shrink = true;
picture.set_size_request(size, size);
picture.halign = Align.CENTER;
picture.valign = Align.CENTER;
return picture;
}

private string get_distro_icon_name() {
string? logo_icon = HardwareInfo.os_release("LOGO");
string? distro_id = HardwareInfo.os_release("ID");
Expand Down
Loading