1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +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:
Nikolas Garofil 2009-04-19 00:42:01 +02:00
parent 86b91db305
commit 6bc19d0396
5 changed files with 22 additions and 7 deletions

View File

@ -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 2009-04-13
* Fix broken compilation without X11 * Fix broken compilation without X11

View File

@ -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. Move text over by N pixels. See also $voffset.
.TP .TP
\fB\*(T<\fBrss\fR\*(T>\fR \*(T<\fBurl delay_in_minutes action item_num\fR\*(T> \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. 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 .TP
\fB\*(T<\fBtab\fR\*(T>\fR \*(T<\fB(width, (start))\fR\*(T> \fB\*(T<\fBtab\fR\*(T>\fR \*(T<\fB(width, (start))\fR\*(T>

View File

@ -2175,10 +2175,10 @@
<varlistentry> <varlistentry>
<term> <term>
<command><option>rss</option></command> <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> </term>
<listitem> <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> <para></para></listitem>
</varlistentry> </varlistentry>

View File

@ -2475,20 +2475,22 @@ static struct text_object *construct_text_object(const char *s,
END OBJ(rss, 0) END OBJ(rss, 0)
if (arg) { if (arg) {
int argc, delay, act_par; int argc, delay, act_par;
unsigned int nrspaces = 0;
char *uri = (char *) malloc(128 * sizeof(char)); char *uri = (char *) malloc(128 * sizeof(char));
char *action = (char *) malloc(64 * sizeof(char)); char *action = (char *) malloc(64 * sizeof(char));
argc = sscanf(arg, "%127s %d %63s %d", uri, &delay, action, argc = sscanf(arg, "%127s %d %63s %d %u", uri, &delay, action,
&act_par); &act_par, &nrspaces);
obj->data.rss.uri = uri; obj->data.rss.uri = uri;
obj->data.rss.delay = delay; obj->data.rss.delay = delay;
obj->data.rss.action = action; obj->data.rss.action = action;
obj->data.rss.act_par = act_par; obj->data.rss.act_par = act_par;
obj->data.rss.nrspaces = nrspaces;
init_rss_info(); init_rss_info();
} else { } else {
CRIT_ERR("rss needs arguments: <uri> <delay in minutes> <action> " CRIT_ERR("rss needs arguments: <uri> <delay in minutes> <action> "
"[act_par]"); "[act_par] [spaces in front]");
} }
#endif #endif
#ifdef HDDTEMP #ifdef HDDTEMP
@ -3890,6 +3892,10 @@ static void generate_text_internal(char *p, int p_max_size,
if (data->item_count > 0) { if (data->item_count > 0) {
int itmp; int itmp;
int show; 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; p[0] = 0;
@ -3912,9 +3918,11 @@ static void generate_text_internal(char *p, int p_max_size,
if (str[strlen(str) - 1] == '\n') { if (str[strlen(str) - 1] == '\n') {
str[strlen(str) - 1] = 0; str[strlen(str) - 1] = 0;
} }
strncat(p, tmpspaces, p_max_size);
strncat(p, str, p_max_size); strncat(p, str, p_max_size);
} }
} }
free(tmpspaces);
} }
} }
} }

View File

@ -482,6 +482,7 @@ struct text_object {
char *action; char *action;
int act_par; int act_par;
int delay; int delay;
unsigned int nrspaces;
} rss; } rss;
#endif #endif
struct { struct {