diff --git a/ChangeLog b/ChangeLog index d3d2c7e3..d90afef6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/doc/conky.1 b/doc/conky.1 index 29b01e42..870cb60f 100644 --- a/doc/conky.1 +++ b/doc/conky.1 @@ -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> diff --git a/doc/variables.xml b/doc/variables.xml index 14204e31..f5d5ab99 100644 --- a/doc/variables.xml +++ b/doc/variables.xml @@ -2175,10 +2175,10 @@ - + - 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). diff --git a/src/conky.c b/src/conky.c index c9b084f3..5ea77a59 100644 --- a/src/conky.c +++ b/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: " - "[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); } } } diff --git a/src/text_object.h b/src/text_object.h index 1d769e72..e36b31c4 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -482,6 +482,7 @@ struct text_object { char *action; int act_par; int delay; + unsigned int nrspaces; } rss; #endif struct {