aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorSuman Manjunath <msuman@src.gnome.org>2009-01-30 17:38:57 +0800
committerSuman Manjunath <msuman@src.gnome.org>2009-01-30 17:38:57 +0800
commitdfdaafa8816cf75e3a9a482c1bcbf4b54c331935 (patch)
treece47168a67c21a06e015e15f7e0ad507641c7898 /calendar
parentd4d9c8155982362c95c256e851d14d63f3ee7fbd (diff)
downloadgsoc2013-evolution-dfdaafa8816cf75e3a9a482c1bcbf4b54c331935.tar.gz
gsoc2013-evolution-dfdaafa8816cf75e3a9a482c1bcbf4b54c331935.tar.zst
gsoc2013-evolution-dfdaafa8816cf75e3a9a482c1bcbf4b54c331935.zip
Fix for bug #450554 (bugzilla.novell.com) - Remove all attendees from the list-view and name-selector before populating it on 'event_changed' callback.
svn path=/trunk/; revision=37191
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog18
-rw-r--r--calendar/gui/dialogs/event-editor.c2
-rw-r--r--calendar/gui/dialogs/event-page.c20
-rw-r--r--calendar/gui/dialogs/event-page.h1
-rw-r--r--calendar/gui/e-meeting-list-view.c47
-rw-r--r--calendar/gui/e-meeting-list-view.h2
-rw-r--r--calendar/gui/e-meeting-store.c24
7 files changed, 98 insertions, 16 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 4d8d9da7a7..a52a0faeb6 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,21 @@
+2009-01-30 Suman Manjunath <msuman@novell.com>
+
+ ** Fix for bug #450554 (bugzilla.novell.com)
+
+ * gui/dialogs/event-editor.c (event_editor_edit_comp):
+ * gui/dialogs/event-page.c (event_page_remove_all_attendees):
+ * gui/dialogs/event-page.h:
+ Remove all attendees from the list-view and name-selector before
+ populating it on 'event_changed' callback.
+ * gui/e-meeting-list-view.c
+ (e_meeting_list_view_remove_attendee_from_name_selector),
+ (e_meeting_list_view_remove_all_attendees_from_name_selector):
+ Fix the GtkTreePath when iterating over the attendee list. It used
+ to cause a mis-match between the model and the view (critical)
+ * gui/e-meeting-list-view.h:
+ * gui/e-meeting-store.c (e_meeting_store_remove_all_attendees):
+ New function added.
+
2009-01-30 Chenthill Palanisamy <pchenthill@novell.com>
Fixes #463602 (bnc)
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index e3d3448f6c..a297765fa6 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -565,6 +565,8 @@ event_editor_edit_comp (CompEditor *editor, ECalComponent *comp)
}
if (!(delegate && e_cal_get_static_capability (client, CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY))) {
+ event_page_remove_all_attendees (priv->event_page);
+
for (l = attendees; l != NULL; l = l->next) {
ECalComponentAttendee *ca = l->data;
EMeetingAttendee *ia;
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index ffbd37d850..d0e6cad470 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -3273,3 +3273,23 @@ event_page_add_attendee (EventPage *epage, EMeetingAttendee *attendee)
e_meeting_store_add_attendee (priv->model, attendee);
e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), attendee);
}
+
+/**
+ * event_page_remove_all_attendees
+ * Removes all attendees from the meeting store and name selector.
+ * @param epage EventPage.
+ **/
+void
+event_page_remove_all_attendees (EventPage *epage)
+{
+ EventPagePrivate *priv;
+
+ g_return_if_fail (epage != NULL);
+ g_return_if_fail (IS_EVENT_PAGE (epage));
+
+ priv = epage->priv;
+
+ e_meeting_store_remove_all_attendees (priv->model);
+ e_meeting_list_view_remove_all_attendees_from_name_selector (E_MEETING_LIST_VIEW (priv->list_view));
+}
+
diff --git a/calendar/gui/dialogs/event-page.h b/calendar/gui/dialogs/event-page.h
index 7c868f1d3d..63c0bd2306 100644
--- a/calendar/gui/dialogs/event-page.h
+++ b/calendar/gui/dialogs/event-page.h
@@ -108,6 +108,7 @@ void event_page_set_view_rvsp (EventPage *epage,
ENameSelector * event_page_get_name_selector (EventPage *epage);
void event_page_add_attendee (EventPage *epage,
EMeetingAttendee *attendee);
+void event_page_remove_all_attendees (EventPage *epage);
G_END_DECLS
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index 9859c65df9..78f87c23f5 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -296,10 +296,8 @@ e_meeting_list_view_remove_attendee_from_name_selector (EMeetingListView *view,
}
} else {
attendee = e_destination_get_email (des);
-
if (madd && attendee && g_str_equal (madd, attendee)) {
- attendee = e_destination_get_email (des);
- e_destination_store_remove_destination (destination_store, des);
+ e_destination_store_remove_destination (destination_store, des);
}
}
}
@@ -307,6 +305,49 @@ e_meeting_list_view_remove_attendee_from_name_selector (EMeetingListView *view,
g_list_free (destinations);
}
+void
+e_meeting_list_view_remove_all_attendees_from_name_selector (EMeetingListView *view)
+{
+ ENameSelectorModel *name_selector_model;
+ EMeetingListViewPrivate *priv;
+ guint i;
+
+ priv = view->priv;
+
+ name_selector_model = e_name_selector_peek_model (priv->name_selector);
+
+ for (i = 0; sections[i] != NULL; i++) {
+ EDestinationStore *destination_store = NULL;
+ GList *destinations = NULL, *l = NULL;
+
+ e_name_selector_model_peek_section (name_selector_model, sections[i],
+ NULL, &destination_store);
+ if (!destination_store) {
+ g_warning ("destination store is NULL\n");
+ continue;
+ }
+
+ destinations = e_destination_store_list_destinations (destination_store);
+ for (l = destinations; l; l = g_list_next (l)) {
+ EDestination *des = l->data;
+
+ if (e_destination_is_evolution_list (des)) {
+ GList *m, *dl;
+
+ dl = (GList *)e_destination_list_get_dests (des);
+
+ for (m = dl; m; m = m->next) {
+ g_object_unref (m->data);
+ m = g_list_remove (m, l->data);
+ }
+ } else {
+ e_destination_store_remove_destination (destination_store, des);
+ }
+ }
+ g_list_free (destinations);
+ }
+}
+
static void
attendee_edited_cb (GtkCellRenderer *renderer, const gchar *path, GList *addresses, GList *names, GtkTreeView *view)
{
diff --git a/calendar/gui/e-meeting-list-view.h b/calendar/gui/e-meeting-list-view.h
index b1ed367257..12deb8a25d 100644
--- a/calendar/gui/e-meeting-list-view.h
+++ b/calendar/gui/e-meeting-list-view.h
@@ -64,6 +64,8 @@ void e_meeting_list_view_edit (EMeetingListView *emlv, EMeetingAttendee *a
void e_meeting_list_view_invite_others_dialog (EMeetingListView *emlv);
void e_meeting_list_view_remove_attendee_from_name_selector (EMeetingListView *view, EMeetingAttendee *ma);
+void e_meeting_list_view_remove_all_attendees_from_name_selector (EMeetingListView *view);
+
void e_meeting_list_view_add_attendee_to_name_selector (EMeetingListView *view, EMeetingAttendee *ma);
void e_meeting_list_view_set_editable (EMeetingListView *lview, gboolean set);
ENameSelector * e_meeting_list_view_get_name_selector (EMeetingListView *lview);
diff --git a/calendar/gui/e-meeting-store.c b/calendar/gui/e-meeting-store.c
index 663de70ba8..d320198ec3 100644
--- a/calendar/gui/e-meeting-store.c
+++ b/calendar/gui/e-meeting-store.c
@@ -780,7 +780,7 @@ e_meeting_store_remove_attendee (EMeetingStore *store, EMeetingAttendee *attende
gtk_tree_model_row_deleted (GTK_TREE_MODEL (store), path);
gtk_tree_path_free (path);
- g_ptr_array_remove_index (store->priv->attendees, row);
+ g_ptr_array_remove_index (store->priv->attendees, row);
g_object_unref (attendee);
}
}
@@ -788,22 +788,20 @@ e_meeting_store_remove_attendee (EMeetingStore *store, EMeetingAttendee *attende
void
e_meeting_store_remove_all_attendees (EMeetingStore *store)
{
- gint i;
- GtkTreePath *path = gtk_tree_path_new ();
-
- gtk_tree_path_append_index (path, 0);
-
- for (i = 0; i < store->priv->attendees->len; i++) {
- EMeetingAttendee *attendee = g_ptr_array_index (store->priv->attendees, i);
-
+ gint i, j, k;
+
+ for (i = 0, j = e_meeting_store_count_actual_attendees (store), k = 0; i < j; i++) {
+ /* Always try to remove the attendee at index 0 since it is the only one that will
+ * continue to exist until all attendees are removed. */
+ EMeetingAttendee *attendee = g_ptr_array_index (store->priv->attendees, k);
+ GtkTreePath *path = gtk_tree_path_new ();
+ gtk_tree_path_append_index (path, k);
gtk_tree_model_row_deleted (GTK_TREE_MODEL (store), path);
- gtk_tree_path_next (path);
+ gtk_tree_path_free (path);
+ g_ptr_array_remove_index (store->priv->attendees, k);
g_object_unref (attendee);
}
-
- g_ptr_array_set_size (store->priv->attendees, 0);
- gtk_tree_path_free (path);
}
EMeetingAttendee *