[evolution-patches] 63866, 67714, 62089, 47747, 61495 Calendar editor meeting page autocompletion fixes



This cleaned up rather nicely with no bonobo.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
? 2412.patch
? 41624.patch
? 68707.patch
? bar.patch
? context.patch
? meeting-autocomplete.patch
? output.pdf
? print-cal.patch
? twentyfour.patch
? gui/menu.patch
? gui/non-cursor.patch
? gui/temp.patch
? gui/dialogs/alarm-dialog.gladep
? gui/dialogs/cal-prefs-dialog.gladep
? gui/dialogs/task-details-page.gladep
? gui/dialogs/task-page.gladep
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2668
diff -u -r1.2668 ChangeLog
--- ChangeLog	18 Feb 2005 13:33:00 -0000	1.2668
+++ ChangeLog	21 Feb 2005 21:06:33 -0000
@@ -1,3 +1,42 @@
+2005-02-21  JP Rosevear  <jpr novell com>
+
+	Fixes #63866, #67714, #62089, #47747, #61495
+	
+	* gui/e-select-names-renderer.h: update signal
+
+	* gui/e-select-names-renderer.c
+	(e_select_names_renderer_editing_done): emit the cancelled signal
+	properly and don't update if it was cancelled
+	(e_select_names_renderer_focus_out_event): if the cell loses focus
+	the editing is done
+	(e_select_names_renderer_start_editing): listen for focus out
+	event, and only set the address if appropriate
+	(e_select_names_renderer_get_property): handle name/email props
+	(e_select_names_renderer_set_property): ditto
+	(e_select_names_renderer_finalize): free name/email
+	(e_select_names_renderer_class_init): install name/email props;
+	cell_edited returns lists now
+
+	* gui/e-select-names-editable.h: update protos
+
+	* gui/e-select-names-editable.c: don't really override any of the
+	gtkentry editable cell routines since we directly inherit from
+	ENameSelectorEntry
+	(e_select_names_editable_get_emails): get all the email addresses
+	(e_select_names_editable_get_names): get all the names
+	(e_select_names_editable_set_address): set the destination
+	correctly for editing
+
+	* gui/e-meeting-list-view.c (attendee_edited_cb): handle a blank
+	entry by removing it and don't allow an entry that already exists
+	to be entered
+	(attendee_editing_canceled_cb): if the item editing is cancelled
+	and it has no name or email address, remove it
+	(process_section): if the contact has multiple addresses (ie a
+	mailing list), expand the entries
+
+	* gui/e-calendar-marshal.list: add new marshaller	
+
 2005-02-18  Rodrigo Moya <rodrigo novell com>
 
 	* gui/alarm-notify/alarm-notify.c (cal_opened_cb): if opening
Index: gui/e-calendar-marshal.list
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-marshal.list,v
retrieving revision 1.3
diff -u -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	21 Feb 2005 21:06:33 -0000
@@ -12,6 +12,7 @@
 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.15
diff -u -r1.15 e-meeting-list-view.c
--- gui/e-meeting-list-view.c	23 Dec 2004 02:42:11 -0000	1.15
+++ gui/e-meeting-list-view.c	21 Feb 2005 21:06:33 -0000
@@ -192,13 +192,86 @@
 }
 
 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);
+	EMeetingStore *model = E_MEETING_STORE (gtk_tree_view_get_model (view));
+	GtkTreePath *treepath = gtk_tree_path_new_from_string (path);
+	int row = gtk_tree_path_get_indices (treepath)[0];
+	EMeetingAttendee *existing_attendee;
+
+	existing_attendee = e_meeting_store_find_attendee_at_row (model, row);
+
+	if (g_list_length (addresses) > 1) {
+		EMeetingAttendee *attendee;
+		GList *l, *m;
+
+		for (l = addresses, m = names; l && m; l = l->next, m = m->next) {
+			char *name = m->data, *email = l->data;
+			
+			if (!((name && *name) || (email && *email)))
+				continue;
+			
+			if (e_meeting_store_find_attendee (model, email, 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);
+		
+	} else if (g_list_length (addresses) == 1) {
+		char *name = names->data, *email = addresses->data;
+
+		if (!((name && *name) || (email && *email)) || e_meeting_store_find_attendee (model, email, NULL) != NULL) {
+			if (existing_attendee)
+				e_meeting_store_remove_attendee (model, existing_attendee);
+		} else {
+			value_edited (view, E_MEETING_STORE_ADDRESS_COL, path, email);
+			value_edited (view, E_MEETING_STORE_CN_COL, path, name);
+		}
+	} else {
+		if (existing_attendee)
+			e_meeting_store_remove_attendee (model, existing_attendee);
+	}
+
+	gtk_tree_path_free (treepath);
 }
 
 static void
+attendee_editing_canceled_cb (GtkCellRenderer *renderer, GtkTreeView *view) 
+{
+	EMeetingStore *model = E_MEETING_STORE (gtk_tree_view_get_model (view));
+	GtkTreePath *path;
+	EMeetingAttendee *existing_attendee;
+	int row;
+
+	/* This is for newly added attendees when the editing is cancelled */
+	gtk_tree_view_get_cursor (view, &path, NULL);
+	if (!path)
+		return;
+	
+	row = gtk_tree_path_get_indices (path)[0];
+	existing_attendee = e_meeting_store_find_attendee_at_row (model, row);
+	if (existing_attendee) {
+		if (!e_meeting_attendee_is_set_cn (existing_attendee) && !e_meeting_attendee_is_set_address (existing_attendee))
+			e_meeting_store_remove_attendee (model, existing_attendee);
+	}
+	
+	gtk_tree_path_free (path);
+}
+
+
+static void
 type_edited_cb (GtkCellRenderer *renderer, const gchar *path, const gchar *text, GtkTreeView *view)
 {
 	value_edited (view, E_MEETING_STORE_TYPE_COL, path, text);
@@ -226,7 +299,7 @@
 build_table (GtkTreeView *view)
 {
 	GtkCellRenderer *renderer;
-
+	
 	gtk_tree_view_set_headers_visible (view, TRUE);
 	gtk_tree_view_set_rules_hint (view, TRUE);
 
@@ -234,10 +307,12 @@
 	g_object_set (G_OBJECT (renderer), "editable", TRUE, NULL);
 	gtk_tree_view_insert_column_with_attributes (view, -1, _("Attendee"), renderer,
 						     "text", E_MEETING_STORE_ATTENDEE_COL,
-						     "address", E_MEETING_STORE_ADDRESS_COL,
+						     "name", E_MEETING_STORE_CN_COL,
+						     "email", E_MEETING_STORE_ADDRESS_COL,
 						     "underline", E_MEETING_STORE_ATTENDEE_UNDERLINE_COL,
 						     NULL);
 	g_signal_connect (renderer, "cell_edited", G_CALLBACK (attendee_edited_cb), view);
+	g_signal_connect (renderer, "editing-canceled", G_CALLBACK (attendee_editing_canceled_cb), view);
 	
 	renderer = e_cell_renderer_combo_new ();
 	g_object_set (G_OBJECT (renderer), "list", get_type_strings (), "editable", TRUE, NULL);
@@ -331,46 +406,62 @@
 	priv = view->priv;
 	for (l = destinations; l; l = g_list_next (l)) {
 		EDestination *destination = l->data;
-		const char *name, *attendee = NULL;
-		char *attr = NULL;
-
-		name = e_destination_get_name (destination);
+		const GList *list_dests, *l;
+		GList card_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 (destination);
-				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 (destination)) {
+			list_dests = e_destination_list_get_dests (destination);
+		} else {
+			card_dest.next = NULL;
+			card_dest.prev = NULL;
+			card_dest.data = destination;
+			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 (destination);
-		}
+			/* 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.9
diff -u -r1.9 e-select-names-editable.c
--- gui/e-select-names-editable.c	23 Dec 2004 06:53:54 -0000	1.9
+++ gui/e-select-names-editable.c	21 Feb 2005 21:06:33 -0000
@@ -29,25 +29,14 @@
 #include "e-select-names-editable.h"
 
 struct _ESelectNamesEditablePriv {
-	
+	gint dummy;
 };
 
 static ENameSelectorEntryClass *parent_class;
 
 static void
-esne_start_editing (GtkCellEditable *cell_editable, GdkEvent *event)
-{
-	ESelectNamesEditable *esne = E_SELECT_NAMES_EDITABLE (cell_editable);
-
-	/* Grab the focus */
-
-	/* TODO */
-}
-
-static void
 esne_cell_editable_init (GtkCellEditableIface *iface)
 {
-	iface->start_editing = esne_start_editing;
 }
 
 static void
@@ -107,81 +96,73 @@
 	return esne_type;
 }
 
-static void
-entry_activate (ESelectNamesEditable *esne)
-{
-	gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (esne));
-	gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (esne));
-}
-
 ESelectNamesEditable *
-e_select_names_editable_construct (ESelectNamesEditable *esne)
+e_select_names_editable_new ()
 {
-	g_signal_connect (esne, "activate", G_CALLBACK (entry_activate), esne);
+	ESelectNamesEditable *esne = g_object_new (E_TYPE_SELECT_NAMES_EDITABLE, NULL);
 
 	return esne;
+}
 
-#if 0
-	CORBA_Environment ev;
-
-	CORBA_exception_init (&ev);
-
-	esne->priv->select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFIID, 0, NULL, &ev);
-	if (BONOBO_EX (&ev)) {
-		CORBA_exception_free (&ev);
-		return NULL;
-	}
+gchar *
+e_select_names_editable_get_email (ESelectNamesEditable *esne)
+{
+	EDestinationStore *destination_store;
+	GList *destinations;
+	EDestination *destination;
+	gchar *result = NULL;
 
-	GNOME_Evolution_Addressbook_SelectNames_addSection (esne->priv->select_names, "A", "A", &ev);
-	if (BONOBO_EX (&ev)) {
-		CORBA_exception_free (&ev);
-		return NULL;
-	}
+	g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
 
-	esne->priv->control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (
-			esne->priv->select_names, "A", &ev);
-	if (BONOBO_EX (&ev)) {
-		CORBA_exception_free (&ev);
+	destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
+	destinations = e_destination_store_list_destinations (destination_store);
+	if (!destinations)
 		return NULL;
-	}
-
-	bonobo_widget_construct_control_from_objref (BONOBO_WIDGET (esne), esne->priv->control, CORBA_OBJECT_NIL, &ev);
-
-	CORBA_exception_free (&ev);
-
-	esne->priv->bag = bonobo_control_frame_get_control_property_bag (
-			bonobo_widget_get_control_frame (BONOBO_WIDGET (esne)), NULL);
-	bonobo_event_source_client_add_listener (esne->priv->bag, entry_activate,
-						 "GNOME/Evolution/Addressbook/SelectNames:activate:entry",
-						 NULL, esne);
 
-	return esne;
-#endif
+	destination = destinations->data;
+	result = g_strdup (e_destination_get_email (destination));
+	g_list_free (destinations);
+	return result;
 }
 
-ESelectNamesEditable *
-e_select_names_editable_new ()
+GList *
+e_select_names_editable_get_emails (ESelectNamesEditable *esne)
 {
-	ESelectNamesEditable *esne = g_object_new (E_TYPE_SELECT_NAMES_EDITABLE, NULL);
+	EDestinationStore *destination_store;
+	GList *destinations;
+	EDestination *destination;
+	GList *result = NULL;
 
-	if (!esne)
-		return NULL;
+	g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
 
-	if (!e_select_names_editable_construct (esne)) {
-		g_object_unref (esne);
+	destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
+	destinations = e_destination_store_list_destinations (destination_store);
+	if (!destinations)
 		return NULL;
+
+	destination = destinations->data;
+	if (e_destination_is_evolution_list (destination)) {	
+		const GList *list_dests, *l;
+
+		list_dests = e_destination_list_get_dests (destination);
+		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 (destination)));
 	}
 
-	return esne;
+	g_list_free (destinations);
+
+	return result;
 }
 
 gchar *
-e_select_names_editable_get_address (ESelectNamesEditable *esne)
+e_select_names_editable_get_name (ESelectNamesEditable *esne)
 {
 	EDestinationStore *destination_store;
 	GList *destinations;
 	EDestination *destination;
-	gchar *dest_str;
 	gchar *result = NULL;
 
 	g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
@@ -192,19 +173,18 @@
 		return NULL;
 
 	destination = destinations->data;
-	result = g_strdup (e_destination_get_email (destination));
+	result = g_strdup (e_destination_get_name (destination));
 	g_list_free (destinations);
 	return result;
 }
 
-gchar *
-e_select_names_editable_get_name (ESelectNamesEditable *esne)
+GList *
+e_select_names_editable_get_names (ESelectNamesEditable *esne)
 {
 	EDestinationStore *destination_store;
 	GList *destinations;
 	EDestination *destination;
-	gchar *dest_str;
-	gchar *result = NULL;
+	GList *result = NULL;
 
 	g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL);
 
@@ -213,30 +193,44 @@
 	if (!destinations)
 		return NULL;
 
-	destination = destinations->data;
-	result = g_strdup (e_destination_get_name (destination));
+	destination = destinations->data;	
+	if (e_destination_is_evolution_list (destination)) {
+		const GList *list_dests, *l;
+		
+		list_dests = e_destination_list_get_dests (destination);
+		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 (destination)));
+	}
+
 	g_list_free (destinations);
+
 	return result;
 }
 
 void
-e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *text)
+e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *name, const gchar *email)
 {
 	EDestinationStore *destination_store;
 	GList *destinations;
 	EDestination *destination;
-	gchar *dest_str;
-	gchar *result = NULL;
 
 	g_return_if_fail (E_IS_SELECT_NAMES_EDITABLE (esne));
 
 	destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY (esne));
 	destinations = e_destination_store_list_destinations (destination_store);
+
 	if (!destinations)
-		return;
+		destination = e_destination_new ();
+	else
+		destination = g_object_ref (destinations->data);
 
-	destination = destinations->data;
-	e_destination_set_address (destination, text);
-	g_list_free (destinations);
+	e_destination_set_name (destination, name);
+	e_destination_set_email (destination, email);
+	
+	if (!destinations)
+		e_destination_store_append_destination (destination_store, destination);
+	g_object_unref (destination);
 }
-
Index: gui/e-select-names-editable.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-select-names-editable.h,v
retrieving revision 1.2
diff -u -r1.2 e-select-names-editable.h
--- gui/e-select-names-editable.h	23 Dec 2004 02:42:11 -0000	1.2
+++ gui/e-select-names-editable.h	21 Feb 2005 21:06:33 -0000
@@ -52,13 +52,16 @@
 
 GType      e_select_names_editable_get_type (void);
 
-ESelectNamesEditable *e_select_names_editable_construct (ESelectNamesEditable *esne);
 ESelectNamesEditable *e_select_names_editable_new (void);
 
-gchar *e_select_names_editable_get_address (ESelectNamesEditable *esne);
-void   e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *text);
+gchar *e_select_names_editable_get_email (ESelectNamesEditable *esne);
+GList *e_select_names_editable_get_emails (ESelectNamesEditable *esne);
 
 gchar *e_select_names_editable_get_name (ESelectNamesEditable *esne);
+GList *e_select_names_editable_get_names (ESelectNamesEditable *esne);
+
+void   e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *name, const gchar *email);
+
 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.7
diff -u -r1.7 e-select-names-renderer.c
--- gui/e-select-names-renderer.c	23 Dec 2004 02:42:11 -0000	1.7
+++ gui/e-select-names-renderer.c	21 Feb 2005 21:06:33 -0000
@@ -32,12 +32,15 @@
 struct _ESelectNamesRendererPriv {
 	ESelectNamesEditable *editable;
 	gchar *path;
-	gchar *address;
+
+	gchar *name;
+	gchar *email;
 };
 
 enum {
 	PROP_0,
-	PROP_ADDRESS
+	PROP_NAME,
+	PROP_EMAIL
 };
 
 enum {
@@ -52,25 +55,38 @@
 static void
 e_select_names_renderer_editing_done (GtkCellEditable *editable, ESelectNamesRenderer *cell)
 {
-	gchar *new_address, *new_name;
+	GList *addresses = NULL, *names = NULL;
 
-	/* We don't need to listen for the de-activation any more */
+	/* 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);
+
+	gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (cell), GTK_ENTRY (editable)->editing_canceled);
+	if (GTK_ENTRY (editable)->editing_canceled)
+		goto cleanup;
 	
-	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));
-                                                             
-	g_signal_emit (cell, signals [CELL_EDITED], 0, cell->priv->path, new_address, new_name);
-	g_free (new_address);
-	g_free (new_name);
+	addresses = e_select_names_editable_get_emails (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, addresses, names);
+
+	g_list_foreach (addresses, (GFunc)g_free, NULL);
+	g_list_foreach (names, (GFunc)g_free, NULL);
+	g_list_free (addresses);
+	g_list_free (names);
+
+ cleanup:
 	g_free (cell->priv->path);
 	cell->priv->path = NULL;
+	cell->priv->editable = NULL;
 }
 
-static void
-e_select_names_renderer_activated (ESelectNamesEditable *editable, ESelectNamesRenderer *cell)
+static gboolean
+e_select_names_renderer_focus_out_event (GtkWidget *entry, GdkEvent  *event, ESelectNamesRenderer *cell)
 {
 	e_select_names_renderer_editing_done (GTK_CELL_EDITABLE (cell->priv->editable), cell);
+
+	/* entry needs focus-out-event */
+	return FALSE;
 }
 
 static GtkCellEditable *
@@ -85,18 +101,14 @@
 		return NULL;
 
 	editable = E_SELECT_NAMES_EDITABLE (e_select_names_editable_new ());
-	e_select_names_editable_set_address (editable, sn_cell->priv->address);
+	gtk_entry_set_has_frame (GTK_ENTRY (editable), FALSE);
+	gtk_entry_set_alignment (GTK_ENTRY (editable), cell->xalign);
+	if (sn_cell->priv->email && *sn_cell->priv->email) 
+		e_select_names_editable_set_address (editable, sn_cell->priv->name, sn_cell->priv->email);
 	gtk_widget_show (GTK_WIDGET (editable));
 
 	g_signal_connect (editable, "editing_done", G_CALLBACK (e_select_names_renderer_editing_done), sn_cell);
-
-#if 0
-	/* Listen for de-activation/loss of focus */
-	cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (editable));
-	bonobo_control_frame_set_autoactivate (cf, TRUE);
-#endif
-
-	g_signal_connect (editable, "activate", G_CALLBACK (e_select_names_renderer_activated), sn_cell);
+	g_signal_connect (editable, "focus_out_event", G_CALLBACK (e_select_names_renderer_focus_out_event), sn_cell);
 
 	sn_cell->priv->editable = g_object_ref (editable);
 	sn_cell->priv->path = g_strdup (path);
@@ -110,8 +122,11 @@
 	ESelectNamesRenderer *esnr = E_SELECT_NAMES_RENDERER (object);
 
 	switch (prop_id) {
-	case PROP_ADDRESS:
-		g_value_set_string (value, esnr->priv->address);
+	case PROP_NAME:
+		g_value_set_string (value, esnr->priv->name);
+		break;
+	case PROP_EMAIL:
+		g_value_set_string (value, esnr->priv->email);
 		break;
 	default:
 		break;
@@ -124,9 +139,13 @@
 	ESelectNamesRenderer *esnr = E_SELECT_NAMES_RENDERER (object);
 
 	switch (prop_id) {
-	case PROP_ADDRESS:
-		g_free (esnr->priv->address);
-		esnr->priv->address = g_strdup (g_value_get_string (value));
+	case PROP_NAME:
+		g_free (esnr->priv->name);
+		esnr->priv->name = g_strdup (g_value_get_string (value));
+		break;
+	case PROP_EMAIL:
+		g_free (esnr->priv->email);
+		esnr->priv->email = g_strdup (g_value_get_string (value));
 		break;
 	default:
 		break;
@@ -143,7 +162,8 @@
 	cell->priv->editable = NULL;
 
 	g_free (cell->priv->path);
-	g_free (cell->priv->address);
+	g_free (cell->priv->name);
+	g_free (cell->priv->email);
 	g_free (cell->priv);
 
 	if (G_OBJECT_CLASS (e_select_names_renderer_parent_class)->finalize)
@@ -168,17 +188,20 @@
 
 	cell_class->start_editing = e_select_names_renderer_start_editing;
 
-	g_object_class_install_property (obj_class, PROP_ADDRESS,
-					 g_param_spec_string ("address", "Address", "Email address.", NULL, G_PARAM_READWRITE));
+	g_object_class_install_property (obj_class, PROP_NAME,
+					 g_param_spec_string ("name", "Name", "Email name.", NULL, G_PARAM_READWRITE));
+
+	g_object_class_install_property (obj_class, PROP_EMAIL,
+					 g_param_spec_string ("email", "Email", "Email address.", NULL, G_PARAM_READWRITE));
 
 	signals [CELL_EDITED] = g_signal_new ("cell_edited",
 					      G_OBJECT_CLASS_TYPE (obj_class),
 					      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);
 }
 
 GtkCellRenderer *
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 -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	21 Feb 2005 21:06:33 -0000
@@ -51,8 +51,8 @@
 
 	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]