diff options
author | rbuj <[email protected]> | 2020-03-11 11:20:54 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-04-16 14:35:22 +0200 |
commit | eb8b7e13f2b4c6076c47c87c50ee2ffeb74409a9 (patch) | |
tree | d3b8b714de8b271f23daf0c577f9e77cd00e6b5d /src | |
parent | 7306dd05d93a17903d95d0381c42873ac26336b2 (diff) | |
download | mate-notification-daemon-eb8b7e13f2b4c6076c47c87c50ee2ffeb74409a9.tar.bz2 mate-notification-daemon-eb8b7e13f2b4c6076c47c87c50ee2ffeb74409a9.tar.xz |
The body of a notification may also contain hyperlinks
Diffstat (limited to 'src')
-rw-r--r-- | src/themes/coco/coco-theme.c | 14 | ||||
-rw-r--r-- | src/themes/nodoka/nodoka-theme.c | 14 | ||||
-rw-r--r-- | src/themes/slider/theme.c | 16 | ||||
-rw-r--r-- | src/themes/standard/theme.c | 14 |
4 files changed, 21 insertions, 37 deletions
diff --git a/src/themes/coco/coco-theme.c b/src/themes/coco/coco-theme.c index 94f38e3..6cfa677 100644 --- a/src/themes/coco/coco-theme.c +++ b/src/themes/coco/coco-theme.c @@ -489,6 +489,7 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body) { char *str; char* quoted; + const char *body_label_text; WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); g_assert(windata != NULL); @@ -499,15 +500,12 @@ 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 (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 { + str = g_strdup_printf("<span color=\"#EAEAEA\">%s</span>", body); + gtk_label_set_markup (GTK_LABEL (windata->body_label), str); + g_free(str); + body_label_text = gtk_label_get_text (GTK_LABEL (windata->body_label)); + if ((body_label_text == NULL) || (strlen (body_label_text) == 0)) gtk_label_set_text (GTK_LABEL (windata->body_label), body); - } if (body == NULL || *body == '\0') gtk_widget_hide(windata->body_label); diff --git a/src/themes/nodoka/nodoka-theme.c b/src/themes/nodoka/nodoka-theme.c index e2bfb06..12dea08 100644 --- a/src/themes/nodoka/nodoka-theme.c +++ b/src/themes/nodoka/nodoka-theme.c @@ -875,6 +875,7 @@ set_notification_text(GtkWindow *nw, const char *summary, const char *body) { char *str; char* quoted; + const char *body_label_text; WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); g_assert(windata != NULL); @@ -885,15 +886,12 @@ 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 (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 { + str = g_strdup_printf("<span color=\"#000000\">%s</span>", body); + gtk_label_set_markup (GTK_LABEL (windata->body_label), str); + g_free(str); + body_label_text = gtk_label_get_text (GTK_LABEL (windata->body_label)); + if ((body_label_text == NULL) || (strlen (body_label_text) == 0)) gtk_label_set_text (GTK_LABEL (windata->body_label), body); - } if (body == NULL || *body == '\0') gtk_widget_hide(windata->body_label); diff --git a/src/themes/slider/theme.c b/src/themes/slider/theme.c index 0c9d5fc..9edb1d7 100644 --- a/src/themes/slider/theme.c +++ b/src/themes/slider/theme.c @@ -494,6 +494,7 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body) { char* str; char* quoted; + const char *body_label_text; GtkRequisition req; WindowData* windata; int summary_width; @@ -509,22 +510,15 @@ 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 (pango_parse_markup (body, -1, 0, NULL, NULL, NULL, NULL)) - { - gtk_label_set_markup (GTK_LABEL (windata->body_label), body); - } - else { - gtk_label_set_text (GTK_LABEL (windata->body_label), body); - } + gtk_label_set_markup (GTK_LABEL (windata->body_label), body); + body_label_text = gtk_label_get_text (GTK_LABEL (windata->body_label)); + if ((body_label_text == NULL) || (strlen (body_label_text) == 0)) + gtk_label_set_text (GTK_LABEL (windata->body_label), body); if (body == NULL || *body == '\0') - { gtk_widget_hide(windata->body_label); - } else - { gtk_widget_show(windata->body_label); - } update_content_hbox_visibility(windata); diff --git a/src/themes/standard/theme.c b/src/themes/standard/theme.c index d36bda3..c81ac34 100644 --- a/src/themes/standard/theme.c +++ b/src/themes/standard/theme.c @@ -844,6 +844,7 @@ void set_notification_text(GtkWindow* nw, const char* summary, const char* body) { char* str; char* quoted; + const char *body_label_text; GtkRequisition req; WindowData* windata; @@ -857,22 +858,15 @@ 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 (pango_parse_markup (body, -1, 0, NULL, NULL, NULL, NULL)) - { - gtk_label_set_markup (GTK_LABEL (windata->body_label), body); - } - else { + gtk_label_set_markup (GTK_LABEL (windata->body_label), body); + body_label_text = gtk_label_get_text (GTK_LABEL (windata->body_label)); + if ((body_label_text == NULL) || (strlen (body_label_text) == 0)) gtk_label_set_text (GTK_LABEL (windata->body_label), body); - } if (body == NULL || *body == '\0') - { gtk_widget_hide(windata->body_label); - } else - { gtk_widget_show(windata->body_label); - } update_content_hbox_visibility(windata); |