user-controls: Add CSS to support styling switches as ‘restrictive’

This will be used in upcoming commits to mark switches as restricting
something when they’re active, rather than allowing something. Their
background will be red, rather than blue.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #11
This commit is contained in:
Philip Withnall 2020-02-24 16:31:51 +00:00
parent 67ca6806e6
commit b9a2b7a6a7
3 changed files with 27 additions and 0 deletions

View file

@ -949,12 +949,20 @@ mct_user_controls_init (MctUserControls *self)
{
g_autoptr(GDBusConnection) system_bus = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(GtkCssProvider) provider = NULL;
/* Ensure the types used in the UI are registered. */
g_type_ensure (MCT_TYPE_RESTRICT_APPLICATIONS_DIALOG);
gtk_widget_init_template (GTK_WIDGET (self));
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider,
"/org/freedesktop/MalcontentUi/ui/restricts-switch.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - 1);
self->selected_age = (guint) -1;
self->cancellable = g_cancellable_new ();