show pango markup errors only once

see also #111
This commit is contained in:
Sascha Kruse 2013-06-29 00:50:57 +02:00
parent a098b9476f
commit fb8eafe3fa
3 changed files with 7 additions and 1 deletions

View File

@ -359,6 +359,8 @@ int notification_init(notification * n, int id)
n->redisplayed = false;
n->first_render = true;
if (id == 0) {
n->id = ++next_notification_id;
} else {

View File

@ -31,6 +31,7 @@ typedef struct _notification {
int dup_count;
int displayed_height;
const char *color_strings[2];
bool first_render;
int progress; /* percentage + 1, 0 to hide */
int line_count;

5
x.c
View File

@ -301,7 +301,9 @@ static colored_layout *r_create_layout_from_notification(cairo_t *c, notificatio
cl->text = NULL;
cl->attr = NULL;
pango_layout_set_text(cl->l, n->text_to_render, -1);
printf("Error parsing markup: %s\n", err->message);
if (n->first_render) {
printf("Error parsing markup: %s\n", err->message);
}
g_error_free(err);
}
@ -309,6 +311,7 @@ static colored_layout *r_create_layout_from_notification(cairo_t *c, notificatio
pango_layout_get_pixel_size(cl->l, NULL, &(n->displayed_height));
n->displayed_height += 2 * settings.padding;
n->first_render = false;
return cl;
}