[Evolution-hackers] 63865 Contact Lists in Meetings



This takes the action of expanding contact lists on the invitations
page.  It still does not work for GroupWise because for efficiency the
lists don't contain an enumerated list of users (the server expands them
anyhow).  We could try to find the contact and do it ourselves, but this
is annoying because the select names stuff is buried in corba so we
can't easily get the ebook.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? 55172.patch
? 59194.patch
? 60904.patch
? 61451.patch
? 62363.patch
? 62728.patch
? 63865.patch
? 64683.patch
? 65454.patch
? 66158.patch
? 66344.patch
? cal-conduits.patch
? cal-name.patch
? gw-list.patch
? nav-scroll-2.patch
? nav-scroll-3.patch
? nav-scroll.patch
? sync.patch
? system-del.patch
? task-default.patch
? task-warning.patch
? gui/66344.patch
? gui/Helgdagar_2004.ics
? gui/apps_evolution_calendar-2.0.schemas
? gui/cal-comp.patch
? gui/month.patch
? gui/monthview.patch
? gui/nav-scroll.patch
? gui/navigator.patch
? gui/new-editor-2.patch
? gui/new-editor.patch
? gui/old-e-cal-model.h
? gui/old.c
? gui/scroll.patch
? gui/sel.patch
? gui/summary.patch
? gui/temp2.c
? gui/alarm-notify/alarm.patch
? gui/dialogs/alarm-dialog.gladep
? gui/dialogs/alarm-list-dialog.gladep
? gui/dialogs/calendar-setup.gladep
? gui/dialogs/event-page.gladep
? gui/dialogs/meeting-page.gladep
? gui/dialogs/recurrence-page.gladep
? gui/dialogs/temp.c
? gui/dialogs/temp2.c
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2500.2.15
diff -u -p -r1.2500.2.15 ChangeLog
--- ChangeLog	27 Sep 2004 14:10:11 -0000	1.2500.2.15
+++ ChangeLog	27 Sep 2004 16:25:09 -0000
@@ -1,3 +1,29 @@
+2004-09-27  JP Rosevear  <jpr novell com>
+
+	* gui/e-select-names-renderer.h: update signal signature
+
+	* gui/e-select-names-renderer.c (esnr_editing_done): cell_edited
+	now provides a list of names/addresses
+	(esnr_class_init): update signal prototype
+
+	* gui/e-select-names-editable.h: new protos
+
+	* gui/e-select-names-editable.c
+	(e_select_names_editable_get_addresses): list all the addresses
+	including the expanded contact list addresses
+	(e_select_names_editable_get_names): ditto for names
+
+	* gui/e-meeting-list-view.c (attendee_edited_cb): get a list of
+	names and addresses rather than just a single name/address in the
+	cell_edited callback; if there is more than one item in the list
+	its a contact list so delete the item and list out the attendees
+	individually
+	(process_section): iterate over all dests (including list dests)
+	when processing the select names dialog entries and insert them
+	all into the list
+
+	* gui/e-calendar-marshal.list: add marshaller
+
 2004-09-24  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #65599
Index: gui/e-calendar-marshal.list
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-marshal.list,v
retrieving revision 1.3
diff -u -p -r1.3 e-calendar-marshal.list
--- gui/e-calendar-marshal.list	29 Apr 2004 19:36:53 -0000	1.3
+++ gui/e-calendar-marshal.list	27 Sep 2004 16:25:09 -0000
@@ -12,6 +12,7 @@ NONE:ENUM,STRING
 NONE:STRING,BOOL,INT,INT
 NONE:STRING,STRING
 NONE:STRING,STRING,STRING
+NONE:STRING,POINTER,POINTER
 NONE:POINTER,ENUM
 NONE:POINTER,STRING
 NONE:POINTER,POINTER
Index: gui/e-meeting-list-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-meeting-list-view.c,v
retrieving revision 1.12
diff -u -p -r1.12 e-meeting-list-view.c
--- gui/e-meeting-list-view.c	2 Jun 2004 17:29:16 -0000	1.12
+++ gui/e-meeting-list-view.c	27 Sep 2004 16:25:09 -0000
@@ -175,10 +175,42 @@ value_edited (GtkTreeView *view, gint co
 }
 
 static void
-attendee_edited_cb (GtkCellRenderer *renderer, const gchar *path, const gchar *address, const gchar *name, GtkTreeView *view)
+attendee_edited_cb (GtkCellRenderer *renderer, const gchar *path, GList *addresses, GList *names, GtkTreeView *view)
 {
-	value_edited (view, E_MEETING_STORE_ADDRESS_COL, path, address);
-	value_edited (view, E_MEETING_STORE_CN_COL, path, name);
+	if (g_list_length (addresses) > 1) {
+		EMeetingStore *model = E_MEETING_STORE (gtk_tree_view_get_model (view));
+		GtkTreePath *treepath = gtk_tree_path_new_from_string (path);
+		EMeetingAttendee *existing_attendee, *attendee;
+		GList *l, *m;
+		int row = gtk_tree_path_get_indices (treepath)[0];
+		
+		existing_attendee = e_meeting_store_find_attendee_at_row (model, row);
+
+		for (l = addresses, m = names; l && m; l = l->next, m = m->next) {
+			if (e_meeting_store_find_attendee (model, l->data, NULL) != NULL)
+				continue;
+			
+			attendee = e_meeting_store_add_attendee_with_defaults (model);
+			e_meeting_attendee_set_address (attendee, g_strdup (l->data));
+			e_meeting_attendee_set_cn (attendee, g_strdup (m->data));
+			if (existing_attendee) {
+				/* FIXME Should we copy anything else? */
+				e_meeting_attendee_set_cutype (attendee, e_meeting_attendee_get_cutype (existing_attendee));
+				e_meeting_attendee_set_role (attendee, e_meeting_attendee_get_role (existing_attendee));
+				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));
+			}
+		}
+
+		if (existing_attendee)
+			e_meeting_store_remove_attendee (model, existing_attendee);
+		
+		gtk_tree_path_free (treepath);
+		
+	} else if (g_list_length (addresses) == 1) {	
+		value_edited (view, E_MEETING_STORE_ADDRESS_COL, path, addresses->data);
+		value_edited (view, E_MEETING_STORE_CN_COL, path, names->data);
+	}
 }
 
 static void
@@ -313,46 +345,62 @@ process_section (EMeetingListView *view,
 
 	priv = view->priv;
 	for (i = 0; cards[i] != NULL; i++) {
-		const char *name, *attendee = NULL;
-		char *attr = NULL;
+		const GList *list_dests, *l;
+		GList card_dest;
 
-		name = e_destination_get_name (cards[i]);
-
-		/* Get the field as attendee from the backend */
-		if (e_cal_get_ldap_attribute (e_meeting_store_get_e_cal (priv->store),
-						   &attr, NULL)) {
-			/* FIXME this should be more general */
-			if (!g_ascii_strcasecmp (attr, "icscalendar")) {
-				EContact *contact;
-
-				/* FIXME: this does not work, have to use first
-				   e_destination_use_contact() */
-				contact = e_destination_get_contact (cards[i]);
-				if (contact) {
-					attendee = e_contact_get (contact, E_CONTACT_FREEBUSY_URL);
-					if (!attendee)
-						attendee = e_contact_get (contact, E_CONTACT_CALENDAR_URI);
+		if (e_destination_is_evolution_list (cards[i])) {
+			list_dests = e_destination_list_get_dests (cards[i]);
+		} else {
+			card_dest.next = NULL;
+			card_dest.prev = NULL;
+			card_dest.data = cards[i];
+			list_dests = &card_dest;
+		}		
+		
+		for (l = list_dests; l; l = l->next) {
+			EDestination *dest = l->data;
+			const char *name, *attendee = NULL;
+			char *attr = NULL;
+			
+			name = e_destination_get_name (dest);
+
+			/* Get the field as attendee from the backend */
+			if (e_cal_get_ldap_attribute (e_meeting_store_get_e_cal (priv->store),
+						      &attr, NULL)) {
+				/* FIXME this should be more general */
+				if (!g_ascii_strcasecmp (attr, "icscalendar")) {
+					EContact *contact;
+
+					/* FIXME: this does not work, have to use first
+					   e_destination_use_contact() */
+					contact = e_destination_get_contact (dest);
+					if (contact) {
+						attendee = e_contact_get (contact, E_CONTACT_FREEBUSY_URL);
+						if (!attendee)
+							attendee = e_contact_get (contact, E_CONTACT_CALENDAR_URI);
+					}
 				}
 			}
-		}
 
-		/* If we couldn't get the attendee prior, get the email address as the default */
-		if (attendee == NULL || *attendee == '\0') {
-			attendee = e_destination_get_email (cards[i]);
-		}
+			/* If we couldn't get the attendee prior, get the email address as the default */
+			if (attendee == NULL || *attendee == '\0') {
+				attendee = e_destination_get_email (dest);
+			}
 		
-		if (attendee == NULL || *attendee == '\0')
-			continue;
+			if (attendee == NULL || *attendee == '\0')
+				continue;
 		
-		if (e_meeting_store_find_attendee (priv->store, attendee, NULL) == NULL) {
-			EMeetingAttendee *ia = e_meeting_store_add_attendee_with_defaults (priv->store);
+			if (e_meeting_store_find_attendee (priv->store, attendee, NULL) == NULL) {
+				EMeetingAttendee *ia = e_meeting_store_add_attendee_with_defaults (priv->store);
 
-			e_meeting_attendee_set_address (ia, g_strdup_printf ("MAILTO:%s", attendee));
-			e_meeting_attendee_set_role (ia, role);
-			if (role == ICAL_ROLE_NONPARTICIPANT)
-				e_meeting_attendee_set_cutype (ia, ICAL_CUTYPE_RESOURCE);
-			e_meeting_attendee_set_cn (ia, g_strdup (name));
+				e_meeting_attendee_set_address (ia, g_strdup_printf ("MAILTO:%s", attendee));
+				e_meeting_attendee_set_role (ia, role);
+				if (role == ICAL_ROLE_NONPARTICIPANT)
+					e_meeting_attendee_set_cutype (ia, ICAL_CUTYPE_RESOURCE);
+				e_meeting_attendee_set_cn (ia, g_strdup (name));
+			}
 		}
+		
 	}
 }
 
Index: gui/e-select-names-editable.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-select-names-editable.c,v
retrieving revision 1.6
diff -u -p -r1.6 e-select-names-editable.c
--- gui/e-select-names-editable.c	9 Apr 2004 17:30:39 -0000	1.6
+++ gui/e-select-names-editable.c	27 Sep 2004 16:25:09 -0000
@@ -206,6 +206,35 @@ e_select_names_editable_get_address (ESe
 	return result;
 }
 
+GList *
+e_select_names_editable_get_addresses (ESelectNamesEditable *esne)
+{
+	EDestination **dest;
+	gchar *dest_str;
+	GList *result = NULL;
+
+	g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
+
+	dest_str = bonobo_pbclient_get_string (esne->priv->bag, "destinations", NULL);
+	dest = e_destination_importv (dest_str);
+	if (dest) {
+		if (e_destination_is_evolution_list (*dest)) {	
+			const GList *list_dests, *l;
+			
+			list_dests = e_destination_list_get_dests (*dest);
+			for (l = list_dests; l != NULL; l = g_list_next (l)) {
+				result = g_list_append (result, g_strdup (e_destination_get_email (l->data)));
+			}
+		} else {
+			result = g_list_append (result, g_strdup (e_destination_get_email (*dest)));
+		}
+	}
+	
+	e_destination_freev (dest);
+
+	return result;
+}
+
 gchar *
 e_select_names_editable_get_name (ESelectNamesEditable *esne)
 {
@@ -219,6 +248,35 @@ e_select_names_editable_get_name (ESelec
 	dest = e_destination_importv (dest_str);
 	if (dest)
 		result = g_strdup (e_destination_get_name (*dest));
+	e_destination_freev (dest);
+
+	return result;
+}
+
+GList *
+e_select_names_editable_get_names (ESelectNamesEditable *esne)
+{
+	EDestination **dest;
+	gchar *dest_str;
+	GList *result = NULL;
+
+	g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
+
+	dest_str = bonobo_pbclient_get_string (esne->priv->bag, "destinations", NULL);
+	dest = e_destination_importv (dest_str);
+	if (dest) {
+		if (e_destination_is_evolution_list (*dest)) {
+			const GList *list_dests, *l;
+			
+			list_dests = e_destination_list_get_dests (*dest);
+			for (l = list_dests; l != NULL; l = g_list_next (l)) {
+				result = g_list_append (result, g_strdup (e_destination_get_name (l->data)));
+			}
+		} else {
+			result = g_list_append (result, g_strdup (e_destination_get_name (*dest)));
+		}
+	}
+
 	e_destination_freev (dest);
 
 	return result;
Index: gui/e-select-names-editable.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-select-names-editable.h,v
retrieving revision 1.1
diff -u -p -r1.1 e-select-names-editable.h
--- gui/e-select-names-editable.h	30 Sep 2003 22:39:02 -0000	1.1
+++ gui/e-select-names-editable.h	27 Sep 2004 16:25:09 -0000
@@ -56,9 +56,11 @@ ESelectNamesEditable *e_select_names_edi
 ESelectNamesEditable *e_select_names_editable_new (void);
 
 gchar *e_select_names_editable_get_address (ESelectNamesEditable *esne);
+GList *e_select_names_editable_get_addresses (ESelectNamesEditable *esne);
 void   e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *text);
 
 gchar *e_select_names_editable_get_name (ESelectNamesEditable *esne);
+GList *e_select_names_editable_get_names (ESelectNamesEditable *esne);
 G_END_DECLS
 
 #endif /* __E_SELECT_NAMES_EDITABLE_H__ */
Index: gui/e-select-names-renderer.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-select-names-renderer.c,v
retrieving revision 1.5
diff -u -p -r1.5 e-select-names-renderer.c
--- gui/e-select-names-renderer.c	6 Jan 2004 17:22:51 -0000	1.5
+++ gui/e-select-names-renderer.c	27 Sep 2004 16:25:09 -0000
@@ -52,19 +52,23 @@ static gint signals [LAST_SIGNAL];
 static void
 esnr_editing_done (GtkCellEditable *editable, ESelectNamesRenderer *cell)
 {
-	gchar *new_address, *new_name;
+	GList *addresses = NULL, *names = NULL;
 	BonoboControlFrame *cf;
-
+	
 	/* We don't need to listen for the de-activation any more */
 	cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (editable));
 	g_signal_handlers_disconnect_matched (G_OBJECT (cf), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, cell);
-	
-	new_address = e_select_names_editable_get_address (E_SELECT_NAMES_EDITABLE (editable));
-	new_name = e_select_names_editable_get_name (E_SELECT_NAMES_EDITABLE (editable));
+
+	addresses = e_select_names_editable_get_addresses (E_SELECT_NAMES_EDITABLE (editable));
+	names = e_select_names_editable_get_names (E_SELECT_NAMES_EDITABLE (editable));
                                                              
-	g_signal_emit (cell, signals [CELL_EDITED], 0, cell->priv->path, new_address, new_name);
-	g_free (new_address);
-	g_free (new_name);
+	g_signal_emit (cell, signals [CELL_EDITED], 0, cell->priv->path, addresses, names);
+
+	g_list_foreach (addresses, g_free, NULL);
+	g_list_foreach (names, g_free, NULL);
+	g_list_free (addresses);
+	g_list_free (names);
+
 	g_free (cell->priv->path);
 	cell->priv->path = NULL;
 }
@@ -180,9 +184,9 @@ esnr_class_init (ESelectNamesRendererCla
 					      G_SIGNAL_RUN_LAST,
 					      G_STRUCT_OFFSET (ESelectNamesRendererClass, cell_edited),
 					      NULL, NULL,
-					      e_calendar_marshal_VOID__STRING_STRING_STRING,
+					      e_calendar_marshal_VOID__STRING_POINTER_POINTER,
 					      G_TYPE_NONE, 3,
-					      G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
+					      G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER);
 }
 
 E_MAKE_TYPE (e_select_names_renderer, "ESelectNamesRenderer", ESelectNamesRenderer, esnr_class_init, esnr_init, GTK_TYPE_CELL_RENDERER_TEXT)
Index: gui/e-select-names-renderer.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-select-names-renderer.h,v
retrieving revision 1.1
diff -u -p -r1.1 e-select-names-renderer.h
--- gui/e-select-names-renderer.h	30 Sep 2003 22:39:02 -0000	1.1
+++ gui/e-select-names-renderer.h	27 Sep 2004 16:25:09 -0000
@@ -51,8 +51,8 @@ struct _ESelectNamesRendererClass
 
 	void (* cell_edited) (ESelectNamesRenderer *renderer, 
 			      const gchar *path, 
-			      const gchar *address, 
-			      const gchar *name);
+			      GList *addresses, 
+			      GList *names);	
 };
 
 GType            e_select_names_renderer_get_type (void);


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