From b04efc12fa2842852129e25a6a64767c1bbd28f5 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 23 Feb 2005 01:28:20 +0000 Subject: Fixes #63866, #67714, #62089, #47747, #61495 2005-02-21 JP Rosevear 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 svn path=/trunk/; revision=28851 --- calendar/ChangeLog | 39 ++++++++ calendar/gui/e-calendar-marshal.list | 1 + calendar/gui/e-meeting-list-view.c | 169 +++++++++++++++++++++++++-------- calendar/gui/e-select-names-editable.c | 150 ++++++++++++++--------------- calendar/gui/e-select-names-editable.h | 9 +- calendar/gui/e-select-names-renderer.c | 86 +++++++++++------ calendar/gui/e-select-names-renderer.h | 4 +- 7 files changed, 305 insertions(+), 153 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a4c2d3400d..1d2725ba8a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,42 @@ +2005-02-21 JP Rosevear + + 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-19 Sivaiah Nallagatla * gui/calendar-component.c (ensure_sources) : diff --git a/calendar/gui/e-calendar-marshal.list b/calendar/gui/e-calendar-marshal.list index 9e095c4291..942e8d03e7 100644 --- a/calendar/gui/e-calendar-marshal.list +++ b/calendar/gui/e-calendar-marshal.list @@ -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 diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c index a3965da4af..f411b1be2d 100644 --- a/calendar/gui/e-meeting-list-view.c +++ b/calendar/gui/e-meeting-list-view.c @@ -192,12 +192,85 @@ value_edited (GtkTreeView *view, gint col, const gchar *path, const gchar *text) } 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) { @@ -226,7 +299,7 @@ static void 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 @@ build_table (GtkTreeView *view) 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 @@ process_section (EMeetingListView *view, GList *destinations, icalparameter_role 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); - - /* 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); + const GList *list_dests, *l; + GList card_dest; + + 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); - - 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)); + 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)); + } } + } } diff --git a/calendar/gui/e-select-names-editable.c b/calendar/gui/e-select-names-editable.c index 60289a5b74..10781150d1 100644 --- a/calendar/gui/e-select-names-editable.c +++ b/calendar/gui/e-select-names-editable.c @@ -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 @@ e_select_names_editable_get_type (void) 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 @@ e_select_names_editable_get_address (ESelectNamesEditable *esne) 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 @@ e_select_names_editable_get_name (ESelectNamesEditable *esne) 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); } - diff --git a/calendar/gui/e-select-names-editable.h b/calendar/gui/e-select-names-editable.h index f361c48cd8..15c1908442 100644 --- a/calendar/gui/e-select-names-editable.h +++ b/calendar/gui/e-select-names-editable.h @@ -52,13 +52,16 @@ struct _ESelectNamesEditableClass 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__ */ diff --git a/calendar/gui/e-select-names-renderer.c b/calendar/gui/e-select-names-renderer.c index 5a8e3316a7..2f119e2e6c 100644 --- a/calendar/gui/e-select-names-renderer.c +++ b/calendar/gui/e-select-names-renderer.c @@ -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,39 @@ G_DEFINE_TYPE (ESelectNamesRenderer, e_select_names_renderer, GTK_TYPE_CELL_REND 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); + + if (GTK_ENTRY (editable)->editing_canceled) { + gtk_cell_renderer_editing_canceled (GTK_CELL_RENDERER (cell)); + 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 +102,14 @@ e_select_names_renderer_start_editing (GtkCellRenderer *cell, GdkEvent *event, G 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 +123,11 @@ e_select_names_renderer_get_property (GObject *object, guint prop_id, GValue *va 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 +140,13 @@ e_select_names_renderer_set_property (GObject *object, guint prop_id, const GVal 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 +163,8 @@ e_select_names_renderer_finalize (GObject *obj) 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 +189,20 @@ e_select_names_renderer_class_init (ESelectNamesRendererClass *class) 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 * diff --git a/calendar/gui/e-select-names-renderer.h b/calendar/gui/e-select-names-renderer.h index fb045d928f..0d469e14a3 100644 --- a/calendar/gui/e-select-names-renderer.h +++ b/calendar/gui/e-select-names-renderer.h @@ -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); -- cgit