Skip to content

Commit

Permalink
Fix: bold formatting #111
Browse files Browse the repository at this point in the history
  • Loading branch information
kajzer authored and raveit65 committed Oct 14, 2016
1 parent 7bf293b commit d9ed22c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 30 deletions.
13 changes: 5 additions & 8 deletions src/themes/coco/coco-theme.c
Expand Up @@ -506,18 +506,15 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);

if (strstr(body, "&") || strstr(body, "<") || strstr(body, ">") || strstr(body, "'") || strstr(body, """))
if (pango_parse_markup (body, -1, 0, NULL, NULL, NULL, NULL))
{
str = g_strdup_printf("<span color=\"#EAEAEA\">%s</span>", body);
gtk_label_set_markup (GTK_LABEL (windata->body_label), str);
g_free(str);
}
else
{
quoted = g_markup_escape_text(body, -1);
str = g_strdup_printf("<span color=\"#EAEAEA\">%s</span>", quoted);
g_free(quoted);
else {
gtk_label_set_text (GTK_LABEL (windata->body_label), body);
}
gtk_label_set_markup (GTK_LABEL (windata->body_label), str);
g_free(str);

if (body == NULL || *body == '\0')
gtk_widget_hide(windata->body_label);
Expand Down
13 changes: 5 additions & 8 deletions src/themes/nodoka/nodoka-theme.c
Expand Up @@ -891,18 +891,15 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);

if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
if (pango_parse_markup (body, -1, 0, NULL, NULL, NULL, NULL))
{
str = g_strdup_printf("<span color=\"#000000\">%s</span>", body);
gtk_label_set_markup (GTK_LABEL (windata->body_label), str);
g_free(str);
}
else
{
quoted = g_markup_escape_text(body, -1);
str = g_strdup_printf("<span color=\"#000000\">%s</span>", quoted);
g_free(quoted);
else {
gtk_label_set_text (GTK_LABEL (windata->body_label), body);
}
gtk_label_set_markup(GTK_LABEL(windata->body_label), str);
g_free(str);

if (body == NULL || *body == '\0')
gtk_widget_hide(windata->body_label);
Expand Down
11 changes: 4 additions & 7 deletions src/themes/slider/theme.c
Expand Up @@ -513,15 +513,12 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);

if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
if (pango_parse_markup (body, -1, 0, NULL, NULL, NULL, NULL))
{
gtk_label_set_markup(GTK_LABEL(windata->body_label), body);
gtk_label_set_markup (GTK_LABEL (windata->body_label), body);
}
else
{
quoted = g_markup_escape_text(body, -1);
gtk_label_set_markup(GTK_LABEL(windata->body_label), quoted);
g_free(quoted);
else {
gtk_label_set_text (GTK_LABEL (windata->body_label), body);
}

if (body == NULL || *body == '\0')
Expand Down
11 changes: 4 additions & 7 deletions src/themes/standard/theme.c
Expand Up @@ -857,15 +857,12 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body)
gtk_label_set_markup(GTK_LABEL(windata->summary_label), str);
g_free(str);

if (strstr(body, "&amp;") || strstr(body, "&lt;") || strstr(body, "&gt;") || strstr(body, "&apos;") || strstr(body, "&quot;"))
if (pango_parse_markup (body, -1, 0, NULL, NULL, NULL, NULL))
{
gtk_label_set_markup(GTK_LABEL(windata->body_label), body);
gtk_label_set_markup (GTK_LABEL (windata->body_label), body);
}
else
{
quoted = g_markup_escape_text(body, -1);
gtk_label_set_markup(GTK_LABEL(windata->body_label), quoted);
g_free(quoted);
else {
gtk_label_set_text (GTK_LABEL (windata->body_label), body);
}

if (body == NULL || *body == '\0')
Expand Down

0 comments on commit d9ed22c

Please sign in to comment.