[evolution] I#1767 - ECalComponentPreview: Use full width for the Description



commit 6c2827601bdef4628d617721a18c601fa0e46c5d
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 11 17:25:40 2022 +0100

    I#1767 - ECalComponentPreview: Use full width for the Description
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1767

 data/webkit/webview.css                    |  9 ++++
 src/calendar/gui/e-cal-component-preview.c | 82 ++++++++++++++++--------------
 2 files changed, 52 insertions(+), 39 deletions(-)
---
diff --git a/data/webkit/webview.css b/data/webkit/webview.css
index 3788d78423..0d21253644 100644
--- a/data/webkit/webview.css
+++ b/data/webkit/webview.css
@@ -93,6 +93,15 @@ a.evo-awrap {
   word-break: break-all;
 }
 
+.calpreview th {
+  white-space: nowrap;
+  width: 1%;
+}
+
+.calpreview td {
+  width: 99%;
+}
+
 /**** HEADERS ****/
 
 button.header-collapse {
diff --git a/src/calendar/gui/e-cal-component-preview.c b/src/calendar/gui/e-cal-component-preview.c
index 0445913a97..5b4ca445c2 100644
--- a/src/calendar/gui/e-cal-component-preview.c
+++ b/src/calendar/gui/e-cal-component-preview.c
@@ -233,7 +233,7 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
        text = e_cal_component_get_summary (comp);
 
        g_string_append (buffer, HTML_HEADER);
-       g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color\">");
+       g_string_append (buffer, "<body class=\"-e-web-view-background-color -e-web-view-text-color 
calpreview\">");
 
        markup = g_markup_escape_text (text && e_cal_component_text_get_value (text) ? 
e_cal_component_text_get_value (text) : _("Untitled"), -1);
        if (text && e_cal_component_text_get_value (text))
@@ -488,44 +488,6 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
                g_slist_free_full (attendees, e_cal_component_attendee_free);
        }
 
-       /* write description and URL */
-       g_string_append (buffer, "<tr><td colspan=\"2\"><hr></td></tr>");
-
-       list = e_cal_component_get_descriptions (comp);
-       if (list) {
-               GSList *node;
-
-               markup = g_markup_escape_text (_("Description:"), -1);
-               g_string_append_printf (buffer, "<tr><th>%s</th>", markup);
-               g_free (markup);
-
-               g_string_append (buffer, "<td class=\"description\">");
-
-               for (node = list; node != NULL; node = node->next) {
-                       gchar *html;
-
-                       text = node->data;
-                       if (!text || !e_cal_component_text_get_value (text))
-                               continue;
-
-                       html = camel_text_to_html (
-                               e_cal_component_text_get_value (text),
-                               CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
-                               CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
-                               CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
-                               CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
-
-                       if (html)
-                               g_string_append_printf (buffer, "%s", html);
-
-                       g_free (html);
-               }
-
-               g_string_append (buffer, "</td></tr>");
-
-               g_slist_free_full (list, e_cal_component_text_free);
-       }
-
        /* URL */
        url = e_cal_component_get_url (comp);
        if (url) {
@@ -562,6 +524,48 @@ cal_component_preview_write_html (ECalComponentPreview *preview,
                g_free (url);
        }
 
+       g_string_append (buffer, "<tr><td colspan=\"2\"><hr></td></tr>");
+
+       /* Write description as the last, using full width */
+
+       list = e_cal_component_get_descriptions (comp);
+       if (list) {
+               GSList *node;
+               gboolean has_header = FALSE;
+
+               for (node = list; node != NULL; node = node->next) {
+                       gchar *html;
+
+                       text = node->data;
+                       if (!text || !e_cal_component_text_get_value (text))
+                               continue;
+
+                       html = camel_text_to_html (
+                               e_cal_component_text_get_value (text),
+                               CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+                               CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES |
+                               CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+                               CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, 0);
+
+                       if (html) {
+                               if (!has_header) {
+                                       has_header = TRUE;
+
+                                       g_string_append (buffer, "<tr><td colspan=\"2\" 
class=\"description\">");
+                               }
+
+                               g_string_append_printf (buffer, "%s", html);
+                       }
+
+                       g_free (html);
+               }
+
+               if (has_header)
+                       g_string_append (buffer, "</td></tr>");
+
+               g_slist_free_full (list, e_cal_component_text_free);
+       }
+
        g_string_append (buffer, "</table>");
 
        /* close document */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]