| 1 | /* |
| 2 | * Copyright 2024 Andrey Kutejko <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * For more details see the file COPYING. |
| 18 | */ |
| 19 | |
| 20 | use gettextrs::gettext; |
| 21 | use gtk::prelude::*; |
| 22 | |
| 23 | pub fn no_scores() -> gtk::Widget { |
| 24 | let vbox = gtk::Box::builder() |
| 25 | .orientation(gtk::Orientation::Vertical) |
| 26 | .spacing(4) |
| 27 | .hexpand(true) |
| 28 | .vexpand(true) |
| 29 | .valign(gtk::Align::Center) |
| 30 | .width_request(450) |
| 31 | .height_request(450) |
| 32 | .build(); |
| 33 | vbox.add_css_class("dim-label"); |
| 34 | |
| 35 | let image = gtk::Image::builder() |
| 36 | .icon_name("org.gnome.Robots-symbolic") |
| 37 | .pixel_size(64) |
| 38 | .opacity(0.2) |
| 39 | .build(); |
| 40 | vbox.append(&image); |
| 41 | |
| 42 | let title_label = gtk::Label::builder() |
| 43 | .label(format!( |
| 44 | "<b><span size=\"large\">{}</span></b>", |
| 45 | gettext("No scores yet") |
| 46 | )) |
| 47 | .use_markup(true) |
| 48 | .build(); |
| 49 | vbox.append(&title_label); |
| 50 | |
| 51 | let description_label = gtk::Label::builder() |
| 52 | .label(gettext( |
| 53 | "Play some games and your scores will show up here.", |
| 54 | )) |
| 55 | .build(); |
| 56 | vbox.append(&description_label); |
| 57 | |
| 58 | vbox.upcast() |
| 59 | } |