1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-30 05:59:07 +00:00

Re-arranged some if statements to reduce redundancy

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1185 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Kevin Lyles 2008-06-21 09:25:37 +00:00
parent 02dad6a2cb
commit 54120a3d83
2 changed files with 14 additions and 27 deletions

View File

@ -109,13 +109,11 @@ int create_audacious_thread(void)
int destroy_audacious_thread(void)
{
/* Is a worker is thread running? If not, no error. */
if (!info.audacious.p_timed_thread) {
return 0;
if (info.audacious.p_timed_thread) {
timed_thread_destroy(info.audacious.p_timed_thread,
&info.audacious.p_timed_thread);
}
timed_thread_destroy(info.audacious.p_timed_thread,
&info.audacious.p_timed_thread);
return 0;
}

View File

@ -778,19 +778,16 @@ static void new_graph(char *buf, int w, int h, unsigned int first_colour,
s->last_colour = adjust_colors(second_colour);
if (scale != 0) {
s->scaled = 0;
s->graph_scale = scale;
s->show_scale = 0;
} else {
s->scaled = 1;
s->graph_scale = 1;
s->show_scale = 1;
}
/* if (s->width) {
s->graph_width = s->width - 2; // subtract 2 for rectangle around
} */
if (s->scaled) {
s->graph_scale = 1;
s->show_scale = 1;
} else {
s->graph_scale = scale;
s->show_scale = 0;
}
if (append) {
graph_append(s, i);
}
@ -4905,9 +4902,7 @@ static void generate_text_internal(char *p, int p_max_size,
}
OBJ(execibar) {
if (current_update_time - obj->data.execi.last_update
< obj->data.execi.interval) {
new_bar(p, 0, 4, (int) obj->f);
} else {
>= obj->data.execi.interval) {
double barnum;
read_exec(obj->data.execi.cmd, p, p_max_size);
@ -4915,16 +4910,14 @@ static void generate_text_internal(char *p, int p_max_size,
if (barnum >= 0.0) {
obj->f = 255 * barnum / 100.0;
new_bar(p, 0, 4, round_to_int(obj->f));
}
obj->data.execi.last_update = current_update_time;
}
new_bar(p, 0, 4, round_to_int(obj->f));
}
OBJ(execigraph) {
if (current_update_time - obj->data.execi.last_update
< obj->data.execi.interval) {
new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->f), 100, 0);
} else {
>= obj->data.execi.interval) {
double barnum;
read_exec(obj->data.execi.cmd, p, p_max_size);
@ -4932,24 +4925,20 @@ static void generate_text_internal(char *p, int p_max_size,
if (barnum >= 0.0) {
obj->f = barnum;
new_graph(p, 0, 25, obj->c, obj->d, (int) (obj->f),
100, 1);
}
obj->data.execi.last_update = current_update_time;
}
new_graph(p, 0, 25, obj->c, obj->d, round_to_int(obj->f), 100, 0);
}
OBJ(execi) {
if (current_update_time - obj->data.execi.last_update
< obj->data.execi.interval
|| obj->data.execi.interval == 0) {
snprintf(p, p_max_size, "%s", obj->data.execi.buffer);
} else {
>= obj->data.execi.interval
&& obj->data.execi.interval != 0) {
read_exec(obj->data.execi.cmd, obj->data.execi.buffer,
p_max_size);
obj->data.execi.last_update = current_update_time;
snprintf(p, p_max_size, "%s", obj->data.execi.buffer);
}
// parse_conky_vars(output, p, cur);
snprintf(p, p_max_size, "%s", obj->data.execi.buffer);
}
OBJ(execpi) {
struct text_object_list *text_objects = 0;