printers: Fill the supply_frame background when supply is empty

According to the mockups at
https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines
The supply level bar should have a grey background when there are
no colors in the supply bar.

This patch sets the "background" css name to the supply_frame when
there's not a single color in the supply bar.

https://bugzilla.gnome.org/show_bug.cgi?id=779075
This commit is contained in:
Felipe Borges 2017-02-22 15:09:36 +01:00
parent 2c7fc8653d
commit 86c028ff9b

View file

@ -191,6 +191,7 @@ supply_levels_draw_cb (GtkWidget *widget,
InkLevelData *inklevel)
{
GtkStyleContext *context;
gboolean is_empty = TRUE;
gchar *tooltip_text = NULL;
gint width;
gint height;
@ -268,6 +269,8 @@ supply_levels_draw_cb (GtkWidget *widget,
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr, 1.5, 1.5, display_value, SUPPLY_BAR_HEIGHT + 1);
cairo_stroke (cr);
is_empty = FALSE;
}
if (tooltip_text)
@ -309,6 +312,13 @@ supply_levels_draw_cb (GtkWidget *widget,
}
}
if (is_empty)
{
GtkWidget *frame = gtk_widget_get_parent (widget);
gtk_style_context_add_class (gtk_widget_get_style_context (frame),
"background");
}
return TRUE;
}