[gnome-control-center/robertroth/power-levels: 71/71] power: set proper level offsets for battery levelbars



commit f7798f5dfa09bd69b79d8c9be1716c83d3ffc578
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Aug 2 13:09:54 2018 +0300

    power: set proper level offsets for battery levelbars
    
    The battery power level level bars are using the default offsets for low, high and full battery level, 
0.25, 0.75 and 1.0.
    
    Based on the suggestion from #68, this commit changes the high and full offset to 0.1 and 0.8, and the 
low battery level offset to 0.03 for primary batteries and UPSs, and 0.05 for other batteries and devices.
    
    https://gitlab.gnome.org/GNOME/gnome-control-center/issues/68

 panels/power/cc-power-panel.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 2c13b7d31..16dd63c9b 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -407,6 +407,9 @@ set_primary (CcPowerPanel *panel, UpDevice *device)
 
   levelbar = gtk_level_bar_new ();
   gtk_level_bar_set_value (GTK_LEVEL_BAR (levelbar), percentage / 100.0);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (levelbar), GTK_LEVEL_BAR_OFFSET_LOW, 0.03);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (levelbar), GTK_LEVEL_BAR_OFFSET_HIGH, 0.1);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (levelbar), GTK_LEVEL_BAR_OFFSET_FULL, 0.8);
   gtk_widget_set_hexpand (levelbar, TRUE);
   gtk_widget_set_halign (levelbar, GTK_ALIGN_FILL);
   gtk_widget_set_valign (levelbar, GTK_ALIGN_CENTER);
@@ -505,6 +508,9 @@ add_battery (CcPowerPanel *panel, UpDevice *device)
 
   levelbar = gtk_level_bar_new ();
   gtk_level_bar_set_value (GTK_LEVEL_BAR (levelbar), percentage / 100.0);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (levelbar), GTK_LEVEL_BAR_OFFSET_LOW, 0.05);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (levelbar), GTK_LEVEL_BAR_OFFSET_HIGH, 0.1);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (levelbar), GTK_LEVEL_BAR_OFFSET_FULL, 0.8);
   gtk_widget_set_hexpand (levelbar, TRUE);
   gtk_widget_set_halign (levelbar, GTK_ALIGN_FILL);
   gtk_widget_set_valign (levelbar, GTK_ALIGN_CENTER);
@@ -694,6 +700,9 @@ add_device (CcPowerPanel *panel, UpDevice *device)
   gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
   gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
   gtk_level_bar_set_value (GTK_LEVEL_BAR (widget), percentage / 100.0f);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (widget), GTK_LEVEL_BAR_OFFSET_LOW, 0.03);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (widget), GTK_LEVEL_BAR_OFFSET_HIGH, 0.1);
+  gtk_level_bar_add_offset_value (GTK_LEVEL_BAR (widget), GTK_LEVEL_BAR_OFFSET_FULL, 0.8);
   gtk_box_pack_start (GTK_BOX (box2), widget, TRUE, TRUE, 0);
   gtk_size_group_add_widget (panel->level_sizegroup, widget);
   gtk_box_pack_start (GTK_BOX (hbox), box2, TRUE, TRUE, 0);


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