From b9d283433086099c3e7c1adaecbb0a2d1febb23e Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 9 Aug 2023 18:37:59 +0200 Subject: [PATCH] I#2446 - Calendar: Change how categories are exported into preview Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/2446 --- src/calendar/gui/comp-util.c | 78 ++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/calendar/gui/comp-util.c b/src/calendar/gui/comp-util.c index e0accbebe8..8fed424b4e 100644 --- a/src/calendar/gui/comp-util.c +++ b/src/calendar/gui/comp-util.c @@ -2652,45 +2652,6 @@ cal_comp_util_write_to_html (GString *html_buffer, g_string_append (html_buffer, ""); - /* write icons for the categories */ - string = g_string_new (NULL); - list = e_cal_component_get_categories_list (comp); - if (list != NULL) { - markup = g_markup_escape_text (_("Categories:"), -1); - g_string_append_printf (html_buffer, ""); - g_slist_free_full (list, g_free); - g_string_free (string, TRUE); - /* write location */ location = e_cal_component_get_location (comp); if (location && *location) { @@ -2782,6 +2743,45 @@ cal_comp_util_write_to_html (GString *html_buffer, g_object_unref (prop); } + string = g_string_new (NULL); + list = e_cal_component_get_categories_list (comp); + if (list != NULL) { + markup = g_markup_escape_text (_("Categories:"), -1); + g_string_append_printf (html_buffer, ""); + g_slist_free_full (list, g_free); + g_string_free (string, TRUE); + /* write priority */ priority = e_cal_component_get_priority (comp); if (priority > 0) {
%s", markup); - g_free (markup); - } - for (iter = list; iter != NULL; iter = iter->next) { - const gchar *category = iter->data; - gchar *icon_file; - - icon_file = e_categories_dup_icon_file_for (category); - if (icon_file && g_file_test (icon_file, G_FILE_TEST_EXISTS)) { - gchar *uri; - - uri = g_filename_to_uri (icon_file, NULL, NULL); - g_string_append_printf ( - html_buffer, "\"%s\"", - category, uri); - g_free (uri); - } else { - if (iter != list) - g_string_append_len (string, ", ", 2); - - markup = g_markup_escape_text (category, -1); - g_string_append (string, markup); - g_free (markup); - } - - g_free (icon_file); - } - if (string->len > 0) - g_string_append_printf (html_buffer, "%s", string->str); - if (list != NULL) - g_string_append (html_buffer, "
%s", markup); + g_free (markup); + } + for (iter = list; iter != NULL; iter = iter->next) { + const gchar *category = iter->data; + gchar *icon_file; + + if (iter != list) + g_string_append (string, ", "); + + icon_file = e_categories_dup_icon_file_for (category); + if (icon_file && g_file_test (icon_file, G_FILE_TEST_EXISTS)) { + gchar *uri; + + uri = g_filename_to_uri (icon_file, NULL, NULL); + + g_string_append_printf ( + string, " ", + uri); + g_free (uri); + } + + markup = g_markup_escape_text (category, -1); + g_string_append (string, markup); + g_free (markup); + + g_free (icon_file); + } + if (string->len > 0) + g_string_append_printf (html_buffer, "%s", string->str); + if (list != NULL) + g_string_append (html_buffer, "