diff options
author | Milan Crha <mcrha@redhat.com> | 2009-11-04 20:01:11 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2009-11-04 20:01:11 +0800 |
commit | 62c105cfab0cbeba77ab2b2a14afe7546d6703a0 (patch) | |
tree | c9508f086da4ccae1eb720ebe109d0cb8799aad3 | |
parent | 7d66ca379652ce979da24ed18315c76a4a6865ec (diff) | |
download | gsoc2013-evolution-62c105cfab0cbeba77ab2b2a14afe7546d6703a0.tar.gz gsoc2013-evolution-62c105cfab0cbeba77ab2b2a14afe7546d6703a0.tar.zst gsoc2013-evolution-62c105cfab0cbeba77ab2b2a14afe7546d6703a0.zip |
Bug #596827 - Don't remove meeting attendees after edit
-rw-r--r-- | calendar/gui/e-meeting-list-view.c | 9 | ||||
-rw-r--r-- | calendar/gui/e-select-names-renderer.c | 19 |
2 files changed, 25 insertions, 3 deletions
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c index 980370e3af..0e48f7cb32 100644 --- a/calendar/gui/e-meeting-list-view.c +++ b/calendar/gui/e-meeting-list-view.c @@ -358,6 +358,7 @@ attendee_edited_cb (GtkCellRenderer *renderer, const gchar *path, GList *address if (g_list_length (addresses) > 1) { EMeetingAttendee *attendee; GList *l, *m; + gboolean can_remove = TRUE; for (l = addresses, m = names; l && m; l = l->next, m = m->next) { gchar *name = m->data, *email = l->data; @@ -365,8 +366,12 @@ attendee_edited_cb (GtkCellRenderer *renderer, const gchar *path, GList *address if (!((name && *name) || (email && *email))) continue; - if (e_meeting_store_find_attendee (model, email, NULL) != NULL) + attendee = e_meeting_store_find_attendee (model, email, NULL); + if (attendee != NULL) { + if (attendee == existing_attendee) + can_remove = FALSE; continue; + } attendee = e_meeting_store_add_attendee_with_defaults (model); e_meeting_attendee_set_address (attendee, g_strdup_printf ("MAILTO:%s", (gchar *)l->data)); @@ -382,7 +387,7 @@ attendee_edited_cb (GtkCellRenderer *renderer, const gchar *path, GList *address e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view), attendee); } - if (existing_attendee) { + if (existing_attendee && can_remove) { removed = TRUE; e_meeting_list_view_remove_attendee_from_name_selector (E_MEETING_LIST_VIEW (view), existing_attendee); diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c index 0f82c3237e..bb0698fa29 100644 --- a/calendar/gui/e-select-names-renderer.c +++ b/calendar/gui/e-select-names-renderer.c @@ -53,7 +53,7 @@ G_DEFINE_TYPE (ESelectNamesRenderer, e_select_names_renderer, GTK_TYPE_CELL_REND static void e_select_names_renderer_editing_done (GtkCellEditable *editable, ESelectNamesRenderer *cell) { - GList *addresses = NULL, *names = NULL; + GList *addresses = NULL, *names = NULL, *a, *n; /* We don't need to listen for the focus out event any more */ g_signal_handlers_disconnect_matched (editable, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cell); @@ -66,6 +66,23 @@ e_select_names_renderer_editing_done (GtkCellEditable *editable, ESelectNamesRen addresses = e_select_names_editable_get_emails (E_SELECT_NAMES_EDITABLE (editable)); names = e_select_names_editable_get_names (E_SELECT_NAMES_EDITABLE (editable)); + /* remove empty addresses */ + for (a = addresses, n = names; a && n; ) { + gchar *addr = a->data, *nm = n->data; + + if ((!addr || !*addr) && (!nm || !*nm)) { + g_free (addr); + g_free (nm); + addresses = g_list_remove_link (addresses, a); + names = g_list_remove_link (names, n); + a = addresses; + n = names; + } else { + a = a->next; + n = n->next; + } + } + g_signal_emit (cell, signals [CELL_EDITED], 0, cell->priv->path, addresses, names); g_list_foreach (addresses, (GFunc)g_free, NULL); |