[gnome-calendar] event-widget: correctly ellipsize descripton tooltip
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] event-widget: correctly ellipsize descripton tooltip
- Date: Thu, 13 Apr 2017 00:06:31 +0000 (UTC)
commit 662373141b74392178b0938839e8c6dbb89e01ed
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Apr 12 21:04:42 2017 -0300
event-widget: correctly ellipsize descripton tooltip
https://bugzilla.gnome.org/show_bug.cgi?id=781185
src/gcal-event-widget.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/gcal-event-widget.c b/src/gcal-event-widget.c
index 9a1fc1d..8ff536d 100644
--- a/src/gcal-event-widget.c
+++ b/src/gcal-event-widget.c
@@ -355,7 +355,7 @@ gcal_event_widget_set_event_tooltip (GcalEventWidget *self,
/* Append event location */
if (g_utf8_strlen (gcal_event_get_location (event), -1) > 0)
{
- g_string_append (tooltip_mesg, "\n");
+ g_string_append (tooltip_mesg, "\n\n");
g_string_append_printf (tooltip_mesg,
_("At %s"),
gcal_event_get_location (event));
@@ -367,10 +367,14 @@ gcal_event_widget_set_event_tooltip (GcalEventWidget *self,
/* Truncate long descriptions at a white space and ellipsize */
if (tooltip_desc->len > 0)
{
- g_string_truncate (tooltip_desc, DESC_MAX_CHAR - 1);
- g_string_append (tooltip_desc, "…");
+ /* If the description is larger than DESC_MAX_CHAR, ellipsize it */
+ if (g_utf8_strlen (tooltip_desc->str, -1) > DESC_MAX_CHAR)
+ {
+ g_string_truncate (tooltip_desc, DESC_MAX_CHAR - 1);
+ g_string_append (tooltip_desc, "…");
+ }
- g_string_append_printf (tooltip_mesg, "\n%s", tooltip_desc->str);
+ g_string_append_printf (tooltip_mesg, "\n\n%s", tooltip_desc->str);
}
gtk_widget_set_tooltip_markup (GTK_WIDGET (self), tooltip_mesg->str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]