evolution r37191 - in trunk/calendar: . gui gui/dialogs



Author: msuman
Date: Fri Jan 30 09:38:57 2009
New Revision: 37191
URL: http://svn.gnome.org/viewvc/evolution?rev=37191&view=rev

Log:
Fix for bug #450554 (bugzilla.novell.com) - Remove all attendees from the list-view and name-selector before populating it on 'event_changed' callback.

Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/gui/dialogs/event-editor.c
   trunk/calendar/gui/dialogs/event-page.c
   trunk/calendar/gui/dialogs/event-page.h
   trunk/calendar/gui/e-meeting-list-view.c
   trunk/calendar/gui/e-meeting-list-view.h
   trunk/calendar/gui/e-meeting-store.c

Modified: trunk/calendar/gui/dialogs/event-editor.c
==============================================================================
--- trunk/calendar/gui/dialogs/event-editor.c	(original)
+++ trunk/calendar/gui/dialogs/event-editor.c	Fri Jan 30 09:38:57 2009
@@ -565,6 +565,8 @@
 		}
 
 		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;

Modified: trunk/calendar/gui/dialogs/event-page.c
==============================================================================
--- trunk/calendar/gui/dialogs/event-page.c	(original)
+++ trunk/calendar/gui/dialogs/event-page.c	Fri Jan 30 09:38:57 2009
@@ -3273,3 +3273,23 @@
 	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));
+}
+

Modified: trunk/calendar/gui/dialogs/event-page.h
==============================================================================
--- trunk/calendar/gui/dialogs/event-page.h	(original)
+++ trunk/calendar/gui/dialogs/event-page.h	Fri Jan 30 09:38:57 2009
@@ -108,6 +108,7 @@
 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
 

Modified: trunk/calendar/gui/e-meeting-list-view.c
==============================================================================
--- trunk/calendar/gui/e-meeting-list-view.c	(original)
+++ trunk/calendar/gui/e-meeting-list-view.c	Fri Jan 30 09:38:57 2009
@@ -296,10 +296,8 @@
 			}
 		} 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 @@
 	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)
 {

Modified: trunk/calendar/gui/e-meeting-list-view.h
==============================================================================
--- trunk/calendar/gui/e-meeting-list-view.h	(original)
+++ trunk/calendar/gui/e-meeting-list-view.h	Fri Jan 30 09:38:57 2009
@@ -64,6 +64,8 @@
 
 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);

Modified: trunk/calendar/gui/e-meeting-store.c
==============================================================================
--- trunk/calendar/gui/e-meeting-store.c	(original)
+++ trunk/calendar/gui/e-meeting-store.c	Fri Jan 30 09:38:57 2009
@@ -780,7 +780,7 @@
 		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 @@
 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 *



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