GList * e_select_names_editable_get_names (ESelectNamesEditable *esne) { EDestinationStore *destination_store; GList *destinations; EDestination *destination; GList *result = NULL; g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL); 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_name (l->data))); } } else { result = g_list_append (result, g_strdup (e_destination_get_name (destination))); } g_list_free (destinations); return result; }
void eab_send_as_to (EShell *shell, GSList *destinations) { GPtrArray *to_array; GPtrArray *bcc_array; CreateComposerData *ccd; g_return_if_fail (E_IS_SHELL (shell)); if (destinations == NULL) return; to_array = g_ptr_array_new (); bcc_array = g_ptr_array_new (); /* Sort contacts into "To" and "Bcc" destinations. */ while (destinations != NULL) { EDestination *destination = destinations->data; if (e_destination_is_evolution_list (destination)) { if (e_destination_list_show_addresses (destination)) g_ptr_array_add (to_array, e_destination_copy (destination)); else g_ptr_array_add (bcc_array, e_destination_copy (destination)); } else g_ptr_array_add (to_array, e_destination_copy (destination)); destinations = g_slist_next (destinations); } /* Add sentinels to each array. */ g_ptr_array_add (to_array, NULL); g_ptr_array_add (bcc_array, NULL); ccd = g_new0 (CreateComposerData, 1); ccd->to_destinations = (EDestination **) g_ptr_array_free (to_array, FALSE); ccd->bcc_destinations = (EDestination **) g_ptr_array_free (bcc_array, FALSE); ccd->attachment_destinations = NULL; e_msg_composer_new (shell, eab_composer_created_cb, ccd); }
GList * e_select_names_editable_get_emails (ESelectNamesEditable *esne) { EDestinationStore *destination_store; GList *destinations; EDestination *destination; GList *result = NULL; g_return_val_if_fail (E_SELECT_NAMES_EDITABLE (esne), NULL); 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 { /* check if the contact is contact list, it does not contain all the email ids */ /* we dont expand it currently, TODO do we need to expand it by getting it from addressbook*/ if (e_destination_get_contact (destination) && e_contact_get (e_destination_get_contact (destination), E_CONTACT_IS_LIST)) { /* If its a contact_list which is not expanded, it wont have a email id, so we can use the name as the email id */ result = g_list_append (result, g_strdup (e_destination_get_name (destination))); } else result = g_list_append (result, g_strdup (e_destination_get_email (destination))); } g_list_free (destinations); return result; }
static void render_contact_list_row (EABContactFormatter *formatter, EDestination *destination, GString *buffer) { gchar *evolution_imagesdir; gboolean list_collapsed = FALSE; const gchar *textrep; gchar *name = NULL, *email_addr = NULL; evolution_imagesdir = g_filename_to_uri (EVOLUTION_IMAGESDIR, NULL, NULL); textrep = e_destination_get_textrep (destination, TRUE); if (!eab_parse_qp_email (textrep, &name, &email_addr)) email_addr = g_strdup (textrep); g_string_append (buffer, "<tr>"); if (e_destination_is_evolution_list (destination)) { g_string_append_printf ( buffer, "<td width=" IMAGE_COL_WIDTH " valign=\"top\" align=\"left\">" "<img src=\"evo-file://%s/minus.png\" " "id=\"%s\" " "class=\"navigable _evo_collapse_button\">" "</td><td width=\"100%%\" align=\"left\">%s", evolution_imagesdir, e_destination_get_contact_uid (destination), name ? name : email_addr); if (!list_collapsed) { const GList *dest, *dests; g_string_append_printf ( buffer, "<br><table cellspacing=\"1\" id=\"list-%s\">", e_destination_get_contact_uid (destination)); dests = e_destination_list_get_root_dests (destination); 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>"); } else { if (name && *name) { g_string_append_printf ( buffer, "<td colspan=\"2\">%s <" "<a href=\"mailto:%s\">%s</a>>" "</td>", name, email_addr, email_addr); } else { g_string_append_printf ( buffer, "<td colspan=\"2\">" "<a href=\"mailto:%s\">%s</a>" "</td>", email_addr, email_addr); } } g_string_append (buffer, "</tr>"); g_free (evolution_imagesdir); g_free (name); g_free (email_addr); }
void eab_send_as_to (EShell *shell, GSList *destinations) { EMsgComposer *composer; EComposerHeaderTable *table; GPtrArray *to_array; GPtrArray *bcc_array; union { gpointer *pdata; EDestination **destinations; } convert; g_return_if_fail (E_IS_SHELL (shell)); if (destinations == NULL) return; composer = e_msg_composer_new (shell); table = e_msg_composer_get_header_table (composer); to_array = g_ptr_array_new (); bcc_array = g_ptr_array_new (); /* Sort contacts into "To" and "Bcc" destinations. */ while (destinations != NULL) { EDestination *destination = destinations->data; if (e_destination_is_evolution_list (destination)) { if (e_destination_list_show_addresses (destination)) g_ptr_array_add (to_array, destination); else g_ptr_array_add (bcc_array, destination); } else g_ptr_array_add (to_array, destination); destinations = g_slist_next (destinations); } /* Add sentinels to each array. */ g_ptr_array_add (to_array, NULL); g_ptr_array_add (bcc_array, NULL); /* XXX Acrobatics like this make me question whether NULL-terminated * arrays are really the best argument type for passing a list of * destinations to the header table. */ /* Set "To" destinations. */ convert.pdata = to_array->pdata; e_composer_header_table_set_destinations_to ( table, convert.destinations); g_ptr_array_free (to_array, FALSE); /* Add "Bcc" destinations. */ convert.pdata = bcc_array->pdata; e_composer_header_table_add_destinations_bcc ( table, convert.destinations); g_ptr_array_free (bcc_array, FALSE); gtk_widget_show (GTK_WIDGET (composer)); }
static void render_contact_list_row (EABContactFormatter *formatter, EDestination *destination, GString *buffer) { gboolean list_collapsed = FALSE; const gchar *textrep; gchar *name = NULL, *email_addr = NULL; textrep = e_destination_get_textrep (destination, TRUE); if (!eab_parse_qp_email (textrep, &name, &email_addr)) email_addr = g_strdup (textrep); g_string_append (buffer, "<tr>"); if (e_destination_is_evolution_list (destination)) { g_string_append_printf ( buffer, "<td width=" IMAGE_COL_WIDTH " valign=\"top\" align=\"left\">" "<button type=\"button\" id=\"%s\" class=\"header-collapse _evo_collapse_button\" style=\"display: inline-block;\">" "<img src=\"gtk-stock://pan-down-symbolic\" />" "</button>" "</td><td width=\"100%%\" align=\"left\">%s", e_destination_get_contact_uid (destination), name ? name : email_addr); if (!list_collapsed) { const GList *dest, *dests; g_string_append_printf ( buffer, "<br><table cellspacing=\"1\" id=\"list-%s\">", e_destination_get_contact_uid (destination)); dests = e_destination_list_get_root_dests (destination); 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>"); } else { if (name && *name) { g_string_append_printf ( buffer, "<td colspan=\"2\">%s <" "<a href=\"mailto:%s\">%s</a>>" "</td>", name, email_addr, email_addr); } else { g_string_append_printf ( buffer, "<td colspan=\"2\">" "<a href=\"mailto:%s\">%s</a>" "</td>", email_addr, email_addr); } } g_string_append (buffer, "</tr>"); g_free (name); g_free (email_addr); }