From 86c028ff9be52807c3a27bc1d47ebd2023beb2a9 Mon Sep 17 00:00:00 2001 From: Felipe Borges Date: Wed, 22 Feb 2017 15:09:36 +0100 Subject: [PATCH] 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 --- panels/printers/pp-printer-entry.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c index bc28ffbc7..cc33ed201 100644 --- a/panels/printers/pp-printer-entry.c +++ b/panels/printers/pp-printer-entry.c @@ -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; }