| 1 |
// This file is part of GNOME Boxes. License: LGPLv2+ |
| 2 |
using Gtk; |
| 3 |
|
| 4 |
namespace Connections { |
| 5 |
[GtkTemplate (ui = "/org/gnome/Connections/ui/onboarding-dialog-page.ui")] |
| 6 |
private class OnboardingDialogPage : Gtk.Box { |
| 7 |
[GtkChild] |
| 8 |
private unowned Label title_label; |
| 9 |
[GtkChild] |
| 10 |
private unowned Label description_label; |
| 11 |
|
| 12 |
public string title { |
| 13 |
set { |
| 14 |
title_label.label = value; |
| 15 |
} |
| 16 |
get { |
| 17 |
return title_label.label; |
| 18 |
} |
| 19 |
} |
| 20 |
public string description { |
| 21 |
set { |
| 22 |
description_label.label = value; |
| 23 |
} |
| 24 |
get { |
| 25 |
return description_label.label; |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
public string image { set; get; } |
| 30 |
|
| 31 |
[GtkCallback] |
| 32 |
private void load_css () { |
| 33 |
var provider = new CssProvider (); |
| 34 |
var css = """ |
| 35 |
.onboarding-dialog-page { |
| 36 |
background-image: url("resource://%s"); |
| 37 |
} |
| 38 |
""".printf (image); |
| 39 |
|
| 40 |
try { |
| 41 |
provider.load_from_data (css); |
| 42 |
get_style_context ().add_provider (provider, STYLE_PROVIDER_PRIORITY_APPLICATION); |
| 43 |
} catch (GLib.Error error) { |
| 44 |
warning ("Failed to load CSS: %s", error.message); |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
} |