diff options
author | JP Rosevear <jpr@novell.com> | 2005-02-23 09:28:20 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2005-02-23 09:28:20 +0800 |
commit | b04efc12fa2842852129e25a6a64767c1bbd28f5 (patch) | |
tree | fd2ebf29cfc9f494408d65e42b1e2a8e071370bd /calendar/gui/e-select-names-renderer.c | |
parent | 7c9fac1f90c71124eda269acd2b87b7149f9002c (diff) | |
download | gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.tar gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.tar.gz gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.tar.bz2 gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.tar.lz gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.tar.xz gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.tar.zst gsoc2013-evolution-b04efc12fa2842852129e25a6a64767c1bbd28f5.zip |
Fixes #63866, #67714, #62089, #47747, #61495
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
svn path=/trunk/; revision=28851
Diffstat (limited to 'calendar/gui/e-select-names-renderer.c')
-rw-r--r-- | calendar/gui/e-select-names-renderer.c | 86 |
1 files changed, 55 insertions, 31 deletions
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 * |