aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-select-names-editable.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@novell.com>2005-02-23 09:28:20 +0800
committerJP Rosevear <jpr@src.gnome.org>2005-02-23 09:28:20 +0800
commitb04efc12fa2842852129e25a6a64767c1bbd28f5 (patch)
treefd2ebf29cfc9f494408d65e42b1e2a8e071370bd /calendar/gui/e-select-names-editable.c
parent7c9fac1f90c71124eda269acd2b87b7149f9002c (diff)
downloadgsoc2013-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-editable.c')
-rw-r--r--calendar/gui/e-select-names-editable.c150
1 files changed, 72 insertions, 78 deletions
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);
}
-