[evolution-data-server] Calendar: Make it possible to assign email address to On This Computer sources ][



commit f104922dc1bd6f82b23dd203f59f4123f4cab98d
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 30 09:57:43 2020 +0100

    Calendar: Make it possible to assign email address to On This Computer sources ][
    
    Also notify about a change of the backend property, thus the client side
    refreshes its cache with the new value.

 src/calendar/backends/file/e-cal-backend-file.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/src/calendar/backends/file/e-cal-backend-file.c b/src/calendar/backends/file/e-cal-backend-file.c
index 8134f360e..79d8b1a8e 100644
--- a/src/calendar/backends/file/e-cal-backend-file.c
+++ b/src/calendar/backends/file/e-cal-backend-file.c
@@ -3719,6 +3719,23 @@ e_cal_backend_file_send_objects (ECalBackendSync *backend,
        *modified_calobj = g_strdup (calobj);
 }
 
+static void
+cal_backend_file_email_address_changed_cb (GObject *object,
+                                          GParamSpec *param,
+                                          gpointer user_data)
+{
+       ECalBackend *cal_backend = user_data;
+       gchar *email_address;
+
+       g_return_if_fail (E_IS_SOURCE_LOCAL (object));
+       g_return_if_fail (E_IS_CAL_BACKEND (cal_backend));
+
+       email_address = e_source_local_dup_email_address (E_SOURCE_LOCAL (object));
+
+       e_cal_backend_notify_property_changed (cal_backend, E_CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS, 
email_address);
+       e_cal_backend_notify_property_changed (cal_backend, E_CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS, 
email_address);
+}
+
 static void
 cal_backend_file_constructed (GObject *object)
 {
@@ -3726,6 +3743,7 @@ cal_backend_file_constructed (GObject *object)
        ESourceRegistry *registry;
        ESource *builtin_source;
        ESource *source;
+       ESourceLocal *local_extension;
        ICalComponentKind kind;
        const gchar *user_data_dir;
        const gchar *component_type;
@@ -3781,6 +3799,11 @@ cal_backend_file_constructed (GObject *object)
        g_free (filename);
 
        g_object_unref (builtin_source);
+
+       local_extension = e_source_get_extension (source, E_SOURCE_EXTENSION_LOCAL_BACKEND);
+
+       g_signal_connect_object (local_extension, "notify::email-address",
+               G_CALLBACK (cal_backend_file_email_address_changed_cb), backend, 0);
 }
 
 static void


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