|
|
bc8cde |
From 5d4cb8ea9c35b0a21259328e75d8672924f754e6 Mon Sep 17 00:00:00 2001
|
|
|
bc8cde |
From: Felipe Borges <felipeborges@gnome.org>
|
|
|
bc8cde |
Date: Tue, 21 Nov 2017 15:16:53 +0100
|
|
|
bc8cde |
Subject: [PATCH] printer: Don't show the supply level bar by default
|
|
|
bc8cde |
|
|
|
bc8cde |
We were checking for the ink supply level at the callback of the
|
|
|
bc8cde |
supply bar "draw" signal. This way we were making the the widget
|
|
|
bc8cde |
visible, causing it to allocate vertical space even when it isn't
|
|
|
bc8cde |
desired.
|
|
|
bc8cde |
|
|
|
bc8cde |
Now we check for the supply level before setting the visiblity of
|
|
|
bc8cde |
the supply level widget.
|
|
|
bc8cde |
|
|
|
bc8cde |
https://bugzilla.gnome.org/show_bug.cgi?id=790667
|
|
|
bc8cde |
---
|
|
|
bc8cde |
panels/printers/pp-printer-entry.c | 16 ++++++++++++++--
|
|
|
bc8cde |
panels/printers/printer-entry.ui | 2 --
|
|
|
bc8cde |
2 files changed, 14 insertions(+), 4 deletions(-)
|
|
|
bc8cde |
|
|
|
bc8cde |
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
|
|
|
bc8cde |
index ba704b9c7..6aa202aba 100644
|
|
|
bc8cde |
--- a/panels/printers/pp-printer-entry.c
|
|
|
bc8cde |
+++ b/panels/printers/pp-printer-entry.c
|
|
|
bc8cde |
@@ -227,6 +227,15 @@ sanitize_printer_model (gchar *printer_make_and_model)
|
|
|
bc8cde |
return g_strdup (printer_model);
|
|
|
bc8cde |
}
|
|
|
bc8cde |
|
|
|
bc8cde |
+static gboolean
|
|
|
bc8cde |
+supply_level_is_empty (PpPrinterEntry *self)
|
|
|
bc8cde |
+{
|
|
|
bc8cde |
+ return !((self->inklevel->marker_levels != NULL) &&
|
|
|
bc8cde |
+ (self->inklevel->marker_colors != NULL) &&
|
|
|
bc8cde |
+ (self->inklevel->marker_names != NULL) &&
|
|
|
bc8cde |
+ (self->inklevel->marker_types != NULL));
|
|
|
bc8cde |
+}
|
|
|
bc8cde |
+
|
|
|
bc8cde |
/* To tone down the colors in the supply level bar
|
|
|
bc8cde |
* we shade them by darkening the hue.
|
|
|
bc8cde |
*
|
|
|
bc8cde |
@@ -267,8 +276,7 @@ supply_levels_draw_cb (GtkWidget *widget,
|
|
|
bc8cde |
|
|
|
bc8cde |
gtk_render_background (context, cr, 0, 0, width, height);
|
|
|
bc8cde |
|
|
|
bc8cde |
- if (self->inklevel->marker_levels && self->inklevel->marker_colors &&
|
|
|
bc8cde |
- self->inklevel->marker_names && self->inklevel->marker_types)
|
|
|
bc8cde |
+ if (!supply_level_is_empty (self))
|
|
|
bc8cde |
{
|
|
|
bc8cde |
GSList *markers = NULL;
|
|
|
bc8cde |
GSList *tmp_list = NULL;
|
|
|
bc8cde |
@@ -694,6 +702,7 @@ pp_printer_entry_new (cups_dest_t printer,
|
|
|
bc8cde |
PpPrinterEntry *self;
|
|
|
bc8cde |
cups_ptype_t printer_type = 0;
|
|
|
bc8cde |
gboolean is_accepting_jobs;
|
|
|
bc8cde |
+ gboolean ink_supply_is_empty;
|
|
|
bc8cde |
gchar *instance;
|
|
|
bc8cde |
gchar *printer_uri = NULL;
|
|
|
bc8cde |
gchar *location = NULL;
|
|
|
bc8cde |
@@ -935,6 +944,9 @@ pp_printer_entry_new (cups_dest_t printer,
|
|
|
bc8cde |
}
|
|
|
bc8cde |
|
|
|
bc8cde |
g_signal_connect (self->supply_drawing_area, "draw", G_CALLBACK (supply_levels_draw_cb), self);
|
|
|
bc8cde |
+ ink_supply_is_empty = supply_level_is_empty (self);
|
|
|
bc8cde |
+ gtk_widget_set_visible (GTK_WIDGET (self->printer_inklevel_label), !ink_supply_is_empty);
|
|
|
bc8cde |
+ gtk_widget_set_visible (GTK_WIDGET (self->supply_frame), !ink_supply_is_empty);
|
|
|
bc8cde |
|
|
|
bc8cde |
pp_printer_entry_update_jobs_count (self);
|
|
|
bc8cde |
|
|
|
bc8cde |
diff --git a/panels/printers/printer-entry.ui b/panels/printers/printer-entry.ui
|
|
|
bc8cde |
index 5ac2eb1e3..c72b90a99 100644
|
|
|
bc8cde |
--- a/panels/printers/printer-entry.ui
|
|
|
bc8cde |
+++ b/panels/printers/printer-entry.ui
|
|
|
bc8cde |
@@ -245,7 +245,6 @@
|
|
|
bc8cde |
|
|
|
bc8cde |
<child>
|
|
|
bc8cde |
<object class="GtkLabel" id="printer_inklevel_label">
|
|
|
bc8cde |
- <property name="visible">True</property>
|
|
|
bc8cde |
<property name="label" translatable="yes">Ink Level</property>
|
|
|
bc8cde |
<property name="halign">end</property>
|
|
|
bc8cde |
<property name="xalign">1</property>
|
|
|
bc8cde |
@@ -261,7 +260,6 @@
|
|
|
bc8cde |
|
|
|
bc8cde |
<child>
|
|
|
bc8cde |
<object class="GtkFrame" id="supply_frame">
|
|
|
bc8cde |
- <property name="visible">True</property>
|
|
|
bc8cde |
<property name="valign">center</property>
|
|
|
bc8cde |
<property name="halign">start</property>
|
|
|
bc8cde |
<property name="height_request">18</property>
|
|
|
bc8cde |
--
|
|
|
bc8cde |
2.14.3
|
|
|
bc8cde |
|