1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-24 11:55:43 +00:00

* Fixed battery_bar default size

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1049 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Brenden Matthews 2008-03-24 21:44:50 +00:00
parent 3966025939
commit a56e669356
3 changed files with 28 additions and 18 deletions

View File

@ -1,5 +1,8 @@
# $Id$
2008-03-24
* Fixed battery_bar default size
2008-03-23
* Fixed compilation with --disable-x11
* Fixed linux.c compilation problem due to (suspected) broken linux

View File

@ -2436,7 +2436,7 @@ static struct text_object *construct_text_object(const char *s,
obj->data.s = strdup(bat);
END OBJ(battery_bar, 0)
char bat[64];
obj->b = 6;
if (arg) {
arg = scan_bar(arg, &obj->a, &obj->b);
sscanf(arg, "%63s", bat);
@ -2806,7 +2806,6 @@ static struct text_object *construct_text_object(const char *s,
}
#endif
END OBJ(fs_bar, INFO_FS)
obj->data.fsbar.h = 4;
arg = scan_bar(arg, &obj->data.fsbar.w, &obj->data.fsbar.h);
if (arg) {
while (isspace(*arg)) {
@ -2820,16 +2819,18 @@ static struct text_object *construct_text_object(const char *s,
}
obj->data.fsbar.fs = prepare_fs_stat(arg);
END OBJ(fs_bar_free, INFO_FS)
obj->data.fsbar.h = 4;
arg = scan_bar(arg, &obj->data.fsbar.w, &obj->data.fsbar.h);
if (arg) {
unsigned int n;
if (sscanf(arg, "%d %n", &obj->data.fsbar.h, &n) >= 1) {
arg += n;
while (isspace(*arg)) {
arg++;
}
if (*arg == '\0') {
arg = "/";
}
} else {
arg = "/";
}
obj->data.fsbar.fs = prepare_fs_stat(arg);
END OBJ(fs_free, INFO_FS)
if (!arg) {

View File

@ -1468,9 +1468,9 @@ present voltage: 16608 mV
#define APM_PATH "/proc/apm"
#define MAX_BATTERY_COUNT 4
static FILE *sysfs_bat_fp[MAX_BATTERY_COUNT];
static FILE *acpi_bat_fp[MAX_BATTERY_COUNT];
static FILE *apm_bat_fp[MAX_BATTERY_COUNT];
static FILE *sysfs_bat_fp[MAX_BATTERY_COUNT] = { NULL, NULL, NULL, NULL };
static FILE *acpi_bat_fp[MAX_BATTERY_COUNT] = { NULL, NULL, NULL, NULL };
static FILE *apm_bat_fp[MAX_BATTERY_COUNT] = { NULL, NULL, NULL, NULL };
static int batteries_initialized = 0;
static char batteries[MAX_BATTERY_COUNT][32];
@ -1544,11 +1544,14 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item)
/* first try SYSFS if that fails try ACPI */
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL)
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL) {
sysfs_bat_fp[idx] = open_file(sysfs_path, &rep);
rep = 0;
}
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL)
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL) {
acpi_bat_fp[idx] = open_file(acpi_path, &rep);
}
if (sysfs_bat_fp[idx] != NULL) {
/* SYSFS */
@ -1818,7 +1821,7 @@ set_return_value:
int get_battery_perct(const char *bat)
{
static int rep;
static int rep = 0;
int idx;
char acpi_path[128];
@ -1838,11 +1841,14 @@ int get_battery_perct(const char *bat)
/* Only check for SYSFS or ACPI */
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL)
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL) {
sysfs_bat_fp[idx] = open_file(sysfs_path, &rep);
rep = 0;
}
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL)
if (sysfs_bat_fp[idx] == NULL && acpi_bat_fp[idx] == NULL && apm_bat_fp[idx] == NULL) {
acpi_bat_fp[idx] = open_file(acpi_path, &rep);
}
int remaining_capacity = -1;