From 62c105cfab0cbeba77ab2b2a14afe7546d6703a0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 4 Nov 2009 13:01:11 +0100 Subject: Bug #596827 - Don't remove meeting attendees after edit --- calendar/gui/e-select-names-renderer.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'calendar/gui/e-select-names-renderer.c') 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); -- cgit v1.2.3