...
 
Commits (1)
  • Robert Roth's avatar
    power: set proper level offsets for battery levelbars · b65bef80
    Robert Roth authored
    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.
    
    GNOME/gnome-control-center#68
    b65bef80
......@@ -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);
......