[evolution-patches] Fix for the bug #321739 [calendar]
- From: chen <pchenthill novell com>
- To: patches <evolution-patches gnome org>
- Subject: [evolution-patches] Fix for the bug #321739 [calendar]
- Date: Thu, 24 Nov 2005 22:12:45 +0530
Hi,
Have attached the fix for the bug. This provides the synchronization
between the attendees shown in ENameSelector dialog and the
EMeetingListView.
thanks, Chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2851
diff -u -p -r1.2851 ChangeLog
--- ChangeLog 24 Nov 2005 15:28:11 -0000 1.2851
+++ ChangeLog 24 Nov 2005 16:27:13 -0000
@@ -1,3 +1,16 @@
+2005-11-24 Chenthill Palanisamy <pchenthill novell com>
+
+ Fixes #321739
+ * gui/dialogs/event-page.c: (event_page_fill_widgets),
+ (remove_attendee): Add/remove attendee from e-name-selector also.
+ * gui/e-meeting-list-view.h:
+ * gui/e-meeting-list-view.c: (get_index_from_role),
+ (e_meeting_list_view_add_attendee_to_name_selector),
+ (e_meeting_list_view_remove_attendee_from_name_selector),
+ (attendee_edited_cb), (process_section), (add_to_list),
+ (name_selector_dialog_close_cb): Syncronize the adding/removing
+ attendees between EMeetingListView and ENameSelector dialog.
+
2005-11-24 Srinivasa Ragavan and P.S.Chakravarthi <sragavan novell com>, <pchakravarthi novell com>
(simultaneously a patch for configure.in in evolution source dir is
Index: gui/e-meeting-list-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-list-view.c,v
retrieving revision 1.23
diff -u -p -r1.23 e-meeting-list-view.c
--- gui/e-meeting-list-view.c 6 Oct 2005 18:21:51 -0000 1.23
+++ gui/e-meeting-list-view.c 24 Nov 2005 16:27:14 -0000
@@ -220,6 +220,90 @@ value_edited (GtkTreeView *view, gint co
gtk_tree_path_free (treepath);
}
+static guint
+get_index_from_role (icalparameter_role role)
+{
+ switch (role) {
+ case ICAL_ROLE_CHAIR:
+ return 0;
+ case ICAL_ROLE_REQPARTICIPANT:
+ return 1;
+ case ICAL_ROLE_OPTPARTICIPANT:
+ return 2;
+ case ICAL_ROLE_NONPARTICIPANT:
+ return 3;
+ default:
+ return 4;
+ }
+}
+
+void
+e_meeting_list_view_add_attendee_to_name_selector (EMeetingListView *view, EMeetingAttendee *ma)
+{
+ EDestinationStore *destination_store;
+ ENameSelectorModel *name_selector_model;
+ EDestination *des;
+ EMeetingListViewPrivate *priv;
+ guint i = 1;
+
+ priv = view->priv;
+
+ name_selector_model = e_name_selector_peek_model (priv->name_selector);
+ i = get_index_from_role (e_meeting_attendee_get_role (ma));
+ e_name_selector_model_peek_section (name_selector_model, sections [i],
+ NULL, &destination_store);
+ des = e_destination_new ();
+ e_destination_set_email (des, itip_strip_mailto (e_meeting_attendee_get_address (ma)));
+ e_destination_set_name (des, e_meeting_attendee_get_cn (ma));
+ e_destination_store_append_destination (destination_store, des);
+}
+
+void
+e_meeting_list_view_remove_attendee_from_name_selector (EMeetingListView *view, EMeetingAttendee *ma)
+{
+ GList *destinations, *l;
+ EDestinationStore *destination_store;
+ ENameSelectorModel *name_selector_model;
+ const char *madd;
+ EMeetingListViewPrivate *priv;
+ guint i = 1;
+
+ priv = view->priv;
+
+ name_selector_model = e_name_selector_peek_model (priv->name_selector);
+ i = get_index_from_role (e_meeting_attendee_get_role (ma));
+ e_name_selector_model_peek_section (name_selector_model, sections [i],
+ NULL, &destination_store);
+ destinations = e_destination_store_list_destinations (destination_store);
+ madd = itip_strip_mailto (e_meeting_attendee_get_address (ma));
+
+ for (l = destinations; l; l = g_list_next (l)) {
+ const char *attendee;
+ EDestination *des = l->data;
+
+
+ if (e_destination_is_evolution_list (des)) {
+ GList *l, *dl;
+
+ dl = e_destination_list_get_dests (des);
+
+ for (l = dl; l; l = l->next) {
+ attendee = e_destination_get_email (l->data);
+ if (madd && attendee && g_str_equal (madd, attendee)) {
+ g_object_unref (l->data);
+ l = g_list_remove (l, l->data);
+ break;
+ }
+ }
+ } if (madd && attendee && g_str_equal (madd, attendee)) {
+ attendee = e_destination_get_email (des);
+ 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)
{
@@ -254,6 +338,7 @@ attendee_edited_cb (GtkCellRenderer *ren
e_meeting_attendee_set_rsvp (attendee, e_meeting_attendee_get_rsvp (existing_attendee));
e_meeting_attendee_set_status (attendee, e_meeting_attendee_get_status (existing_attendee));
}
+ e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view), attendee);
}
if (existing_attendee) {
@@ -271,8 +356,16 @@ attendee_edited_cb (GtkCellRenderer *ren
e_meeting_store_remove_attendee (model, existing_attendee);
}
} else {
+ EMeetingAttendee *attendee = e_meeting_attendee_new ();
+
value_edited (view, E_MEETING_STORE_ADDRESS_COL, path, email);
value_edited (view, E_MEETING_STORE_CN_COL, path, name);
+
+ e_meeting_attendee_set_address (attendee, g_strdup (email));
+ e_meeting_attendee_set_cn (attendee, g_strdup (name));
+ e_meeting_attendee_set_role (attendee, ICAL_ROLE_REQPARTICIPANT);
+ e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (view), attendee);
+ g_object_unref (attendee);
}
} else {
if (existing_attendee) {
@@ -288,7 +381,7 @@ attendee_edited_cb (GtkCellRenderer *ren
gtk_tree_path_free (treepath);
- if (!removed)
+ if (!removed)
g_signal_emit_by_name (G_OBJECT (view), "attendee_added", (gpointer) existing_attendee);
}
@@ -557,7 +650,7 @@ e_meeting_list_view_edit (EMeetingListVi
}
static void
-process_section (EMeetingListView *view, GList *destinations, icalparameter_role role)
+process_section (EMeetingListView *view, GList *destinations, icalparameter_role role, GSList **la)
{
EMeetingListViewPrivate *priv;
GList *l;
@@ -574,7 +667,7 @@ process_section (EMeetingListView *view,
EContact *contact = e_destination_get_contact (destination);
/* check if the contact is contact list which is not expanded yet */
/* we expand it by getting the list again from the server forming the query */
- if (e_contact_get (contact , E_CONTACT_IS_LIST)) {
+ if (contact && e_contact_get (contact , E_CONTACT_IS_LIST)) {
EBook *book = NULL;
ENameSelectorDialog *dialog;
EContactStore *c_store;
@@ -669,6 +762,12 @@ process_section (EMeetingListView *view,
if (role == ICAL_ROLE_NONPARTICIPANT)
e_meeting_attendee_set_cutype (ia, ICAL_CUTYPE_RESOURCE);
e_meeting_attendee_set_cn (ia, g_strdup (name));
+ } else {
+ if (g_slist_length (*la) == 1) {
+ g_slist_free (*la);
+ *la = NULL;
+ } else
+ *la = g_slist_remove_link (*la, g_slist_find_custom (*la, attendee, g_strcasecmp));
}
}
@@ -681,13 +780,29 @@ process_section (EMeetingListView *view,
}
static void
+add_to_list (gpointer data, gpointer u_data)
+{
+ GSList **user_data = u_data;
+
+ *user_data = g_slist_append (*user_data, itip_strip_mailto (e_meeting_attendee_get_address (data)));
+}
+
+static void
name_selector_dialog_close_cb (ENameSelectorDialog *dialog, gint response, gpointer data)
{
EMeetingListView *view = E_MEETING_LIST_VIEW (data);
ENameSelectorModel *name_selector_model;
+ EMeetingStore *store;
+ const GPtrArray *attendees;
int i;
+ GSList *la = NULL, *l;
name_selector_model = e_name_selector_peek_model (view->priv->name_selector);
+ store = E_MEETING_STORE (gtk_tree_view_get_model (view));
+ attendees = e_meeting_store_get_attendees (store);
+
+ /* get all the email ids of the attendees */
+ g_ptr_array_foreach ((GPtrArray *)attendees, (GFunc) add_to_list, &la);
for (i = 0; sections[i] != NULL; i++) {
EDestinationStore *destination_store;
@@ -698,10 +813,23 @@ name_selector_dialog_close_cb (ENameSele
g_assert (destination_store);
destinations = e_destination_store_list_destinations (destination_store);
- process_section (view, destinations, roles [i]);
+ process_section (view, destinations, roles [i], &la);
g_list_free (destinations);
}
+ /* remove the deleted attendees from name selector */
+ for (l = la; l != NULL; l = l->next) {
+ EMeetingAttendee *ma = NULL;
+ const char *email = l->data;
+ int i;
+
+ ma = e_meeting_store_find_attendee (store, email, &i);
+
+ if (ma)
+ e_meeting_store_remove_attendee (store, ma);
+ }
+
+ g_slist_free (la);
gtk_widget_hide (GTK_WIDGET (dialog));
}
Index: gui/e-meeting-list-view.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-list-view.h,v
retrieving revision 1.3
diff -u -p -r1.3 e-meeting-list-view.h
--- gui/e-meeting-list-view.h 20 Jun 2005 17:16:25 -0000 1.3
+++ gui/e-meeting-list-view.h 24 Nov 2005 16:27:14 -0000
@@ -61,6 +61,8 @@ void e_meeting_list_view_column_se
void e_meeting_list_view_edit (EMeetingListView *emlv, EMeetingAttendee *attendee);
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_add_attendee_to_name_selector (EMeetingListView *view, EMeetingAttendee *ma);
G_END_DECLS
Index: gui/dialogs/event-page.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/event-page.c,v
retrieving revision 1.91
diff -u -p -r1.91 event-page.c
--- gui/dialogs/event-page.c 16 Nov 2005 13:53:47 -0000 1.91
+++ gui/dialogs/event-page.c 24 Nov 2005 16:27:14 -0000
@@ -979,13 +979,10 @@ event_page_fill_widgets (CompEditorPage
if (organizer.value != NULL) {
const gchar *strip = itip_strip_mailto (organizer.value);
gchar *string;
- // gtk_widget_hide (priv->organizer_table);
- // gtk_widget_show (priv->existing_organizer_table);
if (itip_organizer_is_user (comp, page->client)) {
if (e_cal_get_static_capability (
page->client,
CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS))
- // gtk_widget_hide (priv->existing_organizer_btn);
priv->user_org = TRUE;
} else {
if (e_cal_get_static_capability (
@@ -1022,6 +1019,7 @@ event_page_fill_widgets (CompEditorPage
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_NEEDSACTION);
else
e_meeting_attendee_set_status (priv->ia, ICAL_PARTSTAT_ACCEPTED);
+ e_meeting_list_view_add_attendee_to_name_selector (E_MEETING_LIST_VIEW (priv->list_view), priv->ia);
}
}
}
@@ -1596,6 +1594,8 @@ remove_attendee (EventPage *epage, EMeet
if (e_meeting_attendee_get_delto (ia) != NULL)
ib = e_meeting_store_find_attendee (priv->model, e_meeting_attendee_get_delto (ia), NULL);
+
+ e_meeting_list_view_remove_attendee_from_name_selector (priv->list_view, ia);
e_meeting_store_remove_attendee (priv->model, ia);
ia = ib;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]