From e39d5f838c08b5b57eae4c1aec4ae00acd18b239 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 25 Dec 2011 23:14:50 +0000 Subject: Sun Dec 25 23:14:50 UTC 2011 --- community/lxpanel/PKGBUILD | 20 ++++++++---- community/lxpanel/battery.patch | 72 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 6 deletions(-) create mode 100644 community/lxpanel/battery.patch (limited to 'community/lxpanel') diff --git a/community/lxpanel/PKGBUILD b/community/lxpanel/PKGBUILD index 802c2e2fa..e4c3a5440 100644 --- a/community/lxpanel/PKGBUILD +++ b/community/lxpanel/PKGBUILD @@ -1,22 +1,26 @@ -# $Id: PKGBUILD 53158 2011-07-31 08:25:21Z angvp $ -# Maintainer: Angel Velasquez -# Maintainer: Juergen Hoetzel +# $Id: PKGBUILD 61193 2011-12-24 11:33:27Z bpiotrowski $ +# Maintainer: Bartłomiej Piotrowski +# Contributor: Angel Velasquez +# Contributor: Juergen Hoetzel pkgname=lxpanel pkgver=0.5.8 -pkgrel=1 +pkgrel=2 pkgdesc="Panel of the LXDE Desktop" arch=('i686' 'x86_64') license=('GPL2') url="http://lxde.org/" groups=('lxde') depends=('gtk2' 'alsa-lib' 'menu-cache' 'lxmenu-data') -source=(http://downloads.sourceforge.net/lxde/${pkgname}-${pkgver}.tar.gz) +source=(http://downloads.sourceforge.net/lxde/${pkgname}-${pkgver}.tar.gz + battery.patch) optdepends=(pcmanfm) -md5sums=('129fae75d1cd3983fd94542c573a70a1') build() { cd "$srcdir/$pkgname-$pkgver" + + patch -Np1 -i "$srcdir/battery.patch" + ./configure --sysconfdir=/etc --prefix=/usr make } @@ -25,3 +29,7 @@ package() { cd "$srcdir/$pkgname-$pkgver" make DESTDIR="$pkgdir" install } +md5sums=('129fae75d1cd3983fd94542c573a70a1' + '5fadb4d5aca09c81138677e91f995d98') +md5sums=('129fae75d1cd3983fd94542c573a70a1' + '5fadb4d5aca09c81138677e91f995d98') diff --git a/community/lxpanel/battery.patch b/community/lxpanel/battery.patch new file mode 100644 index 000000000..5d701ea6d --- /dev/null +++ b/community/lxpanel/battery.patch @@ -0,0 +1,72 @@ +diff --git plugins/batt/batt_sys.c plugins/batt/batt_sys.c +index 54ff678..1eebab5 100644 +--- a/src/plugins/batt/batt_sys.c ++++ b/src/plugins/batt/batt_sys.c +@@ -35,15 +35,6 @@ + #include + #include + +-battery* battery_new() { +- static int battery_num = 1; +- battery * b = g_new0 ( battery, 1 ); +- battery_reset(b); +- b->battery_num = battery_num; +- battery_num++; +- return b; +-} +- + void battery_reset( battery * b) { + b->type_battery = TRUE; + b->capacity_unit = "mAh"; +@@ -58,6 +49,15 @@ void battery_reset( battery * b) { + b->state = NULL; + } + ++battery* battery_new() { ++ static int battery_num = 1; ++ battery * b = g_new0 ( battery, 1 ); ++ battery_reset(b); ++ b->battery_num = battery_num; ++ battery_num++; ++ return b; ++} ++ + static gchar* parse_info_file(char *filename) + { + char *buf = NULL; +@@ -194,7 +194,7 @@ void battery_update( battery *b ) { + + /* convert energy values (in mWh) to charge values (in mAh) if needed and possible */ + if (b->last_capacity_unit != -1 && b->last_capacity == -1) { +- if (b->voltage != -1) { ++ if (b->voltage > 0) { + b->last_capacity = b->last_capacity_unit * 1000 / b->voltage; + } else { + b->last_capacity = b->last_capacity_unit; +@@ -202,7 +202,7 @@ void battery_update( battery *b ) { + } + } + if (b->design_capacity_unit != -1 && b->design_capacity == -1) { +- if (b->voltage != -1) { ++ if (b->voltage > 0) { + b->design_capacity = b->design_capacity_unit * 1000 / b->voltage; + } else { + b->design_capacity = b->design_capacity_unit; +@@ -210,7 +210,7 @@ void battery_update( battery *b ) { + } + } + if (b->remaining_energy != -1 && b->remaining_capacity == -1) { +- if (b->voltage != -1) { ++ if (b->voltage > 0) { + b->remaining_capacity = b->remaining_energy * 1000 / b->voltage; + b->present_rate = b->present_rate * 1000 / b->voltage; + } else { +@@ -220,7 +220,7 @@ void battery_update( battery *b ) { + if (b->last_capacity < MIN_CAPACITY) + b->percentage = 0; + else +- b->percentage = ((float) b->remaining_energy * 100.0) / (float) b->last_capacity_unit; ++ b->percentage = (float) b->remaining_capacity * 100 / b->last_capacity; + + if (b->percentage > 100) + b->percentage = 100; -- cgit v1.2.3-54-g00ecf