[evolution] I#1827 - itip-formatter: Properly update content on message preview reload
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1827 - itip-formatter: Properly update content on message preview reload
- Date: Fri, 18 Mar 2022 08:41:39 +0000 (UTC)
commit 5149858aac4cc82d21f7310fecebb30c117e597d
Author: Milan Crha <mcrha redhat com>
Date: Fri Mar 18 09:41:10 2022 +0100
I#1827 - itip-formatter: Properly update content on message preview reload
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1827
src/modules/itip-formatter/e-mail-part-itip.c | 35 +++++++++++++++++++++++++++
src/modules/itip-formatter/itip-view.c | 11 +++++----
2 files changed, 41 insertions(+), 5 deletions(-)
---
diff --git a/src/modules/itip-formatter/e-mail-part-itip.c b/src/modules/itip-formatter/e-mail-part-itip.c
index 1df7aaf7c3..75a676bba5 100644
--- a/src/modules/itip-formatter/e-mail-part-itip.c
+++ b/src/modules/itip-formatter/e-mail-part-itip.c
@@ -115,6 +115,38 @@ itip_view_alternative_html_clicked_cb (EWebView *web_view,
}
}
+static void
+e_mail_part_itip_web_view_load_changed_cb (WebKitWebView *webkit_web_view,
+ WebKitLoadEvent load_event,
+ gpointer user_data)
+{
+ EMailPartItip *pitip = user_data;
+
+ g_return_if_fail (E_IS_MAIL_PART_ITIP (pitip));
+
+ if (load_event == WEBKIT_LOAD_STARTED) {
+ EWebView *web_view = E_WEB_VIEW (webkit_web_view);
+ ItipView *itip_view;
+ GSList *link;
+
+ for (link = pitip->priv->views; link; link = g_slist_next (link)) {
+ EWebView *used_web_view;
+
+ itip_view = link->data;
+ used_web_view = itip_view_ref_web_view (itip_view);
+
+ if (used_web_view == web_view) {
+ pitip->priv->views = g_slist_remove (pitip->priv->views, itip_view);
+ g_clear_object (&used_web_view);
+ g_clear_object (&itip_view);
+ return;
+ }
+
+ g_clear_object (&used_web_view);
+ }
+ }
+}
+
static void
mail_part_itip_content_loaded (EMailPart *part,
EWebView *web_view,
@@ -164,6 +196,9 @@ mail_part_itip_content_loaded (EMailPart *part,
}
e_web_view_register_element_clicked (web_view, "itip-view-alternative-html",
itip_view_alternative_html_clicked_cb, pitip);
+
+ g_signal_connect_object (web_view, "load-changed",
+ G_CALLBACK (e_mail_part_itip_web_view_load_changed_cb), pitip, 0);
}
static void
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 45292d47c1..a577a70258 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -855,11 +855,11 @@ update_start_end_times (ItipView *view)
now = time (NULL);
now_tm = localtime (&now);
- g_free (priv->start_label);
- g_free (priv->end_label);
- g_free (priv->categories);
- g_free (priv->due_date_label);
- g_free (priv->estimated_duration);
+ g_clear_pointer (&priv->start_label, g_free);
+ g_clear_pointer (&priv->end_label, g_free);
+ g_clear_pointer (&priv->categories, g_free);
+ g_clear_pointer (&priv->due_date_label, g_free);
+ g_clear_pointer (&priv->estimated_duration, g_free);
#define is_same(_member) (priv->start_tm->_member == priv->end_tm->_member)
if (priv->start_tm && priv->end_tm && priv->start_tm_is_date && priv->end_tm_is_date
@@ -1506,6 +1506,7 @@ itip_view_finalize (GObject *object)
g_free (priv->end_tm);
g_free (priv->end_label);
g_free (priv->description);
+ g_free (priv->categories);
g_free (priv->error);
g_free (priv->part_id);
g_free (priv->selected_source_uid);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]