[evolution] Bug 231967 - Use contact's FBURL to fetch Free/Busy information



commit f53e619d40d615cad6d6573025f07c9bfad0a835
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 16 09:17:00 2015 +0200

    Bug 231967 - Use contact's FBURL to fetch Free/Busy information

 calendar/gui/e-meeting-list-view.c     |   28 +++++++++++++++++++++++++---
 calendar/gui/e-select-names-editable.c |   23 +++++++++++++++++++++++
 calendar/gui/e-select-names-editable.h |    2 ++
 calendar/gui/e-select-names-renderer.c |   11 +++++++++++
 calendar/gui/e-select-names-renderer.h |    2 ++
 5 files changed, 63 insertions(+), 3 deletions(-)
---
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 771742a..0766adb 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -410,12 +410,12 @@ attendee_edited_cb (GtkCellRenderer *renderer,
                        e_meeting_attendee_set_address (attendee, g_strdup_printf ("MAILTO:%s", (gchar *) 
l->data));
                        e_meeting_attendee_set_cn (attendee, g_strdup (m->data));
                        if (existing_attendee) {
-                               /* FIXME Should we copy anything else? */
                                e_meeting_attendee_set_cutype (attendee, e_meeting_attendee_get_cutype 
(existing_attendee));
                                e_meeting_attendee_set_role (attendee, e_meeting_attendee_get_role 
(existing_attendee));
                                e_meeting_attendee_set_rsvp (attendee, e_meeting_attendee_get_rsvp 
(existing_attendee));
                                e_meeting_attendee_set_status (attendee, ICAL_PARTSTAT_NEEDSACTION);
-                               e_meeting_attendee_set_delfrom (attendee, (gchar *) 
e_meeting_attendee_get_delfrom (existing_attendee));
+                               e_meeting_attendee_set_delfrom (attendee, g_strdup 
(e_meeting_attendee_get_delfrom (existing_attendee)));
+                               e_meeting_attendee_set_fburi (attendee, g_strdup 
(e_meeting_attendee_get_fburi (existing_attendee)));
                        }
                        e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view), 
attendee);
                        g_signal_emit_by_name (view, "attendee_added", (gpointer) attendee);
@@ -437,6 +437,7 @@ attendee_edited_cb (GtkCellRenderer *renderer,
                } else {
                        gboolean address_changed = FALSE;
                        EMeetingAttendee *attendee;
+                       EDestination *destination;
 
                        if (existing_attendee) {
                                const gchar *addr = e_meeting_attendee_get_address (existing_attendee);
@@ -458,6 +459,23 @@ attendee_edited_cb (GtkCellRenderer *renderer,
                        e_meeting_attendee_set_address (attendee, g_strdup_printf ("MAILTO:%s", email));
                        e_meeting_attendee_set_cn (attendee, g_strdup (name));
                        e_meeting_attendee_set_role (attendee, ICAL_ROLE_REQPARTICIPANT);
+
+                       destination = e_select_names_renderer_get_destination (E_SELECT_NAMES_RENDERER 
(renderer));
+                       if (destination) {
+                               EContact *contact;
+
+                               contact = e_destination_get_contact (destination);
+                               if (contact) {
+                                       gchar *fburi;
+
+                                       fburi = e_contact_get (contact, E_CONTACT_FREEBUSY_URL);
+                                       if (fburi && *fburi)
+                                               e_meeting_attendee_set_fburi (attendee, fburi);
+                                       else
+                                               g_free (fburi);
+                               }
+                       }
+
                        e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view), 
attendee);
 
                        if (address_changed)
@@ -975,8 +993,10 @@ process_section (EMeetingListView *view,
                                        e_meeting_attendee_set_cutype (ia, ICAL_CUTYPE_RESOURCE);
                                e_meeting_attendee_set_cn (ia, g_strdup (name));
 
-                               if (fburi)
+                               if (fburi) {
                                        e_meeting_attendee_set_fburi (ia, fburi);
+                                       fburi = NULL;
+                               }
                        } else {
                                if (g_slist_length (*la) == 1) {
                                        g_slist_free (*la);
@@ -984,6 +1004,8 @@ process_section (EMeetingListView *view,
                                } else
                                        *la = g_slist_remove_link (*la, g_slist_find_custom (*la, attendee, 
(GCompareFunc)g_ascii_strcasecmp));
                        }
+
+                       g_free (fburi);
                }
 
                if (des) {
diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c
index 6f866d1..e0bb7b1 100644
--- a/calendar/gui/e-select-names-editable.c
+++ b/calendar/gui/e-select-names-editable.c
@@ -57,6 +57,29 @@ e_select_names_editable_new (EClientCache *client_cache)
                "client-cache", client_cache, NULL);
 }
 
+EDestination *
+e_select_names_editable_get_destination (ESelectNamesEditable *esne)
+{
+       EDestinationStore *destination_store;
+       EDestination *destination = NULL;
+       GList *list;
+
+       g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
+
+       destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
+       list = e_destination_store_list_destinations (destination_store);
+       if (list == NULL)
+               return NULL;
+
+       if (list && !list->next) {
+               destination = E_DESTINATION (list->data);
+       }
+
+       g_list_free (list);
+
+       return destination;
+}
+
 gchar *
 e_select_names_editable_get_email (ESelectNamesEditable *esne)
 {
diff --git a/calendar/gui/e-select-names-editable.h b/calendar/gui/e-select-names-editable.h
index 6d9041a..7e3bdbf 100644
--- a/calendar/gui/e-select-names-editable.h
+++ b/calendar/gui/e-select-names-editable.h
@@ -62,6 +62,8 @@ struct _ESelectNamesEditableClass {
 GType          e_select_names_editable_get_type
                                                (void) G_GNUC_CONST;
 GtkWidget *    e_select_names_editable_new     (EClientCache *client_cache);
+EDestination * e_select_names_editable_get_destination
+                                               (ESelectNamesEditable *esne);
 gchar *                e_select_names_editable_get_email
                                                (ESelectNamesEditable *esne);
 GList *                e_select_names_editable_get_emails
diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c
index 77a26a1..1be7aef 100644
--- a/calendar/gui/e-select-names-renderer.c
+++ b/calendar/gui/e-select-names-renderer.c
@@ -354,6 +354,17 @@ e_select_names_renderer_ref_client_cache (ESelectNamesRenderer *renderer)
        return g_object_ref (renderer->priv->client_cache);
 }
 
+EDestination *
+e_select_names_renderer_get_destination (ESelectNamesRenderer *renderer)
+{
+       g_return_val_if_fail (E_IS_SELECT_NAMES_RENDERER (renderer), NULL);
+
+       if (!renderer->priv->editable)
+               return NULL;
+
+       return e_select_names_editable_get_destination (renderer->priv->editable);
+}
+
 const gchar *
 e_select_names_renderer_get_name (ESelectNamesRenderer *renderer)
 {
diff --git a/calendar/gui/e-select-names-renderer.h b/calendar/gui/e-select-names-renderer.h
index 1921054..1224570 100644
--- a/calendar/gui/e-select-names-renderer.h
+++ b/calendar/gui/e-select-names-renderer.h
@@ -70,6 +70,8 @@ GtkCellRenderer *
                e_select_names_renderer_new     (EClientCache *client_cache);
 EClientCache * e_select_names_renderer_ref_client_cache
                                                (ESelectNamesRenderer *renderer);
+EDestination * e_select_names_renderer_get_destination
+                                               (ESelectNamesRenderer *renderer);
 const gchar *  e_select_names_renderer_get_name
                                                (ESelectNamesRenderer *renderer);
 void           e_select_names_renderer_set_name


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