@@ -293,7 +293,6 @@ func (self *TitleBar) SetSoundVolume(vol int) {
293
293
func (self * TitleBar ) CheckBatteryStat () {
294
294
bat_segs := [][]int {[]int {0 , 6 }, []int {7 , 15 }, []int {16 , 20 }, []int {21 , 30 }, []int {31 , 50 }, []int {51 , 60 }, []int {61 , 80 }, []int {81 , 90 }, []int {91 , 100 }}
295
295
296
- self .Icons ["battery" ] = self .Icons ["battery_unknown" ]
297
296
298
297
if FileExists (sysgo .Battery ) == false {
299
298
return
@@ -340,11 +339,9 @@ func (self *TitleBar) CheckBatteryStat() {
340
339
341
340
if val , ok := bat_uevent ["POWER_SUPPLY_STATUS" ]; ok {
342
341
if val == "Charging" {
343
- self .Icons ["battery_charging" ].SetIconIndex (cap_ge )
344
- self .Icons ["battery" ] = self .Icons ["battery_charging" ]
342
+ self .Icons ["battery" ].SetIconIndex (1 + cap_ge )
345
343
} else {
346
- self .Icons ["battery_discharging" ].SetIconIndex (cap_ge )
347
- self .Icons ["battery" ] = self .Icons ["battery_discharging" ]
344
+ self .Icons ["battery" ].SetIconIndex (1 + 9 + cap_ge )
348
345
}
349
346
}
350
347
@@ -392,29 +389,13 @@ func (self *TitleBar) Init(main_screen *MainScreen) {
392
389
393
390
self .Icons ["wifistatus" ] = icon_wifi_status
394
391
395
- battery_charging := NewTitleBarIconItem ()
396
- battery_charging .MyType = ICON_TYPES ["STAT" ]
397
- battery_charging .Parent = self
398
- battery_charging .ImageName = self .icon_base_path + "withcharging.png"
399
- battery_charging .Adjust (start_x + self .IconWidth + self .IconWidth + 8 , self .IconHeight / 2 + (self .BarHeight - self .IconHeight )/ 2 , self .IconWidth , self .IconHeight , 0 )
400
-
401
- self .Icons ["battery_charging" ] = battery_charging
402
-
403
- battery_discharging := NewTitleBarIconItem ()
404
- battery_discharging .MyType = ICON_TYPES ["STAT" ]
405
- battery_discharging .Parent = self
406
- battery_discharging .ImageName = self .icon_base_path + "without_charging.png"
407
- battery_discharging .Adjust (start_x + self .IconWidth + self .IconWidth + 8 , self .IconHeight / 2 + (self .BarHeight - self .IconHeight )/ 2 , self .IconWidth , self .IconHeight , 0 )
408
-
409
- self .Icons ["battery_discharging" ] = battery_discharging
410
-
411
392
battery_unknown := NewTitleBarIconItem ()
412
393
battery_unknown .MyType = ICON_TYPES ["STAT" ]
413
394
battery_unknown .Parent = self
414
- battery_unknown .ImageName = self .icon_base_path + "battery_unknown .png"
395
+ battery_unknown .ImageName = self .icon_base_path + "battery .png"
415
396
battery_unknown .Adjust (start_x + self .IconWidth + self .IconWidth + 8 , self .IconHeight / 2 + (self .BarHeight - self .IconHeight )/ 2 , self .IconWidth , self .IconHeight , 0 )
416
397
417
- self .Icons ["battery_unknown " ] = battery_unknown
398
+ self .Icons ["battery " ] = battery_unknown
418
399
419
400
self .CheckBatteryStat ()
420
401
0 commit comments