static void render_contact_list (EABContactFormatter *formatter, EContact *contact, GString *buffer) { EDestination *destination; const GList *dest, *dests; destination = e_destination_new (); e_destination_set_contact (destination, contact, 0); dests = e_destination_list_get_root_dests (destination); render_title_block (formatter, contact, buffer); g_string_append_printf ( buffer, "<table border=\"0\"><tr><th colspan=\"2\">%s</th></tr>" "<tr><td with=" IMAGE_COL_WIDTH "></td><td>", _("List Members:")); g_string_append (buffer, "<table border=\"0\" cellspacing=\"1\">"); for (dest = dests; dest; dest = dest->next) render_contact_list_row (formatter, dest->data, buffer); g_string_append (buffer, "</table>"); g_string_append (buffer, "</td></tr></table>"); g_object_unref (destination); }
static void resolve_list_card (LDIFImporter *gci, EContact *contact) { GList *email, *l; GList *email_attrs = NULL; gchar *full_name; /* set file_as to full_name so we don't later try and figure * out a first/last name for the list. */ full_name = e_contact_get (contact, E_CONTACT_FULL_NAME); if (full_name) e_contact_set (contact, E_CONTACT_FILE_AS, full_name); g_free (full_name); /* FIMXE getting might not be implemented in ebook */ email = e_contact_get (contact, E_CONTACT_EMAIL); for (l = email; l; l = l->next) { /* mozilla stuffs dn's in the EMAIL list for contact lists */ gchar *dn = l->data; EContact *dn_contact = g_hash_table_lookup (gci->dn_contact_hash, dn); /* break list chains here, since we don't support them just yet */ if (dn_contact && !e_contact_get (dn_contact, E_CONTACT_IS_LIST)) { EDestination *dest; EVCardAttribute *attr = e_vcard_attribute_new (NULL, EVC_EMAIL); /* Hard-wired for default e-mail, since * netscape only exports 1 email address. */ dest = e_destination_new (); e_destination_set_contact (dest, dn_contact, 0); e_destination_export_to_vcard_attribute (dest, attr); g_object_unref (dest); email_attrs = g_list_append (email_attrs, attr); } } e_contact_set_attributes (contact, E_CONTACT_EMAIL, email_attrs); g_list_foreach (email, (GFunc) g_free, NULL); g_list_free (email); g_list_foreach (email_attrs, (GFunc) e_vcard_attribute_free, NULL); g_list_free (email_attrs); }
/* Fills the widgets from mail alarm data */ static void alarm_to_malarm_widgets (Dialog *dialog, ECalComponentAlarm *alarm) { ENameSelectorModel *name_selector_model; EDestinationStore *destination_store; ECalComponentText description; GtkTextBuffer *text_buffer; GSList *attendee_list, *l; gint len; /* Attendees */ name_selector_model = e_name_selector_peek_model (dialog->name_selector); e_name_selector_model_peek_section (name_selector_model, section_name, NULL, &destination_store); e_cal_component_alarm_get_attendee_list (alarm, &attendee_list); len = g_slist_length (attendee_list); if (len > 0) { for (l = attendee_list; l; l = g_slist_next (l)) { ECalComponentAttendee *a = l->data; EDestination *dest; dest = e_destination_new (); if (a->cn != NULL && *a->cn) e_destination_set_name (dest, a->cn); if (a->value != NULL && *a->value) { if (!strncasecmp (a->value, "MAILTO:", 7)) e_destination_set_email (dest, a->value + 7); else e_destination_set_email (dest, a->value); } e_destination_store_append_destination (destination_store, dest); g_object_unref (G_OBJECT (dest)); } e_cal_component_free_attendee_list (attendee_list); } /* Description */ e_cal_component_alarm_get_description (alarm, &description); if (description.value) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->malarm_message), TRUE); text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dialog->malarm_description)); gtk_text_buffer_set_text (text_buffer, description.value, -1); } }
static void action_contact_send_message_cb (GtkAction *action, EBookShellView *book_shell_view) { EShell *shell; EShellView *shell_view; EShellWindow *shell_window; EBookShellContent *book_shell_content; EAddressbookView *view; GSList *list, *iter; shell_view = E_SHELL_VIEW (book_shell_view); shell_window = e_shell_view_get_shell_window (shell_view); shell = e_shell_window_get_shell (shell_window); book_shell_content = book_shell_view->priv->book_shell_content; view = e_book_shell_content_get_current_view (book_shell_content); g_return_if_fail (view != NULL); list = e_addressbook_view_get_selected (view); g_return_if_fail (list != NULL); /* Convert the list of contacts to a list of destinations. */ for (iter = list; iter != NULL; iter = iter->next) { EContact *contact = iter->data; EDestination *destination; destination = e_destination_new (); e_destination_set_contact (destination, contact, 0); g_object_unref (contact); iter->data = destination; } eab_send_as_to (shell, list); e_client_util_free_object_slist (list); }
void e_select_names_editable_set_address (ESelectNamesEditable *esne, const gchar *name, const gchar *email) { EDestinationStore *destination_store; GList *destinations; EDestination *destination; 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) destination = e_destination_new (); else destination = g_object_ref (destinations->data); 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); }
static void import_contact (EBookClient *book_client, gchar *line) { gchar **strings, *addr, **addrs; gint i; GList *list; /*EContactName *name;*/ EContact *card; gsize len; GError *error = NULL; card = e_contact_new (); strings = g_strsplit (line, "\t", 5); if (strings[0] && strings[1] && strings[2]) { gchar *new_uid = NULL; e_contact_set (card, E_CONTACT_NICKNAME, strings[0]); e_contact_set (card, E_CONTACT_FULL_NAME, strings[1]); addr = strings[2]; len = strlen (addr); if (addr[0] == '(' && addr[len - 1] == ')') { addr[0] = 0; addr[len - 1] = 0; addrs = g_strsplit (addr + 1, ",", 0); list = NULL; /* XXX So ... this api is just insane ... we set * plain strings as the contact email if it * is a normal contact, but need to do this * XML crap for mailing lists. */ for (i = 0; addrs[i]; i++) { EDestination *d; EVCardAttribute *attr; d = e_destination_new (); e_destination_set_email (d, addrs[i]); attr = e_vcard_attribute_new (NULL, EVC_EMAIL); e_destination_export_to_vcard_attribute (d, attr); list = g_list_append (list, attr); g_object_unref (d); } e_contact_set_attributes (card, E_CONTACT_EMAIL, list); g_list_foreach (list, (GFunc) e_vcard_attribute_free, NULL); g_list_free (list); g_strfreev (addrs); e_contact_set (card, E_CONTACT_IS_LIST, GINT_TO_POINTER (TRUE)); } else { e_contact_set (card, E_CONTACT_EMAIL_1, strings[2]); } /*name = e_contact_name_from_string(strings[1]);*/ if (strings[3] && strings[4]) e_contact_set (card, E_CONTACT_NOTE, strings[4]); e_book_client_add_contact_sync ( book_client, card, &new_uid, NULL, &error); if (error != NULL) { g_warning ( "%s: Failed to add contact: %s", G_STRFUNC, error->message); g_error_free (error); } else { g_free (new_uid); } g_object_unref (card); } g_strfreev (strings); }