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:
parent
67ca6806e6
commit
b9a2b7a6a7
|
@ -4,6 +4,7 @@
|
|||
<gresource prefix="/org/freedesktop/MalcontentUi/ui">
|
||||
<file preprocess="xml-stripblanks">restrict-applications-dialog.ui</file>
|
||||
<file preprocess="xml-stripblanks">restrict-applications-selector.ui</file>
|
||||
<file>restricts-switch.css</file>
|
||||
<file preprocess="xml-stripblanks">user-controls.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
/* FIXME: This ‘negative’ variant of a GtkSwitch should probably be
|
||||
* upstreamed to GTK. See https://gitlab.gnome.org/GNOME/gtk/issues/2470 */
|
||||
switch:checked.restricts {
|
||||
background-color: @error_color;
|
||||
}
|
||||
|
||||
switch:checked.restricts, switch:checked.restricts slider {
|
||||
border-color: #8b0000;
|
||||
}
|
||||
|
||||
switch:disabled.restricts {
|
||||
border-color: @borders;
|
||||
background-color: @insensitive_bg_color;
|
||||
}
|
||||
|
||||
switch:disabled.restricts slider {
|
||||
border-color: #bfb8b1;
|
||||
}
|
|
@ -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 ();
|
||||
|
|
Loading…
Reference in New Issue