mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +00:00
Workaround for the problem that $goto only moves the first rss-item by making
it possible to specify the number of spaces you want in front of each rss-item
This commit is contained in:
parent
86b91db305
commit
6bc19d0396
@ -1,3 +1,9 @@
|
||||
2009-04-19
|
||||
* Make it possible to place spaces in front of RSS-items as a workaround
|
||||
for the problem that $goto only moves the first RSS-item. This is only a
|
||||
workaround and should be replaced by a permanent fix that makes $goto move
|
||||
all RSS-items !
|
||||
|
||||
2009-04-13
|
||||
* Fix broken compilation without X11
|
||||
|
||||
|
@ -1416,8 +1416,8 @@ Runs a command at an interval inside a thread and displays the output. Same as $
|
||||
Move text over by N pixels. See also $voffset.
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBrss\fR\*(T>\fR \*(T<\fBurl delay_in_minutes action item_num\fR\*(T>
|
||||
Download and parse RSS feeds. Action may be one of the following: feed_title, item_title (with num par), item_desc (with num par) and item_titles.
|
||||
\fB\*(T<\fBrss\fR\*(T>\fR \*(T<\fBurl delay_in_minutes action (num_par (spaces_in_front))\fR\*(T>
|
||||
Download and parse RSS feeds. Action may be one of the following: feed_title, item_title (with num par), item_desc (with num par) and item_titles (when using this action and spaces_in_front is given conky places that many spaces in front of each item).
|
||||
|
||||
.TP
|
||||
\fB\*(T<\fBtab\fR\*(T>\fR \*(T<\fB(width, (start))\fR\*(T>
|
||||
|
@ -2175,10 +2175,10 @@
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command><option>rss</option></command>
|
||||
<option>url delay_in_minutes action item_num</option>
|
||||
<option>url delay_in_minutes action (num_par (spaces_in_front))</option>
|
||||
</term>
|
||||
<listitem>
|
||||
Download and parse RSS feeds. Action may be one of the following: feed_title, item_title (with num par), item_desc (with num par) and item_titles.
|
||||
Download and parse RSS feeds. Action may be one of the following: feed_title, item_title (with num par), item_desc (with num par) and item_titles (when using this action and spaces_in_front is given conky places that many spaces in front of each item).
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
14
src/conky.c
14
src/conky.c
@ -2475,20 +2475,22 @@ static struct text_object *construct_text_object(const char *s,
|
||||
END OBJ(rss, 0)
|
||||
if (arg) {
|
||||
int argc, delay, act_par;
|
||||
unsigned int nrspaces = 0;
|
||||
char *uri = (char *) malloc(128 * sizeof(char));
|
||||
char *action = (char *) malloc(64 * sizeof(char));
|
||||
|
||||
argc = sscanf(arg, "%127s %d %63s %d", uri, &delay, action,
|
||||
&act_par);
|
||||
argc = sscanf(arg, "%127s %d %63s %d %u", uri, &delay, action,
|
||||
&act_par, &nrspaces);
|
||||
obj->data.rss.uri = uri;
|
||||
obj->data.rss.delay = delay;
|
||||
obj->data.rss.action = action;
|
||||
obj->data.rss.act_par = act_par;
|
||||
obj->data.rss.nrspaces = nrspaces;
|
||||
|
||||
init_rss_info();
|
||||
} else {
|
||||
CRIT_ERR("rss needs arguments: <uri> <delay in minutes> <action> "
|
||||
"[act_par]");
|
||||
"[act_par] [spaces in front]");
|
||||
}
|
||||
#endif
|
||||
#ifdef HDDTEMP
|
||||
@ -3890,6 +3892,10 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
if (data->item_count > 0) {
|
||||
int itmp;
|
||||
int show;
|
||||
//'tmpspaces' is a string with spaces too be placed in front of each title
|
||||
char *tmpspaces = malloc(obj->data.rss.nrspaces + 1);
|
||||
memset(tmpspaces, ' ', obj->data.rss.nrspaces);
|
||||
tmpspaces[obj->data.rss.nrspaces]=0;
|
||||
|
||||
p[0] = 0;
|
||||
|
||||
@ -3912,9 +3918,11 @@ static void generate_text_internal(char *p, int p_max_size,
|
||||
if (str[strlen(str) - 1] == '\n') {
|
||||
str[strlen(str) - 1] = 0;
|
||||
}
|
||||
strncat(p, tmpspaces, p_max_size);
|
||||
strncat(p, str, p_max_size);
|
||||
}
|
||||
}
|
||||
free(tmpspaces);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -482,6 +482,7 @@ struct text_object {
|
||||
char *action;
|
||||
int act_par;
|
||||
int delay;
|
||||
unsigned int nrspaces;
|
||||
} rss;
|
||||
#endif
|
||||
struct {
|
||||
|
Loading…
Reference in New Issue
Block a user