mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 04:06:03 +00:00
merge diskiographs to callbacks.graphval
This commit is contained in:
parent
9581914f7d
commit
fe05542318
@ -421,13 +421,13 @@ struct text_object *construct_text_object(const char *s, const char *arg, long
|
||||
#ifdef X11
|
||||
END OBJ(diskiograph, &update_diskio)
|
||||
parse_diskiograph_arg(obj, arg);
|
||||
obj->callbacks.print = &print_diskiograph;
|
||||
obj->callbacks.graphval = &diskiographval;
|
||||
END OBJ(diskiograph_read, &update_diskio)
|
||||
parse_diskiograph_arg(obj, arg);
|
||||
obj->callbacks.print = &print_diskiograph_read;
|
||||
obj->callbacks.graphval = &diskiographval_read;
|
||||
END OBJ(diskiograph_write, &update_diskio)
|
||||
parse_diskiograph_arg(obj, arg);
|
||||
obj->callbacks.print = &print_diskiograph_write;
|
||||
obj->callbacks.graphval = &diskiographval_write;
|
||||
#endif /* X11 */
|
||||
END OBJ(color, 0)
|
||||
#ifdef X11
|
||||
|
35
src/diskio.c
35
src/diskio.c
@ -165,40 +165,27 @@ void parse_diskiograph_arg(struct text_object *obj, const char *arg)
|
||||
free(buf);
|
||||
}
|
||||
|
||||
static void print_diskiograph_dir(struct text_object *obj, int dir, char *p, int p_max_size)
|
||||
/* XXX: what about max values? */
|
||||
|
||||
uint8_t diskiographval(struct text_object *obj)
|
||||
{
|
||||
struct diskio_stat *diskio = obj->data.opaque;
|
||||
double val;
|
||||
|
||||
if (!diskio)
|
||||
return;
|
||||
|
||||
if (!p_max_size)
|
||||
return;
|
||||
|
||||
if (dir < 0)
|
||||
val = diskio->current_read;
|
||||
else if (dir == 0)
|
||||
val = diskio->current;
|
||||
else
|
||||
val = diskio->current_write;
|
||||
|
||||
new_graph(obj, p, p_max_size, val);
|
||||
return (diskio ? round_to_int(diskio->current) : 0);
|
||||
}
|
||||
|
||||
void print_diskiograph(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t diskiographval_read(struct text_object *obj)
|
||||
{
|
||||
print_diskiograph_dir(obj, 0, p, p_max_size);
|
||||
struct diskio_stat *diskio = obj->data.opaque;
|
||||
|
||||
return (diskio ? round_to_int(diskio->current_read) : 0);
|
||||
}
|
||||
|
||||
void print_diskiograph_read(struct text_object *obj, char *p, int p_max_size)
|
||||
uint8_t diskiographval_write(struct text_object *obj)
|
||||
{
|
||||
print_diskiograph_dir(obj, -1, p, p_max_size);
|
||||
}
|
||||
struct diskio_stat *diskio = obj->data.opaque;
|
||||
|
||||
void print_diskiograph_write(struct text_object *obj, char *p, int p_max_size)
|
||||
{
|
||||
print_diskiograph_dir(obj, 1, p, p_max_size);
|
||||
return (diskio ? round_to_int(diskio->current_write) : 0);
|
||||
}
|
||||
#endif /* X11 */
|
||||
|
||||
|
@ -57,9 +57,9 @@ void print_diskio_read(struct text_object *, char *, int);
|
||||
void print_diskio_write(struct text_object *, char *, int);
|
||||
#ifdef X11
|
||||
void parse_diskiograph_arg(struct text_object *, const char *);
|
||||
void print_diskiograph(struct text_object *, char *, int);
|
||||
void print_diskiograph_read(struct text_object *, char *, int);
|
||||
void print_diskiograph_write(struct text_object *, char *, int);
|
||||
uint8_t diskiographval(struct text_object *);
|
||||
uint8_t diskiographval_read(struct text_object *);
|
||||
uint8_t diskiographval_write(struct text_object *);
|
||||
#endif /* X11 */
|
||||
|
||||
#endif /* DISKIO_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user