[gnome-control-center] printers: Fill the supply_frame background when supply is empty



commit 86c028ff9be52807c3a27bc1d47ebd2023beb2a9
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Feb 22 15:09:36 2017 +0100

    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 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index bc28ffb..cc33ed2 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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]