aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/.cvsignore13
-rw-r--r--mail/ChangeLog873
-rw-r--r--mail/GNOME_Evolution_Mail.oaf.in28
-rw-r--r--mail/GNOME_Evolution_Mail.oafinfo28
-rw-r--r--mail/Mail.idl30
-rw-r--r--mail/Makefile.am102
-rw-r--r--mail/e-attchmt.pngbin169 -> 0 bytes
-rw-r--r--mail/evolution-mail.gnorba13
-rw-r--r--mail/evolution-mail.oafinfo28
-rw-r--r--mail/folder-browser-factory.c234
-rw-r--r--mail/folder-browser.c400
-rw-r--r--mail/folder-browser.h62
-rw-r--r--mail/mail-config.c1018
-rw-r--r--mail/mail-display.c365
-rw-r--r--mail/mail-display.h54
-rw-r--r--mail/mail-format.c1335
-rw-r--r--mail/mail-identify.c80
-rw-r--r--mail/mail-ops.c490
-rw-r--r--mail/mail-sources.c771
-rw-r--r--mail/mail-types.h39
-rw-r--r--mail/mail.h58
-rw-r--r--mail/main.c82
-rw-r--r--mail/message-list.c871
-rw-r--r--mail/message-list.h86
-rw-r--r--mail/pixmaps.h14
-rw-r--r--mail/pixmaps/attachment-header.xpm22
-rw-r--r--mail/pixmaps/attachment.xpm21
-rw-r--r--mail/pixmaps/empty.xpm21
-rw-r--r--mail/pixmaps/envelope-closed.xpm65
-rw-r--r--mail/pixmaps/envelope-deleted.xpm54
-rw-r--r--mail/pixmaps/envelope-opened.xpm74
-rw-r--r--mail/pixmaps/message-status.xpm22
-rw-r--r--mail/pixmaps/online-status.xpm23
-rw-r--r--mail/session.c62
-rw-r--r--mail/test-mail.c103
35 files changed, 0 insertions, 7541 deletions
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 d167dbc7b2..0000000000
--- a/mail/ChangeLog
+++ /dev/null
@@ -1,873 +0,0 @@
-2000-05-21 Ettore Perazzoli <ettore@helixcode.com>
-
- * message-list.c (get_message_info): Made static.
- (ml_initialize_value): Return NULL to placate compiler.
-
- * folder-browser.c (folder_browser_gui_init): Add cast.
-
- * mail-display.c (mail_html_new): Don't pass an empty URL to
- `gtk_html_begin()' anymore.
-
- * mail-config.c (put_html): Don't pass an empty URL to
- `gtk_html_begin()' anymore.
-
- * mail-display.h: Updated for the new GtkHTML API that uses
- `GtkHTMLStream *' instead of `GtkHTMLStreamHandle'.
- * mail-display.c: Likewise.
- * mail-config.c: Likewise.
- * mail-format.c: Likewise.
-
-2000-05-19 NotZed <NotZed@HelixCode.com>
-
- * mail-format.c: Fixes for stream stuff.
-
- * mail-display.c (save_data_cb): Remove exception stuff on streams.
-
-2000-05-19 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Added initialize_value and value_is_empty
- callbacks.
-
-2000-05-18 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c (folder_browser_factory): Remove
- development_warning (moved to shell)
-
- * message-list.c (select_msg): Update for camel_folder_get_uids
- (folder_changed, message_list_set_folder): Update for
- camel_folder_get_summary
-
- * mail-ops.c (fetch_mail): Update for camel_folder_get_uids
-
-2000-05-17 Dan Winship <danw@helixcode.com>
-
- * mail-component.c: This seems to be cruft. Nuke it.
-
- * mail-display.c (save_data_cb, save_data, on_url_requested):
- * mail-format.c (handle_text_plain_flowed, handle_text_html):
- Use camel_data_wrapper_write_to_stream rather than
- camel_data_wrapper_get_output_stream.
-
-2000-05-16 NotZed <NotZed@HelixCode.com>
-
- * mail-ops.c (filter_edit): Function to bring up the filter editor.
- (filter_druid_clicked): Save/close dialogue.
- (fetch_mail): Apply filters to incoming mail ... *hold breath*
- If we are coming from a non-indexed/searchable/etc source, then
- copy it to an mbox first. When copying mail from an mbox source,
- dont remove it aftewards, open it for append, so partially
- filtered mail isn't lost.
-
- * Makefile.am (evolution_mail_LDADD): Added libfilter.
- (INCLUDES): Add EVOLUTION_DATADIR, and fix matt's brokeneditor(tm)
- for putting spaces instead of tabs in.
-
-2000-05-16 Christopher James Lahey <clahey@helixcode.com>
-
- * mail-format.c: Removed usage of bonobo_object_destroy.
-
-2000-05-14 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Updated to work with new ETable resizing.
-
-2000-05-12 NotZed <NotZed@HelixCode.com>
-
- * mail-ops.c (fetch_mail): Use 6 X's to mkstemp, as required by
- the man page, just a temp fix, this should probably change to a
- known filename.
-
-2000-05-11 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c (control_activate): Now that we depend
- on current gnome-libs we can make the toolbar detachable again.
-
-2000-05-11 Federico Mena Quintero <federico@helixcode.com>
-
- * folder-browser-factory.c (development_warning): Left-justify the
- message.
-
-2000-05-10 Christopher James Lahey <clahey@helixcode.com>
-
- * folder-browser-factory.c (development_warning): Made this dialog
- have fewer buttons.
-
-2000-05-10 Christopher James Lahey <clahey@helixcode.com>
-
- * folder-browser-factory.c (development_warning): New development
- warning text from Nat.
-
-2000-05-10 Larry Ewing <lewing@helixcode.com>
-
- * mail-config.c (html_new): only set the default background color
- if style is not NULL.
-
-2000-05-09 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Removed folder-browser-factory.h since it doesn't
- exist. Added mail-display.h, mail-types.h, pixmaps.h.
-
-2000-05-09 Matt Loper <matt@helixcode.com>
-
- * folder-browser-factory.c (control_activate): Remove "File->mail"
- menuitem.
-
- * mail-config.c (mail_config_druid): Fill in "blah blah blah".
-
-2000-05-09 Dan Winship <danw@helixcode.com>
-
- * folder-browser.c (folder_browser_load_folder): make this a
- little less kludgy. Use gnome_error_dialog rather than printf on
- errors.
-
- * mail-ops.c (fetch_mail): Fix to work with the new shell stuff...
- sorta. Will need more fixing later when the new shell framework is
- more done.
-
- * mail-config.c (finish): Call gnome_config_sync so the data
- actually gets written.
-
-2000-05-08 Dan Winship <danw@helixcode.com>
-
- * mail-display.c (save_data_cb):
- (on_url_requested): Update for CamelStream CamelException changes.
-
- * mail-format.c: Pass NULL for a CamelException in a bunch of
- places... the user will see that the data is not being displayed,
- and there's not a lot we can do, and none of these things should
- be failing anyway. Maybe fix this later.
-
-2000-05-07 NotZed <NotZed@HelixCode.com>
-
- * message-list.c (ml_value_at): Size moved to message info, rather
- than content info structure.
-
-2000-05-07 Dan Winship <danw@helixcode.com>
-
- * message-list.c (select_msg): unref the message after displaying
- it.
-
- * mail-format.c (get_data_wrapper_text):
- (handle_text_plain_flowed):
- (handle_via_bonobo): Replace camel_stream_close calls.
-
-2000-05-07 Matt Loper <matt@helixcode.com>
-
- * folder-browser-factory.c: Changed a toolbar button from saying
- "New mail" (which suggests you might be composing new mail) to
- "Get mail".
-
-2000-05-06 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c (folder_browser_factory): Don't
- hardcode "inbox" here.
-
- * folder-browser.c (folder_browser_set_uri): Don't hardcode
- "inbox" here either.
- (folder_browser_load_folder): Create a new store according to the
- folder browser's URI, and load the mbox file from that store.
- Parts of this are temporary.
-
- * session.c, mail.h: There is no longer a global store, just a
- global session.
-
- * mail-config.c, mail-ops.c: Update for default_session -> session
- change. fetch_mail is currently broken.
-
-2000-05-06 Dan Winship <danw@helixcode.com>
-
- * mail-config.c: New code to configure identity, mail source, and
- mail transport.
- (mail_config_druid): A druid using the config widgets. (Only
- allows configuration of a single identity, source, and transport.)
-
- * mail-ops.c (check_configured): New function to make sure the
- user has configured stuff, and call the druid if not.
- (fetch_mail, send_msg, send_to_url, reply, forward_msg): Call
- check_configured
- (composer_send_cb): Make this pass the message to a CamelTransport
- rather than just printing it to stdout.
-
- * folder-browser-factory.c (development_warning): Add a warning
- about sending mail, since you can do that now.
-
-2000-05-06 Chris Toshok <toshok@HelixCode.com>
-
- * .cvsignore: ignore evolution-mail.pure
-
- * Makefile.am: add support for building evolution-mail.pure
-
-2000-05-06 Dan Winship <danw@helixcode.com>
-
- * mail.h: consolidate mail-format.h, mail-identify.h, mail-ops.h,
- main.h and session.h into this new file. There's no reason to have
- a .h for every .c.
-
-2000-05-05 Anders Carlsson <andersca@gnu.org>
-
- * test-mail.c (create_container): Use the OAFIID when using an
- OAF-enabled build of bonobo.
-
-2000-05-04 NotZed <NotZed@HelixCode.com>
-
- * message-list.c (message_list_set_folder): Get the whole message
- summary right away.
- (folder_changed): And if we change too.
- (ml_row_count): Use the match count or summary table length as the
- row count.
- (get_message_info): Use array references to lookup message summary
- info. For the search result list, use the summary_search_cache to
- cache the info lookup.
- (message_list_init): Allocate the summary search cache.
- (message_list_destroy): Free the summary search cache and the
- summary table, if there is one to free.
- (message_list_set_search): Save the match count, and clear the
- summary search cache for reuse.
- (folder_changed): Re-retrieve the summary list if the folder has
- changed.
- (message_list_set_folder): Retrieve the summary list when opening
- the folder.
-
-2000-05-03 Jason Leach <leach@wam.umd.edu>
-
- * Makefile.am (evolution_mail_LDADD): s/-lunicode/$(UNICODE_LIBS)/
- in the LDADD section.
-
-2000-05-03 Dan Winship <danw@helixcode.com>
-
- * mail-format.c (write_recipients_to_stream, write_headers): Make
- the "Cc:" field optional again. (Before, we could check if
- camel_mime_message_get_recipients returned NULL, but now we need
- to actually look into the returned CamelInternetAddress object.)
-
-2000-05-03 Larry Ewing <lewing@helixcode.com>
-
- * folder-browser.c (folder_browser_gui_init): comment out the
- changed signal for now.
-
-2000-05-02 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: set G_LOG_DOMAIN.
-
-2000-05-02 Larry Ewing <lewing@helixcode.com>
-
- * message-list.c (message_list_set_search): only free search if it
- is not NULL.
-
-2000-05-02 NotZed <NotZed@HelixCode.com>
-
- * folder-browser.c (folder_browser_gui_init): Connect the changed
- signal to search, so it searched immediately?
-
-2000-05-01 NotZed <NotZed@HelixCode.com>
-
- * pixmaps.h: Added envelope-deleted state.
-
- * folder-browser-factory.c: Setup callback for actual delete op.
- (control_activate): Setup a tool menu item to expnge deleted
- messages.
-
- * mail-ops.c (delete_msg): Toggle the delete flag on a message.
- (expunge_folder): New function to expunge deleted messages from
- the current folder.
-
- * folder-browser.c (folder_browser_gui_init): A hackish little
- quick-search entry.
- (search_activate): Perform a quick-search on the folder subject
- only.
- (folder_browser_gui_init): Add an option meny to the search line.
- (create_option_menu): Build the option menu from a table.
- (search_set): Build a search from another string whent he option
- menu or text item is changed. 5 search options are defined so
- far.
-
- * message-list.c (get_message_info): If there is an active search,
- then get the data from that ... use this instead of
- _get_message_info().
- (ml_row_count): If we have an active search, get the info from its
- result.
- (select_msg): Changed to use get_message_info, so searches work.
- (ml_value_at): And same here.
- (message_list_init_renderers): Added a 3rd state to message_status
- = deleted.
- (ml_value_at): Show the message state as deleted, if it is marked
- for deletion.
- (folder_changed): When the folder changes, update the display.
- (message_list_set_folder): Connect to the folder_changed event
- here.
- (message_changed): Callback to update the display when the message
- changes.
- (select_msg): And connect to the message_changed signal so we know
- when it cahgnes.
- (message_list_set_search): Save the search string.
- (folder_changed): If the folder changes, re-run the search,
- otherwise we may end up with invalid entries in the display.
-
- * mail-display.c: Include missing errno.h.
-
-2000-04-30 Dan Winship <danw@helixcode.com>
-
- * session.c (session_providers_init): This is no longer necessary.
-
- * mail-ops.c (fetch_mail): Remove kludge to load remote provider,
- as camel can do it by itself now.
-
-2000-04-29 Dan Winship <danw@helixcode.com>
-
- * mail-display.c (on_link_clicked): Handle clicks on "cid" URLs by
- popping up a "Save Attachment" dialog.
-
- * mail-format.c (get_cid): if the part has a Content-Disposition
- with a filename specified, record (a sanitized version of) that on
- the wrapper when creating the cid reference, so the "save
- attachment" code can use it later.
- (handle_mystery): fix a bug in the cid generation here.
-
-2000-04-29 Dan Winship <danw@helixcode.com>
-
- * mail-format.c (lookup_handler, etc): Improve the builtin vs
- bonobo selection code.
- (handle_mystery): Include name and Content-Description in the
- "mystery data" info, when available
- (handle_unknown_type): Call mail_identify_mime_part before
- giving up.
- (handle_undisplayable): Split out of handle_unknown_type now
- that handle_unknown_type can try alternate viewers.
- (handle_via_bonobo): Fall back to handle_undisplayable if the
- bonobo control fails.
-
- * mail-identify.c (mail_identify_mime_part): New function to
- attempt to identify a MIME part that we can't identify based on
- Content-Type alone.
-
- * mail-display.c (on_url_requested): redo the mystery data icon
- display stuff less kludgily.
-
-2000-04-28 Dan Winship <danw@helixcode.com>
-
- * mail-format.c (write_recipients_to_stream, write_headers,
- mail_generate_reply): Update (minimally) for Camel recipient
- changes.
-
-2000-04-28 Ettore Perazzoli <ettore@helixcode.com>
-
- * main.c (init_bonobo): Don't call `init_corba()' and don't get
- any args.
- (init_corba) [!USING_OAF]: Fix args.
-
-2000-04-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * folder-browser-factory.c: New macro `CONTROL_FACTORY_ID', which
- is #defined to a different value according to whether we are
- `USING_OAF' or not.
- (folder_browser_factory_init): Use `CONTROL_FACTORY_ID'.
-
- * test-mail.c
- (init_corba): New helper function, implemented differently
- according to `USING_OAF'.
- (main): Use `init_corba()'.
-
- * main.c
- (init_corba): New helper function, implemented differently
- according to `USING_OAF'.
- (init_bonobo): Use `init_corba()'.
-
- * Makefile.am: Install OAF stuff if `USING_OAF'. Add
- `-I$(datadir)/idl' to the `orbit-idl' command-line so that we can
- use Bonobo IDL files installed under our prefix as well. Also,
- use `$(ORBIT_IDL)' instead of hardcoded `orbit-idl'.
-
- * evolution-mail.oafinfo: New file.
-
-2000-04-27 Dan Winship <danw@helixcode.com>
-
- * mail-format.c: Move text_to_html to e-util.
-
- * mail-ops.c (send_to_url): New routine. Thin wrapper for
- e_msg_composer_new_from_url.
-
- * mail-display.c (on_link_clicked): print a warning for news or
- nntp URLs (which we'll deal with some day), and call send_to_url
- for mailto URLs.
-
- * mail-format.c (text_to_html): Improve URL conversion code.
- Recognize https, recognize "www\..*" without a prefixed "http://".
- Properly escape &, <, >, etc in URL strings. Don't be fooled by
- "mailto:", "http://", etc with no following data.
-
-2000-04-26 Dan Winship <danw@helixcode.com>
-
- * mail-format.c (text_to_html): Reorganize a bit and add a new
- flag, TEXT_TO_HTML_CONVERT_URLS to recognize and wrap URLs
- in text.
-
- * mail-display.c (mail_html_new): Add link_clicked signal handler.
- (on_link_clicked): Use gnome_url_show to launch a browser.
-
- * mail-format.c: update for CamelStream changes. Update for
- CamelMimeBodyPart -> CamelMimePart
-
-2000-04-25 Dan Winship <danw@helixcode.com>
-
- * mail-display.c, mail-format.c: Redo large chunks of this. The
- mail display now consists of a vbox in a scrolled window, in which
- we put multiple GtkHTML objects. This means broken HTML in one
- part can't corrupt other parts. The headers now scroll with the
- body. Unrecognized attachments look prettier, but still don't do
- anything, and will probably be changed later. We can also now
- display nested message/rfc822 parts and multipart/alternatives
- with multipart subparts. Oh, and text/{richtext,enriched}, since
- we had all these ancient sample messages that use it and the lack
- of support annoyed me. :)
-
- Bonobo embeddables are broken right now, but I don't think that's
- my fault.
-
- * mail-format.c (reply_body): Fix some bugs that crept into reply
- generation. This needs a lot more work to deal correctly with
- complicated bodies.
- (setup_function_table): pass unknown text subtypes to
- handle_text_plain.
- (handle_multipart_appledouble): new handler. Just ignores the
- first (application/applefile) part and tries to display the
- second part. Since the second part is usually
- application/octet-stream, this doesn't work very well still
- usually.
- (reply_body): Make this deal better with multiparts.
-
- * mail-format.c, mail-display.c: Now that we're not limited to
- a single GtkHTML for the display, there's no reason to embed
- Bonobo objects for unrecognized content-types in GtkHTML rather
- than embedded them into the vbox directly. So do that.
-
- Meanwhile, fix up the handler-selection code so that we can
- declare which built-in handlers are more desirable than external
- handlers and which are less. (Of course, eventually we'll want
- this to be customizable.) Add some cleverness to
- handle_multipart_alternative as well so it doesn't accept an
- alternative which we can display generically over one we can
- display specifically.
-
- * mail-format.c (text_to_html): add a convert_space_hack flag,
- which turns N spaces into N-1 &nbsp;s and a space.
- (handle_text_plain): Check for "format=flowed" in the
- Content-Type.
- (handle_text_plain_flowed): Spinoff of handle_text_plain to deal
- with RFC 2646 flowed text. (All the examples I can find of it
- are generated by Eudora, but it's a pretty cool idea that ought
- to be used more widely.)
-
-2000-04-23 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c: rename "send" to "send_msg", to avoid
- name clash with the tcp function. Connect the "forward" button.
-
- * mail-ops.c: rename "send" to "send_msg", to avoid name clash
- with the tcp function. Add forward_msg function.
-
- * mail-format.c (mail_generate_forward): support function for
- forward_msg. Pretty much a big kludge right now, pending the
- attachment/attachment-bar changes.
-
-2000-04-22 Dan Winship <danw@helixcode.com>
-
- * mail-display.c (on_url_requested): Change cid expectations to
- match current camel reality.
-
- * main.c (main): call glade_gnome_init, for composer.
-
- * folder-browser-factory.c: move msg_composer_cb and
- msg_composer_send_cb to mail-ops. Attach send, reply, and "reply
- to all" buttons.
-
- * mail-ops.c (composer_send_cb, send): moved from
- folder-browser-factory.c.
- (reply_to_sender, reply_to_all): new functions to do replies.
-
- * mail-format.c (text_to_html): Add an "add_pre" flag, to make
- it wrap the output in <pre></pre>.
- (mail_generate_reply): New function to create a composer and build
- a reply in it.
-
-2000-04-21 Dan Winship <danw@helixcode.com>
-
- * mail-display.c (on_url_requested): deal with cid: URLs.
- (find_cid): helper routine for above. (This could be much better.)
- (mail_display_init): connect url_requested signal
-
- * mail-format.c (handle_multipart_related): Make this work.
-
- * mail-display.c (mail_display_set_message): ref the message we
- display, since we're going to unref it when we remove it. Fixes a
- bug that showed up with the new camel code, but it's not obvious
- if it's due to a bug or a feature in the new code.
-
-2000-04-20 NotZed <NotZed@HelixCode.com>
-
- * Makefile.am (evolution_mail_LDADD): Add libibex.la to link.
-
- * message-list.h: Removed folder summary.
-
- * message-list.c: Dont include folder-summary anymore.
- (select_msg): Changed to use folder, not summary in
- summary_get_message_info(). God this code is grotty.
- (ml_value_at): Ditto.
- (ml_value_at): Changed to use new interface. Hmm, this returns a
- static variable, that seems wrong.
- (message_list_set_folder): Remove folder summary.
- (ml_row_count): Oops, remove some debug i put there.
-
-2000-04-20 Dan Winship <danw@helixcode.com>
-
- * mail-display.c: update for bonobo change, and remove a
- now-unused variable.
-
-2000-04-17 Chris Toshok <toshok@helixcode.com>
-
- * message-list.c (on_row_selection_idle): new function, actually
- calls select_msg.
- (on_row_selection_cmd): register an idle instead of calling
- select_msg directly. this fixes the lag before the row is
- selected - selection is instantaneous now, with message loading
- happening afterward.
-
- * message-list.h: add row_to_select and an idle_id to the message
- list to make the select_msg call happen in an idle func.
-
- * message-list.c (message_list_init_renderers): no more
- e_cell_set_editable. this info always comes from the model.
-
-2000-04-14 Dan Winship <danw@helixcode.com>
-
- * mail-format.[ch]: Moved from camel/camel-formatter, and changed
- slightly. (More to come.)
-
- * html-stream.[ch]: No longer necessary. mail-format uses
- GtkHTMLStreamHandles directly.
-
- * mail-display.[ch]: update for new message formatting code.
-
-2000-04-14 Chris Toshok <toshok@helixcode.com>
-
- * folder-browser-factory.c (control_activate): use
- gnome_app_fill_toolbar_with_data, so we get the beautiful gnome
- toolbar.
-
-2000-04-14 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c (development_warning): Fix up the
- warning message a bit.
- (folder_browser_factory): Make the warning bypassable.
-
-2000-04-12 Miguel de Icaza <miguel@gnu.org>
-
- * main.c (main): Call e_cursors_init.
-
-2000-04-10 Dan Winship <danw@helixcode.com>
-
- * mail-ops.c (fetch_mail): use camel_movemail when fetching mail
- from an mbox store. This leaves behind temp files for now,
- because CamelMboxFolder::delete is too confused to use, and NotZed
- is rewriting CamelMboxFolder, so I'm not going to bother to try to
- fix it.
-
- * mail-ops.c: Add some #includes for the non-HAVE_MKSTEMP case
-
-2000-04-09 Matt Loper <matt@helixcode.com>
-
- * folder-browser.c (folder_browser_new): set folder_browser->uri
- to NULL, so that we know when to free it.
-
-2000-04-07 Miguel de Icaza <miguel@gnu.org>
-
- * message-list.c (states_pixmaps): Add more beautiful art from
- Miggue, the Diego Rivera of the next millenium.
- (message_list_init_header): Use the beautiful art.
-
- * pixmaps: Miguel rediscovers the "transparent" concept.
-
-2000-04-07 Matt Loper <matt@helixcode.com>
-
- * folder-browser.c (folder_browser_destroy): Unref the shell
- interface that we have a handle to.
-
- * folder-browser-factory.c (control_destroy_cb): New function;
- destroys a folder-browser when its control is destroyed.
- (folder_browser_factory): Hook up to the above.
-
-2000-04-07 Dan Winship <danw@helixcode.com>
-
- * mail-ops.c: new file, for toolbar/menu callbacks
- (fetch_mail): fetch mail. Doesn't do mbox locking. Many kludges.
-
- * folder-browser-factory.c (control_activate): use new fetch_mail
- function as the callback for the "New mail" icon. Rename check_cb
- to random_cb.
-
- * Makefile.am: don't build test-sources since the version in
- CVS doesn't do much and once I've fixed it it won't be a separate
- program. Add mail-ops.[ch].
-
-2000-04-06 Miguel de Icaza <miguel@gnu.org>
-
- * message-list.c: Stick pixmaps here.
-
- * mail-display.c (embeddable_destroy_cb): Replaced C++ comments
- with C comments.
-
- * message-list.c (load_internal_images): New function, loads images.
- (message_list_init_renderers): Load images, fix previous attempt
- at loading images.
-
- * Makefile.am (dist-hook): Added distribution of pixmaps.
-
- * pixmaps: New directory, used to hold the XPMs we ship with.
-
- * pixmaps/envelope-closed.xpm, pixmaps/envelope-open.xpm: Tigert's
- envelopes incorporated.
-
-2000-03-31 Miguel de Icaza <miguel@gnu.org>
-
- * message-list.c (ml_value_at): Fix miss-used variable.
-
-2000-04-01 Michael Meeks <michael@helixcode.com>
-
- * folder-browser.c (folder_browser_properties_init): update to
- new property (folder_browser_property_changed): kill.
- (get_prop, set_prop): do the donkey work + make properly RW.
-
-2000-03-31 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c (folder_browser_set_shell):
- * folder-browser.c (folder_browser_new):
- * message-list.c (on_row_selection_cmd, select_msg,
- message_list_init, message_list_set_folder):
-
- remove debugging printf()s that no longer seem useful
-
-2000-03-29 Dan Winship <danw@helixcode.com>
-
- * folder-browser-factory.c (control_activate): build a toolbar.
- (control_deactivate): and hide it.
-
-2000-03-27 Chris Toshok <toshok@helixcode.com>
- * mail-display.c: quiet warnings when building in ../po
-
-2000-03-26 Miguel de Icaza <miguel@gnu.org>
-
- * folder-browser-factory.c (folder_browser_set_shell): Memory leak
- fix.
-
-2000-03-25 Dan Winship <danw@helixcode.com>
-
- * message-list.c (select_msg, ml_value_at): update for summary
- changes. Hey, neat, it really does make it more efficient.
-
-2000-03-22 Christopher James Lahey <clahey@helixcode.com>
-
- * .cvsignore: Updated .cvsignore.
-
-2000-03-21 Matt Loper <matt@helixcode.com>
-
- * mail-display.c: Minor cleanup & commenting.
-
- * folder-browser-factory.c: Minor cleanup & warning elimination.
-
-2000-03-21 bertrand <bertrand@helixcode.com>
-
- * message-list.c (ml_value_at): display message size
-
-2000-03-20 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Properly ref & sink the table and header models.
-
-2000-03-14 Dan Winship <danw@helixcode.com>
-
- * mail-sources.c: First cut at a mail source selection wizard.
- Basically a rigged demo at this point. Doesn't use camel to get
- its information, and is not yet complete or integrated with the
- mail component. Did I mention that the code is ugly?
-
-2000-03-13 bertrand <bertrand@helixcode.com>
-
- * folder-browser-factory.c (folder_browser_set_shell):
- for testing and demonstration purpose, immediately
- register a fake service.
-
-2000-03-12 bertrand <bertrand@helixcode.com>
-
- * folder-browser-factory.c (folder_browser_factory_init):
- name change.
- (control_activate_cb): when the control is activated,
- it merges its own UI with the remote UIHandler.
- (control_add_menu): sample menu merging.
- (folder_browser_factory): connect the control "activate" signal.
-
- * evolution-mail.gnorba:
- name changes
-
- * folder-browser.h: added a reference to an
- Evolution::Shell object.
-
- * folder-browser-factory.c (folder_browser_set_shell):
- (folder_browser_control_add_service_repository_interface):
- (folder_browser_factory): the folder-browser control now
- implements the Evolution/ServiceRepository interface.
-
-2000-03-07 bertrand <bertrand@helixcode.com>
-
- * folder-browser-factory.c (development_warning):
- added a warning so that the user knows that this
- version may crash his mails.
-
-2000-03-05 bertrand <bertrand@helixcode.com>
-
- * message-list.h: include a referrence to the parent
- folder browser.
-
- * message-list.c (ml_value_at): use the message summary
- from the
-
- * html-stream.c (html_stream_close): when the stream
- is closed, set the html stream to NULL
- (html_stream_write): don't write anything if the
- html handle does not exist.
- (html_stream_reset): implemented. close the current
- html handle and begins a new html parser.
-
- * session.c (session_store_new): use static exception
- here.
-
-2000-03-05 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Added a prototype message listing.
-
-2000-03-04 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Set up the column headers properly.
-
- * folder-browser.c: Show the folder_browser widget.
-
-2000-03-04 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Define ml_duplicate_value and ml_free_value
- correctly.
-
-2000-03-04 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Use g_int_compare and g_str_compare as we should
- be instead of g_int_equal and g_str_equal.
-
-2000-03-04 bertrand <bertrand@helixcode.com>
-
- * test-mail.c (main): replace the bonobo-active/gtk-main
- by bonobo-main.
- Include Gnorba headers.
- (main): don't call the container creation routine
- before we entered the main loop. Use idle for that.
-
-2000-03-04 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Change this to use the ETable widget itself
- instead of building it from all the parts.
-
-2000-03-03 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Ref the table columns since we unref them at the
- end.
-
-2000-03-01 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am (INCLUDES): Add `$(top_srcdir)'. Also, the
- `top_srcdir' includes must come first everything else to avoid
- including installed headers instead of our fresh ones.
-
-2000-02-28 NotZed <NotZed@HelixCode.com>
-
- * Makefile.am (evolution_mail_LDADD): Fixed references to eutil.
-
-2000-02-24 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Changed to match new e_table_simple interface.
-
-2000-02-24 Dan Winship <danw@helixcode.com>
-
- * message-list.c (message_list_set_folder): update for CamelFolder
- changes
-
-2000-02-24 Christopher James Lahey <clahey@helixcode.com>
-
- * message-list.c: Changed this to not use the "x" and "y"
- arguments to e-table-item.
-
-2000-02-23 Matt Loper <matt@helixcode.com>
-
- * message-list.c (message_list_set_folder): Check 'desc'riptions
- of exceptions.
-
-2000-02-22 bertrand <Bertrand.Guiheneuf@aful.org>
-
- * message-list.c (message_list_set_folder):
- fix to show a sample correct implementation.
-
-2000-02-21 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: added -lunicode to evolution_mail_LDADD.
-
-2000-02-21 Dan Winship <danw@helixcode.com>
-
- * session.c (session_store_new): Pass a CamelAuthCallback
- (evolution_auth_callback) to camel_session_new.
-
-2000-02-21 Dan Winship <danw@helixcode.com>
-
- * session.c (session_store_new): Update session_store_new to
- deal with the fact that camel_session_get_store takes a
- CamelException now. Doesn't actually do anything with the
- exception yet, because nothing else does yet either.
-
-2000-02-19 Matt Loper <matt@helixcode.com>
-
- * .cvsignore: added test-mail.
-
-2000-02-14 Miguel de Icaza <miguel@gnu.org>
-
- * folder-browser.c (folder_browser_load_folder): New routine,
- loads a camel folder.
- (folder_browser_set_uri): redo.
-
- * session.c: new file. Implements SessionStores to keep track of
- a Session/Store tuple.
-
-2000-02-13 Matt Loper <matt@helixcode.com>
-
- * html-stream.c (html_stream_new): Second param of gtk_html_begin
- should be "", not NULL.
- (html_stream_new): gtk_html_parse() is deprecated, so the call was
- removed.
-
- * html-stream.h: HTMLStreamClass's parent changed to
- CamelStreamClass, not CamelStream.
-
-2000-02-11 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Add the e-text directory to the includes list.
-
- * message-list.c: Change the call to e_cell_text_new, since
- there's an added argument.
-
-2000-02-09 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added libetext as libetable depends on it.
-
-2000-02-08 Iain Holmes <ih@csd.abdn.ac.uk>
-
- * Makefile.am: Changed the order of the compilation so the CORBA stuff
- was made before it was needed.
-
-2000-01-19 Miguel de Icaza <miguel@gnu.org>
-
- * Started work on the mail display engine.
-
- * html-stream.c, html-stream.h: New files, they are CamelStreams
- used to write to the GtkHTML widget.
-
diff --git a/mail/GNOME_Evolution_Mail.oaf.in b/mail/GNOME_Evolution_Mail.oaf.in
deleted file mode 100644
index 6c284ece5c..0000000000
--- a/mail/GNOME_Evolution_Mail.oaf.in
+++ /dev/null
@@ -1,28 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2"
- type="exe"
- location="evolution-mail">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/GenericFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- value="Evolution mail folder factory component."/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45"
- type="factory"
- location="OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/evolution-mail:1.0"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- value="Evolution mail folder display component."/>
-</oaf_server>
-
-</oaf_info>
diff --git a/mail/GNOME_Evolution_Mail.oafinfo b/mail/GNOME_Evolution_Mail.oafinfo
deleted file mode 100644
index 6c284ece5c..0000000000
--- a/mail/GNOME_Evolution_Mail.oafinfo
+++ /dev/null
@@ -1,28 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2"
- type="exe"
- location="evolution-mail">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/GenericFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- value="Evolution mail folder factory component."/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45"
- type="factory"
- location="OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/evolution-mail:1.0"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- value="Evolution mail folder display component."/>
-</oaf_server>
-
-</oaf_info>
diff --git a/mail/Mail.idl b/mail/Mail.idl
deleted file mode 100644
index 1d12a39c5c..0000000000
--- a/mail/Mail.idl
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * mail.idl: Mail interfaces for Evolution
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-
-#include <Bonobo.idl>
-
-module Evolution {
-
- interface MessageList : Bonobo::Unknown {
-
- void select_message (in long message_number);
- void open_message (in long message_number);
- };
-
- /*
- * FolderBrowser object.
- *
- * configuration of this widget is done trough
- * Bonobo Properties
- */
- interface FolderBrowser : Bonobo::Unknown {
- MessageList get_message_list ();
- };
-};
-
diff --git a/mail/Makefile.am b/mail/Makefile.am
deleted file mode 100644
index 700fb60eb6..0000000000
--- a/mail/Makefile.am
+++ /dev/null
@@ -1,102 +0,0 @@
-bin_PROGRAMS = evolution-mail test-mail
-
-providerdir = $(libdir)/evolution/camel-providers/$(VERSION)
-
-#imagesdir = $(datadir)/images/evolution
-#images_DATA = e-attchmt.png
-#EXTRA_DIST = $(image_DATA)
-
-INCLUDES = \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/widgets/e-text \
- -I$(top_srcdir) \
- -I$(top_srcdir)/camel \
- -I$(top_builddir)/shell \
- $(BONOBO_HTML_GNOME_CFLAGS) \
- -DEVOLUTION_VERSION=\""$(VERSION)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
- -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \
- -DG_LOG_DOMAIN=\"evolution-mail\"
-
-EVOLUTION_MAIL_CORBA_GENERATED = \
- Mail.h \
- Mail-common.c \
- Mail-skels.c \
- Mail-stubs.c
-
-evolution_mail_SOURCES = \
- $(EVOLUTION_MAIL_CORBA_GENERATED) \
- folder-browser.c \
- folder-browser.h \
- folder-browser-factory.c \
- mail-config.c \
- mail-display.c \
- mail-display.h \
- mail-format.c \
- mail-identify.c \
- mail-ops.c \
- mail-types.h \
- main.c \
- message-list.c \
- message-list.h \
- session.c \
- mail.h \
- pixmaps.h
-
-
-evolution_mail_LDADD = \
- ../shell/Evolution-common.o \
- ../shell/Evolution-stubs.o \
- ../shell/Evolution-skels.o \
- ../shell/evolution-service-repository.o \
- ../composer/libcomposer.la \
- ../widgets/e-table/libetable.a \
- ../widgets/e-text/libetext.a \
- ../camel/libcamel.la \
- ../e-util/libeutil.la \
- ../libibex/libibex.la \
- ../filter/libfilter.la \
- $(BONOBO_HTML_GNOME_LIBS) \
- $(UNICODE_LIBS)
-
-test_mail_SOURCES = \
- test-mail.c
-
-test_mail_LDADD = \
- $(BONOBO_HTML_GNOME_LIBS)
-
-
-GOAD_FILES = evolution-mail.gnorba
-OAF_FILES = evolution-mail.oafinfo
-
-if USING_OAF
-oafdir = $(datadir)/oaf
-oaf_DATA = $(OAF_FILES)
-else
-gnorbadir = $(sysconfdir)/CORBA/servers
-gnorba_DATA = $(GOAD_FILES)
-endif
-
-$(EVOLUTION_MAIL_CORBA_GENERATED): Mail.idl
- $(ORBIT_IDL) -I$(datadir)/idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) $(srcdir)/Mail.idl
-
-EXTRA_DIST = Mail.idl $(GOAD_FILES) $(OAF_FILES)
-
-dist-hook:
- -mkdir $(distdir)/pixmaps
- cp $(srcdir)/pixmaps/*.xpm $(distdir)/pixmaps
-
-if ENABLE_PURIFY
-PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-
-all-local: evolution-mail.pure
-
-evolution-mail.pure: evolution-mail
- @rm -f evolution-mail.pure
- $(PLINK) $(evolution_mail_LDFLAGS) $(evolution_mail_OBJECTS) $(evolution_mail_LDADD) $(LIBS)
-
-endif
-
diff --git a/mail/e-attchmt.png b/mail/e-attchmt.png
deleted file mode 100644
index b4bac8db67..0000000000
--- a/mail/e-attchmt.png
+++ /dev/null
Binary files differ
diff --git a/mail/evolution-mail.gnorba b/mail/evolution-mail.gnorba
deleted file mode 100644
index 7eb90dbc8a..0000000000
--- a/mail/evolution-mail.gnorba
+++ /dev/null
@@ -1,13 +0,0 @@
-[control-factory:evolution-mail]
-type=exe
-repo_id=IDL:GNOME/GenericFactory:1.0
-description=Evolution mail folder factory component.
-location_info=evolution-mail
-
-[control:evolution-mail]
-type=factory
-repo_id=IDL:BonoboControl/evolution-mail:1.0 IDL:GNOME/Control:1.0
-description=Evolution mail folder display component.
-location_info=control-factory:evolution-mail
-
-
diff --git a/mail/evolution-mail.oafinfo b/mail/evolution-mail.oafinfo
deleted file mode 100644
index 6c284ece5c..0000000000
--- a/mail/evolution-mail.oafinfo
+++ /dev/null
@@ -1,28 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2"
- type="exe"
- location="evolution-mail">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/GenericFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- value="Evolution mail folder factory component."/>
-</oaf_server>
-
-<oaf_server iid="OAFIID:control:evolution-mail:833d5a71-a201-4a0e-b7e6-5475c5c4cb45"
- type="factory"
- location="OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/evolution-mail:1.0"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- value="Evolution mail folder display component."/>
-</oaf_server>
-
-</oaf_info>
diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c
deleted file mode 100644
index e46e51df52..0000000000
--- a/mail/folder-browser-factory.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gnome.h>
-#include <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-object.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-control.h>
-#include "e-util/e-util.h"
-#include "e-util/e-gui-utils.h"
-#include "folder-browser.h"
-#include "mail.h"
-#include "shell/Evolution.h"
-#include "shell/evolution-service-repository.h"
-
-#ifdef USING_OAF
-#define CONTROL_FACTORY_ID "OAFIID:control-factory:evolution-mail:25902062-543b-4f44-8702-d90145fcdbf2"
-#else
-#define CONTROL_FACTORY_ID "control-factory:evolution-mail"
-#endif
-
-static void
-folder_browser_set_shell (EvolutionServiceRepository *sr,
- Evolution_Shell shell,
- void *closure)
-{
- FolderBrowser *folder_browser;
- CORBA_Environment ev;
-
- g_return_if_fail (closure);
- g_return_if_fail (IS_FOLDER_BROWSER (closure));
- g_return_if_fail (shell != CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- folder_browser = FOLDER_BROWSER (closure);
-
- folder_browser->shell = shell;
-
- /* test the component->shell registration */
- Evolution_Shell_register_service (shell, Evolution_Shell_MAIL_STORE, "a_service", &ev);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-folder_browser_control_add_service_repository_interface (BonoboControl *control,
- GtkWidget *folder_browser)
-{
- EvolutionServiceRepository *sr;
-
- /*
- * create an implementation for the Evolution::ServiceRepository
- * interface
- */
- sr = evolution_service_repository_new (folder_browser_set_shell,
- (void *)folder_browser);
-
- /* add the interface to the control */
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (sr));
-}
-
-
-static void
-random_cb (GtkWidget *button, gpointer user_data)
-{
- printf ("Yow! I am called back!\n");
-}
-
-static GnomeUIInfo gnome_toolbar [] = {
- GNOMEUIINFO_ITEM_STOCK (N_("Get mail"), N_("Check for new mail"), fetch_mail, GNOME_STOCK_PIXMAP_MAIL_RCV),
- GNOMEUIINFO_ITEM_STOCK (N_("Send"), N_("Send a new message"), send_msg, GNOME_STOCK_PIXMAP_MAIL_SND),
- GNOMEUIINFO_ITEM_STOCK (N_("Find"), N_("Find messages"), random_cb, GNOME_STOCK_PIXMAP_SEARCH),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Reply"), N_("Reply to the sender of this message"), reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL),
- GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"), reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL),
-
- GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD),
-
- GNOMEUIINFO_SEPARATOR,
-
- GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), random_cb, GNOME_STOCK_PIXMAP_PRINT),
-
- GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), delete_msg, GNOME_STOCK_PIXMAP_TRASH),
-
- GNOMEUIINFO_END
-};
-
-static void
-control_activate (BonoboControl *control, BonoboUIHandler *uih)
-{
- Bonobo_UIHandler remote_uih;
- BonoboControl *toolbar_control;
- GtkWidget *toolbar, *folder_browser;
-
- remote_uih = bonobo_control_get_remote_ui_handler (control);
- bonobo_ui_handler_set_container (uih, remote_uih);
-
- folder_browser = bonobo_control_get_widget (control);
-
- bonobo_ui_handler_menu_new_item (uih, "/Tools/Expunge", N_("_Expunge"),
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_STOCK,
- GNOME_STOCK_PIXMAP_TRASH,
- 0, 0, expunge_folder, folder_browser);
-
- bonobo_ui_handler_menu_new_item (uih, "/Tools/Filter Druid ...", N_("_Filter Druid"),
- NULL, -1,
- BONOBO_UI_HANDLER_PIXMAP_NONE,
- 0,
- 0, 0, filter_edit, folder_browser);
-
- toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
- GTK_TOOLBAR_BOTH);
-
- gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
- gnome_toolbar,
- NULL, folder_browser);
-
- gtk_widget_show_all (toolbar);
-
- toolbar_control = bonobo_control_new (toolbar);
- bonobo_ui_handler_dock_add (uih, "/Toolbar",
- bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)),
- GNOME_DOCK_ITEM_BEH_EXCLUSIVE,
- GNOME_DOCK_TOP,
- 1, 1, 0);
-}
-
-static void
-control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
-{
- bonobo_ui_handler_menu_remove (uih, "/File/Mail");
- bonobo_ui_handler_menu_remove (uih, "/Tools/Expunge");
- bonobo_ui_handler_menu_remove (uih, "/Tools/Filter Druid ...");
- bonobo_ui_handler_dock_remove (uih, "/Toolbar");
-}
-
-static void
-control_activate_cb (BonoboControl *control,
- gboolean activate,
- gpointer user_data)
-{
- BonoboUIHandler *uih;
-
- uih = bonobo_control_get_ui_handler (control);
- g_assert (uih);
-
- if (activate)
- control_activate (control, uih);
- else
- control_deactivate (control, uih);
-}
-
-static void
-control_destroy_cb (BonoboControl *control,
- gpointer user_data)
-{
- GtkWidget *folder_browser = user_data;
-
- gtk_object_destroy (GTK_OBJECT (folder_browser));
-}
-
-/*
- * Creates the Folder Browser, wraps it in a Bonobo Control, and
- * sets the Bonobo Control properties to point to the Folder Browser
- * Properties
- */
-static BonoboObject *
-folder_browser_factory (BonoboGenericFactory *factory, void *closure)
-{
- BonoboControl *control;
- GtkWidget *folder_browser;
-
- folder_browser = folder_browser_new ();
- if (folder_browser == NULL)
- return NULL;
-
- gtk_widget_show(folder_browser);
-
- control = bonobo_control_new (folder_browser);
-
- if (control == NULL){
- gtk_object_destroy (GTK_OBJECT (folder_browser));
- return NULL;
- }
-
- gtk_signal_connect (GTK_OBJECT (control), "activate",
- control_activate_cb, NULL);
-
- gtk_signal_connect (GTK_OBJECT (control), "destroy",
- control_destroy_cb, folder_browser);
-
- bonobo_control_set_property_bag (control,
- FOLDER_BROWSER (folder_browser)->properties);
-
- /* for the moment, the control has the ability to register
- * some services itself, but this should not last.
- *
- * It's not the way to do it, but we don't have the
- * correct infrastructure in the shell now.
- */
- folder_browser_control_add_service_repository_interface (control, folder_browser);
- return BONOBO_OBJECT (control);
-}
-
-void
-folder_browser_factory_init (void)
-{
- static BonoboGenericFactory *bonobo_folder_browser_factory = NULL;
-
- if (bonobo_folder_browser_factory != NULL)
- return;
-
- bonobo_folder_browser_factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID,
- folder_browser_factory,
- NULL);
-
- if (bonobo_folder_browser_factory == NULL){
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("We are sorry, Evolution's Folder Browser can not be initialized."));
- exit (1);
- }
-}
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
deleted file mode 100644
index 292c22d5d7..0000000000
--- a/mail/folder-browser.c
+++ /dev/null
@@ -1,400 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * folder-browser.c: Folder browser top level component
- *
- * Author:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gnome.h>
-#include "e-util/e-util.h"
-#include "folder-browser.h"
-#include "mail.h"
-#include "message-list.h"
-
-
-#define PARENT_TYPE (gtk_table_get_type ())
-
-static GtkObjectClass *folder_browser_parent_class;
-
-
-#define PROPERTY_FOLDER_URI "folder_uri"
-#define PROPERTY_MESSAGE_PREVIEW "message_preview"
-
-#define PROPERTY_FOLDER_URI_IDX 1
-#define PROPERTY_MESSAGE_PREVIEW_IDX 2
-
-
-
-static void
-folder_browser_destroy (GtkObject *object)
-{
- FolderBrowser *folder_browser = FOLDER_BROWSER (object);
-
- if (folder_browser->shell) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- Bonobo_Unknown_unref (folder_browser->shell, &ev);
- CORBA_exception_free (&ev);
- }
-
- if (folder_browser->uri)
- g_free (folder_browser->uri);
-
- if (folder_browser->folder)
- gtk_object_unref (GTK_OBJECT (folder_browser->folder));
-
- if (folder_browser->message_list)
- bonobo_object_unref (BONOBO_OBJECT (folder_browser->message_list));
-
- folder_browser_parent_class->destroy (object);
-}
-
-static void
-folder_browser_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = folder_browser_destroy;
-
- folder_browser_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-static gboolean
-folder_browser_load_folder (FolderBrowser *fb, const char *name)
-{
- char *store_name, *msg;
- CamelStore *store;
- CamelFolder *new_folder;
- CamelException *ex;
- gboolean new_folder_exists = FALSE;
-
- if (strncmp (name, "file:", 5) != 0) {
- char *msg;
-
- msg = g_strdup_printf ("Can't open URI %s", name);
- gnome_error_dialog (msg);
- g_free (msg);
- return FALSE;
- }
-
- /* Change "file:" to "mbox:". */
- store_name = g_strdup_printf ("mbox:%s", name + 5);
-
- ex = camel_exception_new ();
- store = camel_session_get_store (session, store_name, ex);
- g_free (store_name);
- if (store) {
- new_folder = camel_store_get_folder (store, "mbox", ex);
- gtk_object_unref (GTK_OBJECT (store));
- }
-
- if (camel_exception_get_id (ex)) {
- msg = g_strdup_printf ("Unable to get folder %s: %s\n", name,
- camel_exception_get_description (ex));
- gnome_error_dialog (msg);
- camel_exception_free (ex);
- return FALSE;
- }
-
- /* If the folder does not exist, we don't want to show it */
- new_folder_exists = camel_folder_exists (new_folder, ex);
- if (camel_exception_get_id (ex)) {
- msg = g_strdup_printf ("Unable to test if folder %s "
- "exists: %s\n", name,
- camel_exception_get_description (ex));
- gnome_error_dialog (msg);
- camel_exception_free (ex);
- return FALSE;
- }
- camel_exception_free (ex);
-
- if (!new_folder_exists) {
- gtk_object_unref (GTK_OBJECT (new_folder));
- return FALSE;
- }
-
- if (fb->folder)
- gtk_object_unref (GTK_OBJECT (fb->folder));
-
- fb->folder = new_folder;
-
- message_list_set_folder (fb->message_list, new_folder);
-
- return TRUE;
-}
-
-#define EQUAL(a,b) (strcmp (a,b) == 0)
-
-void
-folder_browser_set_uri (FolderBrowser *folder_browser, const char *uri)
-{
- if (folder_browser->uri)
- g_free (folder_browser->uri);
-
- folder_browser->uri = g_strdup (uri);
- folder_browser_load_folder (folder_browser, folder_browser->uri);
-}
-
-void
-folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview)
-{
- if (folder_browser->preview_shown == show_message_preview)
- return;
-
- g_warning ("FIXME: implement me");
-}
-
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- FolderBrowser *fb = user_data;
-
- switch (arg_id) {
-
- case PROPERTY_FOLDER_URI_IDX:
- if (fb && fb->uri)
- BONOBO_ARG_SET_STRING (arg, fb->uri);
- else
- BONOBO_ARG_SET_STRING (arg, "");
- break;
-
- case PROPERTY_MESSAGE_PREVIEW_IDX:
- g_warning ("Implement me; no return value");
- BONOBO_ARG_SET_BOOLEAN (arg, FALSE);
- break;
-
- default:
- g_warning ("Unhandled arg %d\n", arg_id);
- }
-}
-
-static void
-set_prop (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- FolderBrowser *fb = user_data;
-
- switch (arg_id) {
-
- case PROPERTY_FOLDER_URI_IDX:
- folder_browser_set_uri (fb, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case PROPERTY_MESSAGE_PREVIEW_IDX:
- folder_browser_set_message_preview (fb, BONOBO_ARG_GET_BOOLEAN (arg));
- break;
-
- default:
- g_warning ("Unhandled arg %d\n", arg_id);
- break;
- }
-}
-
-static void
-folder_browser_properties_init (FolderBrowser *fb)
-{
- fb->properties = bonobo_property_bag_new (get_prop, set_prop, fb);
-
- bonobo_property_bag_add (
- fb->properties, PROPERTY_FOLDER_URI, PROPERTY_FOLDER_URI_IDX,
- BONOBO_ARG_STRING, NULL, _("The URI that the Folder Browser will display"), 0);
- bonobo_property_bag_add (
- fb->properties, PROPERTY_MESSAGE_PREVIEW, PROPERTY_MESSAGE_PREVIEW_IDX,
- BONOBO_ARG_BOOLEAN, NULL, _("Whether a message preview should be shown"), 0);
-}
-
-static char * search_options[] = {
- "Body or subject contains",
- "Body contains",
- "Subject contains",
- "Body does not contain",
- "Subject does not contain",
- NULL
-};
-
-/* %s is replaced by the whole search string in quotes ...
- possibly could split the search string into words as well ? */
-static char * search_string[] = {
- "(or (body-contains %s) (match-all (header-contains \"Subject\" %s)))",
- "(body-contains %s)",
- "(match-all (header-contains \"Subject\" %s)",
- "(match-all (not (body-contains %s)))",
- "(match-all (not (header-contains \"Subject\" %s)))"
-};
-
-static void
-search_set(FolderBrowser *fb)
-{
- GtkWidget *widget;
- GString *out;
- char *str;
- int index;
- char *text;
-
- text = gtk_entry_get_text((GtkEntry *)fb->search_entry);
-
- if (text == NULL || text[0] == 0) {
- message_list_set_search (fb->message_list, NULL);
- return;
- }
-
- widget = gtk_menu_get_active (GTK_MENU(GTK_OPTION_MENU(fb->search_menu)->menu));
- index = (int)gtk_object_get_data((GtkObject *)widget, "search_option");
- if (index > sizeof(search_string)/sizeof(search_string[0]))
- index = 0;
- str = search_string[index];
-
- out = g_string_new("");
- while (*str) {
- if (str[0] == '%' && str[1]=='s') {
- str+=2;
- g_string_sprintfa(out, "\"%s\"", text);
- } else {
- g_string_append_c(out, *str);
- str++;
- }
- }
- message_list_set_search (fb->message_list, out->str);
- g_string_free(out, TRUE);
-}
-
-static void
-search_menu_deactivate(GtkWidget *menu, FolderBrowser *fb)
-{
- search_set(fb);
-}
-
-static GtkWidget *
-create_option_menu (char **menu_list, int item, void *data)
-{
- GtkWidget *omenu;
- GtkWidget *menu;
- int i = 0;
-
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- while (*menu_list){
- GtkWidget *entry;
-
- entry = gtk_menu_item_new_with_label (*menu_list);
- gtk_widget_show (entry);
- gtk_object_set_data((GtkObject *)entry, "search_option", (void *)i);
- gtk_menu_append (GTK_MENU (menu), entry);
- menu_list++;
- i++;
- }
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), item);
- gtk_widget_show (omenu);
-
- gtk_signal_connect (GTK_OBJECT (menu),
- "deactivate",
- GTK_SIGNAL_FUNC (search_menu_deactivate), data);
-
- return omenu;
-}
-
-static void
-search_activate(GtkEntry *entry, FolderBrowser *fb)
-{
- search_set(fb);
-}
-
-static void
-folder_browser_gui_init (FolderBrowser *fb)
-{
- GtkWidget *hbox, *label;
-
- /*
- * The panned container
- */
- fb->vpaned = gtk_vpaned_new ();
- gtk_widget_show (fb->vpaned);
-
- gtk_table_attach (
- GTK_TABLE (fb), fb->vpaned,
- 0, 1, 1, 3,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL | GTK_EXPAND,
- 0, 0);
-
- /* quick-search entry */
- hbox = gtk_hbox_new(FALSE, 3);
- gtk_widget_show(hbox);
- fb->search_entry = gtk_entry_new();
- gtk_widget_show(fb->search_entry);
- gtk_signal_connect(GTK_OBJECT (fb->search_entry), "activate", search_activate, fb);
- /* gtk_signal_connect(fb->search_entry, "changed", search_activate, fb); */
- label = gtk_label_new("Search");
- gtk_widget_show(label);
- fb->search_menu = create_option_menu(search_options, 0, fb);
- gtk_box_pack_end((GtkBox *)hbox, fb->search_entry, FALSE, FALSE, 3);
- gtk_box_pack_end((GtkBox *)hbox, fb->search_menu, FALSE, FALSE, 3);
- gtk_box_pack_end((GtkBox *)hbox, label, FALSE, FALSE, 3);
- gtk_table_attach (
- GTK_TABLE (fb), hbox,
- 0, 1, 0, 1,
- GTK_FILL | GTK_EXPAND,
- 0,
- 0, 0);
-
- fb->message_list_w = message_list_get_widget (fb->message_list);
- gtk_paned_add1 (GTK_PANED (fb->vpaned), fb->message_list_w);
- gtk_widget_show (fb->message_list_w);
-
- gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display));
- gtk_paned_set_position (GTK_PANED (fb->vpaned), 200);
-
- gtk_widget_show (GTK_WIDGET (fb->mail_display));
- gtk_widget_show (GTK_WIDGET (fb));
-
-}
-
-static void
-folder_browser_init (GtkObject *object)
-{
-}
-
-static void
-my_folder_browser_init (GtkObject *object)
-{
- FolderBrowser *fb = FOLDER_BROWSER (object);
-
- /*
- * Setup parent class fields.
- */
- GTK_TABLE (fb)->homogeneous = FALSE;
- gtk_table_resize (GTK_TABLE (fb), 1, 2);
-
- /*
- * Our instance data
- */
- fb->message_list = MESSAGE_LIST (message_list_new (fb));
- fb->mail_display = MAIL_DISPLAY (mail_display_new (fb));
-
- folder_browser_properties_init (fb);
- folder_browser_gui_init (fb);
-}
-
-GtkWidget *
-folder_browser_new (void)
-{
- FolderBrowser *folder_browser = gtk_type_new (folder_browser_get_type ());
-
- my_folder_browser_init (GTK_OBJECT (folder_browser));
- folder_browser->uri = NULL;
-
- return GTK_WIDGET (folder_browser);
-}
-
-
-E_MAKE_TYPE (folder_browser, "FolderBrowser", FolderBrowser, folder_browser_class_init, folder_browser_init, PARENT_TYPE);
-
-
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
deleted file mode 100644
index 6e9c66a0cd..0000000000
--- a/mail/folder-browser.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-
-#ifndef _FOLDER_BROWSER_H_
-#define _FOLDER_BROWSER_H_
-
-#include "mail-types.h"
-#include <gtk/gtktable.h>
-#include "camel/camel-stream.h"
-#include <bonobo/bonobo-property-bag.h>
-#include "message-list.h"
-#include "mail-display.h"
-#include "shell/Evolution.h"
-
-
-#define FOLDER_BROWSER_TYPE (folder_browser_get_type ())
-#define FOLDER_BROWSER(o) (GTK_CHECK_CAST ((o), FOLDER_BROWSER_TYPE, FolderBrowser))
-#define FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), FOLDER_BROWSER_TYPE, FolderBrowserClass))
-#define IS_FOLDER_BROWSER(o) (GTK_CHECK_TYPE ((o), FOLDER_BROWSER_TYPE))
-#define IS_FOLDER_BROWSER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), FOLDER_BROWSER_TYPE))
-
-
-struct _FolderBrowser {
- GtkTable parent;
-
- BonoboPropertyBag *properties;
-
- Evolution_Shell shell;
-
- /*
- * The current URI being displayed by the FolderBrowser
- */
- char *uri;
- CamelFolder *folder;
-
- MessageList *message_list;
- GtkWidget *message_list_w;
- MailDisplay *mail_display;
- GtkWidget *vpaned;
- GtkWidget *search_menu;
- GtkWidget *search_entry;
-
- gboolean preview_shown;
-
-};
-
-
-typedef struct {
- GtkTableClass parent_class;
-} FolderBrowserClass;
-
-
-
-
-GtkType folder_browser_get_type (void);
-GtkWidget *folder_browser_new (void);
-void folder_browser_set_uri (FolderBrowser *folder_browser,
- const char *uri);
-void folder_browser_set_message_preview (FolderBrowser *folder_browser,
- gboolean show_message_preview);
-
-#endif /* _FOLDER_BROWSER_H_ */
diff --git a/mail/mail-config.c b/mail/mail-config.c
deleted file mode 100644
index 513e7e66b0..0000000000
--- a/mail/mail-config.c
+++ /dev/null
@@ -1,1018 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* mail-config.c: Mail configuration dialogs/wizard. */
-
-/*
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * 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 <config.h>
-#include <pwd.h>
-
-#include <gnome.h>
-#include <gtkhtml/gtkhtml.h>
-
-#include "mail.h"
-#include "e-util/e-html-utils.h"
-#include "e-util/e-setup.h"
-
-struct service_type {
- CamelProvider *provider;
- CamelService *service;
- GList *authtypes;
-};
-
-struct identity_record {
- char *name, *address, *organization, *sigfile;
-};
-
-static char *username = NULL;
-
-
-/* HTML Helpers */
-
-static void
-html_size_req (GtkWidget *widget, GtkRequisition *requisition)
-{
- requisition->height = GTK_LAYOUT (widget)->height;
-}
-
-/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If
- * @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame.
- */
-static GtkWidget *
-html_new (gboolean white)
-{
- GtkWidget *html, *scrolled, *frame;
- GtkStyle *style;
-
- html = gtk_html_new ();
- GTK_LAYOUT (html)->height = 0;
- gtk_signal_connect (GTK_OBJECT (html), "size_request",
- GTK_SIGNAL_FUNC (html_size_req), NULL);
- gtk_html_set_editable (GTK_HTML (html), FALSE);
- style = gtk_rc_get_style (html);
- if (style) {
- gtk_html_set_default_background_color (GTK_HTML (html),
- white ? &style->white :
- &style->bg[0]);
- }
- gtk_widget_set_sensitive (html, FALSE);
- 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), html);
-
- if (white) {
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame),
- GTK_SHADOW_ETCHED_IN);
- gtk_container_add (GTK_CONTAINER (frame), scrolled);
- gtk_widget_show_all (frame);
- } else
- gtk_widget_show_all (scrolled);
-
- return html;
-}
-
-static void
-put_html (GtkHTML *html, char *text)
-{
- GtkHTMLStream *handle;
-
- text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL);
- handle = gtk_html_begin (html);
- gtk_html_write (html, handle, "<HTML><BODY>", 12);
- gtk_html_write (html, handle, text, strlen (text));
- gtk_html_write (html, handle, "</BODY></HTML>", 14);
- g_free (text);
- gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
-}
-
-
-/* Identity page */
-
-static void
-identity_note_doneness (GtkObject *page, gpointer user_data)
-{
- GtkWidget *exit_button;
- GtkEntry *entry;
- char *data;
-
- exit_button = gtk_object_get_data (page, "exit_button");
-
- entry = gtk_object_get_data (page, "name");
- data = gtk_entry_get_text (entry);
- if (data && *data) {
- entry = gtk_object_get_data (page, "addr");
- data = gtk_entry_get_text (entry);
- }
-
- gtk_widget_set_sensitive (exit_button, data && *data);
-}
-
-static void
-prepare_identity (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
-{
- identity_note_doneness (user_data, NULL);
-}
-
-static gboolean
-identity_next (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
-{
- GtkObject *box = user_data;
- GtkEntry *addr = gtk_object_get_data (box, "addr");
- char *data, *at;
-
- /* FIXME: we need more sanity checking than this. */
-
- data = gtk_entry_get_text (addr);
- at = strchr (data, '@');
- if (!at || !strchr (at + 1, '.')) {
- GtkWidget *parent =
- gtk_widget_get_ancestor (GTK_WIDGET (page),
- GTK_TYPE_WINDOW);
- gnome_error_dialog_parented ("Email address must be of the "
- "form \"user@domain\".",
- GTK_WINDOW (parent));
- return TRUE;
- }
-
- g_free (username);
- username = g_strndup (data, at - data);
-
- return FALSE;
-}
-
-static void
-destroy_identity (GtkObject *table, gpointer idrecp)
-{
- struct identity_record *idrec = idrecp;
- GtkEditable *editable;
-
- editable = gtk_object_get_data (table, "name");
- idrec->name = gtk_editable_get_chars (editable, 0, -1);
- editable = gtk_object_get_data (table, "addr");
- idrec->address = gtk_editable_get_chars (editable, 0, -1);
- editable = gtk_object_get_data (table, "org");
- idrec->organization = gtk_editable_get_chars (editable, 0, -1);
- editable = gtk_object_get_data (table, "sig");
- idrec->sigfile = gtk_editable_get_chars (editable, 0, -1);
-}
-
-static void
-create_identity_page (GtkWidget *vbox, struct identity_record *idrec)
-{
- GtkWidget *html, *table;
- GtkWidget *name, *addr, *org, *sig;
- GtkWidget *name_entry, *addr_entry, *org_entry, *sig_entry;
- GtkWidget *hsep;
- char *user;
- struct passwd *pw;
-
- html = html_new (FALSE);
- put_html (GTK_HTML (html),
- _("Enter your name and email address to be used in "
- "outgoing mail. You may also, optionally, enter the "
- "name of your organization, and the name of a file "
- "to read your signature from."));
- gtk_box_pack_start (GTK_BOX (vbox), html->parent, FALSE, TRUE, 0);
-
- table = gtk_table_new (5, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 10);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
- gtk_container_set_border_width (GTK_CONTAINER (table), 8);
- gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
- gtk_signal_connect (GTK_OBJECT (vbox), "destroy",
- GTK_SIGNAL_FUNC (destroy_identity), idrec);
-
- name = gtk_label_new (_("Full name:"));
- gtk_table_attach (GTK_TABLE (table), name, 0, 1, 0, 1,
- GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (name), 1, 0.5);
-
- name_entry = gtk_entry_new ();
- gtk_table_attach (GTK_TABLE (table), name_entry, 1, 2, 0, 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_object_set_data (GTK_OBJECT (vbox), "name", name_entry);
-
- user = getenv ("USER");
- if (user)
- pw = getpwnam (user);
- else
- pw = getpwuid (getuid ());
- if (pw && pw->pw_gecos && *pw->pw_gecos) {
- char *name;
- int pos = 0;
-
- name = g_strndup (pw->pw_gecos, strcspn (pw->pw_gecos, ","));
- gtk_editable_insert_text (GTK_EDITABLE (name_entry),
- name, strlen (name), &pos);
- }
-
- addr = gtk_label_new (_("Email address:"));
- gtk_table_attach (GTK_TABLE (table), addr, 0, 1, 1, 2,
- GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (addr), 1, 0.5);
-
- addr_entry = gtk_entry_new ();
- gtk_table_attach (GTK_TABLE (table), addr_entry, 1, 2, 1, 2,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_object_set_data (GTK_OBJECT (vbox), "addr", addr_entry);
-
- gtk_signal_connect_object (GTK_OBJECT (name_entry), "changed",
- GTK_SIGNAL_FUNC (identity_note_doneness),
- GTK_OBJECT (vbox));
- gtk_signal_connect_object (GTK_OBJECT (addr_entry), "changed",
- GTK_SIGNAL_FUNC (identity_note_doneness),
- GTK_OBJECT (vbox));
-
- hsep = gtk_hseparator_new ();
- gtk_table_attach (GTK_TABLE (table), hsep, 0, 2, 2, 3,
- GTK_FILL, 0, 0, 8);
-
- org = gtk_label_new (_("Organization:"));
- gtk_table_attach (GTK_TABLE (table), org, 0, 1, 3, 4,
- GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (org), 1, 0.5);
-
- org_entry = gtk_entry_new ();
- gtk_table_attach (GTK_TABLE (table), org_entry, 1, 2, 3, 4,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_object_set_data (GTK_OBJECT (vbox), "org", org_entry);
-
- sig = gtk_label_new (_("Signature file:"));
- gtk_table_attach (GTK_TABLE (table), sig, 0, 1, 4, 5,
- GTK_FILL, GTK_FILL, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (sig), 1, 0);
-
- sig_entry = gnome_file_entry_new (NULL, _("Signature File"));
- gtk_table_attach (GTK_TABLE (table), sig_entry, 1, 2, 4, 5,
- GTK_FILL, 0, 0, 0);
- gnome_file_entry_set_default_path (GNOME_FILE_ENTRY (sig_entry),
- g_get_home_dir ());
- gtk_object_set_data (GTK_OBJECT (vbox), "sig",
- gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (sig_entry)));
-
- gtk_widget_show_all (table);
-}
-
-
-/* Source/Transport pages */
-
-static void
-service_note_doneness (GtkObject *page, gpointer user_data)
-{
- GtkObject *box;
- GtkWidget *button;
- GtkEntry *entry;
- char *data;
- gboolean sensitive = TRUE;
-
- entry = gtk_object_get_data (page, "server_entry");
- if (entry) {
- data = gtk_entry_get_text (entry);
- if (!data || !*data)
- sensitive = FALSE;
- }
-
- if (sensitive) {
- entry = gtk_object_get_data (page, "user_entry");
- if (entry) {
- data = gtk_entry_get_text (entry);
- if (!data || !*data)
- sensitive = FALSE;
- }
- }
-
- if (sensitive) {
- entry = gtk_object_get_data (page, "path_entry");
- if (entry) {
- data = gtk_entry_get_text (entry);
- if (!data || !*data)
- sensitive = FALSE;
- }
- }
-
- button = gtk_object_get_data (page, "autodetect");
- if (button)
- gtk_widget_set_sensitive (button, sensitive);
-
- box = gtk_object_get_data (page, "box");
- button = gtk_object_get_data (box, "exit_button");
- if (button)
- gtk_widget_set_sensitive (button, sensitive);
-}
-
-static void
-prepare_service (GnomeDruidPage *page, gpointer arg1, gpointer user_data)
-{
- GtkObject *box = user_data;
- GtkNotebook *notebook = gtk_object_get_data (box, "notebook");
- GtkWidget *table;
- GtkEntry *entry;
-
- table = gtk_notebook_get_nth_page (
- notebook, gtk_notebook_get_current_page (notebook));
-
- if (username) {
- char *data = NULL;
-
- entry = gtk_object_get_data (GTK_OBJECT (table), "user_entry");
- if (entry) {
- data = gtk_entry_get_text (entry);
- if (!data || !*data)
- gtk_entry_set_text (entry, username);
- }
- }
-
- service_note_doneness (GTK_OBJECT (table), NULL);
-}
-
-static void
-auth_menuitem_activate (GtkObject *menuitem, GtkHTML *html)
-{
- CamelServiceAuthType *authtype;
-
- authtype = gtk_object_get_data (menuitem, "authtype");
- put_html (html, authtype->description);
-}
-
-static void
-fill_auth_menu (GtkOptionMenu *optionmenu, GtkHTML *html, GList *authtypes)
-{
- CamelServiceAuthType *authtype;
- GtkWidget *menu, *item, *firstitem = NULL;
-
- menu = gtk_menu_new ();
- gtk_option_menu_set_menu (optionmenu, menu);
- for (; authtypes; authtypes = authtypes->next) {
- authtype = authtypes->data;
- item = gtk_menu_item_new_with_label (_(authtype->name));
- if (!firstitem)
- firstitem = item;
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_object_set_data (GTK_OBJECT (item), "authtype", authtype);
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (auth_menuitem_activate),
- html);
- }
- gtk_widget_show_all (menu);
- gtk_option_menu_set_history (optionmenu, 0);
- if (firstitem)
- auth_menuitem_activate (GTK_OBJECT (firstitem), html);
-}
-
-static char *
-get_service_url (GtkObject *table)
-{
- CamelURL *url;
- GtkEditable *editable;
- GtkOptionMenu *auth_optionmenu;
- char *url_str;
-
- url = g_new0 (CamelURL, 1);
- url->protocol = g_strdup (gtk_object_get_data (table, "protocol"));
- editable = gtk_object_get_data (table, "user_entry");
- if (editable)
- url->user = gtk_editable_get_chars (editable, 0, -1);
- editable = gtk_object_get_data (table, "server_entry");
- if (editable)
- url->host = gtk_editable_get_chars (editable, 0, -1);
- editable = gtk_object_get_data (table, "path_entry");
- if (editable)
- url->path = gtk_editable_get_chars (editable, 0, -1);
-
- auth_optionmenu = gtk_object_get_data (table, "auth_optionmenu");
- if (auth_optionmenu) {
- GtkWidget *menu, *item;
- CamelServiceAuthType *authtype;
-
- menu = gtk_option_menu_get_menu (auth_optionmenu);
- if (menu) {
- item = gtk_menu_get_active (GTK_MENU (menu));
- authtype = gtk_object_get_data (GTK_OBJECT (item),
- "authtype");
- if (*authtype->authproto)
- url->authmech = g_strdup (authtype->authproto);
- }
- }
-
- url_str = camel_url_to_string (url, FALSE);
- camel_url_free (url);
- return url_str;
-}
-
-static void
-autodetect_cb (GtkWidget *button, GtkObject *table)
-{
- char *url, *err;
- CamelException *ex;
- CamelService *service;
- GList *authtypes;
- GtkHTML *html;
- GtkOptionMenu *optionmenu;
- GtkWidget *parent;
- int type;
-
- type = GPOINTER_TO_UINT (gtk_object_get_data (table, "service_type"));
- url = get_service_url (table);
-
- ex = camel_exception_new ();
- service = camel_session_get_service (session, url, type, ex);
- g_free (url);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
- goto error;
-
- authtypes = camel_service_query_auth_types (service, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE)
- goto error;
-
- html = gtk_object_get_data (table, "auth_html");
- optionmenu = gtk_object_get_data (table, "auth_optionmenu");
- fill_auth_menu (optionmenu, html, authtypes);
- return;
-
- error:
- err = g_strdup_printf ("Could not detect supported "
- "authentication types:\n%s",
- camel_exception_get_description (ex));
- camel_exception_free (ex);
- parent = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
- gnome_error_dialog_parented (err, GTK_WINDOW (parent));
- g_free (err);
-}
-
-static void
-destroy_service (GtkObject *notebook, gpointer urlp)
-{
- char **url = urlp;
- GtkWidget *table;
- int page;
-
- page = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
- table = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page);
- *url = get_service_url (GTK_OBJECT (table));
-}
-
-static void
-add_row (GtkWidget *table, int row, const char *label_text,
- const char *tag, int flag)
-{
- GtkWidget *label, *entry;
-
- label = gtk_label_new (label_text);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1,
- GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
- entry = gtk_entry_new ();
- gtk_table_attach (GTK_TABLE (table), entry, 1, 3, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
- gtk_signal_connect_object (GTK_OBJECT (entry), "changed",
- GTK_SIGNAL_FUNC (service_note_doneness),
- GTK_OBJECT (table));
- gtk_object_set_data (GTK_OBJECT (table), tag, entry);
-}
-
-static GtkWidget *
-create_source (struct service_type *st)
-{
- GtkWidget *table;
- GtkWidget *auth, *auth_optionmenu, *auth_html;
- GtkWidget *autodetect;
- int row, service_flags;
-
- table = gtk_table_new (5, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 8);
- gtk_object_set_data (GTK_OBJECT (table), "protocol",
- st->provider->protocol);
- gtk_object_set_data (GTK_OBJECT (table), "service_type",
- GUINT_TO_POINTER (CAMEL_PROVIDER_STORE));
-
- row = 0;
- service_flags = st->service->url_flags &
- ~CAMEL_SERVICE_URL_NEED_AUTH;
-
- if (service_flags & CAMEL_SERVICE_URL_NEED_HOST) {
- add_row (table, row, _("Server:"), "server_entry",
- CAMEL_SERVICE_URL_NEED_HOST);
- row++;
- }
-
- if (service_flags & CAMEL_SERVICE_URL_NEED_USER) {
- add_row (table, row, _("Username:"), "user_entry",
- CAMEL_SERVICE_URL_NEED_USER);
- row++;
- }
-
- if (service_flags & CAMEL_SERVICE_URL_NEED_PATH) {
- add_row (table, row, _("Path:"), "path_entry",
- CAMEL_SERVICE_URL_NEED_PATH);
- row++;
- }
-
- if (st->authtypes) {
- auth = gtk_label_new (_("Authentication:"));
- gtk_table_attach (GTK_TABLE (table), auth, 0, 1,
- row, row + 1, GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (auth), 1, 0.5);
-
- auth_optionmenu = gtk_option_menu_new ();
- gtk_table_attach (GTK_TABLE (table), auth_optionmenu, 1, 2,
- row, row + 1, GTK_FILL | GTK_EXPAND,
- 0, 0, 0);
- gtk_object_set_data (GTK_OBJECT (table), "auth_optionmenu",
- auth_optionmenu);
-
- autodetect = gtk_button_new_with_label (_("Detect supported types..."));
- gtk_table_attach (GTK_TABLE (table), autodetect, 2, 3,
- row, row + 1, 0, 0, 0, 0);
- gtk_widget_set_sensitive (autodetect, FALSE);
- gtk_signal_connect (GTK_OBJECT (autodetect), "clicked",
- GTK_SIGNAL_FUNC (autodetect_cb), table);
- gtk_object_set_data (GTK_OBJECT (table), "autodetect",
- autodetect);
-
- auth_html = html_new (TRUE);
- gtk_table_attach (GTK_TABLE (table), auth_html->parent->parent,
- 0, 3, row + 1, row + 2,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_object_set_data (GTK_OBJECT (table), "auth_html",
- auth_html);
-
- fill_auth_menu (GTK_OPTION_MENU (auth_optionmenu),
- GTK_HTML (auth_html), st->authtypes);
-
- row += 2;
- }
-
- if (row != 0) {
- GtkWidget *check;
-
- check = gtk_check_button_new_with_label (
- _("Test these values before continuing"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
- gtk_table_attach (GTK_TABLE (table), check, 0, 3,
- row, row + 1, GTK_FILL, GTK_FILL, 0, 0);
- gtk_object_set_data (GTK_OBJECT (table), "check", check);
- row += 1;
- }
-
- gtk_table_resize (GTK_TABLE (table), row, 3);
- gtk_widget_show_all (table);
-
- return table;
-}
-
-static GtkWidget *
-create_transport (struct service_type *st)
-{
- GtkWidget *table;
- GtkWidget *auth, *auth_optionmenu, *auth_html;
- GtkWidget *autodetect;
- int row, service_flags;
-
- table = gtk_table_new (5, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 8);
- gtk_object_set_data (GTK_OBJECT (table), "protocol",
- st->provider->protocol);
- gtk_object_set_data (GTK_OBJECT (table), "service_type",
- GUINT_TO_POINTER (CAMEL_PROVIDER_TRANSPORT));
-
- row = 0;
- service_flags = st->service->url_flags &
- ~CAMEL_SERVICE_URL_NEED_AUTH;
-
- if (service_flags & CAMEL_SERVICE_URL_NEED_HOST) {
- add_row (table, row, _("Server:"), "server_entry",
- CAMEL_SERVICE_URL_NEED_HOST);
- row++;
- }
-
- if (st->authtypes) {
- auth = gtk_label_new (_("Authentication:"));
- gtk_table_attach (GTK_TABLE (table), auth, 0, 1,
- row, row + 1, GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (auth), 1, 0.5);
-
- auth_optionmenu = gtk_option_menu_new ();
- gtk_table_attach (GTK_TABLE (table), auth_optionmenu, 1, 2,
- row, row + 1, GTK_FILL | GTK_EXPAND,
- 0, 0, 0);
- gtk_object_set_data (GTK_OBJECT (table), "auth_optionmenu",
- auth_optionmenu);
-
- autodetect = gtk_button_new_with_label (_("Detect supported types..."));
- gtk_table_attach (GTK_TABLE (table), autodetect, 2, 3,
- row, row + 1, 0, 0, 0, 0);
- gtk_widget_set_sensitive (autodetect, FALSE);
- gtk_object_set_data (GTK_OBJECT (table), "autodetect",
- autodetect);
-
- auth_html = html_new (TRUE);
- gtk_table_attach (GTK_TABLE (table), auth_html->parent->parent,
- 0, 3, row + 1, row + 2,
- GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
-
- fill_auth_menu (GTK_OPTION_MENU (auth_optionmenu),
- GTK_HTML (auth_html), st->authtypes);
-
- row += 2;
- }
-
- if (row != 0) {
- GtkWidget *check;
-
- check = gtk_check_button_new_with_label (
- _("Test these values before continuing"));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
- gtk_table_attach (GTK_TABLE (table), check, 0, 3,
- row, row + 1, GTK_FILL | GTK_EXPAND,
- GTK_FILL, 0, 0);
- gtk_object_set_data (GTK_OBJECT (table), "check", check);
- row += 1;
- }
-
- gtk_table_resize (GTK_TABLE (table), row, 3);
- gtk_widget_show_all (table);
-
- return table;
-}
-
-static void
-stype_menuitem_activate (GtkObject *menuitem, GtkObject *table)
-{
- GtkHTML *html;
- char *text;
- int page;
- GtkNotebook *notebook;
-
- text = gtk_object_get_data (menuitem, "description");
- html = gtk_object_get_data (table, "html");
- put_html (html, text);
-
- page = GPOINTER_TO_UINT (gtk_object_get_data (menuitem, "page"));
- notebook = gtk_object_get_data (table, "notebook");
- gtk_notebook_set_page (notebook, page);
- service_note_doneness (GTK_OBJECT (gtk_notebook_get_nth_page (notebook,
- page)),
- NULL);
-}
-
-/* Create the mail source/transport page. */
-static void
-create_service_page (GtkWidget *vbox, const char *label_text, GList *services,
- GtkWidget *(*create_service)(struct service_type *),
- char **urlp)
-{
- GtkWidget *hbox, *stype, *stype_optionmenu, *stype_menu;
- GtkWidget *menuitem, *first_menuitem = NULL;
- GtkWidget *stype_html, *notebook, *service;
- int page;
- GList *s;
-
- hbox = gtk_hbox_new (FALSE, 8);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
-
- stype = gtk_label_new (label_text);
- gtk_box_pack_start (GTK_BOX (hbox), stype, FALSE, FALSE, 0);
- gtk_misc_set_alignment (GTK_MISC (stype), 1, 0.5);
-
- stype_optionmenu = gtk_option_menu_new ();
- gtk_box_pack_start (GTK_BOX (hbox), stype_optionmenu, TRUE, TRUE, 0);
- stype_menu = gtk_menu_new ();
- gtk_option_menu_set_menu (GTK_OPTION_MENU (stype_optionmenu),
- stype_menu);
-
- stype_html = html_new (TRUE);
- gtk_object_set_data (GTK_OBJECT (vbox), "html", stype_html);
- gtk_box_pack_start (GTK_BOX (vbox), stype_html->parent->parent,
- TRUE, TRUE, 0);
-
- notebook = gtk_notebook_new ();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
- gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
- gtk_object_set_data (GTK_OBJECT (vbox), "notebook", notebook);
- gtk_signal_connect (GTK_OBJECT (notebook), "destroy",
- GTK_SIGNAL_FUNC (destroy_service), urlp);
-
- for (s = services, page = 0; s; s = s->next, page++) {
- struct service_type *st = s->data;
-
- menuitem = gtk_menu_item_new_with_label (_(st->provider->name));
- if (!first_menuitem)
- first_menuitem = menuitem;
- gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
- GTK_SIGNAL_FUNC (stype_menuitem_activate),
- vbox);
- gtk_menu_append (GTK_MENU (stype_menu), menuitem);
-
- service = (*create_service) (st);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook), service,
- NULL);
- gtk_object_set_data (GTK_OBJECT (service), "box", vbox);
-
- gtk_object_set_data (GTK_OBJECT (menuitem), "page",
- GUINT_TO_POINTER (page));
- gtk_object_set_data (GTK_OBJECT (menuitem), "description",
- st->provider->description);
- }
-
- stype_menuitem_activate (GTK_OBJECT (first_menuitem),
- GTK_OBJECT (vbox));
- gtk_option_menu_set_history (GTK_OPTION_MENU (stype_optionmenu), 0);
-
- gtk_widget_show_all (vbox);
-}
-
-static void
-create_source_page (GtkWidget *vbox, GList *sources, char **urlp)
-{
- GtkWidget *html;
-
- html = html_new (FALSE);
- put_html (GTK_HTML (html),
- _("Select the kind of mail server you have, and enter "
- "the relevant information about it.\n\nIf the server "
- "requires authentication, you can click the "
- "\"Detect supported types...\" button after entering "
- "the other information."));
- gtk_box_pack_start (GTK_BOX (vbox), html->parent, FALSE, TRUE, 0);
-
- create_service_page (vbox, "Mail source type:", sources,
- create_source, urlp);
-}
-
-static void
-create_transport_page (GtkWidget *vbox, GList *transports, char **urlp)
-{
- GtkWidget *html;
-
- html = html_new (FALSE);
- put_html (GTK_HTML (html),
- _("Select the method you would like to use to deliver "
- "your mail."));
- gtk_box_pack_start (GTK_BOX (vbox), html->parent, FALSE, TRUE, 0);
-
- create_service_page (vbox, "Mail transport type:", transports,
- create_transport, urlp);
-}
-
-
-/* Generic stuff */
-
-static GList *
-add_service (GList *services, CamelProviderType type, CamelProvider *prov)
-{
- CamelService *service;
- CamelException *ex;
- char *url;
- struct service_type *st;
-
- ex = camel_exception_new ();
-
- url = g_strdup_printf ("%s:", prov->protocol);
- service = camel_session_get_service (session, url, type, ex);
- g_free (url);
- if (!service) {
- camel_exception_free (ex);
- return services;
- }
-
- st = g_new (struct service_type, 1);
- st->provider = prov;
- st->service = service;
- st->authtypes = camel_service_query_auth_types (st->service, ex);
- camel_exception_free (ex);
-
- return g_list_append (services, st);
-}
-
-static GdkImlibImage *
-load_image (const char *name)
-{
- char *path;
- GdkImlibImage *image;
-
- path = g_strdup_printf ("/usr/local/share/images/evolution/%s", name);
- image = gdk_imlib_load_image (path);
- g_free (path);
-
- return image;
-}
-
-static void
-prepare_first (GnomeDruidPage *page, GnomeDruid *druid, gpointer user_data)
-{
- gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE);
-}
-
-static struct identity_record idrec;
-static char *source, *transport;
-
-static void
-cancel (GnomeDruid *druid, gpointer window)
-{
- gtk_window_set_modal (window, FALSE);
- gtk_widget_destroy (window);
- gtk_main_quit ();
-}
-
-static void
-finish (GnomeDruidPage *page, gpointer arg1, gpointer window)
-{
- char *path;
-
- cancel (arg1, window);
-
- /* According to the API docs, there's an easier way to do this,
- * except that it doesn't work. Anyway, this will be replaced
- * by GConf eventually. FIXME.
- */
-
- path = g_strdup_printf ("=%s/config=/mail/configured", evolution_dir);
- gnome_config_set_bool (path, TRUE);
- g_free (path);
-
- path = g_strdup_printf ("=%s/config=/mail/id_name", evolution_dir);
- gnome_config_set_string (path, idrec.name);
- g_free (path);
-
- path = g_strdup_printf ("=%s/config=/mail/id_addr", evolution_dir);
- gnome_config_set_string (path, idrec.address);
- g_free (path);
-
- path = g_strdup_printf ("=%s/config=/mail/id_org", evolution_dir);
- gnome_config_set_string (path, idrec.organization);
- g_free (path);
-
- path = g_strdup_printf ("=%s/config=/mail/id_sig", evolution_dir);
- gnome_config_set_string (path, idrec.sigfile);
- g_free (path);
-
- path = g_strdup_printf ("=%s/config=/mail/source", evolution_dir);
- gnome_config_set_string (path, source);
- g_free (path);
-
- path = g_strdup_printf ("=%s/config=/mail/transport", evolution_dir);
- gnome_config_set_string (path, transport);
- g_free (path);
-
- gnome_config_sync ();
-}
-
-void
-mail_config_druid (void)
-{
- GnomeDruid *druid;
- GtkWidget *page, *window;
- GnomeDruidPageStandard *dpage;
- GList *providers, *p, *sources, *transports;
- GdkImlibImage *mail_logo, *identity_logo;
- GdkImlibImage *source_logo, *transport_logo;
-
- /* Fetch list of all providers. */
- providers = camel_session_list_providers (session, TRUE);
- sources = transports = NULL;
- for (p = providers; p; p = p->next) {
- CamelProvider *prov = p->data;
-
- if (prov->object_types[CAMEL_PROVIDER_STORE]) {
- sources = add_service (sources,
- CAMEL_PROVIDER_STORE,
- prov);
- } else if (prov->object_types[CAMEL_PROVIDER_TRANSPORT]) {
- transports = add_service (transports,
- CAMEL_PROVIDER_TRANSPORT,
- prov);
- }
- }
-
- mail_logo = load_image ("evolution-inbox.png");
- identity_logo = load_image ("malehead.png");
- source_logo = mail_logo;
- transport_logo = load_image ("envelope.png");
-
- window = gtk_window_new (GTK_WINDOW_DIALOG);
- druid = GNOME_DRUID (gnome_druid_new ());
- gtk_signal_connect (GTK_OBJECT (druid), "cancel",
- GTK_SIGNAL_FUNC (cancel), window);
-
- /* Start page */
- page = gnome_druid_page_start_new_with_vals (
- _("Mail Configuration"),
- "Welcome to the Evolution Mail configuration wizard!\n"
- "By filling in some information about your email\n"
- "settings,you can start sending and receiving email\n"
- "right away. Click \"Next\" to continue.",
- mail_logo, NULL);
-
- gnome_druid_page_start_set_logo_bg_color (
- GNOME_DRUID_PAGE_START (page),
- &GNOME_DRUID_PAGE_START (page)->background_color);
- gnome_druid_append_page (druid, GNOME_DRUID_PAGE (page));
- gtk_signal_connect (GTK_OBJECT (page), "prepare",
- GTK_SIGNAL_FUNC (prepare_first), NULL);
- gtk_widget_show_all (page);
-
-
- /* Identity page */
- page = gnome_druid_page_standard_new_with_vals (_("Identity"),
- identity_logo);
- dpage = GNOME_DRUID_PAGE_STANDARD (page);
- gnome_druid_page_standard_set_logo_bg_color (dpage,
- &dpage->background_color);
- gtk_container_set_border_width (GTK_CONTAINER (dpage->vbox), 8);
- gtk_box_set_spacing (GTK_BOX (dpage->vbox), 5);
- create_identity_page (dpage->vbox, &idrec);
- gtk_object_set_data (GTK_OBJECT (dpage->vbox), "exit_button",
- druid->next);
- gnome_druid_append_page (druid, GNOME_DRUID_PAGE (page));
- gtk_signal_connect (GTK_OBJECT (page), "prepare",
- GTK_SIGNAL_FUNC (prepare_identity), dpage->vbox);
- gtk_signal_connect (GTK_OBJECT (page), "next",
- GTK_SIGNAL_FUNC (identity_next), dpage->vbox);
- gtk_widget_show (page);
-
-
- /* Source page */
- page = gnome_druid_page_standard_new_with_vals (_("Mail Source"),
- source_logo);
- dpage = GNOME_DRUID_PAGE_STANDARD (page);
- gnome_druid_page_standard_set_logo_bg_color (dpage,
- &dpage->background_color);
- gtk_container_set_border_width (GTK_CONTAINER (dpage->vbox), 8);
- gtk_box_set_spacing (GTK_BOX (dpage->vbox), 5);
- create_source_page (dpage->vbox, sources, &source);
- gtk_object_set_data (GTK_OBJECT (dpage->vbox), "exit_button",
- druid->next);
- gnome_druid_append_page (druid, GNOME_DRUID_PAGE (page));
- gtk_signal_connect (GTK_OBJECT (page), "prepare",
- GTK_SIGNAL_FUNC (prepare_service), dpage->vbox);
- gtk_widget_show (page);
-
-
- /* Transport page */
- page = gnome_druid_page_standard_new_with_vals (_("Mail Transport"),
- transport_logo);
- dpage = GNOME_DRUID_PAGE_STANDARD (page);
- gnome_druid_page_standard_set_logo_bg_color (dpage,
- &dpage->background_color);
- gtk_container_set_border_width (GTK_CONTAINER (dpage->vbox), 8);
- gtk_box_set_spacing (GTK_BOX (dpage->vbox), 5);
- create_transport_page (dpage->vbox, transports, &transport);
- gtk_object_set_data (GTK_OBJECT (dpage->vbox), "exit_button",
- druid->next);
- gnome_druid_append_page (druid, GNOME_DRUID_PAGE (page));
- gtk_signal_connect (GTK_OBJECT (page), "prepare",
- GTK_SIGNAL_FUNC (prepare_service), dpage->vbox);
- gtk_widget_show (page);
-
-
- /* Finish page */
- page = gnome_druid_page_finish_new_with_vals (
- _("Mail Configuration"),
- "Your email configuration is now complete.\n"
- "Click \"finish\" to save your new settings",
- mail_logo, NULL);
- gnome_druid_page_finish_set_logo_bg_color (
- GNOME_DRUID_PAGE_FINISH (page),
- &GNOME_DRUID_PAGE_FINISH (page)->background_color);
- gnome_druid_append_page (druid, GNOME_DRUID_PAGE (page));
- gtk_signal_connect (GTK_OBJECT (page), "finish",
- GTK_SIGNAL_FUNC (finish), window);
- gtk_widget_show_all (page);
-
- gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (druid));
-
- gtk_widget_show (GTK_WIDGET (druid));
- gtk_widget_show (window);
- gtk_widget_queue_resize (window);
- gnome_druid_set_buttons_sensitive (druid, FALSE, TRUE, TRUE);
-
- gtk_window_set_modal (GTK_WINDOW (window), TRUE);
- gtk_main ();
-}
diff --git a/mail/mail-display.c b/mail/mail-display.c
deleted file mode 100644
index b72169327e..0000000000
--- a/mail/mail-display.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * mail-display.c: Mail display widget
- *
- * Author:
- * Miguel de Icaza
- * Bertrand Guiheneuf (bg@aful.org)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <gnome.h>
-#include "e-util/e-setup.h"
-#include "e-util/e-util.h"
-#include "mail-display.h"
-#include "mail.h"
-
-#define PARENT_TYPE (gtk_vbox_get_type ())
-
-static GtkObjectClass *mail_display_parent_class;
-
-
-/*----------------------------------------------------------------------*
- * Callbacks
- *----------------------------------------------------------------------*/
-
-static void
-save_data_eexist_cb (int reply, gpointer user_data)
-{
- gboolean *ok = user_data;
-
- *ok = reply == 0;
- gtk_main_quit ();
-}
-
-static void
-save_data_cb (GtkWidget *widget, gpointer user_data)
-{
- CamelDataWrapper *data = user_data;
- CamelStream *stream_fs;
- GtkFileSelection *file_select = (GtkFileSelection *)
- gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION);
- char *name;
- int fd;
-
- name = gtk_file_selection_get_filename (file_select);
-
- fd = open (name, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
- if (fd == -1 && errno == EEXIST) {
- gboolean ok = FALSE;
-
- gnome_ok_cancel_dialog_modal_parented (
- "A file by that name already exists.\nOverwrite it?",
- save_data_eexist_cb, &ok, GTK_WINDOW (file_select));
- gtk_main ();
- if (!ok)
- return;
- fd = open (name, O_WRONLY | O_TRUNC);
- }
-
- if (fd == -1) {
- char *msg;
-
- msg = g_strdup_printf ("Could not open file %s:\n%s",
- name, g_strerror (errno));
- gnome_error_dialog_parented (msg, GTK_WINDOW (file_select));
- return;
- }
-
- stream_fs = camel_stream_fs_new_with_fd (fd);
- if (camel_data_wrapper_write_to_stream (data, stream_fs) == -1
- || camel_stream_flush (stream_fs) == -1) {
- char *msg;
-
- msg = g_strdup_printf ("Could not write data: %s", strerror(errno));
- gnome_error_dialog_parented (msg, GTK_WINDOW (file_select));
- }
- gtk_object_unref (GTK_OBJECT (stream_fs));
-
- gtk_widget_destroy (GTK_WIDGET (file_select));
-}
-
-static void
-save_data (const char *cid, CamelMimeMessage *message)
-{
- CamelDataWrapper *data;
- GtkFileSelection *file_select;
- char *filename;
-
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
- data = gtk_object_get_data (GTK_OBJECT (message), cid);
- g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data));
-
- file_select = GTK_FILE_SELECTION (gtk_file_selection_new ("Save Attachment"));
- filename = gtk_object_get_data (GTK_OBJECT (data), "filename");
- if (filename)
- filename = g_strdup_printf ("%s/%s", evolution_dir, filename);
- else
- filename = g_strdup_printf ("%s/attachment", evolution_dir);
- gtk_file_selection_set_filename (file_select, filename);
- g_free (filename);
-
- gtk_signal_connect (GTK_OBJECT (file_select->ok_button), "clicked",
- GTK_SIGNAL_FUNC (save_data_cb), data);
- gtk_signal_connect_object (GTK_OBJECT (file_select->cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (file_select));
-
- gtk_widget_show (GTK_WIDGET (file_select));
-}
-
-static void
-on_link_clicked (GtkHTML *html, const char *url, gpointer user_data)
-{
- if (!strncasecmp (url, "news:", 5) ||
- !strncasecmp (url, "nntp:", 5))
- g_warning ("Can't handle news URLs yet.");
- else if (!strncasecmp (url, "mailto:", 7))
- send_to_url (url);
- else if (!strncasecmp (url, "cid:", 4))
- save_data (url + 4, user_data);
- else
- gnome_url_show (url);
-}
-
-static void
-on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
- gpointer user_data)
-{
- CamelMimeMessage *message = CAMEL_MIME_MESSAGE (user_data);
-
- if (strncmp (url, "x-gnome-icon:", 13) == 0) {
- const char *name = url + 13;
- /* FIXME: gnome_pixmap_file will cheerily accept icon
- * names like "../../../dev/zero". Anyway, this whole
- * hack needs to be replaced with something more
- * efficient anyway.
- */
- char *path = gnome_pixmap_file (name), buf[1024];
- int fd, nread;
-
- g_return_if_fail (path != NULL);
- fd = open (path, O_RDONLY);
- g_free (path);
- g_return_if_fail (fd != -1);
-
- while (1) {
- nread = read (fd, buf, sizeof (buf));
- if (nread < 1)
- break;
- gtk_html_write (html, handle, buf, nread);
- }
- close (fd);
- } else if (strncmp (url, "cid:", 4) == 0) {
- const char *cid = url + 4;
- CamelDataWrapper *data;
- CamelStream *stream_mem;
- GByteArray *ba;
-
- data = gtk_object_get_data (GTK_OBJECT (message), cid);
- g_return_if_fail (CAMEL_IS_DATA_WRAPPER (data));
-
- ba = g_byte_array_new ();
- stream_mem = camel_stream_mem_new_with_byte_array (ba);
- camel_data_wrapper_write_to_stream (data, stream_mem);
- gtk_html_write (html, handle, ba->data, ba->len);
- gtk_object_unref (GTK_OBJECT (stream_mem));
- } else
- return;
-}
-
-/* HTML part code */
-static void
-html_size_req (GtkWidget *widget, GtkRequisition *requisition)
-{
- requisition->height = GTK_LAYOUT (widget)->height;
- requisition->width = GTK_LAYOUT (widget)->width;
-}
-
-void
-mail_html_new (GtkHTML **html, GtkHTMLStream **stream,
- CamelMimeMessage *root, gboolean init)
-{
- *html = GTK_HTML (gtk_html_new ());
- gtk_html_set_editable (*html, FALSE);
- gtk_signal_connect (GTK_OBJECT (*html), "size_request",
- GTK_SIGNAL_FUNC (html_size_req), NULL);
- gtk_signal_connect (GTK_OBJECT (*html), "url_requested",
- GTK_SIGNAL_FUNC (on_url_requested), root);
- gtk_signal_connect (GTK_OBJECT (*html), "link_clicked",
- GTK_SIGNAL_FUNC (on_link_clicked), root);
-
- *stream = gtk_html_begin (*html);
- if (init) {
- mail_html_write (*html, *stream, HTML_HEADER
- "<BODY TEXT=\"#000000\" "
- "BGCOLOR=\"#FFFFFF\">\n");
- }
-}
-
-void
-mail_html_write (GtkHTML *html, GtkHTMLStream *stream,
- const char *format, ...)
-{
- char *buf;
- va_list ap;
-
- va_start (ap, format);
- buf = g_strdup_vprintf (format, ap);
- va_end (ap);
- gtk_html_write (html, stream, buf, strlen (buf));
- g_free (buf);
-}
-
-void
-mail_html_end (GtkHTML *html, GtkHTMLStream *stream, gboolean finish, GtkBox *box)
-{
- GtkWidget *scroll;
-
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_NEVER,
- GTK_POLICY_NEVER);
- gtk_container_add (GTK_CONTAINER (scroll), GTK_WIDGET (html));
-
- if (finish)
- mail_html_write (html, stream, "</BODY></HTML>\n");
- gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
-
- gtk_box_pack_start (box, scroll, FALSE, TRUE, 0);
- gtk_widget_show (GTK_WIDGET (html));
- gtk_widget_show (scroll);
-}
-
-
-
-
-/**
- * mail_display_set_message:
- * @mail_display: the mail display object
- * @mime_message: the input camel medium
- *
- * Makes the mail_display object show the contents of the medium
- * param. This means feeding mail_display->body_stream and
- * mail_display->headers_stream with html.
- *
- **/
-void
-mail_display_set_message (MailDisplay *mail_display,
- CamelMedium *medium)
-{
- GtkAdjustment *adj;
-
- /*
- * for the moment, camel-formatter deals only with
- * mime messages, but in the future, it should be
- * able to deal with any medium.
- * It can work on pretty much data wrapper, but in
- * fact, only the medium class has the distinction
- * header / body
- */
- if (!CAMEL_IS_MIME_MESSAGE (medium))
- return;
-
- /* Clean up from previous message. */
- if (mail_display->current_message) {
- GtkContainer *container =
- GTK_CONTAINER (mail_display->inner_box);
- GList *htmls;
-
- htmls = gtk_container_children (container);
- while (htmls) {
- gtk_container_remove (container, htmls->data);
- htmls = htmls->next;
- }
-
- gtk_object_unref (GTK_OBJECT (mail_display->current_message));
- }
-
- mail_display->current_message = CAMEL_MIME_MESSAGE (medium);
- gtk_object_ref (GTK_OBJECT (medium));
-
- mail_format_mime_message (CAMEL_MIME_MESSAGE (medium),
- mail_display->inner_box);
-
- adj = gtk_scrolled_window_get_vadjustment (mail_display->scroll);
- gtk_adjustment_set_value (adj, 0);
- gtk_scrolled_window_set_vadjustment (mail_display->scroll, adj);
-
- adj = gtk_scrolled_window_get_hadjustment (mail_display->scroll);
- gtk_adjustment_set_value (adj, 0);
- gtk_scrolled_window_set_hadjustment (mail_display->scroll, adj);
-}
-
-
-/*----------------------------------------------------------------------*
- * Standard Gtk+ Class functions
- *----------------------------------------------------------------------*/
-
-static void
-mail_display_init (GtkObject *object)
-{
- MailDisplay *mail_display = MAIL_DISPLAY (object);
-
- /* various other initializations */
- mail_display->current_message = NULL;
-}
-
-static void
-mail_display_destroy (GtkObject *object)
-{
- /* MailDisplay *mail_display = MAIL_DISPLAY (object); */
-
- mail_display_parent_class->destroy (object);
-}
-
-static void
-mail_display_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = mail_display_destroy;
- mail_display_parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-GtkWidget *
-mail_display_new (FolderBrowser *parent_folder_browser)
-{
- MailDisplay *mail_display = gtk_type_new (mail_display_get_type ());
- GtkWidget *scroll, *vbox;
-
- g_assert (parent_folder_browser);
-
- mail_display->parent_folder_browser = parent_folder_browser;
-
- gtk_box_set_homogeneous (GTK_BOX (mail_display), FALSE);
- gtk_widget_show (GTK_WIDGET (mail_display));
-
- /* For now, the box only contains a single scrolled window,
- * which in turn contains a vbox itself.
- */
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_ALWAYS);
- gtk_box_pack_start_defaults (GTK_BOX (mail_display),
- GTK_WIDGET (scroll));
- gtk_widget_show (GTK_WIDGET (scroll));
-
- vbox = gtk_vbox_new (FALSE, 2);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scroll),
- vbox);
- gtk_widget_show (GTK_WIDGET (vbox));
-
- mail_display->scroll = GTK_SCROLLED_WINDOW (scroll);
- mail_display->inner_box = GTK_BOX (vbox);
-
- return GTK_WIDGET (mail_display);
-}
-
-
-
-E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE);
diff --git a/mail/mail-display.h b/mail/mail-display.h
deleted file mode 100644
index 0d38d4e432..0000000000
--- a/mail/mail-display.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#ifndef _MAIL_DISPLAY_H_
-#define _MAIL_DISPLAY_H_
-
-#include <gtk/gtkvbox.h>
-#include <gtkhtml/gtkhtml.h>
-#include "camel/camel-stream.h"
-#include "camel/camel-mime-message.h"
-#include "folder-browser.h"
-
-
-#define MAIL_DISPLAY_TYPE (mail_display_get_type ())
-#define MAIL_DISPLAY(o) (GTK_CHECK_CAST ((o), MAIL_DISPLAY_TYPE, MailDisplay))
-#define MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), MAIL_DISPLAY_TYPE, MailDisplayClass))
-#define IS_MAIL_DISPLAY(o) (GTK_CHECK_TYPE ((o), MAIL_DISPLAY_TYPE))
-#define IS_MAIL_DISPLAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), MAIL_DISPLAY_TYPE))
-
-struct _MailDisplay {
- GtkVBox parent;
-
- GtkScrolledWindow *scroll;
- GtkBox *inner_box;
-
- FolderBrowser *parent_folder_browser;
- CamelMimeMessage *current_message;
-};
-
-typedef struct {
- GtkVBoxClass parent_class;
-} MailDisplayClass;
-
-GtkType mail_display_get_type (void);
-GtkWidget * mail_display_new (FolderBrowser *parent_folder_browser);
-
-void mail_display_set_message (MailDisplay *mail_display,
- CamelMedium *medium);
-
-
-#define HTML_HEADER "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<HTML>\n<HEAD>\n<META NAME=\"GENERATOR\" CONTENT=\"Evolution Mail Component\">\n</HEAD>\n"
-
-void mail_html_new (GtkHTML **html,
- GtkHTMLStream **stream,
- CamelMimeMessage *root,
- gboolean init);
-void mail_html_write (GtkHTML *html,
- GtkHTMLStream *stream,
- const char *format, ...);
-void mail_html_end (GtkHTML *html,
- GtkHTMLStream *stream,
- gboolean finish,
- GtkBox *box);
-
-#endif /* _MAIL_DISPLAY_H_ */
diff --git a/mail/mail-format.c b/mail/mail-format.c
deleted file mode 100644
index ad7aa0fff6..0000000000
--- a/mail/mail-format.c
+++ /dev/null
@@ -1,1335 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Authors:
- * Matt Loper <matt@helixcode.com>
- * Dan Winship <danw@helixcode.com>
- *
- * 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 <config.h>
-#include "mail-display.h"
-#include "mail.h"
-#include "e-util/e-html-utils.h"
-
-#include <libgnome/libgnome.h>
-#include <bonobo.h>
-#include <libgnorba/gnorba.h>
-#include <bonobo/bonobo-stream-memory.h>
-
-#include <ctype.h> /* for isprint */
-#include <string.h> /* for strstr */
-#include <fcntl.h>
-
-static void handle_text_plain (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_text_plain_flowed (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_text_enriched (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_text_html (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_image (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_multipart_mixed (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_multipart_related (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_multipart_alternative (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_multipart_appledouble (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_audio (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_message_rfc822 (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-
-static void handle_unknown_type (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-static void handle_via_bonobo (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-
-/* writes the header info for a mime message into an html stream */
-static void write_headers (CamelMimeMessage *mime_message, GtkBox *box);
-
-/* dispatch html printing via mimetype */
-static void call_handler_function (CamelMimePart *part,
- CamelMimeMessage *root,
- GtkBox *box);
-
-
-
-/**
- * mail_format_mime_message:
- * @mime_message: the input mime message
- * @box: GtkBox to stack elements into.
- *
- * Writes a CamelMimeMessage out, as a series of GtkHTML objects,
- * into the provided box.
- **/
-void
-mail_format_mime_message (CamelMimeMessage *mime_message, GtkBox *box)
-{
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
- g_return_if_fail (GTK_IS_BOX (box));
-
- write_headers (mime_message, box);
- call_handler_function (CAMEL_MIME_PART (mime_message),
- mime_message, box);
-}
-
-static char *
-get_cid (CamelMimePart *part, CamelMimeMessage *root)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- char *cid;
- const char *filename;
-
- /* If we have a real Content-ID, use it. If we don't,
- * make a (syntactically invalid) fake one.
- */
- if (camel_mime_part_get_content_id (part))
- cid = g_strdup (camel_mime_part_get_content_id (part));
- else
- cid = g_strdup_printf ("@@@%p", wrapper);
-
- gtk_object_set_data (GTK_OBJECT (root), cid, wrapper);
-
- /* Record the filename, in case the user wants to save this
- * data later.
- */
- filename = camel_mime_part_get_filename (part);
- if (filename) {
- char *safe, *p;
-
- safe = strrchr (filename, '/');
- if (safe)
- safe = g_strdup (safe + 1);
- else
- safe = g_strdup (filename);
-
- for (p = safe; *p; p++) {
- if (!isascii ((unsigned char)*p) ||
- strchr (" /'\"`&();|<>${}!", *p))
- *p = '_';
- }
-
- gtk_object_set_data (GTK_OBJECT (wrapper), "filename", safe);
- }
-
- return cid;
-}
-
-
-/* We're maintaining a hashtable of mimetypes -> functions;
- * Those functions have the following signature...
- */
-typedef void (*mime_handler_fn) (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box);
-
-static GHashTable *mime_function_table, *mime_fallback_table;
-
-static void
-setup_function_table (void)
-{
- mime_function_table = g_hash_table_new (g_str_hash, g_str_equal);
- mime_fallback_table = g_hash_table_new (g_str_hash, g_str_equal);
-
- g_hash_table_insert (mime_function_table, "text/plain",
- handle_text_plain);
- g_hash_table_insert (mime_function_table, "text/richtext",
- handle_text_enriched);
- g_hash_table_insert (mime_function_table, "text/enriched",
- handle_text_enriched);
- g_hash_table_insert (mime_function_table, "text/html",
- handle_text_html);
-
- g_hash_table_insert (mime_function_table, "image/*",
- handle_image);
-
- g_hash_table_insert (mime_function_table, "audio/*",
- handle_audio);
-
- g_hash_table_insert (mime_function_table, "message/rfc822",
- handle_message_rfc822);
-
- g_hash_table_insert (mime_function_table, "multipart/alternative",
- handle_multipart_alternative);
- g_hash_table_insert (mime_function_table, "multipart/related",
- handle_multipart_related);
- g_hash_table_insert (mime_function_table, "multipart/mixed",
- handle_multipart_mixed);
- g_hash_table_insert (mime_function_table, "multipart/appledouble",
- handle_multipart_appledouble);
-
- /* RFC 2046 says unrecognized text subtypes can be treated
- * as text/plain (as long as you recognize the character set),
- * and unrecognized multipart subtypes as multipart/mixed.
- */
- g_hash_table_insert (mime_fallback_table, "text/*",
- handle_text_plain);
- g_hash_table_insert (mime_function_table, "multipart/*",
- handle_multipart_mixed);
-}
-
-static mime_handler_fn
-lookup_handler (const char *mime_type, gboolean *generic)
-{
- mime_handler_fn handler_function;
- const char *whole_goad_id, *generic_goad_id;
- char *mime_type_main;
-
- if (mime_function_table == NULL)
- setup_function_table ();
-
- mime_type_main = g_strdup_printf ("%.*s/*",
- (int)strcspn (mime_type, "/"),
- mime_type);
-
- /* OK. There are 6 possibilities, which we try in this order:
- * 1) full match in the main table
- * 2) partial match in the main table
- * 3) full match in bonobo
- * 4) full match in the fallback table
- * 5) partial match in the fallback table
- * 6) partial match in bonobo
- *
- * Of these, 1-4 are considered exact matches, and 5 and 6 are
- * considered generic.
- */
-
- /* Check for full match in mime_function_table. */
- handler_function = g_hash_table_lookup (mime_function_table,
- mime_type);
- if (!handler_function) {
- handler_function = g_hash_table_lookup (mime_function_table,
- mime_type_main);
- if (handler_function) {
- /* Optimize this for the next time through. */
- g_hash_table_insert (mime_function_table,
- g_strdup (mime_type),
- handler_function);
- }
- }
-
- if (handler_function) {
- g_free (mime_type_main);
- *generic = FALSE;
- return handler_function;
- }
-
- whole_goad_id = gnome_mime_get_value (mime_type, "bonobo-goad-id");
- generic_goad_id = gnome_mime_get_value (mime_type_main,
- "bonobo-goad-id");
-
- if (whole_goad_id && (!generic_goad_id ||
- strcmp (whole_goad_id, generic_goad_id) != 0)) {
- /* Optimize this for the next time through. */
- g_hash_table_insert (mime_function_table,
- g_strdup (mime_type),
- handle_via_bonobo);
- g_free (mime_type_main);
- *generic = FALSE;
- return handle_via_bonobo;
- }
-
- handler_function = g_hash_table_lookup (mime_fallback_table,
- mime_type);
- if (handler_function)
- *generic = FALSE;
- else {
- handler_function = g_hash_table_lookup (mime_fallback_table,
- mime_type_main);
- if (!handler_function && generic_goad_id)
- handler_function = handle_via_bonobo;
- *generic = TRUE;
- }
-
- g_free (mime_type_main);
- return handler_function;
-}
-
-static void
-call_handler_function (CamelMimePart *part, CamelMimeMessage *root,
- GtkBox *box)
-{
- CamelDataWrapper *wrapper;
- mime_handler_fn handler_function = NULL;
- gboolean generic;
- char *mime_type;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- mime_type = camel_data_wrapper_get_mime_type (wrapper);
- g_strdown (mime_type);
- handler_function = lookup_handler (mime_type, &generic);
- g_free (mime_type);
-
- if (handler_function)
- (*handler_function) (part, root, box);
- else
- handle_unknown_type (part, root, box);
-}
-
-static void
-write_field_to_stream (const char *description, const char *value,
- gboolean bold, GtkHTML *html,
- GtkHTMLStream *stream)
-{
- char *encoded_value;
-
- if (value) {
- unsigned char *p;
-
- encoded_value = e_text_to_html (value,
- E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_URLS);
- for (p = (unsigned char *)encoded_value; *p; p++) {
- if (!isprint (*p))
- *p = '?';
- }
- } else
- encoded_value = "";
-
- mail_html_write (html, stream,
- "<tr valign=top><%s align=right>%s</%s>"
- "<td>%s</td></tr>", bold ? "th" : "td",
- description, bold ? "th" : "td", encoded_value);
- if (value)
- g_free (encoded_value);
-}
-
-static void
-write_recipients_to_stream (const gchar *recipient_type,
- const CamelInternetAddress *recipients,
- gboolean optional, gboolean bold,
- GtkHTML *html, GtkHTMLStream *stream)
-{
- int i;
- char *recipients_string = NULL;
- const char *name, *addr;
-
- i = 0;
- while (camel_internet_address_get (recipients, i++, &name, &addr)) {
- char *old_string = recipients_string;
- recipients_string =
- g_strdup_printf ("%s%s%s%s%s <%s>",
- old_string ? old_string : "",
- old_string ? ", " : "",
- *name ? "\"" : "", name,
- *name ? "\"" : "", addr);
- g_free (old_string);
- }
-
- if (recipients_string || !optional) {
- write_field_to_stream (recipient_type, recipients_string,
- bold, html, stream);
- }
- g_free (recipients_string);
-}
-
-
-
-static void
-write_headers (CamelMimeMessage *mime_message, GtkBox *box)
-{
- const CamelInternetAddress *recipients;
- GtkHTML *html;
- GtkHTMLStream *stream;
-
- mail_html_new (&html, &stream, mime_message, FALSE);
- mail_html_write (html, stream, "%s%s", HTML_HEADER,
- "<BODY TEXT=\"#000000\" BGCOLOR=\"#EEEEEE\">\n");
-
- mail_html_write (html, stream, "<table>");
-
- /* A few fields will probably be available from the mime_message;
- * for each one that's available, write it to the output stream
- * with a helper function, 'write_field_to_stream'.
- */
-
- write_field_to_stream ("From:",
- camel_mime_message_get_from (mime_message),
- TRUE, html, stream);
-
- if (camel_mime_message_get_reply_to (mime_message)) {
- write_field_to_stream ("Reply-To:",
- camel_mime_message_get_reply_to (mime_message),
- FALSE, html, stream);
- }
-
- write_recipients_to_stream ("To:",
- camel_mime_message_get_recipients (mime_message, CAMEL_RECIPIENT_TYPE_TO),
- FALSE, TRUE, html, stream);
-
- recipients = camel_mime_message_get_recipients (mime_message, CAMEL_RECIPIENT_TYPE_CC);
- write_recipients_to_stream ("Cc:", recipients, TRUE, TRUE,
- html, stream);
- write_field_to_stream ("Subject:",
- camel_mime_message_get_subject (mime_message),
- TRUE, html, stream);
-
- mail_html_write (html, stream, "</table>");
-
- mail_html_end (html, stream, TRUE, box);
-}
-
-#define MIME_TYPE_WHOLE(a) (gmime_content_field_get_mime_type ( \
- camel_mime_part_get_content_type (CAMEL_MIME_PART (a))))
-#define MIME_TYPE_MAIN(a) ((camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))->type)
-#define MIME_TYPE_SUB(a) ((camel_mime_part_get_content_type (CAMEL_MIME_PART (a)))->subtype)
-
-
-static char *
-get_data_wrapper_text (CamelDataWrapper *data)
-{
- CamelStream *memstream;
- GByteArray *ba;
- char *text;
-
- ba = g_byte_array_new ();
- memstream = camel_stream_mem_new_with_byte_array (ba);
-
- camel_data_wrapper_write_to_stream (data, memstream);
- text = g_malloc (ba->len + 1);
- memcpy (text, ba->data, ba->len);
- text[ba->len] = '\0';
-
- gtk_object_unref (GTK_OBJECT (memstream));
- return text;
-}
-
-/*----------------------------------------------------------------------*
- * Mime handling functions
- *----------------------------------------------------------------------*/
-
-static void
-handle_text_plain (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- GtkHTML *html;
- GtkHTMLStream *stream;
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- char *text, *htmltext;
- GMimeContentField *type;
- const char *format;
-
- mail_html_new (&html, &stream, root, TRUE);
- mail_html_write (html, stream, "\n<!-- text/plain -->\n<pre>\n");
-
- /* Check for RFC 2646 flowed text. */
- type = camel_mime_part_get_content_type (part);
- format = gmime_content_field_get_parameter (type, "format");
- if (format && !g_strcasecmp (format, "flowed")) {
- handle_text_plain_flowed (part, root, box);
- return;
- }
-
- text = get_data_wrapper_text (wrapper);
- if (text && *text) {
- htmltext = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_URLS);
- mail_html_write (html, stream, "%s", htmltext);
- g_free (htmltext);
- } else
- mail_html_write (html, stream, "<b>(empty)</b>");
- g_free (text);
-
- mail_html_write (html, stream, "</pre>\n");
- mail_html_end (html, stream, TRUE, box);
-}
-
-static void
-handle_text_plain_flowed (CamelMimePart *part, CamelMimeMessage *root,
- GtkBox *box)
-{
- GtkHTML *html;
- GtkHTMLStream *stream;
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- char *buf, *text, *line, *eol, *p;
- int prevquoting = 0, quoting, len;
- gboolean br_pending = FALSE;
-
- mail_html_new (&html, &stream, root, TRUE);
- mail_html_write (html, stream,
- "\n<!-- text/plain, flowed -->\n<tt>\n");
-
- buf = get_data_wrapper_text (wrapper);
- for (line = buf; *line; line = eol + 1) {
- /* Process next line */
- eol = strchr (line, '\n');
- if (eol)
- *eol = '\0';
-
- quoting = 0;
- for (p = line; *p == '>'; p++)
- quoting++;
- if (quoting != prevquoting) {
- mail_html_write (html, stream, "%s\n",
- prevquoting == 0 ? "<i>\n" : "");
- while (quoting > prevquoting) {
- mail_html_write (html, stream, "<blockquote>");
- prevquoting++;
- }
- while (quoting < prevquoting) {
- mail_html_write (html, stream,
- "</blockquote>");
- prevquoting--;
- }
- mail_html_write (html, stream, "%s\n",
- prevquoting == 0 ? "</i>\n" : "");
- } else if (br_pending) {
- mail_html_write (html, stream, "<br>\n");
- br_pending = FALSE;
- }
-
- if (*p == ' ')
- p++;
-
- /* replace '<' with '&lt;', etc. */
- text = e_text_to_html (p, E_TEXT_TO_HTML_CONVERT_SPACES |
- E_TEXT_TO_HTML_CONVERT_URLS);
- if (text && *text)
- mail_html_write (html, stream, "%s", text);
- g_free (text);
-
- len = strlen (p);
- if (len == 0 || p[len - 1] != ' ' || !strcmp (p, "-- "))
- br_pending = TRUE;
-
- if (!eol)
- break;
- }
- g_free (buf);
-
- mail_html_write (html, stream, "</tt>\n");
- mail_html_end (html, stream, TRUE, box);
-}
-
-/* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */
-static void
-handle_text_enriched (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- static GHashTable *translations = NULL;
- GtkHTML *html;
- GtkHTMLStream *stream;
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- CamelStream *memstream;
- GByteArray *ba;
- char *p;
- int len, nofill = 0;
-
- if (!translations) {
- translations = g_hash_table_new (g_strcase_hash,
- g_strcase_equal);
- g_hash_table_insert (translations, "bold", "<b>");
- g_hash_table_insert (translations, "/bold", "</b>");
- g_hash_table_insert (translations, "italic", "<i>");
- g_hash_table_insert (translations, "/italic", "</i>");
- g_hash_table_insert (translations, "fixed", "<tt>");
- g_hash_table_insert (translations, "/fixed", "</tt>");
- g_hash_table_insert (translations, "smaller", "<font size=-1>");
- g_hash_table_insert (translations, "/smaller", "</font>");
- g_hash_table_insert (translations, "bigger", "<font size=+1>");
- g_hash_table_insert (translations, "/bigger", "</font>");
- g_hash_table_insert (translations, "underline", "<u>");
- g_hash_table_insert (translations, "/underline", "</u>");
- g_hash_table_insert (translations, "center", "<p align=center>");
- g_hash_table_insert (translations, "/center", "</p>");
- g_hash_table_insert (translations, "flushleft", "<p align=left>");
- g_hash_table_insert (translations, "/flushleft", "</p>");
- g_hash_table_insert (translations, "flushright", "<p align=right>");
- g_hash_table_insert (translations, "/flushright", "</p>");
- g_hash_table_insert (translations, "excerpt", "<blockquote>");
- g_hash_table_insert (translations, "/excerpt", "</blockquote>");
- g_hash_table_insert (translations, "paragraph", "<p>");
- g_hash_table_insert (translations, "signature", "<address>");
- g_hash_table_insert (translations, "/signature", "</address>");
- g_hash_table_insert (translations, "comment", "<!-- ");
- g_hash_table_insert (translations, "/comment", " -->");
- g_hash_table_insert (translations, "param", "<!-- ");
- g_hash_table_insert (translations, "/param", " -->");
- g_hash_table_insert (translations, "nl", "<br>");
- g_hash_table_insert (translations, "np", "<hr>");
- }
-
- mail_html_new (&html, &stream, root, TRUE);
- mail_html_write (html, stream, "\n<!-- text/enriched -->\n");
-
- ba = g_byte_array_new ();
- memstream = camel_stream_mem_new_with_byte_array (ba);
- camel_data_wrapper_write_to_stream (wrapper, memstream);
- g_byte_array_append (ba, "", 1);
-
- p = ba->data;
-
- while (p) {
- len = strcspn (p, " <>&\n");
- if (len)
- gtk_html_write (html, stream, p, len);
-
- p += len;
- if (!*p)
- break;
-
- switch (*p++) {
- case ' ':
- while (*p == ' ') {
- mail_html_write (html, stream, "&nbsp;");
- p++;
- }
- mail_html_write (html, stream, " ");
- break;
-
- case '\n':
- mail_html_write (html, stream, " ");
- if (nofill <= 0) {
- while (*p == '\n') {
- mail_html_write (html, stream, "<br>");
- p++;
- }
- }
- break;
-
- case '>':
- mail_html_write (html, stream, "&gt;");
- break;
-
- case '&':
- mail_html_write (html, stream, "&amp;");
- break;
-
- case '<':
- if (*p == '<') {
- mail_html_write (html, stream, "&lt;");
- break;
- }
-
- if (strncmp (p, "lt>", 3) == 0)
- mail_html_write (html, stream, "&lt;");
- else if (strncmp (p, "nofill>", 7) == 0) {
- nofill++;
- mail_html_write (html, stream, "<pre>");
- } else if (strncmp (p, "/nofill>", 8) == 0) {
- nofill--;
- mail_html_write (html, stream, "</pre>");
- } else {
- char *copy, *match;
-
- len = strcspn (p, ">");
- copy = g_strndup (p, len);
- match = g_hash_table_lookup (translations,
- copy);
- g_free (copy);
- if (match) {
- mail_html_write (html, stream, "%s",
- match);
- }
- }
-
- p = strchr (p, '>');
- if (p)
- p++;
- }
- }
-
- mail_html_end (html, stream, TRUE, box);
-}
-
-static void
-handle_text_html (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- GtkHTML *html;
- GtkHTMLStream *stream;
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- char *text;
-
- mail_html_new (&html, &stream, root, FALSE);
- mail_html_write (html, stream, "\n<!-- text/html -->\n");
-
- text = get_data_wrapper_text (wrapper);
- mail_html_write (html, stream, text);
- g_free (text);
-
- mail_html_end (html, stream, FALSE, box);
-}
-
-static void
-handle_image (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- GtkHTML *html;
- GtkHTMLStream *stream;
- char *cid;
-
- cid = get_cid (part, root);
- mail_html_new (&html, &stream, root, TRUE);
- mail_html_write (html, stream, "<img src=\"cid:%s\">", cid);
- mail_html_end (html, stream, TRUE, box);
- g_free (cid);
-}
-
-static void
-handle_multipart_mixed (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- CamelMultipart *mp;
- int i, nparts;
-
- g_return_if_fail (CAMEL_IS_MULTIPART (wrapper));
- mp = CAMEL_MULTIPART (wrapper);
-
- nparts = camel_multipart_get_number (mp);
- for (i = 0; i < nparts; i++) {
- part = camel_multipart_get_part (mp, i);
-
- call_handler_function (part, root, box);
- }
-}
-
-/* As seen in RFC 2387! */
-static void
-handle_multipart_related (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- 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_if_fail (CAMEL_IS_MULTIPART (wrapper));
- 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. */
- handle_multipart_mixed (part, root, box);
- }
- } 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++) {
- char *cid;
-
- body_part = camel_multipart_get_part (mp, i);
- if (body_part == display_part)
- continue;
-
- cid = get_cid (body_part, root);
- g_free (cid);
- }
-
- /* Now, display the displayed part. */
- call_handler_function (display_part, root, box);
-}
-
-/* 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 void
-handle_multipart_alternative (CamelMimePart *part, CamelMimeMessage *root,
- GtkBox *box)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- CamelMultipart *multipart;
- CamelMimePart *mime_part;
-
- g_return_if_fail (CAMEL_IS_MULTIPART (wrapper));
- multipart = CAMEL_MULTIPART (wrapper);
-
- mime_part = find_preferred_alternative (multipart);
- if (mime_part)
- call_handler_function (mime_part, root, box);
- else
- handle_unknown_type (part, root, box);
-}
-
-/* RFC 1740 */
-static void
-handle_multipart_appledouble (CamelMimePart *part, CamelMimeMessage *root,
- GtkBox *box)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- CamelMultipart *multipart;
-
- g_return_if_fail (CAMEL_IS_MULTIPART (wrapper));
- 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);
- call_handler_function (part, root, box);
-}
-
-static void
-handle_mystery (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box,
- char *icon_name, char *id, char *action)
-{
- GtkHTML *html;
- GtkHTMLStream *stream;
- const char *info;
- char *htmlinfo;
- GMimeContentField *content_type;
-
- mail_html_new (&html, &stream, root, TRUE);
- mail_html_write (html, stream, "<table><tr><td><a href=\"cid:%s\">"
- "<img src=\"x-gnome-icon:%s\"></a></td>"
- "<td>%s<br>", get_cid (part, root), icon_name, id);
-
- info = camel_mime_part_get_description (part);
- if (info) {
- htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS);
- mail_html_write (html, stream, "Description: %s<br>",
- htmlinfo);
- g_free (htmlinfo);
- }
-
- 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 (html, stream, "Name: %s<br>",
- htmlinfo);
- g_free (htmlinfo);
- }
-
- mail_html_write (html, stream,
- "<br>Click on the icon to %s.</td></tr></table>",
- action);
- mail_html_end (html, stream, TRUE, box);
-}
-
-static void
-handle_audio (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- char *id;
-
- id = g_strdup_printf ("Audio data in \"%s\" format.",
- camel_mime_part_get_content_type (part)->subtype);
- handle_mystery (part, root, box, "gnome-audio2.png", id, "play it");
- g_free (id);
-}
-
-static void
-handle_message_rfc822 (CamelMimePart *part, CamelMimeMessage *root,
- GtkBox *box)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- GtkWidget *subbox, *frame;
-
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper));
-
- subbox = gtk_vbox_new (FALSE, 2);
- mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper),
- GTK_BOX (subbox));
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
- gtk_container_set_border_width (GTK_CONTAINER (frame), 8);
- gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
- gtk_container_add (GTK_CONTAINER (frame), subbox);
- gtk_widget_show_all (frame);
-}
-
-static void
-handle_undisplayable (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- char *id;
-
- id = g_strdup_printf ("Unknown data of type \"%s/%s\".",
- camel_mime_part_get_content_type (part)->type,
- camel_mime_part_get_content_type (part)->subtype);
- handle_mystery (part, root, box, "gnome-question.png", id,
- "save it to disk");
- g_free (id);
-}
-
-static void
-handle_unknown_type (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- char *type;
-
- /* Don't give up quite yet. */
- type = mail_identify_mime_part (part);
- if (type) {
- mime_handler_fn handler_function;
- gboolean generic;
-
- handler_function = lookup_handler (type, &generic);
- g_free (type);
- if (handler_function &&
- handler_function != handle_unknown_type) {
- (*handler_function) (part, root, box);
- return;
- }
- }
-
- /* OK. Give up. */
- handle_undisplayable (part, root, box);
-}
-
-static void
-embeddable_destroy_cb (GtkObject *obj, gpointer user_data)
-{
- BonoboWidget *be; /* bonobo embeddable */
- BonoboViewFrame *vf; /* the embeddable view frame */
- BonoboObjectClient* server;
- CORBA_Environment ev;
-
- be = BONOBO_WIDGET (obj);
- server = bonobo_widget_get_server (be);
-
- vf = bonobo_widget_get_view_frame (be);
- bonobo_control_frame_control_deactivate (
- BONOBO_CONTROL_FRAME (vf));
- /* w = bonobo_control_frame_get_widget (BONOBO_CONTROL_FRAME (vf)); */
-
- /* gtk_widget_destroy (w); */
-
- CORBA_exception_init (&ev);
- Bonobo_Unknown_unref (
- bonobo_object_corba_objref (BONOBO_OBJECT(server)), &ev);
- CORBA_Object_release (
- bonobo_object_corba_objref (BONOBO_OBJECT(server)), &ev);
-
- CORBA_exception_free (&ev);
- bonobo_object_unref (BONOBO_OBJECT (vf));
-}
-
-static void
-handle_via_bonobo (CamelMimePart *part, CamelMimeMessage *root, GtkBox *box)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
- GMimeContentField *type;
- char *mimetype;
- const char *goad_id;
- GtkWidget *embedded;
- BonoboObjectClient *server;
- Bonobo_PersistStream persist;
- CORBA_Environment ev;
- GByteArray *ba;
- CamelStream *cstream;
- BonoboStream *bstream;
-
- type = camel_data_wrapper_get_mime_type_field (
- camel_medium_get_content_object (CAMEL_MEDIUM (part)));
- mimetype = g_strdup_printf ("%s/%s", type->type, type->subtype);
- goad_id = gnome_mime_get_value (mimetype, "bonobo-goad-id");
- g_free (mimetype);
-
- if (!goad_id)
- goad_id = gnome_mime_get_value (type->type, "bonobo-goad-id");
- if (!goad_id) {
- handle_undisplayable (part, root, box);
- return;
- }
-
- embedded = bonobo_widget_new_subdoc (goad_id, NULL);
- if (!embedded) {
- handle_undisplayable (part, root, box);
- return;
- }
- server = bonobo_widget_get_server (BONOBO_WIDGET (embedded));
-
- persist = (Bonobo_PersistStream) bonobo_object_client_query_interface (
- server, "IDL:Bonobo/PersistStream:1.0", NULL);
- if (persist == CORBA_OBJECT_NIL) {
- bonobo_object_unref (BONOBO_OBJECT (embedded));
- handle_undisplayable (part, root, box);
- return;
- }
-
- /* Write the data to a CamelStreamMem... */
- ba = g_byte_array_new ();
- cstream = camel_stream_mem_new_with_byte_array (ba);
- camel_data_wrapper_write_to_stream (wrapper, cstream);
-
- /* ...convert the CamelStreamMem to a BonoboStreamMem... */
- bstream = bonobo_stream_mem_create (ba->data, ba->len, TRUE, FALSE);
- gtk_object_unref (GTK_OBJECT (cstream));
-
- /* ...and hydrate the PersistStream from the BonoboStream. */
- CORBA_exception_init (&ev);
- Bonobo_PersistStream_load (persist,
- bonobo_object_corba_objref (
- BONOBO_OBJECT (bstream)),
- &ev);
- bonobo_object_unref (BONOBO_OBJECT (bstream));
- Bonobo_Unknown_unref (persist, &ev);
- CORBA_Object_release (persist, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- bonobo_object_unref (BONOBO_OBJECT (embedded));
- CORBA_exception_free (&ev);
- handle_undisplayable (part, root, box);
- return;
- }
- CORBA_exception_free (&ev);
-
- /* Embed the widget. */
- gtk_widget_show (embedded);
- gtk_box_pack_start (box, embedded, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (embedded), "destroy",
- embeddable_destroy_cb, NULL);
-}
-
-
-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 ("<blockquote><i>\n%s\n"
- "</i></blockquote>\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 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;
-}
-
-/* This is part of the temporary kludge below. */
-#ifndef HAVE_MKSTEMP
-#include <fcntl.h>
-#include <sys/stat.h>
-#endif
-
-EMsgComposer *
-mail_generate_forward (CamelMimeMessage *mime_message,
- gboolean forward_as_attachment,
- gboolean keep_attachments)
-{
- EMsgComposer *composer;
- char *tmpfile;
- int fd;
- CamelStream *stream;
-
- if (!forward_as_attachment)
- g_warning ("Forward as non-attachment not implemented.");
- if (!keep_attachments)
- g_warning ("Forwarding without attachments not implemented.");
-
- /* For now, we kludge by writing out a temp file. Later,
- * EMsgComposer will support attaching CamelMimeParts directly,
- * or something. FIXME.
- */
- tmpfile = g_strdup ("/tmp/evolution-kludge-XXXX");
-#ifdef HAVE_MKSTEMP
- fd = mkstemp (tmpfile);
-#else
- if (mktemp (tmpfile)) {
- fd = open (tmpfile, O_RDWR | O_CREAT | O_EXCL,
- S_IRUSR | S_IWUSR);
- } else
- fd = -1;
-#endif
- if (fd == -1) {
- g_warning ("Couldn't create temp file for forwarding");
- g_free (tmpfile);
- return NULL;
- }
-
- stream = camel_stream_fs_new_with_fd (fd);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), stream);
- camel_stream_flush (stream);
- gtk_object_unref (GTK_OBJECT (stream));
-
- composer = E_MSG_COMPOSER (e_msg_composer_new ());
- e_msg_composer_attachment_bar_attach (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), tmpfile);
- g_free (tmpfile);
-
- /* 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 <danw@helixcode.com>
- *
- * 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 <config.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <glib.h>
-#include <libgnome/libgnome.h>
-#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 90acb9e84d..0000000000
--- a/mail/mail-ops.c
+++ /dev/null
@@ -1,490 +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 <danw@helixcode.com>
- *
- * 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 <config.h>
-#include <errno.h>
-#include <gnome.h>
-#include "mail.h"
-#include "folder-browser.h"
-#include "e-util/e-setup.h"
-#include "filter/filter-editor.h"
-#include "filter/filter-driver.h"
-
-#ifndef HAVE_MKSTEMP
-#include <fcntl.h>
-#include <sys/stat.h>
-#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,
- ex);
- camel_folder_open (folder, FOLDER_OPEN_READ, 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_with_url (CAMEL_SERVICE (store),
- url, ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Unable to get new mail", ex, fb);
- goto cleanup;
- }
-
- sourcefolder = camel_store_get_folder (store, "inbox", ex);
- camel_folder_open (sourcefolder, FOLDER_OPEN_READ, 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,
- ex);
-
- if (!camel_folder_exists(folder, ex)) {
- camel_folder_create(folder, ex);
- }
-
- camel_folder_open(folder, FOLDER_OPEN_RW, 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);
- gtk_object_unref((GtkObject *)sourcefolder);
- } else {
- printf("we can search on this folder, performing search!\n");
- folder = sourcefolder;
- }
- }
-
- /* 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) {
- if (camel_folder_is_open (folder))
- camel_folder_close (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);
-}
-
-
-static void
-composer_send_cb (EMsgComposer *composer, gpointer data)
-{
- static CamelTransport *transport = NULL;
- 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_transport_send (transport, CAMEL_MEDIUM (message), ex);
- if (camel_exception_get_id (ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Could not send message", ex, composer);
- camel_exception_free (ex);
- gtk_object_unref (GTK_OBJECT (message));
- return;
- }
-
- gtk_object_unref (GTK_OBJECT (message));
- gtk_object_destroy (GTK_OBJECT (composer));
-}
-
-
-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;
-
- if (!check_configured ())
- return;
-
- composer = mail_generate_reply (fb->mail_display->current_message,
- to_all);
-
- gtk_signal_connect (GTK_OBJECT (composer), "send",
- GTK_SIGNAL_FUNC (composer_send_cb), NULL);
-
- 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;
-
- if (fb->mail_display->current_message) {
- guint32 flags;
-
- /* FIXME: table should watch the message with a signal and update display! */
-
- flags = camel_mime_message_get_flags(fb->mail_display->current_message);
- camel_mime_message_set_flags(fb->mail_display->current_message, CAMEL_MESSAGE_DELETED, ~flags);
- printf("Message %s set to %s\n", fb->mail_display->current_message->message_uid, flags&CAMEL_MESSAGE_DELETED?"UNDELETED":"DELETED");
- }
-}
-
-void
-expunge_folder (GtkWidget *button, gpointer user_data)
-{
- 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);
-
-/* this always throws an error, when it shouldn't? */
-#if 0
- if (camel_exception_get_id (&ex) != CAMEL_EXCEPTION_NONE) {
- mail_exception_dialog ("Unable to expunge deleted messages", &ex, fb);
- }
-#endif
- }
-}
-
-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 (GtkWidget *button, gpointer user_data)
-{
- 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);
-}
-
-
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 <danw@helixcode.com>
- *
- * 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 <sys/stat.h>
-
-#include <gnome.h>
-#include <gtkhtml/gtkhtml.h>
-
-/* 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, "<body bgcolor=white>\n");
- return handle;
-}
-
-void
-end_html (GtkHTML *html, GtkHTMLStreamHandle handle)
-{
- write_html (html, handle, "</body>");
- 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 \
- "<h1>Evolution Mail Source Wizard</h1>\n" \
- "<p>Welcome to the Evolution Mail Source Wizard. This will " \
- "help you blah blah blah blah blah.</p>"
-
-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 \
- "<h1>Local mail source</h1>\n<hr>\n" \
- "<p>First you need to tell Evolution whether or not you " \
- "receive mail locally, and if so, where.</p>\n" \
- "<p>Your default mail file on this system is <b>"
-
-#define local_text_2 \
- "</b>.</p>\n"
-
-#define local_text_3_file \
- "<p>That file exists, so you almost certainly want to use it " \
- "as a mail source.</p>\n"
-
-#define local_text_3_dir \
- "<p>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.</p>\n"
-
-#define local_text_3_none \
- "<p>However, that directory does not exist.</p>\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,
- "<object classid=\"local:no\"></object><br>\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,
- "<object classid=\"local:default\"></object><br>\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,
- "<object classid=\"local:alt\"></object> "
- "<object classid=\"local:text\"></object>");
-
- 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 \
- "<h1>Remote mail source</h1>\n<hr>\n<p>Now you need to " \
- "configure a remote mail source, if you have one.</p>\n" \
- "<p>Evolution supports the following protocols for reading " \
- "mail from remote servers:</p>"
-
-#define remote_text_2 \
- "<p>To add a remote mail source, choose a protocol from " \
- "the list below and click \"Next\".</p>"
-
-#define remote_text_3_must \
- "<p>You have not configured a local mail source, so you " \
- "must configure a remote one.</p>"
-
-#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 = "<blockquote><table border=1>\n";
- write_html (msi->html, handle, table);
- for (i = 0; i < nproviders; i++) {
- table = g_strdup_printf ("<tr><th width=\"15%%\" "
- "rowspan=2 valign=top>%s</th>"
- "<td>%s</td></tr>\n"
- "<tr><td>%s</td>\n",
- providers[i].protocol,
- providers[i].name,
- providers[i].description);
- write_html (msi->html, handle, table);
- g_free (table);
- }
- table = "</table></blockquote>\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, "<blockquote>");
- 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<object classid=\"remote:no\"></object><br>");
- }
-
- 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<object classid=\"remote:%s\">"
- "</object><br>",
- providers[i].protocol);
- write_html (msi->html, handle, button);
- g_free (button);
- }
- write_html (msi->html, handle, "</blockquote>");
-
- 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 \
- "<h1>Configure a remote mail source: %s</h1><hr>"
-
-#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 \
- "<p>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.</p>\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, "<object classid=\"sub:table\">"
- "</object>\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, "<object classid=\"sub:once\">"
- "</object>\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, "<object classid=\"sub:forget\">"
- "</object>\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, "<table>\n");
-
- if (1) {
- write_html (msi->html, handle, "<tr><td>");
- 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, "</td><td><object "
- "classid=\"remconf:host\"></object></td></tr>");
- }
-
- if (1) {
- write_html (msi->html, handle, "<tr><td>");
- 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, "</td><td><object "
- "classid=\"remconf:user\"></object></td></tr>");
- }
-
- if (0) {
- write_html (msi->html, handle, "<tr><td>");
- 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, "</td><td><object "
- "classid=\"remconf:path\"></object></td></tr>");
- }
-
- if (1) {
- int i;
-
- write_html (msi->html, handle, "<tr><td>");
- 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, "</td><td><object "
- "classid=\"remconf:auth\"></object></td></tr>");
- }
- write_html (msi->html, handle, "</table>\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, "<object classid=\"remconf:htmlwin\">"
- "</object>\n");
- write_html (msi->html, handle, "<p>foo</p>");
-
- 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 b9275a29d6..0000000000
--- a/mail/mail.h
+++ /dev/null
@@ -1,58 +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 <gtkhtml/gtkhtml.h>
-#include "camel/camel.h"
-#include "composer/e-msg-composer.h"
-
-/* folder-browser-factory */
-void folder_browser_factory_init (void);
-
-/* mail-config */
-void mail_config_druid (void);
-
-/* mail-format */
-void mail_format_mime_message (CamelMimeMessage *mime_message, GtkBox *box);
-
-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 (GtkWidget *button, gpointer user_data);
-
-void filter_edit (GtkWidget *button, gpointer user_data);
-
-/* session */
-void session_init (void);
-extern CamelSession *session;
diff --git a/mail/main.c b/mail/main.c
deleted file mode 100644
index 737b6df11a..0000000000
--- a/mail/main.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * mail-component.c: The core of the mail component
- *
- * Author:
- * Miguel de Icaza (miguel@helixcode.com)
- *
- * (C) 2000 Helix Code, Inc.
- */
-#include <config.h>
-#include <gnome.h>
-#include <bonobo/bonobo-main.h>
-#include <glade/glade.h>
-#include "e-util/e-gui-utils.h"
-#include "e-util/e-cursors.h"
-#include "mail.h"
-
-#ifdef USING_OAF
-
-#include <liboaf/liboaf.h>
-
-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 <libgnorba/gnorba.h>
-
-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 ();
-
- glade_gnome_init ();
-
- session_init ();
- e_cursors_init ();
-
- folder_browser_factory_init ();
-
- bonobo_main ();
-
- return 0;
-}
-
-
-
-
diff --git a/mail/message-list.c b/mail/message-list.c
deleted file mode 100644
index d556fc1514..0000000000
--- a/mail/message-list.c
+++ /dev/null
@@ -1,871 +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 <config.h>
-#include <gnome.h>
-#include <bonobo/bonobo-main.h>
-#include "e-util/e-util.h"
-#include "camel/camel-exception.h"
-#include <camel/camel-folder.h>
-#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 "pixmaps.h"
-
-/*
- * 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 (4.0)
-#define COL_SENT_WIDTH_MIN (1)
-#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_row_selection_cmd (ETable *table,
- int row,
- gboolean selected,
- gpointer user_data);
-
-
-static CamelMessageInfo *get_message_info(MessageList *message_list, gint row)
-{
- CamelMessageInfo *info = NULL;
-
- if (message_list->search) {
- if (row<message_list->match_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] =
- camel_folder_summary_get_by_uid(message_list->folder, uid);
- }
- }
- }
- } else {
- if (row<message_list->summary_table->len)
- info = message_list->summary_table->pdata[row];
- }
-
- return info;
-}
-
-static void
-message_changed(CamelMimeMessage *m, enum _MessageChangeType type, MessageList *message_list)
-{
- e_table_model_changed (message_list->table_model);
-}
-
-/* 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) {
- gtk_signal_connect((GtkObject *)message, "message_changed",
- message_changed, message_list);
- mail_display_set_message (message_list->parent_folder_browser->mail_display,
- CAMEL_MEDIUM (message));
- gtk_object_unref (GTK_OBJECT (message));
- }
-}
-
-/*
- * 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_DELETED)
- retval = GINT_TO_POINTER (2);
- else
- retval = GINT_TO_POINTER (1);
- 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 = "sent";
- break;
-
- case COL_RECEIVE:
- retval = "receive";
- break;
-
- case COL_TO:
- retval = "dudes@server";
- break;
-
- case COL_SIZE:
- sprintf (buffer, "%d", msg_info->size);
- retval = buffer;
- 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)
-{
-}
-
-static gboolean
-ml_is_cell_editable (ETableModel *etm, int col, int row, void *data)
-{
- return FALSE;
-}
-
-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:
- return (void *) value;
-
- case COL_FROM:
- case COL_SUBJECT:
- case COL_SENT:
- 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:
- break;
-
- case COL_FROM:
- case COL_SUBJECT:
- case COL_SENT:
- 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:
- return NULL;
-
- case COL_FROM:
- case COL_SUBJECT:
- case COL_SENT:
- 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:
- return value == NULL;
-
- case COL_FROM:
- case COL_SUBJECT:
- case COL_SENT:
- case COL_RECEIVE:
- case COL_TO:
- case COL_SIZE:
- return !(value && *(char *)value);
- default:
- g_assert_not_reached ();
- return FALSE;
- }
-}
-
-static void
-ml_thaw (ETableModel *etm, void *data)
-{
- e_table_model_changed (etm);
-}
-
-static struct {
- char **image_base;
- GdkPixbuf *pixbuf;
-} states_pixmaps [] = {
- { envelope_opened_xpm, NULL },
- { envelope_closed_xpm, NULL },
- { empty_xpm, NULL },
- { attachment_xpm, NULL },
- { attachment_header_xpm, NULL },
- { online_status_xpm, NULL },
- { message_status_xpm, NULL },
- { envelope_deleted_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 void
-message_list_init_renderers (MessageList *message_list)
-{
- 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);
-
- message_list->render_online_status = e_cell_checkbox_new ();
-
- /*
- * Message status
- */
- {
- GdkPixbuf *images [3];
-
- images [0] = states_pixmaps [0].pixbuf;
- images [1] = states_pixmaps [1].pixbuf;
- images [2] = states_pixmaps [7].pixbuf;
-
- message_list->render_message_status = e_cell_toggle_new (0, 3, images);
- }
-
- /*
- * Attachment
- */
- {
- GdkPixbuf *images [2];
-
- images [0] = states_pixmaps [2].pixbuf;
- images [1] = states_pixmaps [3].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_with_pixbuf (
- COL_ONLINE_STATUS, states_pixmaps [5].pixbuf,
- 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, _("Sent"),
- COL_SENT_EXPANSION, COL_SENT_WIDTH_MIN,
- message_list->render_text,
- g_str_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)
-{
- if (0)
- return g_strdup ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> <column> 5 </column> <column> 6 </column> <column> 7 </column> <column> 8 </column> <column> 9 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"1\"> <leaf column=\"5\" ascending=\"1\"/> </group> </grouping> </ETableSpecification>");
- else {
- /* Message status, From, Sent, Subject */
- return g_strdup ("<ETableSpecification> <columns-shown> <column> 1 </column> <column> 4 </column> <column> 5 </column> </columns-shown> <grouping> </grouping> </ETableSpecification>");
- }
-}
-
-/*
- * 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,
- ml_thaw, 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_signal_connect (GTK_OBJECT (message_list->etable), "row_selection",
- GTK_SIGNAL_FUNC (on_row_selection_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)
- g_ptr_array_free(message_list->summary_table, TRUE);
-
- for (i = 0; i < COL_LAST; i++)
- gtk_object_unref (GTK_OBJECT (message_list->table_cols [i]));
-
- 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)
- g_ptr_array_free(message_list->summary_table, TRUE);
- message_list->summary_table = camel_folder_get_summary (message_list->folder, NULL);
-
- message_list_set_search(message_list, message_list->search);
-}
-
-void
-message_list_set_folder (MessageList *message_list, CamelFolder *camel_folder)
-{
- CamelException ex;
- gboolean folder_exists;
-
- 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;
- }
-
- if (message_list->summary_table)
- g_ptr_array_free(message_list->summary_table, TRUE);
- message_list->summary_table = NULL;
-
- camel_exception_init (&ex);
-
- if (message_list->folder)
- gtk_object_unref (GTK_OBJECT (message_list->folder));
-
- message_list->folder = camel_folder;
-
- folder_exists = camel_folder_exists (camel_folder, NULL);
-
- if (camel_exception_get_id (&ex)) {
- printf ("Unable to test for folder existence: %s\n",
- ex.desc?ex.desc:"unknown reason");
- return;
- }
-
- if (!folder_exists) {
- g_warning ("Folder does not exist, creating it\n");
- /*
- if you don't want the directory to be created
- automatically here remove this.
- */
- camel_folder_create (camel_folder, &ex);
- if (camel_exception_get_id (&ex)) {
- printf ("Unable to create folder: %s\n",
- ex.desc?ex.desc:"unknown_reason");
- return;
- }
-
- }
-
- camel_folder_open (camel_folder, FOLDER_OPEN_RW, &ex);
- if (camel_exception_get_id (&ex)) {
- printf ("Unable to open folder: %s\n",
- ex.desc?ex.desc:"unknown_reason");
- return;
- }
-
- gtk_signal_connect((GtkObject *)camel_folder, "folder_changed", folder_changed, message_list);
-
- gtk_object_ref (GTK_OBJECT (camel_folder));
-
- message_list->summary_table = camel_folder_get_summary (message_list->folder, NULL);
- e_table_model_changed (message_list->table_model);
-
- 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_row_selection_idle (gpointer data)
-{
- MessageList *message_list = data;
-
- select_msg (message_list, message_list->row_to_select);
-
- message_list->idle_id = 0;
- return FALSE;
-}
-
-static void
-on_row_selection_cmd (ETable *table,
- int row,
- gboolean selected,
- gpointer user_data)
-{
- if (selected) {
- MessageList *message_list;
-
- message_list = MESSAGE_LIST (user_data);
-
- message_list->row_to_select = row;
-
- if (!message_list->idle_id)
- g_idle_add_full (G_PRIORITY_LOW, on_row_selection_idle, message_list, NULL);
- }
-}
-
diff --git a/mail/message-list.h b/mail/message-list.h
deleted file mode 100644
index f3d6d2fa7f..0000000000
--- a/mail/message-list.h
+++ /dev/null
@@ -1,86 +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 <bonobo/bonobo-main.h>
-#include <bonobo/bonobo-object.h>
-#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
-};
-
-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_online_status;
- ECell *render_message_status;
- ECell *render_priority;
- ECell *render_attachment;
-
- GtkWidget *etable;
-
- CamelFolder *folder;
-
- GPtrArray *summary_table; /* the summary of all messages */
-
- 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 */
-
- /* used by the idle-call to select a row */
- int row_to_select;
- guint idle_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 b7b24920b0..0000000000
--- a/mail/session.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * session.c: handles the session infomration and resource manipulation
- *
- * Author:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * (C) 2000 Helix Code, Inc. http://www.helixcode.com
- */
-#include <config.h>
-#include <gnome.h>
-#include "mail.h"
-#include "e-util/e-setup.h"
-
-CamelSession *session;
-
-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 (char *prompt, gboolean secret,
- CamelService *service, char *item,
- CamelException *ex)
-{
- GtkWidget *dialog;
- char *ans;
-
- /* XXX look up stored passwords */
-
- /* XXX parent window? */
- dialog = gnome_request_dialog (secret, prompt, NULL, 0,
- request_callback, &ans, NULL);
- if (!dialog) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- "Could not create dialog box.");
- 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.");
- return NULL;
- }
-
- return ans;
-}
-
-void
-session_init (void)
-{
- e_setup_base_dir ();
- camel_init ();
-
- session = camel_session_new (evolution_auth_callback);
-}
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 <config.h>
-
-#include <gnome.h>
-#include <bonobo.h>
-
-#ifdef USING_OAF
-
-#include <liboaf/liboaf.h>
-
-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 <libgnorba/gnorba.h>
-
-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;
-}
-
-
-
-
-