From 4873d50a914ad0c3041010195808f3e596e8ba0f Mon Sep 17 00:00:00 2001 From: nobody Date: Sat, 17 Jun 2000 21:00:40 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'gnome-debug-0-1-3'. svn path=/tags/gnome-debug-0-1-3/; revision=3621 --- mail/.cvsignore | 13 - mail/ChangeLog | 1449 ------------------------ mail/GNOME_Evolution_Mail.oaf.in | 54 - mail/GNOME_Evolution_Mail.oafinfo | 54 - mail/Mail.idl | 30 - mail/Makefile.am | 109 -- mail/component-factory.c | 252 ----- mail/component-factory.h | 29 - mail/e-attchmt.png | Bin 169 -> 0 bytes mail/evolution-mail.gnorba | 23 - mail/evolution-mail.oafinfo | 54 - mail/folder-browser-factory.c | 196 ---- mail/folder-browser.c | 397 ------- mail/folder-browser.h | 66 -- mail/mail-config.c | 2117 ------------------------------------ mail/mail-display.c | 441 -------- mail/mail-display.h | 49 - mail/mail-format.c | 1461 ------------------------- mail/mail-identify.c | 80 -- mail/mail-ops.c | 649 ----------- mail/mail-sources.c | 771 ------------- mail/mail-types.h | 39 - mail/mail.h | 68 -- mail/main.c | 83 -- mail/message-list.c | 1006 ----------------- mail/message-list.h | 94 -- mail/pixmaps.h | 14 - mail/pixmaps/attachment-header.xpm | 22 - mail/pixmaps/attachment.xpm | 21 - mail/pixmaps/empty.xpm | 21 - mail/pixmaps/envelope-closed.xpm | 65 -- mail/pixmaps/envelope-deleted.xpm | 54 - mail/pixmaps/envelope-opened.xpm | 74 -- mail/pixmaps/message-status.xpm | 22 - mail/pixmaps/online-status.xpm | 23 - mail/session.c | 112 -- mail/test-mail.c | 103 -- 37 files changed, 10115 deletions(-) delete mode 100644 mail/.cvsignore delete mode 100644 mail/ChangeLog delete mode 100644 mail/GNOME_Evolution_Mail.oaf.in delete mode 100644 mail/GNOME_Evolution_Mail.oafinfo delete mode 100644 mail/Mail.idl delete mode 100644 mail/Makefile.am delete mode 100644 mail/component-factory.c delete mode 100644 mail/component-factory.h delete mode 100644 mail/e-attchmt.png delete mode 100644 mail/evolution-mail.gnorba delete mode 100644 mail/evolution-mail.oafinfo delete mode 100644 mail/folder-browser-factory.c delete mode 100644 mail/folder-browser.c delete mode 100644 mail/folder-browser.h delete mode 100644 mail/mail-config.c delete mode 100644 mail/mail-display.c delete mode 100644 mail/mail-display.h delete mode 100644 mail/mail-format.c delete mode 100644 mail/mail-identify.c delete mode 100644 mail/mail-ops.c delete mode 100644 mail/mail-sources.c delete mode 100644 mail/mail-types.h delete mode 100644 mail/mail.h delete mode 100644 mail/main.c delete mode 100644 mail/message-list.c delete mode 100644 mail/message-list.h delete mode 100644 mail/pixmaps.h delete mode 100644 mail/pixmaps/attachment-header.xpm delete mode 100644 mail/pixmaps/attachment.xpm delete mode 100644 mail/pixmaps/empty.xpm delete mode 100644 mail/pixmaps/envelope-closed.xpm delete mode 100644 mail/pixmaps/envelope-deleted.xpm delete mode 100644 mail/pixmaps/envelope-opened.xpm delete mode 100644 mail/pixmaps/message-status.xpm delete mode 100644 mail/pixmaps/online-status.xpm delete mode 100644 mail/session.c delete mode 100644 mail/test-mail.c (limited to 'mail') diff --git a/mail/.cvsignore b/mail/.cvsignore deleted file mode 100644 index 898d2ab6fc..0000000000 --- a/mail/.cvsignore +++ /dev/null @@ -1,13 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -Mail-stubs.c -Mail-skels.c -Mail-common.c -Mail.h -evolution-mail -evolution-mail.pure -test-mail -test-sources diff --git a/mail/ChangeLog b/mail/ChangeLog deleted file mode 100644 index 9d87b56f9d..0000000000 --- a/mail/ChangeLog +++ /dev/null @@ -1,1449 +0,0 @@ -2000-06-17 Dan Winship - - * message-list.c (message_list_set_folder): Prevent double-freeing - action on summary_table and uid_rowmap. - -2000-06-16 Dan Winship - - * message-list.c (ml_set_value_at): Implement clicking on the - envelope icon to set read/unread. Based on a patch by clahey. - (select_msg): keep the timeout id for the "seen" flagging in the - message_list structure, so ml_set_value_at can clear it so it - doesn't re-mark a message seen after you click it unseen. - -2000-06-16 Dan Winship - - * message-list.c (get_message_row): new function to do a uid to - row mapping. - (mark_msg_seen, select_msg, message_changed, - message_list_set_folder): Update for Camel flag changes. - (on_cursor_change_cmd): Rename "row_to_select" to "selected_row", - and keep a "selected_uid" as well. - - * mail-ops.c (composer_send_cb): Update for Camel flag changes, - and fix some memory-handling bugs. (Free the post_send_data when - the composer is destroyed, not when the user clicks "send", which - could happen never, or more than once.) - (delete_msg): Update for Camel flag changes, and fix the "holding - down the delete key skips some messages" bug. - -2000-06-15 Dan Winship - - * mail-ops.c (fetch_mail): - * component-factory.c (owner_unset_cb): - * message-list.c (message_list_set_folder): Update for CamelFolder - changes. - - * folder-browser.c (folder_browser_clear_search): New function to - revert back to non-searching mode. - - * mail-ops.c (fetch_mail): Use folder_browser_clear_search. - - * mail-display.c (on_url_requested): if the document requests an - unknown URL, it's not an error; just ignore the URL. - - * mail-ops.c (fetch_mail): If there's no new mail, tell the user. - -2000-06-14 Radek Doulik - - * main.c (main): call gtkhtmllib_init here - -2000-06-13 Jeffrey Stedfast - - * mail-config.c (on_SourceConfigDialogButton_clicked): Make sure source - is always pointing to something, so a blank is not written to the config file - on close. - -2000-06-13 Ettore Perazzoli - - * Makefile.am (SHELL_OBJS): Removed. - (evolution_mail_LDADD): Use `libeshell.a'. Also use - `top_builddir' consistently. - -2000-06-12 Jeffrey Stedfast - - * mail-config.c: Got rid of sources_max_row and identities_max_row - as they are not really needed (just use clist->rows) - (on_cmdSourcesEdit_clicked): Modified to make 'source' - point to the data being edited. - (on_cmdSourcesAdd_clicked): Adds a new clist item and selects it so the - editor knows where to stick the data when it's done. - -2000-06-12 Federico Mena Quintero - - * message-list.c: Removed the ETableModel thaw handler. - -2000-06-12 Dan Winship - - * folder-browser.c (folder_browser_set_uri): Return the result of - folder_browser_load_folder. - (get_prop, set_prop, folder_browser_properties_init): Remove. No - longer needed. - - * folder-browser-factory.c (folder_browser_factory_new_control): - Add a "uri" argument, return NULL if setting it fails. - (folder_browser_factory_new_control): Remove property bag stuff. - (folder_browser_factory_init, folder_browser_factory): Remove - this, since we're using the component factory now. - - * component-factory.c (create_view): Update for - folder_browser_factory_new_control change and return NOTFOUND as - appropriate. - - * main.c (main): Don't call folder_browser_factory_init. - - * mail-format.c (mail_generate_reply): Fix the subject generation - so we don't get "Re: Re:". This is working around something that - may later be declared a misfeature in Camel. - -2000-06-10 Ettore Perazzoli - - * component-factory.c (create_folder): New stub implementation for - the folder creation function in the EvolutionShellComponent we - expose [it simply returns success all the time]. - (factory_fn): Pass this function to `evolution_shell_component_new'. - -2000-06-09 Dan Winship - - * folder-browser.c (folder_browser_new): Add a serial number to - FolderBrowser. - - * folder-browser-factory.c (control_activate, control_deactivate): - Include fb serial number in the name of the Bonobo toolbar to - prevent problems with disappearing toolbars. This is a kludge and - should go away. - - - * mail-ops.c (expunge_folder): display error from - camel_folder_expunge if there is one. - - * message-list.c (select_row): install an idle function to - select the row rather than doing it directly. Ugh. What a - kludge, but at least it works now. - - * session.c (evolution_auth_callback): Update for - CamelAuthCallback changes. (Uncache passwords when asked to.) - - * mail-ops.c (fetch_mail): close and expunge the source folder - after copying it to a local folder. - -2000-06-09 Ettore Perazzoli - - * component-factory.c (create_view): Updated to match the changes - to the definition of `EvolutionShellComponentCreateFn'. If @type - is not "mail", return an "unsupported type" error. - (factory_fn): Pass NULL for the `remove_folder' and - `create_folder' functions. - -2000-06-09 Dan Winship - - * mail-format.c: Redo things a bit so that whitespace-only - text parts aren't displayed. (In particular, so that - whitespace-only subparts of multipart/mixed aren't displayed as - separate (empty) parts.) - -2000-06-06 Dan Winship - - * mail-ops.c (fetch_mail): - * folder-browser.c (folder_browser_load_folder): Update for folder - creation/existence changes. - - * message-list.c (message_list_set_folder): Remove the code to - create the folder if it doesn't exist, since we don't want to do - that. - -2000-06-05 Dan Winship - - * mail-ops.c (composer_send_cb): Leave the composer window around - if the message doesn't get sent. - -2000-06-05 Matt Loper - - * folder-browser.c (etable_key): Allow "GDK_KP_Delete", a keypad - delete key, to delete a message. - -2000-06-05 Dan Winship - - * session.c (evolution_auth_callback): Remember passwords between - calls. - (forget_passwords): Callback for "Forget Passwords" menu item. - - * folder-browser-factory.c (control_activate): - (control_deactivate): Add "Forget Passwords" menu item. - - * mail.h, mail-ops.c: fix some function prototypes - - * folder-browser.c (etable_key): Add "Delete" = delete message. - - * mail-format.c (mail_generate_forward): Update for new composer - attachment interface. - -2000-06-02 Jeffrey Stedfast - - * mail-config.c (providers_config_new): Added a new notebook - page that allowed for mail format (text/plain or - multipart/alternative) - -2000-06-02 Dan Winship - - * message-list.c (filter_date): If the date in the summary is 0, - output "?". - - * component-factory.c (create_view): keep a GList of folder - browsers created - (owner_unset_cb): Go through the list and close each folder before - exiting so they sync their summary state, etc to disk. - - * mail-ops.c (fetch_mail): Use camel_service_connect, not - connect_with_url, since we already passed the URL into - camel_session_get_store. - -2000-06-02 Christopher James Lahey - - * message-list.c: Use camel_folder_free_summary instead of - g_ptr_array_free. Unref the folder when we're done with it. - -2000-06-02 Christopher James Lahey - - * session.c: Revert removal of e_setup_base_dir. - -2000-06-02 Dan Winship - - * folder-browser.c (my_folder_browser_init): Connect to ETable's - key_press signal. - (etable_key): scroll mail on space/backspace. - -2000-06-02 Christopher James Lahey - - * message-list.c: Made sent column as wide as from column. - -2000-06-02 Jeffrey Stedfast - - * mail-config.c (on_cmdSourcesAdd_clicked): Changed identity_row - to source_row as this is a Sources clist we are dealing with and - not an identity clist - (on_cmdSourcesEdit_clicked): same - (on_cmdSourcesDelete_clicked): again, same - (on_cmdSourcesEdit_clicked): Source editor now fills in data from - the clist - -2000-06-01 Dan Winship - - * message-list.c: Add a date column. - (COL_SENT_WIDTH_MIN): Make this wider. - (ml_value_at): return the sent date (as a time_t) for COL_SENT. - (Fix COL_TO too while I'm here.) - (ml_duplicate_value, ml_free_value, ml_initialize_value, - ml_value_is_empty): COL_SENT is numeric now. - (message_list_init_renderers): Create a date renderer (using - text_filter to translate the time_t into a string). - (message_list_init_header): Use render_date for COL_SENT. - -2000-06-01 Christopher James Lahey - - * session.c: Don't call e_setup_base_dir. - -2000-06-01 Dan Winship - - * mail-format.c (mail_generate_forward): Fix forwarding to work - for people other than me. :) [Although apparently it doesn't - really.] - - * mail-ops.c (delete_msg): Add a quick hack to move the selection - down a row when you delete a message. - - * mail-format.c (handle_message_rfc822): use
rather - than
to frame the embedded - message. If
 text in the subtable won't fit in the 95% width,
-	GtkHTML will write past the border of the table (and
-	
causes creeping updates so it's not - usable for now). - -2000-06-01 Christopher James Lahey - - * message-list.c (message_list_init): Turn off the grid in our - ETable. - -2000-06-01 Dan Winship - - * mail-format.c (write_headers): Oops. This needs to take a - message argument because we might be writing headers for an - embedded message/rfc822 subpart rather than the root document. - -2000-06-01 Jeffrey Stedfast - - * mail-config.c: Config dialogs are completed. - (service_acceptable): Fixed a segfault caused by duplicate - camel_exception_free() - (providers_config_new): Identity and Source clists are now filled in - when the dialog is created as well as the Transport page - - * folder-browser-factory.c: Renamed Tool/ menu items - Vfolder was changed to Virtual Folder and - Configure Camel Providers was changed to Mail Configuration - -2000-06-01 Ettore Perazzoli - - * Makefile.am (evolution_mail_LDADD): Link with - `libemiscwidgets.a'. - - * mail-display.c (mail_display_new): Use an EScrollFrame instead - of a GtkScrolledWindow. - (mail_display_set_message): Likewise. - - * mail-display.h: Replace the GtkScrolledWindow with an - EScrollFrame. - -2000-06-01 Dan Winship - - * component-factory.c (owner_unset_cb): Quit when the shell exits. - This is a kludge, but a pretty necessary one until the refcounting - bugs that keep the component from exiting properly are fixed. - -2000-05-31 Jeffrey Stedfast - - * mail-config.c: Partially implemented the source - configuration, seems to segfault due to a destroyed - gnome dialog being destroyed again in the method - on_SourceConfigDialogButton_clicked() - -2000-05-31 Dan Winship - - * mail-format.c (free_url, handle_text_enriched, - get_url_for_icon): Fix up memory management of x-evolution-data - URLs so the URLs and/or their data don't get freed while there are - still references to them. - - * message-list.c (message_list_init_header): redo the (unused) - online status column to no longer refer to pixmaps that no longer - exist. - -2000-06-01 Ettore Perazzoli - - * folder-browser-factory.c (control_activate): Put the toolbar - into a frame to make it look like standard GNOME toolbars. Also, - set `GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL' so that it does not do - evil things when its moved to the left or the right of the window. - -2000-05-31 Jeffrey Stedfast - - * mail-config.c: Configuration dialog now allows - adding/editing/deleting of Identities (which leaves - adding/editing/deleting of sources left to implement). - The data is also saved when the dialog is exited via - the OK button. - -2000-05-31 Dan Winship - - * mail-format.c (mail_format_mime_message): Initialize the "urls" - hash table stored on the message and store cid and other URLs - there rather than as object data on the message. - (get_cid): rewrite this a bunch - (handle_text_enriched): move the code from write_iframe_string() - into here, since it's the only place that actually needs it. - (handle_text_html): simplify this a lot. We can use a cid: URL - here rather than x-evolution-data. - (get_url_for_icon): New routine to return URLs for icons, and - cache the results, so we don't have to keep re-reading the icon - files (and so we can't be spoofed into reading non-icon files). - (handle_mystery, handle_audio): use get_url_for_icon. - - * mail-display.c (save_data): move the CamelMimePart filename - extracting code from get_cid to here. - (on_link_clicked, on_object_requested): Update for cid: changes. - (on_url_requested): Kill off the kludgy, exploitable x-gnome-icon - URL schema, update cid and x-evolution-data to match - mail-format.c. - - It should now be easier to implement RFC 2557 (Content-Location, - etc), but that RFC still pretty much sucks. - -2000-05-30 Dan Winship - - * mail-format.c: Redo this back to the old way: a single GtkHTML - with various things inline in it. (Gets rid of flicker, simplifies - some scrolling, selecting, and printing issues.) - (handle_text_enriched, handle_text_html): Use ", xed); - - return TRUE; -} - -static gboolean -handle_text_html (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - mail_html_write (mfd->html, mfd->stream, "\n\n"); - mail_html_write (mfd->html, mfd->stream, - "", get_cid (part, mfd)); - return TRUE; -} - -static gboolean -handle_image (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - mail_html_write (mfd->html, mfd->stream, "", - get_cid (part, mfd)); - return TRUE; -} - -static gboolean -handle_multipart_mixed (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *mp; - int i, nparts; - gboolean output = FALSE; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - mp = CAMEL_MULTIPART (wrapper); - - nparts = camel_multipart_get_number (mp); - for (i = 0; i < nparts; i++) { - if (i != 0 && output) - mail_html_write (mfd->html, mfd->stream, "
\n"); - - part = camel_multipart_get_part (mp, i); - - output = call_handler_function (part, mfd); - } - - return TRUE; -} - -/* As seen in RFC 2387! */ -static gboolean -handle_multipart_related (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *mp; - CamelMimePart *body_part, *display_part = NULL; - GMimeContentField *content_type; - const char *start; - int i, nparts; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - mp = CAMEL_MULTIPART (wrapper); - nparts = camel_multipart_get_number (mp); - - content_type = camel_mime_part_get_content_type (part); - start = gmime_content_field_get_parameter (content_type, "start"); - if (start) { - int len; - - /* The "start" parameter includes <>s, which Content-Id - * does not. - */ - len = strlen (start) - 2; - - for (i = 0; i < nparts; i++) { - const char *cid; - - body_part = camel_multipart_get_part (mp, i); - cid = camel_mime_part_get_content_id (body_part); - - if (!strncmp (cid, start + 1, len) && - strlen (cid) == len) { - display_part = body_part; - break; - } - } - - if (!display_part) { - /* Oops. Hrmph. */ - return handle_multipart_mixed (part, mime_type, mfd); - } - } else { - /* No start parameter, so it defaults to the first part. */ - display_part = camel_multipart_get_part (mp, 0); - } - - /* Record the Content-IDs of any non-displayed parts. */ - for (i = 0; i < nparts; i++) { - body_part = camel_multipart_get_part (mp, i); - if (body_part == display_part) - continue; - - get_cid (body_part, mfd); - } - - /* Now, display the displayed part. */ - return call_handler_function (display_part, mfd); -} - -/* RFC 2046 says "display the last part that you are able to display". */ -static CamelMimePart * -find_preferred_alternative (CamelMultipart *multipart) -{ - int i, nparts; - CamelMimePart *preferred_part = NULL; - gboolean generic; - - nparts = camel_multipart_get_number (multipart); - for (i = 0; i < nparts; i++) { - CamelMimePart *part = camel_multipart_get_part (multipart, i); - char *mime_type = gmime_content_field_get_mime_type ( - camel_mime_part_get_content_type (part)); - - g_strdown (mime_type); - if (lookup_handler (mime_type, &generic) && - (!preferred_part || !generic)) - preferred_part = part; - g_free (mime_type); - } - - return preferred_part; -} - -static gboolean -handle_multipart_alternative (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *multipart; - CamelMimePart *mime_part; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - multipart = CAMEL_MULTIPART (wrapper); - - mime_part = find_preferred_alternative (multipart); - if (mime_part) - return call_handler_function (mime_part, mfd); - else - return handle_unknown_type (part, mime_type, mfd); -} - -/* RFC 1740 */ -static gboolean -handle_multipart_appledouble (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - CamelMultipart *multipart; - - g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE); - multipart = CAMEL_MULTIPART (wrapper); - - /* The first part is application/applefile and is not useful - * to us. The second part _may_ be displayable data. Most - * likely it's application/octet-stream though. - */ - part = camel_multipart_get_part (multipart, 1); - return call_handler_function (part, mfd); -} - -static const char * -get_url_for_icon (const char *icon_name, struct mail_format_data *mfd) -{ - static GHashTable *icons; - char *icon_path = gnome_pixmap_file (icon_name), buf[1024], *url; - GByteArray *ba; - - if (!icons) - icons = g_hash_table_new (g_str_hash, g_str_equal); - - if (!icon_path) - return "file:///dev/null"; - - ba = g_hash_table_lookup (icons, icon_path); - if (!ba) { - int fd, nread; - - fd = open (icon_path, O_RDONLY); - if (fd == -1) { - g_free (icon_path); - return "file:///dev/null"; - } - - ba = g_byte_array_new (); - - while (1) { - nread = read (fd, buf, sizeof (buf)); - if (nread < 1) - break; - g_byte_array_append (ba, buf, nread); - } - close (fd); - - g_hash_table_insert (icons, icon_path, ba); - } - g_free (icon_path); - - url = g_strdup_printf ("x-evolution-data:%p", ba); - g_hash_table_insert (mfd->urls, url, ba); - - return url; -} - -static void -handle_mystery (CamelMimePart *part, struct mail_format_data *mfd, - const char *url, const char *icon_name, const char *id, - const char *action) -{ - const char *info; - char *htmlinfo; - GMimeContentField *content_type; - - mail_html_write (mfd->html, mfd->stream, "
"); - - /* Draw the icon, surrounded by an if we have a URL, - * or a plain inactive border if not. - */ - if (url) { - mail_html_write (mfd->html, mfd->stream, - "", url); - } else { - mail_html_write (mfd->html, mfd->stream, - "
"); - } - mail_html_write (mfd->html, mfd->stream, "", - get_url_for_icon (icon_name, mfd)); - - if (url) - mail_html_write (mfd->html, mfd->stream, ""); - else - mail_html_write (mfd->html, mfd->stream, "
"); - mail_html_write (mfd->html, mfd->stream, "
%s
", id); - - /* Write a description, if we have one. */ - info = camel_mime_part_get_description (part); - if (info) { - htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS); - mail_html_write (mfd->html, mfd->stream, "Description: %s
", - htmlinfo); - g_free (htmlinfo); - } - - /* Write the name, if we have it. */ - content_type = camel_mime_part_get_content_type (part); - info = gmime_content_field_get_parameter (content_type, "name"); - if (!info) - info = camel_mime_part_get_filename (part); - if (info) { - htmlinfo = e_text_to_html (info, 0); - mail_html_write (mfd->html, mfd->stream, "Name: %s
", - htmlinfo); - g_free (htmlinfo); - } - - /* Describe the click action, if any. */ - if (action) { - mail_html_write (mfd->html, mfd->stream, - "
Click on the icon to %s.", action); - } - - mail_html_write (mfd->html, mfd->stream, "
"); -} - -static gboolean -handle_audio (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - char *id; - const char *desc; - - desc = gnome_mime_get_value (mime_type, "description"); - if (desc) - id = g_strdup_printf ("%s data", desc); - else { - id = g_strdup_printf ("Audio data in \"%s\" format.", - mime_type); - } - handle_mystery (part, mfd, get_cid (part, mfd), "gnome-audio2.png", - id, "play it"); - g_free (id); - - return TRUE; -} - -static gboolean -handle_message_rfc822 (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - CamelDataWrapper *wrapper = - camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE); - - mail_html_write (mfd->html, mfd->stream, "
"); - mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), - mfd->html, mfd->stream, mfd->root); - mail_html_write (mfd->html, mfd->stream, "
"); - - return TRUE; -} - -static gboolean -handle_message_external_body (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - GMimeContentField *type; - const char *access_type; - char *url = NULL, *desc = NULL; - - type = camel_mime_part_get_content_type (part); - access_type = gmime_content_field_get_parameter (type, "access-type"); - if (!access_type) - goto fallback; - - if (!g_strcasecmp (access_type, "ftp") || - !g_strcasecmp (access_type, "anon-ftp")) { - const char *name, *site, *dir, *mode, *ftype; - char *path; - - name = gmime_content_field_get_parameter (type, "name"); - site = gmime_content_field_get_parameter (type, "site"); - if (name == NULL || site == NULL) - goto fallback; - dir = gmime_content_field_get_parameter (type, "directory"); - mode = gmime_content_field_get_parameter (type, "mode"); - - /* Generate the path. */ - if (dir) { - const char *p = dir + strlen (dir); - - path = g_strdup_printf ("%s%s%s%s", - *dir == '/' ? "" : "/", - dir, - *p == '/' ? "" : "/", - name); - } else { - path = g_strdup_printf ("%s%s", - *name == '/' ? "" : "/", - name); - } - - if (mode && *mode == 'A') - ftype = ";type=A"; - else if (mode && *mode == 'I') - ftype = ";type=I"; - else - ftype = ""; - - url = g_strdup_printf ("ftp://%s%s%s", site, path, ftype); - g_free (path); - desc = g_strdup_printf ("Pointer to FTP site (%s)", url); - } else if (!g_strcasecmp (access_type, "local-file")) { - const char *name, *site; - - name = gmime_content_field_get_parameter (type, "name"); - if (name == NULL) - goto fallback; - site = gmime_content_field_get_parameter (type, "site"); - - url = g_strdup_printf ("file://%s%s", *name == '/' ? "" : "/", - name); - desc = g_strdup_printf ("Pointer to local file (%s)%s%s%s", - name, site ? " valid at site \"" : "", - site ? site : "", site ? "\"" : ""); - } else if (!g_strcasecmp (access_type, "URL")) { - const char *urlparam; - char *s, *d; - - /* RFC 2017 */ - - urlparam = gmime_content_field_get_parameter (type, "url"); - if (urlparam == NULL) - goto fallback; - - /* For obscure MIMEy reasons, the URL may be split into - * multiple words, and needs to be rejoined. (The URL - * must have any real whitespace %-encoded, so we just - * get rid of all of it. - */ - url = g_strdup (urlparam); - s = d = url; - - while (*s) { - if (!isspace ((unsigned char)*s)) - *d++ = *s; - s++; - } - *d = *s; - - desc = g_strdup_printf ("Pointer to remote data (%s)", url); - } - - fallback: - if (!desc) { - if (access_type) { - desc = g_strdup_printf ("Pointer to unknown external " - "data (\"%s\" type)", - access_type); - } else - desc = g_strdup ("Malformed external-body part."); - } - - handle_mystery (part, mfd, url, "gnome-globe.png", desc, - url ? "open it in a browser" : NULL); - - g_free (desc); - g_free (url); - return TRUE; -} - -static gboolean -handle_undisplayable (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - const char *desc; - char *id; - - desc = gnome_mime_get_value (mime_type, "description"); - if (desc) - id = g_strdup (desc); - else - id = g_strdup_printf ("Data of type \"%s\".", mime_type); - handle_mystery (part, mfd, get_cid (part, mfd), "gnome-question.png", - id, "save it to disk"); - g_free (id); - - return TRUE; -} - -static gboolean -handle_unknown_type (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - char *type; - - /* Don't give up quite yet. */ - type = mail_identify_mime_part (part); - if (type) { - mime_handler_fn handler_function; - gboolean generic, output; - - handler_function = lookup_handler (type, &generic); - if (handler_function && - handler_function != handle_unknown_type) { - output = (*handler_function) (part, type, mfd); - g_free (type); - return output; - } - } else - type = g_strdup (mime_type); - - /* OK. Give up. */ - handle_undisplayable (part, type, mfd); - g_free (type); - - return TRUE; -} - -static gboolean -handle_via_bonobo (CamelMimePart *part, const char *mime_type, - struct mail_format_data *mfd) -{ - mail_html_write (mfd->html, mfd->stream, - "", - get_cid (part, mfd), mime_type); - - /* Call handle_undisplayable to output its HTML inside the - * ... . It will only be displayed if the - * object loading fails. - */ - handle_undisplayable (part, mime_type, mfd); - - mail_html_write (mfd->html, mfd->stream, ""); - - return TRUE; -} - -static char * -reply_body (CamelDataWrapper *data, gboolean *html) -{ - CamelMultipart *mp; - CamelMimePart *subpart; - int i, nparts; - char *subtext, *old; - const char *boundary, *disp; - char *text = NULL; - GMimeContentField *mime_type; - - /* We only include text, message, and multipart bodies. */ - mime_type = camel_data_wrapper_get_mime_type_field (data); - - /* FIXME: This is wrong. We don't want to include large - * images. But if we don't do it this way, we don't get - * the headers... - */ - if (g_strcasecmp (mime_type->type, "message") == 0) { - *html = FALSE; - return get_data_wrapper_text (data); - } - - if (g_strcasecmp (mime_type->type, "text") == 0) { - *html = !g_strcasecmp (mime_type->subtype, "html"); - return get_data_wrapper_text (data); - } - - /* If it's not message and it's not text, and it's not - * multipart, we don't want to deal with it. - */ - if (g_strcasecmp (mime_type->type, "multipart") != 0) - return NULL; - - mp = CAMEL_MULTIPART (data); - - if (g_strcasecmp (mime_type->subtype, "alternative") == 0) { - /* Pick our favorite alternative and reply to it. */ - - subpart = find_preferred_alternative (mp); - if (!subpart) - return NULL; - - data = camel_medium_get_content_object ( - CAMEL_MEDIUM (subpart)); - return reply_body (data, html); - } - - nparts = camel_multipart_get_number (mp); - - /* Otherwise, concatenate all the parts that we can. If we find - * an HTML part in there though, return just that: We don't want - * to deal with merging HTML and non-HTML parts. - */ - boundary = camel_multipart_get_boundary (mp); - for (i = 0; i < nparts; i++) { - subpart = camel_multipart_get_part (mp, i); - - disp = camel_mime_part_get_disposition (subpart); - if (disp && g_strcasecmp (disp, "inline") != 0) - continue; - - data = camel_medium_get_content_object ( - CAMEL_MEDIUM (subpart)); - subtext = reply_body (data, html); - if (!subtext) - continue; - if (*html) { - g_free (text); - return subtext; - } - - if (text) { - old = text; - text = g_strdup_printf ("%s\n--%s\n%s", text, - boundary, subtext); - g_free (subtext); - g_free (old); - } else - text = subtext; - } - - if (!text) - return NULL; - - return text; -} - -EMsgComposer * -mail_generate_reply (CamelMimeMessage *message, gboolean to_all) -{ - CamelDataWrapper *contents; - char *text, *subject; - EMsgComposer *composer; - gboolean html; - const char *repl_to, *message_id, *references; - GList *to, *cc; - - contents = camel_medium_get_content_object (CAMEL_MEDIUM (message)); - text = reply_body (contents, &html); - - composer = E_MSG_COMPOSER (e_msg_composer_new ()); - - /* Set the quoted reply text. */ - if (text) { - char *repl_text; - - if (html) { - repl_text = g_strdup_printf ("
\n%s\n" - "
\n", - text); - } else { - char *s, *d, *quoted_text; - int lines, len; - - /* Count the number of lines in the body. If - * the text ends with a \n, this will be one - * too high, but that's ok. Allocate enough - * space for the text and the "> "s. - */ - for (s = text, lines = 0; s; s = strchr (s + 1, '\n')) - lines++; - quoted_text = g_malloc (strlen (text) + lines * 2); - - s = text; - d = quoted_text; - - /* Copy text to quoted_text line by line, - * prepending "> ". - */ - while (1) { - len = strcspn (s, "\n"); - if (len == 0 && !*s) - break; - sprintf (d, "> %.*s\n", len, s); - s += len; - if (!*s++) - break; - d += len + 3; - } - - /* Now convert that to HTML. */ - repl_text = e_text_to_html (quoted_text, - E_TEXT_TO_HTML_PRE); - g_free (quoted_text); - } - e_msg_composer_set_body_text (composer, repl_text); - g_free (repl_text); - g_free (text); - } - - /* Set the recipients */ - repl_to = camel_mime_message_get_reply_to (message); - if (!repl_to) - repl_to = camel_mime_message_get_from (message); - to = g_list_append (NULL, (gpointer)repl_to); - - if (to_all) { - const CamelInternetAddress *recip; - const char *name, *addr; - char *fulladdr; - int i; - - recip = camel_mime_message_get_recipients (message, - CAMEL_RECIPIENT_TYPE_TO); - i = 0; - cc = NULL; - while (camel_internet_address_get (recip, i++, &name, &addr)) { - fulladdr = g_strdup_printf ("%s <%s>", name, addr); - cc = g_list_append (cc, fulladdr); - } - - recip = camel_mime_message_get_recipients (message, - CAMEL_RECIPIENT_TYPE_CC); - i = 0; - while (camel_internet_address_get (recip, i++, &name, &addr)) { - fulladdr = g_strdup_printf ("%s <%s>", name, addr); - cc = g_list_append (cc, fulladdr); - } - } else - cc = NULL; - - /* Set the subject of the new message. */ - subject = (char *)camel_mime_message_get_subject (message); - if (!subject) - subject = g_strdup (""); - else { - while (*subject == ' ') - subject++; - - if (!strncasecmp (subject, "Re: ", 4)) - subject = g_strdup (subject); - else - subject = g_strdup_printf ("Re: %s", subject); - } - - e_msg_composer_set_headers (composer, to, cc, NULL, subject); - g_list_free (to); - g_list_free (cc); - g_free (subject); - - /* Add In-Reply-To and References. */ - message_id = camel_medium_get_header (CAMEL_MEDIUM (message), - "Message-Id"); - references = camel_medium_get_header (CAMEL_MEDIUM (message), - "References"); - if (message_id) { - e_msg_composer_add_header (composer, "In-Reply-To", - message_id); - if (references) { - char *reply_refs; - reply_refs = g_strdup_printf ("%s %s", references, - message_id); - e_msg_composer_add_header (composer, "References", - reply_refs); - g_free (reply_refs); - } - } else if (references) - e_msg_composer_add_header (composer, "References", references); - - return composer; -} - -EMsgComposer * -mail_generate_forward (CamelMimeMessage *mime_message, - gboolean forward_as_attachment, - gboolean keep_attachments) -{ - EMsgComposer *composer; - CamelMimePart *part; - - if (!forward_as_attachment) - g_warning ("Forward as non-attachment not implemented."); - if (!keep_attachments) - g_warning ("Forwarding without attachments not implemented."); - - composer = E_MSG_COMPOSER (e_msg_composer_new ()); - - part = camel_mime_part_new (); - camel_mime_part_set_disposition (part, "inline"); - camel_mime_part_set_description (part, "forwarded message"); - camel_medium_set_content_object (CAMEL_MEDIUM (part), - CAMEL_DATA_WRAPPER (mime_message)); - camel_mime_part_set_content_type (part, "message/rfc822"); - - e_msg_composer_attach (composer, part); - gtk_object_unref (GTK_OBJECT (part)); - - /* FIXME: should we default a subject? */ - - return composer; -} diff --git a/mail/mail-identify.c b/mail/mail-identify.c deleted file mode 100644 index 8b8e61487d..0000000000 --- a/mail/mail-identify.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Author : - * Dan Winship - * - * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#include - -#include -#include - -#include -#include -#include "mail.h" - -/** - * mail_identify_mime_part: - * @part: a CamelMimePart - * - * Try to identify the MIME type of the data in @part (which presumably - * doesn't have a useful Content-Type). - **/ -char * -mail_identify_mime_part (CamelMimePart *part) -{ - GMimeContentField *content_type; - const char *filename, *type; - - content_type = camel_mime_part_get_content_type (part); - - - /* Try identifying based on name in Content-Type or - * filename in Content-Disposition. - */ - filename = gmime_content_field_get_parameter (content_type, "name"); - if (filename) { - type = gnome_mime_type_or_default (filename, NULL); - if (type) - return g_strdup (type); - } - - filename = camel_mime_part_get_filename (part); - if (filename) { - type = gnome_mime_type_or_default (filename, NULL); - if (type) - return g_strdup (type); - } - - - /* Try file magic. */ - /* FIXME */ - - - /* Another possibility to try is the x-mac-type / x-mac-creator - * parameter to Content-Type used by some Mac email clients. That - * would require a Mac type to mime type conversion table. - */ - - - /* We give up. */ - return NULL; -} diff --git a/mail/mail-ops.c b/mail/mail-ops.c deleted file mode 100644 index c28c4a0de6..0000000000 --- a/mail/mail-ops.c +++ /dev/null @@ -1,649 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-ops.c: callbacks for the mail toolbar/menus */ - -/* - * Author : - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include -#include -#include -#include "mail.h" -#include "folder-browser.h" -#include "e-util/e-setup.h" -#include "filter/filter-editor.h" -#include "filter/filter-driver.h" -#include "widgets/e-table/e-table.h" - -/* FIXME: is there another way to do this? */ -#include "Evolution.h" -#include "evolution-storage.h" - -#ifndef HAVE_MKSTEMP -#include -#include -#endif - -static void -mail_exception_dialog (char *head, CamelException *ex, gpointer widget) -{ - char *msg; - GtkWindow *window = - GTK_WINDOW (gtk_widget_get_ancestor (widget, GTK_TYPE_WINDOW)); - - msg = g_strdup_printf ("%s:\n%s", head, - camel_exception_get_description (ex)); - gnome_error_dialog_parented (msg, window); - g_free (msg); -} - -static gboolean -check_configured (void) -{ - char *path; - gboolean configured; - - path = g_strdup_printf ("=%s/config=/mail/configured", evolution_dir); - if (gnome_config_get_bool (path)) { - g_free (path); - return TRUE; - } - - mail_config_druid (); - - configured = gnome_config_get_bool (path); - g_free (path); - return configured; -} - -/* FIXME: This is BROKEN! It fetches mail into whatever folder you're - * currently viewing. - */ -void -fetch_mail (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = FOLDER_BROWSER (user_data); - CamelException *ex; - CamelStore *store = NULL; - CamelFolder *folder = NULL; - char *path, *url = NULL; - FilterDriver *filter = NULL; - char *userrules, *systemrules; - char *tmp_mbox = NULL, *source; - - if (!check_configured ()) - return; - - path = g_strdup_printf ("=%s/config=/mail/source", evolution_dir); - url = gnome_config_get_string (path); - g_free (path); - if (!url) { - GtkWidget *win = gtk_widget_get_ancestor (GTK_WIDGET (fb), - GTK_TYPE_WINDOW); - - gnome_error_dialog_parented ("You have no remote mail source " - "configured", GTK_WINDOW (win)); - return; - } - - path = CAMEL_SERVICE (fb->folder->parent_store)->url->path; - ex = camel_exception_new (); - - tmp_mbox = g_strdup_printf ("%s/movemail", path); - - /* If fetching mail from an mbox store, safely copy it to a - * temporary store first. - */ - if (!strncmp (url, "mbox:", 5)) { - int tmpfd; - - printf("moving from a local mbox\n"); - - tmpfd = open (tmp_mbox, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); - - if (tmpfd == -1) { - camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, - "Couldn't create temporary " - "mbox: %s", g_strerror (errno)); - mail_exception_dialog ("Unable to move mail", ex, fb); - goto cleanup; - } - close (tmpfd); - - /* Skip over "mbox:" plus host part (if any) of url. */ - source = url + 5; - if (!strncmp (source, "//", 2)) - source = strchr (source + 2, '/'); - - switch (camel_movemail (source, tmp_mbox, ex)) { - case -1: - mail_exception_dialog ("Unable to move mail", ex, fb); - /* FALL THROUGH */ - - case 0: - goto cleanup; - } - - folder = camel_store_get_folder (fb->folder->parent_store, - strrchr (tmp_mbox, '/') + 1, - FALSE, ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Unable to move mail", ex, fb); - goto cleanup; - } - } else { - CamelFolder *sourcefolder; - - store = camel_session_get_store (session, url, ex); - if (!store) { - mail_exception_dialog ("Unable to get new mail", ex, fb); - goto cleanup; - } - camel_service_connect (CAMEL_SERVICE (store), ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_USER_CANCEL) - mail_exception_dialog ("Unable to get new mail", ex, fb); - goto cleanup; - } - - sourcefolder = camel_store_get_folder (store, "inbox", - FALSE, ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Unable to get new mail", ex, fb); - goto cleanup; - } - - /* can we perform filtering on this source? */ - if (!(sourcefolder->has_summary_capability - && sourcefolder->has_search_capability)) { - GPtrArray *uids; - int i; - - printf("folder isn't searchable, performing movemail ...\n"); - - folder = camel_store_get_folder (fb->folder->parent_store, - strrchr (tmp_mbox, '/') + 1, - TRUE, ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Unable to move mail", ex, fb); - goto cleanup; - } - - uids = camel_folder_get_uids (sourcefolder, ex); - printf("got %d messages in source\n", uids->len); - for (i = 0; i < uids->len; i++) { - CamelMimeMessage *msg; - printf("copying message %d to dest\n", i + 1); - msg = camel_folder_get_message_by_uid (sourcefolder, uids->pdata[i], ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Unable to read message", ex, fb); - gtk_object_unref((GtkObject *)msg); - gtk_object_unref((GtkObject *)sourcefolder); - goto cleanup; - } - - camel_folder_append_message (folder, msg, ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Unable to write message", ex, fb); - gtk_object_unref((GtkObject *)msg); - gtk_object_unref((GtkObject *)sourcefolder); - goto cleanup; - } - - camel_folder_delete_message_by_uid(sourcefolder, uids->pdata[i], ex); - gtk_object_unref((GtkObject *)msg); - } - camel_folder_free_uids (sourcefolder, uids); - camel_folder_sync (sourcefolder, TRUE, ex); - if (camel_exception_is_set (ex)) - mail_exception_dialog ("", ex, fb); - gtk_object_unref((GtkObject *)sourcefolder); - } else { - printf("we can search on this folder, performing search!\n"); - folder = sourcefolder; - } - } - - if (camel_folder_get_message_count (folder, ex) == 0) { - gnome_ok_dialog ("No new messages."); - goto cleanup; - } else if (camel_exception_is_set (ex)) { - mail_exception_dialog ("Unable to get new mail", ex, fb); - goto cleanup; - } - - folder_browser_clear_search (fb); - - /* apply filtering rules to this inbox */ - filter = filter_driver_new(); - userrules = g_strdup_printf ("%s/filters.xml", evolution_dir); - systemrules = g_strdup_printf("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); - filter_driver_set_rules(filter, systemrules, userrules); - filter_driver_set_session(filter, session); - g_free(userrules); - g_free(systemrules); - - if (filter_driver_run(filter, folder, fb->folder) == -1) { - mail_exception_dialog ("Unable to get new mail", ex, fb); - goto cleanup; - } - - /* Redisplay. Ick. FIXME */ - path = g_strdup_printf ("file://%s", path); - folder_browser_set_uri (fb, path); - g_free (path); - - cleanup: - g_free(tmp_mbox); - - if (filter) - gtk_object_unref((GtkObject *)filter); - if (url) - g_free (url); - if (folder) { - camel_folder_sync (folder, TRUE, ex); - gtk_object_unref (GTK_OBJECT (folder)); - } - if (store) { - camel_service_disconnect (CAMEL_SERVICE (store), ex); - gtk_object_unref (GTK_OBJECT (store)); - } - camel_exception_free (ex); -} - - -struct post_send_data { - CamelFolder *folder; - const char *uid; - guint32 flags; -}; - -static void -composer_send_cb (EMsgComposer *composer, gpointer data) -{ - static CamelTransport *transport = NULL; - struct post_send_data *psd = data; - static char *from = NULL; - CamelException *ex; - CamelMimeMessage *message; - char *name, *addr, *path; - - ex = camel_exception_new (); - - if (!from) { - CamelInternetAddress *ciaddr; - - path = g_strdup_printf ("=%s/config=/mail/id_name", - evolution_dir); - name = gnome_config_get_string (path); - g_assert (name); - g_free (path); - path = g_strdup_printf ("=%s/config=/mail/id_addr", - evolution_dir); - addr = gnome_config_get_string (path); - g_assert (addr); - g_free (path); - - ciaddr = camel_internet_address_new (); - camel_internet_address_add (ciaddr, name, addr); - - from = camel_address_encode (CAMEL_ADDRESS (ciaddr)); - } - - if (!transport) { - char *url; - - path = g_strdup_printf ("=%s/config=/mail/transport", - evolution_dir); - url = gnome_config_get_string (path); - g_assert (url); - g_free (path); - - transport = camel_session_get_transport (session, url, ex); - if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Could not load mail transport", - ex, composer); - camel_exception_free (ex); - return; - } - } - - message = e_msg_composer_get_message (composer); - - camel_mime_message_set_from (message, from); - camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer", - "Evolution (Developer Preview)"); - camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0); - - camel_service_connect (CAMEL_SERVICE (transport), ex); - if (!camel_exception_is_set (ex)) - camel_transport_send (transport, CAMEL_MEDIUM (message), ex); - if (!camel_exception_is_set (ex)) - camel_service_disconnect (CAMEL_SERVICE (transport), ex); - if (camel_exception_is_set (ex)) - mail_exception_dialog ("Could not send message", ex, composer); - else { - if (psd) { - guint32 set; - - set = camel_folder_get_message_flags (psd->folder, - psd->uid, ex); - camel_folder_set_message_flags (psd->folder, psd->uid, - psd->flags, ~set, ex); - } - gtk_object_destroy (GTK_OBJECT (composer)); - } - - camel_exception_free (ex); - gtk_object_unref (GTK_OBJECT (message)); -} - -static void -free_psd (GtkWidget *composer, gpointer user_data) -{ - struct post_send_data *psd = user_data; - - gtk_object_unref (GTK_OBJECT (psd->folder)); - g_free (psd); -} - -void -send_msg (GtkWidget *widget, gpointer user_data) -{ - GtkWidget *composer; - - if (!check_configured ()) - return; - - composer = e_msg_composer_new (); - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); - gtk_widget_show (composer); -} - -/* Send according to a mailto (RFC 2368) URL. */ -void -send_to_url (const char *url) -{ - GtkWidget *composer; - - if (!check_configured ()) - return; - - composer = e_msg_composer_new_from_url (url); - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); - gtk_widget_show (composer); -} - -static void -reply (FolderBrowser *fb, gboolean to_all) -{ - EMsgComposer *composer; - struct post_send_data *psd; - - if (!check_configured ()) - return; - - psd = g_new (struct post_send_data, 1); - psd->folder = fb->folder; - gtk_object_ref (GTK_OBJECT (psd->folder)); - psd->uid = fb->message_list->selected_uid; - psd->flags = CAMEL_MESSAGE_ANSWERED; - - composer = mail_generate_reply (fb->mail_display->current_message, - to_all); - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), psd); - gtk_signal_connect (GTK_OBJECT (composer), "destroy", - GTK_SIGNAL_FUNC (free_psd), psd); - - gtk_widget_show (GTK_WIDGET (composer)); -} - -void -reply_to_sender (GtkWidget *button, gpointer user_data) -{ - reply (FOLDER_BROWSER (user_data), FALSE); -} - -void -reply_to_all (GtkWidget *button, gpointer user_data) -{ - reply (FOLDER_BROWSER (user_data), TRUE); -} - - -void -forward_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb; - EMsgComposer *composer; - - if (!check_configured ()) - return; - - fb = FOLDER_BROWSER (user_data); - composer = mail_generate_forward (fb->mail_display->current_message, - TRUE, TRUE); - - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); - - gtk_widget_show (GTK_WIDGET (composer)); -} - -void -delete_msg (GtkWidget *button, gpointer user_data) -{ - FolderBrowser *fb = user_data; - MessageList *ml = fb->message_list; - CamelException ex; - guint32 flags; - - if (!fb->mail_display->current_message) - return; - - camel_exception_init (&ex); - - flags = camel_folder_get_message_flags (fb->folder, ml->selected_uid, - &ex); - if (!camel_exception_is_set (&ex)) { - /* Toggle the deleted flag without touching other flags. */ - camel_folder_set_message_flags (fb->folder, ml->selected_uid, - CAMEL_MESSAGE_DELETED, - ~flags, &ex); - } - - if (camel_exception_is_set (&ex)) { - mail_exception_dialog ("Could not toggle deleted flag", - &ex, fb); - camel_exception_clear (&ex); - return; - } - - /* Move the cursor down a row... FIXME: should skip other - * deleted messages. - */ - e_table_select_row (E_TABLE (ml->etable), ml->selected_row + 1); -} - -void -expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER(user_data); - CamelException ex; - - if (fb->message_list->folder) { - camel_exception_init(&ex); - - camel_folder_expunge(fb->message_list->folder, &ex); - - /* FIXME: is there a better way to force an update? */ - /* FIXME: Folder should raise a signal to say its contents has changed ... */ - e_table_model_changed (fb->message_list->table_model); - - if (camel_exception_get_id (&ex) != CAMEL_EXCEPTION_NONE) { - mail_exception_dialog ("Unable to expunge deleted messages", &ex, fb); - } - } -} - -static void -filter_druid_clicked(FilterEditor *fe, int button, FolderBrowser *fb) -{ - printf("closing dialog\n"); - if (button == 0) { - char *user; - - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - filter_editor_save_rules(fe, user); - printf("saving filter options to '%s'\n", user); - g_free(user); - } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)fe); - } -} - -void -filter_edit (BonoboUIHandler *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER(user_data); - FilterEditor *fe; - char *user, *system; - - printf("Editing filters ...\n"); - fe = filter_editor_new(); - - user = g_strdup_printf ("%s/filters.xml", evolution_dir); - system = g_strdup_printf("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); - filter_editor_set_rule_files(fe, system, user); - g_free(user); - g_free(system); - gnome_dialog_append_buttons((GnomeDialog *)fe, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0); - gtk_signal_connect((GtkObject *)fe, "clicked", filter_druid_clicked, fb); - gtk_widget_show((GtkWidget *)fe); -} - -static void -vfolder_editor_clicked(FilterEditor *fe, int button, FolderBrowser *fb) -{ - printf("closing dialog\n"); - if (button == 0) { - char *user; - - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - filter_editor_save_rules(fe, user); - printf("saving vfolders to '%s'\n", user); - g_free(user); - - /* FIXME: this is also not the way to do this, see also - component-factory.c */ - { - EvolutionStorage *storage; - FilterDriver *fe; - int i, count; - char *user, *system; - extern char *evolution_dir; - - storage = gtk_object_get_data((GtkObject *)fb, "e-storage"); - - fe = filter_driver_new(); - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - system = g_strdup_printf("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR); - filter_driver_set_rules(fe, system, user); - g_free(user); - g_free(system); - count = filter_driver_rule_count(fe); - for (i=0;idescription) - desc = fo->description->data; - if (desc) - desctext = desc->data; - else { - sprintf(descunknown, "volder-%p", fo); - desctext = descunknown; - } - g_string_sprintf(query, "vfolder:/%s/vfolder/%s?", evolution_dir, desctext); - filter_driver_expand_option(fe, query, NULL, fo); - name = g_strdup_printf("/%s", desctext); - printf("Adding new vfolder: %s\n", query->str); - evolution_storage_new_folder (storage, name, - "mail", - query->str, - name+1); - g_string_free(query, TRUE); - g_free(name); - } - gtk_object_unref((GtkObject *)fe); - } - - } - if (button != -1) { - gnome_dialog_close((GnomeDialog *)fe); - } -} - -void -vfolder_edit (BonoboUIHandler *uih, void *user_data, const char *path) -{ - FolderBrowser *fb = FOLDER_BROWSER(user_data); - FilterEditor *fe; - char *user, *system; - - printf("Editing vfolders ...\n"); - fe = filter_editor_new(); - - user = g_strdup_printf ("%s/vfolders.xml", evolution_dir); - system = g_strdup_printf("%s/evolution/vfoldertypes.xml", EVOLUTION_DATADIR); - filter_editor_set_rule_files(fe, system, user); - g_free(user); - g_free(system); - gnome_dialog_append_buttons((GnomeDialog *)fe, GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, 0); - gtk_signal_connect((GtkObject *)fe, "clicked", vfolder_editor_clicked, fb); - gtk_widget_show((GtkWidget *)fe); -} - -void -providers_config (BonoboUIHandler *uih, void *user_data, const char *path) -{ - GtkWidget *pc; - - printf("Configuring Providers ...\n"); - pc = providers_config_new(); - - gtk_widget_show(pc); -} - diff --git a/mail/mail-sources.c b/mail/mail-sources.c deleted file mode 100644 index 3e5fbaed91..0000000000 --- a/mail/mail-sources.c +++ /dev/null @@ -1,771 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* mail-sources.c: Mail source selection wizard */ - -/* - * Author : - * Dan Winship - * - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#include - -#include -#include - -/* XXX */ -#define default_mail_path "/var/mail" - -struct { - char *protocol, *name, *description, *authname[4], *authproto[4]; - gboolean authpasswd[4]; -} providers[] = { - { "POP3", "Post Office Protocol, version 3", - "For connecting to POP3 servers. Some web mail providers and " - "proprietary email systems also provide POP3 interfaces.", - { "Password/APOP", "Kerberos 4" }, - { NULL, "KERBEROS_V4" }, - { TRUE, FALSE } - }, - { "IMAP", "Internet Mail Access Protocol", - "For connecting to IMAP servers. Allows you to keep all of " - "your mail on the IMAP server so that you can access it from " - "anywhere.", - { "Password/CRAM-MD5", "S/Key", "Kerberos 4", "GSSAPI" }, - { NULL, "SKEY", "KERBEROS_V4", "GSSAPI" }, - { TRUE, TRUE, FALSE, FALSE }, - } -}; -#define nproviders 2 - -struct msinfo { - GtkHTML *html; - GtkWidget *prev, *next; - int page; - - /* Locally-delivered mail. */ - gboolean get_local_mail, default_local_mail_path; - char *local_mail_path; - gboolean use_movemail; - - /* Remotely-delivered mail. */ - gboolean get_remote_mail; - int remote_provider; - char *remote_host, *remote_user, *remote_password; - int remote_auth; - gboolean remember_password; - gboolean copy_local; - - /* Local store. */ - gboolean store_local; - char *local_store_path; -}; - -static void display_intro (struct msinfo *msi); -static int finish_intro (struct msinfo *msi, int direction); -static void display_local (struct msinfo *msi); -static int finish_local (struct msinfo *msi, int direction); -static void display_remote (struct msinfo *msi); -static int finish_remote (struct msinfo *msi, int direction); -static void display_remconf (struct msinfo *msi); -static int finish_remconf (struct msinfo *msi, int direction); - -static struct { - void (*display) (struct msinfo *msi); - int (*finish) (struct msinfo *msi, int direction); -} pages[] = { - { display_intro, finish_intro }, - { display_local, finish_local }, -#if 0 - { display_movemail, finish_movemail }, -#endif - { display_remote, finish_remote }, - { display_remconf, finish_remconf }, - { NULL, NULL } -}; - - -/* Wrappers around gtkhtml */ - -static void -write_html (GtkHTML *html, GtkHTMLStreamHandle handle, const char *text) -{ - gtk_html_write (html, handle, text, strlen (text)); -} - -static GtkHTMLStreamHandle -start_html (GtkHTML *html) -{ - GtkHTMLStreamHandle handle; - - handle = gtk_html_begin (html, ""); - write_html (html, handle, "\n"); - return handle; -} - -void -end_html (GtkHTML *html, GtkHTMLStreamHandle handle) -{ - write_html (html, handle, ""); - gtk_html_end (html, handle, GTK_HTML_STREAM_OK); -} - - -/* Button callbacks */ - -static void -prev_clicked (GtkButton *button, gpointer data) -{ - struct msinfo *msi = data; - - if (msi->page == 3) - gtk_widget_set_sensitive (msi->next, TRUE); - msi->page = pages[msi->page].finish (data, -1); - pages[msi->page].display (data); - if (msi->page == 0) - gtk_widget_set_sensitive (msi->prev, FALSE); -} - -static void -next_clicked (GtkButton *button, gpointer data) -{ - struct msinfo *msi = data; - - if (msi->page == 0) - gtk_widget_set_sensitive (msi->prev, TRUE); - msi->page = pages[msi->page].finish (data, 1); - pages[msi->page].display (data); - if (msi->page == 3) - gtk_widget_set_sensitive (msi->next, FALSE); -} - -static void -cancel_clicked (GtkButton *button, gpointer data) -{ - exit (1); -} - -static void -object_requested(GtkHTML *html, GtkHTMLEmbedded *eb) -{ - GtkWidget *w; - - w = gtk_object_get_data (GTK_OBJECT(html), eb->classid); - gtk_container_add (GTK_CONTAINER(eb), w); - gtk_widget_show_all (GTK_WIDGET(eb)); -} - - - -int -main (int argc, char **argv) -{ - struct msinfo *msi; - GtkWidget *window, *vbox, *frame, *scrolled, *hbbox; - GtkWidget *cancel; - int page; - - gtk_init (&argc, &argv); - gdk_imlib_init (); - gdk_rgb_init (); - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - msi = g_new (struct msinfo, 1); - - /* Build window */ - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (window), - "Mail Source Configuration"); - gtk_window_set_default_size (GTK_WINDOW (window), 600, 400); - - vbox = gtk_vbox_new (FALSE, 5); - gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); - gtk_container_add (GTK_CONTAINER (window), vbox); - - frame = gtk_frame_new (NULL); - gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); - - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_ALWAYS); - gtk_container_add (GTK_CONTAINER (frame), scrolled); - - msi->html = GTK_HTML (gtk_html_new()); - gtk_html_set_editable (msi->html, FALSE); - gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (msi->html)); - gtk_signal_connect (GTK_OBJECT (msi->html), "object_requested", - GTK_SIGNAL_FUNC (object_requested), NULL); - - hbbox= gtk_hbutton_box_new (); - gtk_button_box_set_layout (GTK_BUTTON_BOX (hbbox), - GTK_BUTTONBOX_END); - gtk_box_pack_end (GTK_BOX (vbox), hbbox, FALSE, FALSE, 0); - - msi->prev = gnome_stock_button (GNOME_STOCK_BUTTON_PREV); - msi->next = gnome_stock_button (GNOME_STOCK_BUTTON_NEXT); - cancel = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL); - - gtk_box_pack_start (GTK_BOX (hbbox), msi->prev, TRUE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbbox), msi->next, TRUE, FALSE, 0); - gtk_box_pack_end (GTK_BOX (hbbox), cancel, TRUE, FALSE, 0); - - GTK_WIDGET_SET_FLAGS (msi->prev, GTK_CAN_DEFAULT); - GTK_WIDGET_SET_FLAGS (msi->next, GTK_CAN_DEFAULT); - GTK_WIDGET_SET_FLAGS (cancel, GTK_CAN_DEFAULT); - gtk_widget_grab_default (msi->next); - - gtk_signal_connect (GTK_OBJECT (msi->prev), "clicked", - prev_clicked, msi); - gtk_signal_connect (GTK_OBJECT (msi->next), "clicked", - next_clicked, msi); - gtk_signal_connect (GTK_OBJECT (cancel), "clicked", - cancel_clicked, NULL); - - msi->page = 0; - msi->get_local_mail = msi->default_local_mail_path = -1; - msi->use_movemail = -1; - msi->get_remote_mail = msi->store_local = -1; - msi->remember_password = msi->copy_local = -1; - msi->local_mail_path = msi->local_store_path = NULL; - msi->remote_provider = msi->remote_auth = -1; - msi->remote_host = msi->remote_user = msi->remote_password = NULL; - - display_intro (msi); - - gtk_widget_show_all (window); - gtk_main (); - exit (0); -} - -#define intro_text \ - "

Evolution Mail Source Wizard

\n" \ - "

Welcome to the Evolution Mail Source Wizard. This will " \ - "help you blah blah blah blah blah.

" - -static void -display_intro (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - - handle = start_html (msi->html); - write_html (msi->html, handle, intro_text); - end_html (msi->html, handle); -} - -static int -finish_intro (struct msinfo *msi, int direction) -{ - return msi->page + direction; -} - -#define local_text_1 \ - "

Local mail source

\n
\n" \ - "

First you need to tell Evolution whether or not you " \ - "receive mail locally, and if so, where.

\n" \ - "

Your default mail file on this system is " - -#define local_text_2 \ - ".

\n" - -#define local_text_3_file \ - "

That file exists, so you almost certainly want to use it " \ - "as a mail source.

\n" - -#define local_text_3_dir \ - "

That directory exists, but you currently have no mail " \ - "there. If you aren't sure whether or not you receive mail " \ - "on this machine, it's safest to leave it selected.

\n" - -#define local_text_3_none \ - "

However, that directory does not exist.

\n" - -#define local_text_label_1 \ - "Don't fetch local mail." - -#define local_text_label_2 \ - "Fetch local mail from the default location." - -#define local_text_label_3 \ - "Fetch local mail from an alternate location:" - -void -display_local (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - struct stat st; - char *default_user_mail_path; - GtkWidget *radio, *text; - GSList *group = NULL; - - default_user_mail_path = g_strdup_printf ("%s/%s", default_mail_path, - getenv ("USER")); - - handle = start_html (msi->html); - write_html (msi->html, handle, local_text_1); - write_html (msi->html, handle, default_user_mail_path); - write_html (msi->html, handle, local_text_2); - - if (stat (default_mail_path, &st) == 0) { - if (stat (default_user_mail_path, &st) == 0) - write_html (msi->html, handle, local_text_3_file); - else - write_html (msi->html, handle, local_text_3_dir); - if (msi->get_local_mail == -1) - msi->get_local_mail = TRUE; - } else { - write_html (msi->html, handle, local_text_3_none); - if (msi->get_local_mail == -1) - msi->get_local_mail = FALSE; - } - g_free (default_user_mail_path); - - radio = gtk_radio_button_new_with_label (group, local_text_label_1); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - if (!msi->get_local_mail) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_object_set_data (GTK_OBJECT (msi->html), "local:no", radio); - write_html (msi->html, handle, - "
\n"); - - radio = gtk_radio_button_new_with_label (group, local_text_label_2); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - if (msi->get_local_mail && msi->default_local_mail_path) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_object_set_data (GTK_OBJECT (msi->html), "local:default", radio); - write_html (msi->html, handle, - "
\n"); - - radio = gtk_radio_button_new_with_label (group, local_text_label_3); - text = gtk_entry_new (); - if (msi->get_local_mail && !msi->default_local_mail_path) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE); - gtk_entry_set_text (GTK_ENTRY (text), msi->local_mail_path); - } - gtk_object_set_data (GTK_OBJECT (msi->html), "local:alt", radio); - gtk_object_set_data (GTK_OBJECT (msi->html), "local:text", text); - write_html (msi->html, handle, - " " - ""); - - end_html (msi->html, handle); -} - -static int -finish_local (struct msinfo *msi, int direction) -{ - GtkWidget *radio, *text; - - radio = gtk_object_get_data (GTK_OBJECT (msi->html), "local:no"); - msi->get_local_mail = - !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); - - g_free (msi->local_mail_path); - if (!msi->get_local_mail) - msi->local_mail_path = NULL; - else { - radio = gtk_object_get_data (GTK_OBJECT (msi->html), - "local:default"); - msi->default_local_mail_path = - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)); - if (msi->default_local_mail_path) - msi->local_mail_path = NULL; - else { - text = gtk_object_get_data (GTK_OBJECT (msi->html), - "local:text"); - msi->local_mail_path = - g_strdup (gtk_entry_get_text (GTK_ENTRY (text))); - } - } - - return msi->page + direction; -} - -#define remote_text_1 \ - "

Remote mail source

\n
\n

Now you need to " \ - "configure a remote mail source, if you have one.

\n" \ - "

Evolution supports the following protocols for reading " \ - "mail from remote servers:

" - -#define remote_text_2 \ - "

To add a remote mail source, choose a protocol from " \ - "the list below and click \"Next\".

" - -#define remote_text_3_must \ - "

You have not configured a local mail source, so you " \ - "must configure a remote one.

" - -#define remote_label_none \ - "No remote mail source" - -void -display_remote (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - char *table, *item, *button, *nolabel; - GtkWidget *widget; - int i; - GSList *group = NULL; - - handle = start_html (msi->html); - write_html (msi->html, handle, remote_text_1); - - /* Write the table of available providers */ - table = "
\n"; - write_html (msi->html, handle, table); - for (i = 0; i < nproviders; i++) { - table = g_strdup_printf ("" - "\n" - "\n", - providers[i].protocol, - providers[i].name, - providers[i].description); - write_html (msi->html, handle, table); - g_free (table); - } - table = "
%s%s
%s
\n"; - write_html (msi->html, handle, table); - - write_html (msi->html, handle, remote_text_2); - if (!msi->get_local_mail) - write_html (msi->html, handle, remote_text_3_must); - - /* Write the list of configurable sources */ - write_html (msi->html, handle, "
"); - if (msi->get_local_mail) { - widget = gtk_radio_button_new_with_label (NULL, - remote_label_none); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget)); - gtk_object_set_data (GTK_OBJECT (msi->html), "remote:no", - widget); - write_html (msi->html, handle, - "\n
"); - } - - for (i = 0; i < nproviders; i++) { - button = g_strdup_printf ("remote:%s", providers[i].protocol); - widget = gtk_radio_button_new_with_label (group, providers[i].protocol); - if (msi->remote_provider == i) { - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), - TRUE); - } - group = gtk_radio_button_group (GTK_RADIO_BUTTON (widget)); - gtk_object_set_data (GTK_OBJECT (msi->html), button, widget); - g_free (button); - - button = g_strdup_printf ("\n" - "
", - providers[i].protocol); - write_html (msi->html, handle, button); - g_free (button); - } - write_html (msi->html, handle, "
"); - - end_html (msi->html, handle); -} - -static int -finish_remote (struct msinfo *msi, int direction) -{ - GtkToggleButton *radio; - char *button; - int i; - - radio = gtk_object_get_data (GTK_OBJECT (msi->html), "remote:no"); - msi->get_remote_mail = !radio || !gtk_toggle_button_get_active (radio); - if (msi->get_remote_mail) { - for (i = 0; i < nproviders; i++) { - button = g_strdup_printf ("remote:%s", - providers[i].protocol); - radio = gtk_object_get_data (GTK_OBJECT (msi->html), - button); - if (gtk_toggle_button_get_active (radio)) - break; - } - - msi->remote_provider = i; - } else if (direction == 1) - direction = 2; /* Skip remconf page. */ - - return msi->page + direction; -} - -#define remconf_text_title \ - "

Configure a remote mail source: %s


" - -#define remconf_text_host_label "Server name:" -#define remconf_text_user_label "Account name:" -#define remconf_text_path_label "Path to mail on server:" -#define remconf_text_auth_label "Authentication method:" - -#define remconf_text_password \ - "

If you would like to have Evolution remember the password " \ - "for this account, enter it below. If you would rather be " \ - "prompted for the password when Evolution needs it, choose " \ - "one of the other options.

\n" - -#define remconf_text_password_remember "Remember my password" -#define remconf_text_password_confirm "Enter password again for confirmation" -#define remconf_text_password_once \ - "Prompt me for the password once each Evolution session." -#define remconf_text_password_forget \ - "Prompt me for the password every time it is needed." - -static void -resize_password (GtkWidget *html, GtkAllocation *alloc, gpointer data) -{ - GtkWidget *scrolled; - - scrolled = gtk_object_get_data (GTK_OBJECT (html), "remconf:htmlwin"); - gtk_widget_set_usize (scrolled, alloc->width - 20, 300); -} - -static void -frob_password (GtkMenuItem *menuitem, gpointer data) -{ - struct msinfo *msi = data; - GtkHTML *subhtml; - GtkHTMLStreamHandle handle; - GtkWidget *radio, *table, *text, *label; - GSList *group = NULL; - int id; - - id = GPOINTER_TO_UINT (gtk_object_get_data (GTK_OBJECT (menuitem), - "id")); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:authproto", - GUINT_TO_POINTER (id)); - subhtml = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:html"); - handle = start_html (subhtml); - if (providers[msi->remote_provider].authpasswd[id]) { - write_html (subhtml, handle, remconf_text_password); - - table = gtk_table_new (2, 2, FALSE); - radio = gtk_radio_button_new_with_label (NULL, remconf_text_password_remember); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:remember", - radio); - gtk_table_attach (GTK_TABLE (table), radio, 0, 1, 0, 1, - GTK_FILL, GTK_SHRINK, 0, 0); - text = gtk_entry_new (); - gtk_entry_set_visibility (GTK_ENTRY (text), FALSE); - if (msi->remote_password) - gtk_entry_set_text (GTK_ENTRY (text), msi->remote_password); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:passwd1", - text); - gtk_table_attach (GTK_TABLE (table), text, 1, 2, 0, 1, - GTK_EXPAND, GTK_SHRINK, 0, 0); - label = gtk_label_new (remconf_text_password_confirm); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_RIGHT); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - GTK_SHRINK, GTK_SHRINK, 5, 0); - text = gtk_entry_new (); - gtk_entry_set_visibility (GTK_ENTRY (text), FALSE); - if (msi->remote_password) - gtk_entry_set_text (GTK_ENTRY (text), msi->remote_password); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:passwd2", - text); - gtk_table_attach (GTK_TABLE (table), text, 1, 2, 1, 2, - GTK_EXPAND, GTK_SHRINK, 0, 0); - - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:table", table); - - write_html (subhtml, handle, "" - "\n"); - - radio = gtk_radio_button_new_with_label (group, remconf_text_password_once); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:once", - radio); - write_html (subhtml, handle, "" - "\n"); - - radio = gtk_radio_button_new_with_label (group, remconf_text_password_forget); - group = gtk_radio_button_group (GTK_RADIO_BUTTON (radio)); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:forget", - radio); - write_html (subhtml, handle, "" - "\n"); - } else { - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:remember", NULL); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:once", NULL); - gtk_object_set_data (GTK_OBJECT (subhtml), "sub:forget", NULL); - } - end_html (subhtml, handle); -} - -void -display_remconf (struct msinfo *msi) -{ - GtkHTMLStreamHandle handle; - char *text; - int prov = msi->remote_provider; - GtkWidget *widget, *menu, *menuitem, *mi1 = NULL; - GtkWidget *scrolled, *subhtml; - - handle = start_html (msi->html); - - text = g_strdup_printf (remconf_text_title, providers[prov].protocol); - write_html (msi->html, handle, text); - g_free (text); - - write_html (msi->html, handle, "\n"); - - if (1) { - write_html (msi->html, handle, ""); - } - - if (1) { - write_html (msi->html, handle, ""); - } - - if (0) { - write_html (msi->html, handle, ""); - } - - if (1) { - int i; - - write_html (msi->html, handle, ""); - } - write_html (msi->html, handle, "
"); - write_html (msi->html, handle, remconf_text_host_label); - widget = gtk_entry_new (); - if (msi->remote_host) { - gtk_entry_set_text (GTK_ENTRY (widget), - msi->remote_host); - } - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:host", - widget); - write_html (msi->html, handle, "
"); - write_html (msi->html, handle, remconf_text_user_label); - widget = gtk_entry_new (); - if (msi->remote_user) { - gtk_entry_set_text (GTK_ENTRY (widget), - msi->remote_user); - } - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:user", - widget); - write_html (msi->html, handle, "
"); - write_html (msi->html, handle, remconf_text_path_label); - widget = gtk_entry_new (); -#if 0 - if (msi->remote_path) { - gtk_entry_set_text (GTK_ENTRY (widget), - msi->remote_path); - } -#endif - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:path", - widget); - write_html (msi->html, handle, "
"); - write_html (msi->html, handle, remconf_text_auth_label); - menu = gtk_menu_new (); - for (i = 0; i < 4 && providers[prov].authname[i]; i++) { - menuitem = gtk_menu_item_new_with_label (providers[prov].authname[i]); - gtk_widget_show (menuitem); - gtk_signal_connect (GTK_OBJECT (menuitem), "activate", - GTK_SIGNAL_FUNC (frob_password), - msi); - gtk_object_set_data (GTK_OBJECT (menuitem), "id", - GUINT_TO_POINTER (i)); - if (!mi1) - mi1 = menuitem; - gtk_menu_append (GTK_MENU (menu), menuitem); - } - widget = gtk_option_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu); - gtk_option_menu_set_history (GTK_OPTION_MENU (widget), - msi->remote_auth ? - msi->remote_auth : 0); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:auth", - widget); - write_html (msi->html, handle, "
\n"); - - subhtml = gtk_html_new (); - gtk_html_set_editable (GTK_HTML (subhtml), FALSE); - gtk_signal_connect (GTK_OBJECT (subhtml), "object_requested", - GTK_SIGNAL_FUNC (object_requested), NULL); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:html", - subhtml); - frob_password (GTK_MENU_ITEM (mi1), msi); - scrolled = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), - GTK_POLICY_NEVER, GTK_POLICY_NEVER); - gtk_container_add (GTK_CONTAINER (scrolled), subhtml); - gtk_object_set_data (GTK_OBJECT (msi->html), "remconf:htmlwin", - scrolled); - write_html (msi->html, handle, "" - "\n"); - write_html (msi->html, handle, "

foo

"); - - gtk_signal_connect (GTK_OBJECT (msi->html), "size-allocate", - GTK_SIGNAL_FUNC (resize_password), NULL); - - end_html (msi->html, handle); -} - -static int -finish_remconf (struct msinfo *msi, int direction) -{ - GtkEntry *host, *user, *passwd1, *passwd2; - char *data; - GtkWidget *menu, *menuitem; - GtkObject *subhtml; - GtkToggleButton *radio; - - gtk_signal_disconnect_by_func (GTK_OBJECT (msi->html), - GTK_SIGNAL_FUNC (resize_password), - NULL); - - host = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:host"); - data = gtk_entry_get_text (GTK_ENTRY (host)); - if (data && *data) - msi->remote_host = g_strdup (data); - - user = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:user"); - data = gtk_entry_get_text (GTK_ENTRY (user)); - if (data && *data) - msi->remote_user = g_strdup (data); - - msi->remote_auth = GPOINTER_TO_UINT (gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:authproto")); - - subhtml = gtk_object_get_data (GTK_OBJECT (msi->html), "remconf:html"); - radio = gtk_object_get_data (subhtml, "sub:remember"); - if (radio && gtk_toggle_button_get_active (radio)) { - passwd1 = gtk_object_get_data (subhtml, "sub:passwd1"); - passwd2 = gtk_object_get_data (subhtml, "sub:passwd2"); - - /* XXX compare */ - data = gtk_entry_get_text (GTK_ENTRY (passwd1)); - printf ("%s\n", data); - if (data && *data) { - msi->remote_password = g_strdup (data); - msi->remember_password = TRUE; - } - } else { - radio = gtk_object_get_data (subhtml, "sub:once"); - msi->remember_password = gtk_toggle_button_get_active (radio); - } - - return msi->page + direction; -} diff --git a/mail/mail-types.h b/mail/mail-types.h deleted file mode 100644 index c5b690563d..0000000000 --- a/mail/mail-types.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Copyright 2000 Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef MAIL_TYPES_H -#define MAIL_TYPES_H 1 - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus }*/ - - -typedef struct _FolderBrowser FolderBrowser; -typedef struct _MessageList MessageList; -typedef struct _MailDisplay MailDisplay; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* MAIL_TYPES_H */ diff --git a/mail/mail.h b/mail/mail.h deleted file mode 100644 index a63ffdb4ac..0000000000 --- a/mail/mail.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * Copyright 2000, Helix Code, Inc. (http://www.helixcode.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - */ - -#include -#include "camel/camel.h" -#include "composer/e-msg-composer.h" - -/* FIXME FIXME FIXME this sucks sucks sucks sucks */ - -/* folder-browser-factory */ -void folder_browser_factory_init (void); -BonoboControl *folder_browser_factory_new_control (const char *uri); - -/* mail-config */ -void mail_config_druid (void); - -/* mail-format */ -void mail_format_mime_message (CamelMimeMessage *mime_message, - GtkHTML *html, GtkHTMLStream *stream, - CamelMimeMessage *root_message); - -EMsgComposer *mail_generate_reply (CamelMimeMessage *mime_message, - gboolean to_all); - -EMsgComposer *mail_generate_forward (CamelMimeMessage *mime_message, - gboolean forward_as_attachment, - gboolean keep_attachments); - -/* mail-identify */ -char *mail_identify_mime_part (CamelMimePart *part); - -/* mail-ops */ -void fetch_mail (GtkWidget *button, gpointer user_data); -void send_msg (GtkWidget *button, gpointer user_data); -void send_to_url (const char *url); -void forward_msg (GtkWidget *button, gpointer user_data); -void reply_to_sender (GtkWidget *button, gpointer user_data); -void reply_to_all (GtkWidget *button, gpointer user_data); -void delete_msg (GtkWidget *button, gpointer user_data); - -void expunge_folder (BonoboUIHandler *uih, void *user_data, const char *path); -void filter_edit (BonoboUIHandler *uih, void *user_data, const char *path); -void vfolder_edit (BonoboUIHandler *uih, void *user_data, const char *path); -void providers_config (BonoboUIHandler *uih, void *user_data, const char *path); - -GtkWidget *providers_config_new (void); - -/* session */ -void session_init (void); -void forget_passwords (BonoboUIHandler *uih, void *user_data, const char *path); -extern CamelSession *session; diff --git a/mail/main.c b/mail/main.c deleted file mode 100644 index c7e72bd69e..0000000000 --- a/mail/main.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * mail-component.c: The core of the mail component - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include -#include -#include -#include - -#include "e-util/e-gui-utils.h" -#include "e-util/e-cursors.h" - -#include "component-factory.h" -#include "mail.h" - -#ifdef USING_OAF - -#include - -static void -init_corba (int *argc, char *argv []) -{ - gnome_init_with_popt_table ("evolution-mail-component", VERSION, *argc, argv, - oaf_popt_options, 0, NULL); - oaf_init (*argc, argv); -} - -#else /* USING_OAF */ - -#include - -static void -init_corba (int *argc, char *argv []) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ( - "evolution-mail-component", "1.0", - argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - CORBA_exception_free (&ev); -} - -#endif /* USING_OAF */ - -static void -init_bonobo (void) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE){ - e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, - _("Mail Component: I could not initialize Bonobo")); - exit (1); - } -} - -int -main (int argc, char *argv []) -{ - bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR); - textdomain (PACKAGE); - - init_corba (&argc, argv); - init_bonobo (); - gtkhtmllib_init (argc, argv); - - glade_gnome_init (); - - session_init (); - e_cursors_init (); - - component_factory_init (); - - bonobo_main (); - - return 0; -} diff --git a/mail/message-list.c b/mail/message-list.c deleted file mode 100644 index eab53cb772..0000000000 --- a/mail/message-list.c +++ /dev/null @@ -1,1006 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * message-list.c: Displays the messages. - * Implements CORBA's Evolution::MessageList - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * Bertrand Guiheneuf (bg@aful.org) - * - * (C) 2000 Helix Code, Inc. - */ -#include -#include -#include -#include "e-util/e-util.h" -#include "camel/camel-exception.h" -#include -#include "message-list.h" -#include "Mail.h" -#include "widgets/e-table/e-table-header-item.h" -#include "widgets/e-table/e-table-item.h" - -#include "art/mail-new.xpm" -#include "art/mail-read.xpm" -#include "art/mail-replied.xpm" -#include "art/attachment.xpm" -#include "art/empty.xpm" - -/* - * Default sizes for the ETable display - * - */ -#define N_CHARS(x) (CHAR_WIDTH * (x)) - -#define COL_ICON_WIDTH (16) -#define COL_CHECK_BOX_WIDTH (16) -#define COL_FROM_EXPANSION (24.0) -#define COL_FROM_WIDTH_MIN (32) -#define COL_SUBJECT_EXPANSION (30.0) -#define COL_SUBJECT_WIDTH_MIN (32) -#define COL_SENT_EXPANSION (24.0) -#define COL_SENT_WIDTH_MIN (32) -#define COL_RECEIVE_EXPANSION (20.0) -#define COL_RECEIVE_WIDTH_MIN (32) -#define COL_TO_EXPANSION (24.0) -#define COL_TO_WIDTH_MIN (32) -#define COL_SIZE_EXPANSION (6.0) -#define COL_SIZE_WIDTH_MIN (32) - -#define PARENT_TYPE (bonobo_object_get_type ()) - -static BonoboObjectClass *message_list_parent_class; -static POA_Evolution_MessageList__vepv evolution_message_list_vepv; - -static void -on_cursor_change_cmd (ETable *table, - int row, - gpointer user_data); -static void -select_row (ETable *table, - gpointer user_data); - - -static CamelMessageInfo * -get_message_info(MessageList *message_list, gint row) -{ - CamelMessageInfo *info = NULL; - - if (message_list->search) { - if (rowmatch_count) { - info = message_list->summary_search_cache->pdata[row]; - if (info == NULL) { - char *uid = g_list_nth_data(message_list->matches, row); - if (uid) { - info = message_list->summary_search_cache->pdata[row] = - (CamelMessageInfo *) camel_folder_summary_get_by_uid(message_list->folder, uid); - } - } - } - } else { - if (rowsummary_table->len) - info = message_list->summary_table->pdata[row]; - } - - return info; -} - -static int -get_message_row (MessageList *message_list, const char *uid) -{ - CamelMessageInfo *info; - int row; - - if (message_list->search) { - GList *l; - - /* Yum. Linear search. See also "FIXME: This should use - * a better format" in message-list.h - */ - for (l = message_list->matches, row = 0; l; l = l->next, row++) { - if (!strcmp (uid, l->data)) - return row; - } - } else { - gpointer key, value; - - if (g_hash_table_lookup_extended (message_list->uid_rowmap, - uid, &key, &value)) - return GPOINTER_TO_INT (value); - - row = g_hash_table_size (message_list->uid_rowmap); - for (; row < message_list->summary_table->len; row++) { - info = message_list->summary_table->pdata[row]; - g_hash_table_insert (message_list->uid_rowmap, - info->uid, GINT_TO_POINTER (row)); - if (!strcmp (uid, info->uid)) - return row; - } - } - - return -1; -} - -static gint -mark_msg_seen (gpointer data) -{ - MessageList *ml = data; - guint32 flags; - - flags = camel_folder_get_message_flags (ml->folder, ml->selected_uid, - NULL); - camel_folder_set_message_flags (ml->folder, ml->selected_uid, - CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN, - NULL); - return FALSE; -} - -/* select a message and display it */ -static void -select_msg (MessageList *message_list, gint row) -{ - CamelException ex; - CamelMimeMessage *message = NULL; - CamelMessageInfo *msg_info; - - camel_exception_init (&ex); - - msg_info = get_message_info(message_list, row); - if (msg_info) { - message = camel_folder_get_message_by_uid (message_list->folder, - msg_info->uid, - &ex); - if (camel_exception_get_id (&ex)) { - printf ("Unable to get message: %s\n", - ex.desc?ex.desc:"unknown_reason"); - return; - } - } - - if (message) { - if (message_list->seen_id) - gtk_timeout_remove (message_list->seen_id); - - mail_display_set_message (message_list->parent_folder_browser->mail_display, - CAMEL_MEDIUM (message)); - gtk_object_unref (GTK_OBJECT (message)); - - message_list->seen_id = - gtk_timeout_add (1500, mark_msg_seen, message_list); - } -} - -/* - * SimpleTableModel::col_count - */ -static int -ml_col_count (ETableModel *etm, void *data) -{ - return COL_LAST; -} - -/* - * SimpleTableModel::row_count - */ -static int -ml_row_count (ETableModel *etm, void *data) -{ - MessageList *message_list = data; - int v; - - if (!message_list->folder) { - return 0; - } - - if (message_list->search) { - v = message_list->match_count; - } else { - v = message_list->summary_table->len; - } - - /* in the case where no message is available, return 1 - * however, cause we want to be able to show a text */ - return (v ? v:1); - -} - -static void * -ml_value_at (ETableModel *etm, int col, int row, void *data) -{ - static char buffer [10]; - MessageList *message_list = data; - CamelFolder *folder; - CamelMessageInfo *msg_info; - CamelException ex; - void *retval = NULL; - - camel_exception_init (&ex); - - folder = message_list->folder; - if (!folder) - goto nothing_to_see; - - - /* retrieve the message information array */ - msg_info = get_message_info(message_list, row); - - /* - * in the case where it is zero message long - * display nothing - */ - if (msg_info == NULL) - goto nothing_to_see; - - switch (col){ - case COL_ONLINE_STATUS: - retval = GINT_TO_POINTER (0); - break; - - case COL_MESSAGE_STATUS: - if (msg_info->flags & CAMEL_MESSAGE_ANSWERED) - retval = GINT_TO_POINTER (2); - else if (msg_info->flags & CAMEL_MESSAGE_SEEN) - retval = GINT_TO_POINTER (1); - else - retval = GINT_TO_POINTER (0); - break; - - case COL_PRIORITY: - retval = GINT_TO_POINTER (1); - break; - - case COL_ATTACHMENT: - retval = GINT_TO_POINTER (0); - break; - - case COL_FROM: - if (msg_info->from) - retval = msg_info->from; - else - retval = ""; - break; - - case COL_SUBJECT: - if (msg_info->subject) - retval = msg_info->subject; - else - retval = ""; - break; - - case COL_SENT: - retval = GINT_TO_POINTER (msg_info->date_sent); - break; - - case COL_RECEIVE: - retval = "receive"; - break; - - case COL_TO: - retval = msg_info->to; - break; - - case COL_SIZE: - sprintf (buffer, "%d", msg_info->size); - retval = buffer; - break; - - case COL_DELETED: - retval = GINT_TO_POINTER(!!(msg_info->flags & CAMEL_MESSAGE_DELETED)); - break; - - case COL_UNREAD: - retval = GINT_TO_POINTER(!(msg_info->flags & CAMEL_MESSAGE_SEEN)); - break; - - default: - g_assert_not_reached (); - } - - return retval; - - - nothing_to_see: - /* - * in the case there is nothing to look at, - * notify the user. - */ - if (col == COL_SUBJECT) - return "No item in this view"; - else - return NULL; -} - -static void -ml_set_value_at (ETableModel *etm, int col, int row, const void *value, void *data) -{ - MessageList *message_list = data; - CamelMessageInfo *msg_info; - - switch (col) { - case COL_MESSAGE_STATUS: - msg_info = get_message_info (message_list, row); - camel_folder_set_message_flags (message_list->folder, - msg_info->uid, - CAMEL_MESSAGE_SEEN, - ~(msg_info->flags), NULL); - if (message_list->seen_id) { - gtk_timeout_remove (message_list->seen_id); - message_list->seen_id = 0; - } - break; - default: - break; - } - -} - -static gboolean -ml_is_cell_editable (ETableModel *etm, int col, int row, void *data) -{ - switch (col) { - case COL_MESSAGE_STATUS: - return TRUE; - break; - default: - return FALSE; - break; - } -} - -static void * -ml_duplicate_value (ETableModel *etm, int col, const void *value, void *data) -{ - switch (col){ - case COL_ONLINE_STATUS: - case COL_MESSAGE_STATUS: - case COL_PRIORITY: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - return (void *) value; - - case COL_FROM: - case COL_SUBJECT: - case COL_RECEIVE: - case COL_TO: - case COL_SIZE: - return g_strdup (value); - default: - g_assert_not_reached (); - } - return NULL; -} - -static void -ml_free_value (ETableModel *etm, int col, void *value, void *data) -{ - switch (col){ - case COL_ONLINE_STATUS: - case COL_MESSAGE_STATUS: - case COL_PRIORITY: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - break; - - case COL_FROM: - case COL_SUBJECT: - case COL_RECEIVE: - case COL_TO: - case COL_SIZE: - g_free (value); - break; - default: - g_assert_not_reached (); - } -} - -static void * -ml_initialize_value (ETableModel *etm, int col, void *data) -{ - switch (col){ - case COL_ONLINE_STATUS: - case COL_MESSAGE_STATUS: - case COL_PRIORITY: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - return NULL; - - case COL_FROM: - case COL_SUBJECT: - case COL_RECEIVE: - case COL_TO: - case COL_SIZE: - return g_strdup(""); - default: - g_assert_not_reached (); - } - - return NULL; -} - -static gboolean -ml_value_is_empty (ETableModel *etm, int col, const void *value, void *data) -{ - switch (col){ - case COL_ONLINE_STATUS: - case COL_MESSAGE_STATUS: - case COL_PRIORITY: - case COL_ATTACHMENT: - case COL_DELETED: - case COL_UNREAD: - case COL_SENT: - return value == NULL; - - case COL_FROM: - case COL_SUBJECT: - case COL_RECEIVE: - case COL_TO: - case COL_SIZE: - return !(value && *(char *)value); - default: - g_assert_not_reached (); - return FALSE; - } -} - -static struct { - char **image_base; - GdkPixbuf *pixbuf; -} states_pixmaps [] = { - { mail_new_xpm, NULL }, - { mail_read_xpm, NULL }, - { mail_replied_xpm, NULL }, - { empty_xpm, NULL }, - { attachment_xpm, NULL }, - { NULL, NULL } -}; - -static void -message_list_init_images (void) -{ - int i; - - /* - * Only load once, and share - */ - if (states_pixmaps [0].pixbuf) - return; - - for (i = 0; states_pixmaps [i].image_base; i++){ - states_pixmaps [i].pixbuf = gdk_pixbuf_new_from_xpm_data ( - (const char **) states_pixmaps [i].image_base); - } -} - -static char * -filter_date (const void *data) -{ - time_t date = GPOINTER_TO_INT (data); - char buf[26], *p; - - if (date == 0) - return g_strdup ("?"); - - ctime_r (&date, buf); - p = strchr (buf, '\n'); - if (p) - *p = '\0'; - - return g_strdup (buf); -} - -static void -message_list_init_renderers (MessageList *message_list) -{ - GdkPixbuf *images [3]; - - g_assert (message_list); - g_assert (message_list->table_model); - - message_list->render_text = e_cell_text_new ( - message_list->table_model, - NULL, GTK_JUSTIFY_LEFT); - - gtk_object_set(GTK_OBJECT(message_list->render_text), - "strikeout_column", COL_DELETED, - NULL); - gtk_object_set(GTK_OBJECT(message_list->render_text), - "bold_column", COL_UNREAD, - NULL); - - message_list->render_date = e_cell_text_new ( - message_list->table_model, - NULL, GTK_JUSTIFY_LEFT); - - gtk_object_set(GTK_OBJECT(message_list->render_date), - "text_filter", filter_date, - NULL); - gtk_object_set(GTK_OBJECT(message_list->render_date), - "strikeout_column", COL_DELETED, - NULL); - gtk_object_set(GTK_OBJECT(message_list->render_date), - "bold_column", COL_UNREAD, - NULL); - - message_list->render_online_status = e_cell_checkbox_new (); - - /* - * Message status - */ - images [0] = states_pixmaps [0].pixbuf; - images [1] = states_pixmaps [1].pixbuf; - images [2] = states_pixmaps [2].pixbuf; - - message_list->render_message_status = e_cell_toggle_new (0, 3, images); - - /* - * Attachment - */ - images [0] = states_pixmaps [3].pixbuf; - images [1] = states_pixmaps [4].pixbuf; - - message_list->render_attachment = e_cell_toggle_new (0, 2, images); - - /* - * FIXME: We need a real renderer here - */ - message_list->render_priority = e_cell_checkbox_new (); -} - -static void -message_list_init_header (MessageList *message_list) -{ - int i; - - /* - * FIXME: - * - * Use the font metric to compute this. - */ - - message_list->header_model = e_table_header_new (); - gtk_object_ref (GTK_OBJECT (message_list->header_model)); - gtk_object_sink (GTK_OBJECT (message_list->header_model)); - - message_list->table_cols [COL_ONLINE_STATUS] = - e_table_col_new ( - COL_ONLINE_STATUS, _("Online Status"), - 0.0, COL_CHECK_BOX_WIDTH, - message_list->render_online_status, - g_int_compare, FALSE); - - message_list->table_cols [COL_MESSAGE_STATUS] = - e_table_col_new_with_pixbuf ( - COL_MESSAGE_STATUS, states_pixmaps [0].pixbuf, - 0.0, COL_CHECK_BOX_WIDTH, - message_list->render_message_status, - g_int_compare, FALSE); - - message_list->table_cols [COL_PRIORITY] = - e_table_col_new ( - COL_PRIORITY, _("Priority"), - 0.0, COL_CHECK_BOX_WIDTH, - message_list->render_priority, - g_int_compare, FALSE); - - message_list->table_cols [COL_ATTACHMENT] = - e_table_col_new_with_pixbuf ( - COL_ATTACHMENT, states_pixmaps [4].pixbuf, - 0.0, COL_ICON_WIDTH, - message_list->render_attachment, - g_int_compare, FALSE); - - message_list->table_cols [COL_FROM] = - e_table_col_new ( - COL_FROM, _("From"), - COL_FROM_EXPANSION, COL_FROM_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_SUBJECT] = - e_table_col_new ( - COL_SUBJECT, _("Subject"), - COL_SUBJECT_EXPANSION, COL_SUBJECT_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_SENT] = - e_table_col_new ( - COL_SENT, _("Date"), - COL_SENT_EXPANSION, COL_SENT_WIDTH_MIN, - message_list->render_date, - g_int_compare, TRUE); - - message_list->table_cols [COL_RECEIVE] = - e_table_col_new ( - COL_RECEIVE, _("Receive"), - COL_RECEIVE_EXPANSION, COL_RECEIVE_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_TO] = - e_table_col_new ( - COL_TO, _("To"), - COL_TO_EXPANSION, COL_TO_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - message_list->table_cols [COL_SIZE] = - e_table_col_new ( - COL_SIZE, _("Size"), - COL_SIZE_EXPANSION, COL_SIZE_WIDTH_MIN, - message_list->render_text, - g_str_compare, TRUE); - - /* - * Dummy init: It setups the headers to match the order in which - * they are defined. In the future e-table widget will take care - * of this. - */ - for (i = 0; i < COL_LAST; i++) { - gtk_object_ref (GTK_OBJECT (message_list->table_cols [i])); - e_table_header_add_column (message_list->header_model, - message_list->table_cols [i], i); - } -} - -static char * -message_list_get_layout (MessageList *message_list) -{ - /* Message status, From, Subject, Sent Date */ - return g_strdup (" 1 4 5 6 "); -} - -/* - * GtkObject::init - */ -static void -message_list_init (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - char *spec; - - message_list->table_model = e_table_simple_new ( - ml_col_count, ml_row_count, ml_value_at, - ml_set_value_at, ml_is_cell_editable, - ml_duplicate_value, ml_free_value, - ml_initialize_value, ml_value_is_empty, - message_list); - - message_list_init_renderers (message_list); - message_list_init_header (message_list); - - /* - * The etable - */ - - spec = message_list_get_layout (message_list); - message_list->etable = e_table_new ( - message_list->header_model, message_list->table_model, spec); - g_free (spec); - - gtk_object_set(GTK_OBJECT(message_list->etable), - "cursor_mode", E_TABLE_CURSOR_LINE, - "drawfocus", FALSE, - "drawgrid", FALSE, - NULL); - - gtk_signal_connect (GTK_OBJECT (message_list->etable), "realize", - GTK_SIGNAL_FUNC (select_row), message_list); - - gtk_signal_connect (GTK_OBJECT (message_list->etable), "cursor_change", - GTK_SIGNAL_FUNC (on_cursor_change_cmd), message_list); - - gtk_widget_show (message_list->etable); - - gtk_object_ref (GTK_OBJECT (message_list->table_model)); - gtk_object_sink (GTK_OBJECT (message_list->table_model)); - - /* - * We do own the Etable, not some widget container - */ - gtk_object_ref (GTK_OBJECT (message_list->etable)); - gtk_object_sink (GTK_OBJECT (message_list->etable)); - - message_list->summary_search_cache = g_ptr_array_new(); -} - -static void -message_list_destroy (GtkObject *object) -{ - MessageList *message_list = MESSAGE_LIST (object); - int i; - - - gtk_object_unref (GTK_OBJECT (message_list->table_model)); - gtk_object_unref (GTK_OBJECT (message_list->header_model)); - - /* - * Renderers - */ - gtk_object_unref (GTK_OBJECT (message_list->render_text)); - gtk_object_unref (GTK_OBJECT (message_list->render_online_status)); - gtk_object_unref (GTK_OBJECT (message_list->render_message_status)); - gtk_object_unref (GTK_OBJECT (message_list->render_priority)); - gtk_object_unref (GTK_OBJECT (message_list->render_attachment)); - - gtk_object_unref (GTK_OBJECT (message_list->etable)); - - if (message_list->summary_search_cache) - g_ptr_array_free(message_list->summary_search_cache, TRUE); - if (message_list->summary_table) - camel_folder_free_summary(message_list->folder, message_list->summary_table); - if (message_list->uid_rowmap) - g_hash_table_destroy(message_list->uid_rowmap); - - for (i = 0; i < COL_LAST; i++) - gtk_object_unref (GTK_OBJECT (message_list->table_cols [i])); - - if (message_list->idle_id != 0) - g_source_remove(message_list->idle_id); - - gtk_object_unref (GTK_OBJECT (message_list->folder)); - - GTK_OBJECT_CLASS (message_list_parent_class)->destroy (object); -} - -/* - * CORBA method: Evolution::MessageList::select_message - */ -static void -MessageList_select_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: select message method\n"); -} - -/* - * CORBA method: Evolution::MessageList::open_message - */ -static void -MessageList_open_message (PortableServer_Servant _servant, - const CORBA_long message_number, - CORBA_Environment *ev) -{ - printf ("FIXME: open message method\n"); -} - -static POA_Evolution_MessageList__epv * -evolution_message_list_get_epv (void) -{ - POA_Evolution_MessageList__epv *epv; - - epv = g_new0 (POA_Evolution_MessageList__epv, 1); - - epv->select_message = MessageList_select_message; - epv->open_message = MessageList_open_message; - - return epv; -} - -static void -message_list_corba_class_init (void) -{ - evolution_message_list_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - evolution_message_list_vepv.Evolution_MessageList_epv = evolution_message_list_get_epv (); -} - -/* - * GtkObjectClass::init - */ -static void -message_list_class_init (GtkObjectClass *object_class) -{ - message_list_parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = message_list_destroy; - - message_list_corba_class_init (); - - message_list_init_images (); -} - -static void -message_list_construct (MessageList *message_list, Evolution_MessageList corba_message_list) -{ - bonobo_object_construct (BONOBO_OBJECT (message_list), corba_message_list); -} - -static Evolution_MessageList -create_corba_message_list (BonoboObject *object) -{ - POA_Evolution_MessageList *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_MessageList *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &evolution_message_list_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_MessageList__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_MessageList) bonobo_object_activate_servant (object, servant); -} - -BonoboObject * -message_list_new (FolderBrowser *parent_folder_browser) -{ - Evolution_MessageList corba_object; - MessageList *message_list; - - g_assert (parent_folder_browser); - - message_list = gtk_type_new (message_list_get_type ()); - - corba_object = create_corba_message_list (BONOBO_OBJECT (message_list)); - if (corba_object == CORBA_OBJECT_NIL){ - gtk_object_destroy (GTK_OBJECT (message_list)); - return NULL; - } - - message_list->parent_folder_browser = parent_folder_browser; - - message_list->idle_id = 0; - - message_list_construct (message_list, corba_object); - - return BONOBO_OBJECT (message_list); -} - -void -message_list_set_search (MessageList *message_list, const char *search) -{ - if (message_list->matches) { - /* FIXME: free contents too ... */ - g_list_free(message_list->matches); - message_list->matches = NULL; - } - - if (message_list->search) { - g_free(message_list->search); - message_list->search = NULL; - } - - if (search) { - CamelException ex; - - camel_exception_init (&ex); - message_list->matches = camel_folder_search_by_expression(message_list->folder, search, &ex); - message_list->search = g_strdup(search); - message_list->match_count = g_list_length(message_list->matches); - g_ptr_array_set_size(message_list->summary_search_cache, message_list->match_count); - memset(message_list->summary_search_cache->pdata, 0, sizeof(message_list->summary_search_cache->pdata[0]) * message_list->match_count); - } - - e_table_model_changed (message_list->table_model); - select_msg (message_list, 0); -} - -static void -folder_changed(CamelFolder *f, int type, MessageList *message_list) -{ - if (message_list->summary_table) - camel_folder_free_summary(f, message_list->summary_table); - message_list->summary_table = camel_folder_get_summary (f, NULL); - - if (message_list->uid_rowmap) - g_hash_table_destroy(message_list->uid_rowmap); - message_list->uid_rowmap = g_hash_table_new (g_str_hash, g_str_equal); - - message_list_set_search(message_list, message_list->search); -} - -static void -message_changed (CamelFolder *f, const char *uid, MessageList *message_list) -{ - int row; - - row = get_message_row (message_list, uid); - if (row != -1) - e_table_model_row_changed (message_list->table_model, row); -} - -void -message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder) -{ - CamelException ex; - - g_return_if_fail (message_list != NULL); - g_return_if_fail (camel_folder != NULL); - g_return_if_fail (IS_MESSAGE_LIST (message_list)); - g_return_if_fail (CAMEL_IS_FOLDER (camel_folder)); - g_return_if_fail (camel_folder_has_summary_capability (camel_folder)); - - if (message_list->matches) { - /* FIXME: free contents too ... */ - g_list_free(message_list->matches); - message_list->matches = NULL; - } - - camel_exception_init (&ex); - - if (message_list->folder) - gtk_object_unref (GTK_OBJECT (message_list->folder)); - - message_list->folder = camel_folder; - - gtk_signal_connect(GTK_OBJECT (camel_folder), "folder_changed", - folder_changed, message_list); - gtk_signal_connect(GTK_OBJECT (camel_folder), "message_changed", - message_changed, message_list); - - gtk_object_ref (GTK_OBJECT (camel_folder)); - - folder_changed (camel_folder, 0, message_list); - - select_msg (message_list, 0); -} - -GtkWidget * -message_list_get_widget (MessageList *message_list) -{ - return message_list->etable; -} - -E_MAKE_TYPE (message_list, "MessageList", MessageList, message_list_class_init, message_list_init, PARENT_TYPE); - -static gboolean -on_cursor_change_idle (gpointer data) -{ - MessageList *message_list = data; - - select_msg (message_list, message_list->selected_row); - - message_list->idle_id = 0; - return FALSE; -} - -static void -on_cursor_change_cmd (ETable *table, - int row, - gpointer user_data) -{ - MessageList *message_list; - CamelMessageInfo *info; - - message_list = MESSAGE_LIST (user_data); - - info = get_message_info (message_list, row); - if (!info) - return; - - message_list->selected_row = row; - message_list->selected_uid = info->uid; - - if (!message_list->idle_id) - message_list->idle_id = g_idle_add_full (G_PRIORITY_LOW, on_cursor_change_idle, message_list, NULL); -} - - -/* FIXME: this is all a kludge. */ - -static gint -idle_select_row (gpointer user_data) -{ - e_table_select_row (user_data, 0); - return FALSE; -} - -static void -select_row (ETable *table, gpointer user_data) -{ - MessageList *message_list = user_data; - - gtk_idle_add (idle_select_row, message_list->etable); -} diff --git a/mail/message-list.h b/mail/message-list.h deleted file mode 100644 index d3be0c14bc..0000000000 --- a/mail/message-list.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _MESSAGE_LIST_H_ -#define _MESSAGE_LIST_H_ - -#include "mail-types.h" -#include -#include -#include "camel/camel-folder.h" -#include "e-table/e-table.h" -#include "e-table/e-table-simple.h" -#include "e-table/e-cell-text.h" -#include "e-table/e-cell-toggle.h" -#include "e-table/e-cell-checkbox.h" -#include "folder-browser.h" - - -#define MESSAGE_LIST_TYPE (message_list_get_type ()) -#define MESSAGE_LIST(o) (GTK_CHECK_CAST ((o), MESSAGE_LIST_TYPE, MessageList)) -#define MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MESSAGE_LIST_TYPE, MessageListClass)) -#define IS_MESSAGE_LIST(o) (GTK_CHECK_TYPE ((o), MESSAGE_LIST_TYPE)) -#define IS_MESSAGE_LIST_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MESSAGE_LIST_TYPE)) - -typedef struct _Renderer Renderer; - - -enum { - COL_ONLINE_STATUS, - COL_MESSAGE_STATUS, - COL_PRIORITY, - COL_ATTACHMENT, - COL_FROM, - COL_SUBJECT, - COL_SENT, - COL_RECEIVE, - COL_TO, - COL_SIZE, - - COL_LAST, - - /* Invisible columns */ - COL_DELETED, - COL_UNREAD, -}; - -struct _MessageList { - BonoboObject parent; - - /* the folder browser that contains the - * this message list */ - FolderBrowser *parent_folder_browser; - - ETableModel *table_model; - ETableHeader *header_model; - ETableCol *table_cols [COL_LAST]; - - ECell *render_text; - ECell *render_date; - ECell *render_online_status; - ECell *render_message_status; - ECell *render_priority; - ECell *render_attachment; - - GtkWidget *etable; - - CamelFolder *folder; - - GPtrArray *summary_table; /* the summary of all messages */ - GHashTable *uid_rowmap; - - char *search; /* search string */ - /* FIXME: This should use a better format ... */ - GList *matches; /* when a search has been performed ... */ - int match_count; - GPtrArray *summary_search_cache; /* summary info cache for searches */ - - int selected_row; - const char *selected_uid; - - /* row-selection and seen-marking timers */ - guint idle_id, seen_id; -}; - -typedef struct { - BonoboObjectClass parent_class; -} MessageListClass; - -GtkType message_list_get_type (void); -BonoboObject *message_list_new (FolderBrowser *parent_folder_browser); -void message_list_set_folder (MessageList *message_list, - CamelFolder *camel_folder); -void message_list_set_search (MessageList *message_list, const char *search); -GtkWidget *message_list_get_widget (MessageList *message_list); - -#endif /* _MESSAGE_LIST_H_ */ diff --git a/mail/pixmaps.h b/mail/pixmaps.h deleted file mode 100644 index fdbb932771..0000000000 --- a/mail/pixmaps.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef EVOLUTION_PIXMAPS_H -#define EVOLUTION_PIXMAPS_H - -#include "pixmaps/envelope-opened.xpm" -#include "pixmaps/envelope-closed.xpm" -#include "pixmaps/empty.xpm" -#include "pixmaps/attachment.xpm" -#include "pixmaps/attachment-header.xpm" -#include "pixmaps/online-status.xpm" -#include "pixmaps/message-status.xpm" -#include "pixmaps/envelope-deleted.xpm" - -#endif /* EVOLUTION_PIXMAPS_H */ - diff --git a/mail/pixmaps/attachment-header.xpm b/mail/pixmaps/attachment-header.xpm deleted file mode 100644 index d3b0f96301..0000000000 --- a/mail/pixmaps/attachment-header.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * attachment_header_xpm[] = { -"16 16 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" .. ", -" + .. ..... ", -" .. .. . ", -" . .. . ", -" .. . .. ", -" . . . ", -" .. . ", -" . .. ", -" . .. ", -" ....... ", -" ", -" ", -" "}; diff --git a/mail/pixmaps/attachment.xpm b/mail/pixmaps/attachment.xpm deleted file mode 100644 index f154cceb18..0000000000 --- a/mail/pixmaps/attachment.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static char * attachment_xpm[] = { -"16 16 2 1", -" c None", -". c #000000", -" ", -" .. ", -" . . . ", -" . . .. ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. .. ", -" .. .. ", -" .. ", -" ", -" "}; diff --git a/mail/pixmaps/empty.xpm b/mail/pixmaps/empty.xpm deleted file mode 100644 index 93b02c0164..0000000000 --- a/mail/pixmaps/empty.xpm +++ /dev/null @@ -1,21 +0,0 @@ -/* XPM */ -static char * empty_xpm[] = { -"16 16 2 1", -" c None", -". c #FFFFFF", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................", -"................"}; diff --git a/mail/pixmaps/envelope-closed.xpm b/mail/pixmaps/envelope-closed.xpm deleted file mode 100644 index 060b659c78..0000000000 --- a/mail/pixmaps/envelope-closed.xpm +++ /dev/null @@ -1,65 +0,0 @@ -/* XPM */ -static char * envelope_closed_xpm[] = { -"16 16 46 1", -" c None", -". c #000000", -"+ c #837D71", -"@ c #FFFFFF", -"# c #4E4B42", -"$ c #767165", -"% c #FFFEFE", -"& c #FFF4DB", -"* c #FFFEFD", -"= c #F4E9D1", -"- c #625D54", -"; c #D0C7B2", -"> c #767166", -", c #FFFDFA", -"' c #F2E7CF", -") c #666257", -"! c #C8BFAB", -"~ c #736D63", -"{ c #FFFEFC", -"] c #F6EBD3", -"^ c #EEE3CC", -"/ c #FAEFD6", -"( c #918A7C", -"_ c #7E786B", -": c #E0D6C0", -"< c #C7BEAA", -"[ c #FDF2D9", -"} c #8A8476", -"| c #746F63", -"1 c #CEC4B0", -"2 c #8C8678", -"3 c #F9EED5", -"4 c #F1E6CE", -"5 c #F7ECD3", -"6 c #EFE4CD", -"7 c #D1C7B2", -"8 c #555149", -"9 c #CDC4B0", -"0 c #666258", -"a c #C1B8A5", -"b c #C2B9A6", -"c c #C0B7A4", -"d c #C3BAA7", -"e c #C4BBA8", -"f c #CAC1AD", -"g c #4E4B43", -" ", -" ", -" ", -" ", -" ", -" ........... ", -" .+@@@@@@@@@#. ", -" .@$%&@&*&=-;. ", -" .@&>%&,&')'!. ", -" .@&&~{&])&^!. ", -" .@&/()@)_=:<. ", -" .@[}&&)]]|1<. ", -" .@2&^3456789. ", -" .0abbbcddefg. ", -" ........... ", -" "}; diff --git a/mail/pixmaps/envelope-deleted.xpm b/mail/pixmaps/envelope-deleted.xpm deleted file mode 100644 index 9588ad2f0b..0000000000 --- a/mail/pixmaps/envelope-deleted.xpm +++ /dev/null @@ -1,54 +0,0 @@ -/* XPM */ -static char * envelope_deleted_xpm[] = { -"16 16 35 1", -" c None", -". c #FF0000", -"+ c #000000", -"@ c #837D71", -"# c #FFFFFF", -"$ c #4E4B42", -"% c #767165", -"& c #FFFEFE", -"* c #FFF4DB", -"= c #F4E9D1", -"- c #625D54", -"; c #D0C7B2", -"> c #767166", -", c #FFFDFA", -"' c #666257", -") c #F2E7CF", -"! c #C8BFAB", -"~ c #FFFEFC", -"{ c #F6EBD3", -"] c #EEE3CC", -"^ c #918A7C", -"/ c #E0D6C0", -"( c #C7BEAA", -"_ c #8A8476", -": c #F9EED5", -"< c #F1E6CE", -"[ c #F7ECD3", -"} c #EFE4CD", -"| c #D1C7B2", -"1 c #C1B8A5", -"2 c #C2B9A6", -"3 c #C0B7A4", -"4 c #C3BAA7", -"5 c #C4BBA8", -"6 c #CAC1AD", -" ", -" ", -" . ", -" ... ... ", -" ... .. ", -" ++..++..+++ ", -" +@###...###$+ ", -" +#%&*...*=-;+ ", -" +#*>..,..')!+ ", -" +#*..~*{.*]!+ ", -" +#..^'#'../(+ ", -" +#._**'{{..(+ ", -" +..*]:<[}|..+ ", -" +.122234456.+ ", -" +++++++++++ ", -" "}; diff --git a/mail/pixmaps/envelope-opened.xpm b/mail/pixmaps/envelope-opened.xpm deleted file mode 100644 index 40de0d743d..0000000000 --- a/mail/pixmaps/envelope-opened.xpm +++ /dev/null @@ -1,74 +0,0 @@ -/* XPM */ -static char * envelope_opened_xpm[] = { -"16 16 55 1", -" c None", -". c #000000", -"+ c #F4EDDD", -"@ c #F1EBDB", -"# c #F1EAD8", -"$ c #EAE3CB", -"% c #F4EAD5", -"& c #F1E6CF", -"* c #DDD4BE", -"= c #ECE3CD", -"- c #D3CAB6", -"; c #C1C1C1", -"> c #BDBDBD", -", c #BFBFBF", -"' c #12110F", -") c #FFFFFF", -"! c #514D45", -"~ c #767165", -"{ c #D0C7B2", -"] c #FFF4DB", -"^ c #625D54", -"/ c #565249", -"( c #F2E7CF", -"_ c #C8BFAB", -": c #3B3732", -"< c #837D71", -"[ c #807A6D", -"} c #45423B", -"| c #EEE3CC", -"1 c #FBF0D7", -"2 c #918A7C", -"3 c #7E786B", -"4 c #F4E9D1", -"5 c #E0D6C0", -"6 c #C7BEAA", -"7 c #FDF2D9", -"8 c #6A665B", -"9 c #F6EBD3", -"0 c #656157", -"a c #CEC4B0", -"b c #6D675D", -"c c #F9EED5", -"d c #F1E6CE", -"e c #F7ECD3", -"f c #EFE4CD", -"g c #D1C7B2", -"h c #CDC4B0", -"i c #080707", -"j c #C1B8A5", -"k c #C2B9A6", -"l c #C0B7A4", -"m c #C3BAA7", -"n c #C4BBA8", -"o c #CAC1AD", -"p c #1E1D1A", -" ", -" ", -" ..... ", -" .+@##$. ", -" .%&&&&&*. ", -" .=&&&&&&&-. ", -" ..;>>>>>>>,'. ", -" .)!)))))))~{. ", -" .)]^)))))/(_. ", -" .)]]:<<[}]|_. ", -" .)]12]]]3456. ", -" .)78]]]990a6. ", -" .)b]|cdefg0h. ", -" .ijkkklmmnop. ", -" ........... ", -" "}; diff --git a/mail/pixmaps/message-status.xpm b/mail/pixmaps/message-status.xpm deleted file mode 100644 index a0c4414f3f..0000000000 --- a/mail/pixmaps/message-status.xpm +++ /dev/null @@ -1,22 +0,0 @@ -/* XPM */ -static char * message_status_xpm[] = { -"16 16 3 1", -" c None", -". c #09B0F2", -"+ c #33A8D6", -" ", -" .. ", -" .. ", -" ++++ ", -" ++++ ", -" ++++ ", -" +++++++++++ ", -"..+++++..++++.. ", -"..+++++..++++.. ", -" +++++++++++ ", -" ++++ ", -" ++++ ", -" ++++ ", -" .. ", -" .. ", -" "}; diff --git a/mail/pixmaps/online-status.xpm b/mail/pixmaps/online-status.xpm deleted file mode 100644 index 88009ea480..0000000000 --- a/mail/pixmaps/online-status.xpm +++ /dev/null @@ -1,23 +0,0 @@ -/* XPM */ -static char * online_status_xpm[] = { -"16 16 4 1", -" c None", -". c #000000", -"+ c #9B9B9B", -"@ c #5CE537", -" ", -" . ", -" . ", -" . ", -" . +........+ ", -" . .++++++++. ", -" .. .++++++@+. ", -" ...++++++++. ", -" .. .++++++++. ", -" . .++++++++. ", -" . +........+ ", -" . ", -" . ", -" . ", -" . ", -" "}; diff --git a/mail/session.c b/mail/session.c deleted file mode 100644 index 259a087377..0000000000 --- a/mail/session.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * session.c: handles the session information and resource manipulation - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 2000 Helix Code, Inc. http://www.helixcode.com - */ -#include -#include -#include "mail.h" -#include "e-util/e-setup.h" - -CamelSession *session; -GHashTable *passwords; - -static void -request_callback (gchar *string, gpointer data) -{ - char **ans = data; - - if (string) - *ans = g_strdup(string); - else - *ans = NULL; -} - -static char * -evolution_auth_callback (CamelAuthCallbackMode mode, char *data, - gboolean secret, CamelService *service, char *item, - CamelException *ex) -{ - GtkWidget *dialog; - char *key, *ans; - - if (!passwords) - passwords = g_hash_table_new (g_str_hash, g_str_equal); - - key = g_strdup_printf ("%s:%s", - camel_url_to_string (service->url, FALSE), - item); - - if (mode == CAMEL_AUTHENTICATOR_TELL) { - if (!data) { - g_hash_table_remove (passwords, key); - g_free (key); - } else { - gpointer old_key, old_data; - - if (g_hash_table_lookup_extended (passwords, key, - &old_key, - &old_data)) { - g_hash_table_insert (passwords, old_key, data); - g_free (old_data); - g_free (key); - } else - g_hash_table_insert (passwords, key, data); - } - - return NULL; - } - - ans = g_hash_table_lookup (passwords, key); - if (ans) { - g_free (key); - return g_strdup (ans); - } - - /* XXX parent window? */ - dialog = gnome_request_dialog (secret, data, NULL, 0, - request_callback, &ans, NULL); - if (!dialog) { - camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, - "Could not create dialog box."); - g_free (key); - return NULL; - } - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == -1 || - ans == NULL) { - camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, - "User cancelled query."); - g_free (key); - return NULL; - } - - g_hash_table_insert (passwords, key, g_strdup (ans)); - return ans; -} - -void -session_init (void) -{ - e_setup_base_dir (); - camel_init (); - - session = camel_session_new (evolution_auth_callback); -} - -static gboolean -free_entry (gpointer key, gpointer value, gpointer user_data) -{ - g_free (key); - memset (value, 0, strlen (value)); - g_free (value); - return TRUE; -} - -void -forget_passwords (BonoboUIHandler *uih, void *user_data, const char *path) -{ - g_hash_table_foreach_remove (passwords, free_entry, NULL); -} diff --git a/mail/test-mail.c b/mail/test-mail.c deleted file mode 100644 index f2a39bf104..0000000000 --- a/mail/test-mail.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Tests the mail summary display bonobo component - * - * Author: - * Miguel de Icaza (miguel@kernel.org) - * - * (C) 2000 Helix Code, Inc. - */ - -#include - -#include -#include - -#ifdef USING_OAF - -#include - -static void -init_corba (int *argc, char *argv[]) -{ - gnome_init ("sample-control-container", "1.0", *argc, argv); - oaf_init (*argc, argv); -} - -#else /* USING_OAF */ - -#include - -static void -init_corba (int *argc, char *argv []) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gnome_CORBA_init ("sample-control-container", "1.0", argc, argv, 0, &ev); - - CORBA_exception_free (&ev); -} - -#endif /* USING_OAF */ - -static guint -create_container (void) -{ - GtkWidget *window, *control; - BonoboUIHandler *uih; - - gdk_rgb_init (); - - gtk_widget_set_default_colormap (gdk_rgb_get_cmap ()); - gtk_widget_set_default_visual (gdk_rgb_get_visual ()); - - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_widget_set_usize (GTK_WIDGET (window), 640, 480); - gtk_widget_show (GTK_WIDGET (window)); - - uih = bonobo_ui_handler_new (); - -#ifdef USING_OAF - control = bonobo_widget_new_control ("OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45", - bonobo_object_corba_objref (BONOBO_OBJECT (uih))); -#else - control = bonobo_widget_new_control ("control:evolution-mail", - bonobo_object_corba_objref (BONOBO_OBJECT (uih))); -#endif - - if (control == NULL){ - printf ("Could not launch mail control\n"); - exit (1); - } - gtk_container_add (GTK_CONTAINER (window), control); - - gtk_widget_show (window); - gtk_widget_show (control); - - - return FALSE; -} - -int -main (int argc, char *argv []) -{ - init_corba (&argc, argv); - - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error ("Could not initialize Bonobo\n"); - - gtk_idle_add ((GtkFunction) create_container, NULL); - - /* - * Main loop - */ - bonobo_main (); - - return 0; -} - - - - - -- cgit v1.2.3