diff options
author | JP Rosevear <jpr@ximian.com> | 2003-03-05 06:02:01 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2003-03-05 06:02:01 +0800 |
commit | af8947c7c413379f6eca5fe81b930a5e0014bc8c (patch) | |
tree | 9a136a13172c2ac0d1e9ef8b18cd1e30cf95934d /calendar/gui | |
parent | c1e2563e393921af0dea2d29eeb13d58e1bcd91b (diff) | |
download | gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.tar gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.tar.gz gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.tar.bz2 gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.tar.lz gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.tar.xz gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.tar.zst gsoc2013-evolution-af8947c7c413379f6eca5fe81b930a5e0014bc8c.zip |
implement
2003-03-04 JP Rosevear <jpr@ximian.com>
* pcs/cal.c (impl_Cal_get_ldap_attribute): implement
* pcs/cal-backend.h: add virtual method
* pcs/cal-backend.c (cal_backend_get_ldap_attribute): call
get_ldap_attribute_method
* pcs/cal-backend-file.c (cal_backend_file_class_init): overrid
get_ldap_attribute method
* idl/evolution-calendar.idl: add getLdapAttribute method
* gui/e-meeting-model.c (process_section): take simple card list
as arg and try to use the ldap attribute (if any) as the attendee,
else use the email address
(select_names_ok_cb): get the simple card list
* cal-client/cal-client.h: add proto
* cal-client/cal-client.c (cal_client_init): init ldap_attribute
to NULL
(cal_client_destroy): free ldap_attribute
svn path=/trunk/; revision=20154
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/e-meeting-model.c | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c index 2ab28a1fe4..d8dff221db 100644 --- a/calendar/gui/e-meeting-model.c +++ b/calendar/gui/e-meeting-model.c @@ -40,7 +40,6 @@ #include <ebook/e-card-cursor.h> #include <ebook/e-card.h> #include <ebook/e-card-simple.h> -#include <ebook/e-destination.h> #include <cal-util/cal-component.h> #include <cal-util/cal-util.h> #include <cal-util/timeutil.h> @@ -1696,24 +1695,57 @@ e_meeting_model_invite_others_dialog (EMeetingModel *im) } static void -process_section (EMeetingModel *im, EDestination **destv, icalparameter_role role) +process_section (EMeetingModel *im, GNOME_Evolution_Addressbook_SimpleCardList *cards, icalparameter_role role) { + EMeetingModelPrivate *priv; int i; - - for (i = 0; destv[i] != NULL; i++) { + + priv = im->priv; + for (i = 0; i < cards->_length; i++) { EMeetingAttendee *ia; - const char *name, *address; - - name = e_destination_get_name (destv[i]); - address = e_destination_get_email (destv[i]); + const char *name, *attendee = NULL, *attr; + GNOME_Evolution_Addressbook_SimpleCard card; + CORBA_Environment ev; + + card = cards->_buffer[i]; + + CORBA_exception_init (&ev); + + /* Get the CN */ + name = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_FullName, &ev); + if (BONOBO_EX (&ev)) { + CORBA_exception_free (&ev); + continue; + } + + /* Get the field as attendee from the backend */ + attr = cal_client_get_ldap_attribute (priv->client); + if (attr) { + /* FIXME this should be more general */ + if (!strcmp (attr, "icscalendar")) + attendee = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_Icscalendar, &ev); + } + + CORBA_exception_init (&ev); + + /* If we couldn't get the attendee prior, get the email address as the default */ + if (attendee == NULL) { + attendee = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_Email, &ev); + if (BONOBO_EX (&ev)) { + CORBA_exception_free (&ev); + continue; + } + } - if (address == NULL || *address == '\0') + CORBA_exception_free (&ev); + + if (attendee == NULL || *attendee == '\0') continue; - if (e_meeting_model_find_attendee (im, address, NULL) == NULL) { + if (e_meeting_model_find_attendee (im, attendee, NULL) == NULL) { ia = e_meeting_model_add_attendee_with_defaults (im); - e_meeting_attendee_set_address (ia, g_strdup_printf ("MAILTO:%s", address)); + 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); @@ -1733,8 +1765,10 @@ select_names_ok_cb (BonoboListener *listener, EMeetingModelPrivate *priv; Bonobo_Control corba_control; GtkWidget *control_widget; - EDestination **destv; - char *string = NULL; + BonoboControlFrame *control_frame; + Bonobo_PropertyBag pb; + BonoboArg *card_arg; + GNOME_Evolution_Addressbook_SimpleCardList cards; int i; priv = im->priv; @@ -1744,13 +1778,15 @@ select_names_ok_cb (BonoboListener *listener, (priv->corba_select_names, sections[i], ev); control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL); - - bonobo_widget_get_property (BONOBO_WIDGET (control_widget), "destinations", TC_CORBA_string, &string, NULL); - destv = e_destination_importv (string); - if (destv != NULL) { - process_section (im, destv, roles[i]); - e_destination_freev (destv); - } + + control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_widget)); + pb = bonobo_control_frame_get_control_property_bag (control_frame, NULL); + card_arg = bonobo_property_bag_client_get_value_any (pb, "simple_card_list", NULL); + if (card_arg != NULL) { + cards = BONOBO_ARG_GET_GENERAL (card_arg, TC_GNOME_Evolution_Addressbook_SimpleCardList, GNOME_Evolution_Addressbook_SimpleCardList, NULL); + process_section (im, &cards, roles[i]); + bonobo_arg_release (card_arg); + } } } |