aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog1737
-rw-r--r--mail/Makefile.am28
-rw-r--r--mail/folder-browser-ui.c174
-rw-r--r--mail/folder-browser.c686
-rw-r--r--mail/mail-account-gui.c1141
-rw-r--r--mail/mail-accounts.c1178
-rw-r--r--mail/mail-callbacks.c1433
-rw-r--r--mail/mail-callbacks.h39
-rw-r--r--mail/mail-config.c996
-rw-r--r--mail/mail-display.c645
-rw-r--r--mail/mail-folder-cache.c11
-rw-r--r--mail/mail-format.c766
-rw-r--r--mail/mail-ops.c118
-rw-r--r--mail/mail-send-recv.c33
-rw-r--r--mail/mail-send-recv.h2
-rw-r--r--mail/mail-tools.c7
-rw-r--r--mail/mail-vfolder.c5
-rw-r--r--mail/main.c11
-rw-r--r--mail/message-list.c424
19 files changed, 2538 insertions, 6896 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 61c2891b8a..35acaea732 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,905 +1,8 @@
-2002-05-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (mail_reply): Set the Seen flag as well since
- it's safe to assume that if the user has replied to an email
- message that he has read it. Not always true, but usually ;-)
-
- * folder-browser.c (on_right_click): If we are in a
- Sent/Drafts/Outbox folder, don't show the "Add Sender to
- Addressbook" menu item.
-
-2002-05-06 Not Zed <NotZed@Ximian.com>
-
- * component-factory.c (idle_quit): Check all threads are idle as
- well, using new e_thread_busy call. Should fix #22553? Also
- sleep a little bit, to let the other threads run.
-
-2002-05-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (sig_new_text): Update the code to actually
- work.
- (sig_new_html): Same.
-
- * mail-composer-prefs.c (mail_composer_prefs_new_signature): Allow
- 'prefs' to be NULL.
-
- * folder-browser.c (on_right_click): Fix the filter_menu static
- array to use the E_POPUP_MENU_CC macros since we plan on using
- custom closures for this.
- (on_right_click): Fixed so that you can "Edit as New" for any Sent
- folder and not just the local Sent folder.
-
-2002-05-01 Not Zed <NotZed@Ximian.com>
-
- * folder-browser.h (FOLDER_BROWSER_IS_DESTROYED): Also check
- folder!=NULL. Fixes race where folder isn't setup yet, and
- neither is bonobo menu status (because its delayed), and we get a
- menu event before we're setup yet. For bug #21939.
-
-2002-04-30 Dan Winship <danw@ximian.com>
-
- * mail-callbacks.c (delete_msg): If the folder's permanent_flags
- don't include CAMEL_MESSAGE_DELETED, don't do anything. (In
- particular, don't move the cursor.)
-
-2002-04-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (message_tag_followup_append_message):
- Convert UTF-8 to gtkstrings since we are using a clist and not an
- E-widget that takes UTF-8.
-
- * mail-display.c (mail_display_add_url): If the data-urls is NULL,
- add a data-urls hash to the datalist. This finishes up bug #90.
-
- * mail-account-gui.c (save_service): Strip leading/trailing
- whitespace from the username because users sometimes accidently
- add extra spaces here and there. Fixes bug #24009 (along with a
- number of other "bugs").
- (mail_account_gui_auto_detect_extra_conf): Use a CamelURL instead
- of a GHashTable *settings. Also parse out the port # from the
- hostname.
-
-2002-04-29 Larry Ewing <lewing@ximian.com>
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): clean up
- propmanager initialization code.
-
- * mail-preferences.c (mail_preferences_construct): small clean
- ups to propmanager code.
-
- * mail-config-factory.c (config_control_factory_cb): handle
- requests for the font manager control.
-
- * mail-config.glade: add fonts tabs and reorder composer options
- to match the new dialogs from anna.
-
- * GNOME_Evolution_Mail.oaf.in: add font manager control definition.
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): hook to
- the gtkhtml propmanager.
- (mail_composer_prefs_apply): apply propmanager changes.
- (mail_composer_prefs_finalise): unref the propmanager.
-
- * mail-composer-prefs.h: add propmanager member.
-
- * mail-font-prefs.c: initialize gui properly.
-
- * mail-preferences.c (mail_preferences_construct): hook to
- gtkhtml's propmanager.
- (mail_preferences_apply): apply propmanager changes.
- (mail_preferences_finalise): unref the propmanager.
-
- * mail-preferences.h: add propmanager member.
-
- * Makefile.am (evolution_mail_SOURCES): add mail-font-prefs.[ch]
- to the build.
-
- * mail-tools.c (mail_tool_quote_message): use the html reply logic
- even for plain parts so that we can test out the new gtkhtml cite logic.
-
- * importers/evolution-mbox-importer.c (process_item_fn): add const
- to silence warning.
-
- * mail-display.c: add gtkhtml.h include so to pick up the
- object_relative prototype.
-
-2002-04-26 Larry Ewing <lewing@ximian.com>
-
- * mail-font-prefs.c: Add the font config dialog.
-
- * mail-font-prefs.h: add font config dialog headers.
-
-2002-04-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Don't link with libibex anymore, it's been
- deprecated.
-
- * mail-callbacks.c (next_unread_msg): Do away with the
- goto-next-folder stuff, it's very annoying.
-
- * mail-config-druid.c (extra_prepare): After building the extra
- config options into a Gtk form, auto-detect any values that we can
- and populate them by calling
- mail_account_gui_auto_detect_extra_conf.
-
- * mail-account-gui.c (mail_account_gui_auto_detect_extra_conf):
- New function to auto-detect the extra config options for a source.
-
-2002-04-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_build_extra_conf): Allow
- providers to override text entry boxes too.
- (source_type_changed): Remove the logic to decide upon default
- paths, these paths can now be set by the provider.
-
-2002-04-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (label_menu): Update to use
- E_POPUP_MENU_PIXMAP_WIDGET_ITEM_CC so that our callback gets
- called without per-item closure rather than being called with NULL
- and causing a segfault.
-
- * mail-account-gui.c (mail_account_gui_build_extra_conf): Set the
- default Username label and handle the new
- CAMEL_PROVIDER_CONF_LABEL enum allowing the provider to setup a
- label.
-
-2002-04-23 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Added back the checkmark icon for enabled
- accounts.
- (account_able_clicked): Don't reload the accounts list, that was
- just lame.
-
-2002-04-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-display.c (mail_display_render): Plug-in Anna's html for
- the flag-for-followup stuff. Finishes up bug #90.
-
-2002-04-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (folder_browser_finalise): Free the
- loading/pending/new/loaded_uid string buffers.
-
- * mail-config.c (config_read_signature): Free some temporary path
- buffers.
-
- * mail-display.c (stream_write_or_redisplay_when_loaded): Ref the
- html object here, this is an async handler so it's possible for
- our caller (or someone else) to unref the html object before we
- finish.
- (load_content_free): Unref the async handler's ref of the html
- object here.
- (mail_display_new): Ref the html widget here so that we can be
- sure that so long as the mail-display is "alive", so is the html
- object. See bug #22328 for details. Basically, the message-browser
- is being closed before the message gets loaded and so the html
- object was being destroyed but the mail-display was still alive.
- (mail_display_destroy): Unref the html object when the
- mail-display is destroyed.
-
-2002-04-19 Anna Marie Dirks <anna@ximian.com>
-
- * mail-config.glade: Added yet more accelerators for the new config
- dialog--this time for the composer pages
-
-2002-04-19 Anna Marie Dirks <anna@ximian.com>
-
- * mail-config.glade: Added a bunch of accelerators for the new config
- dialog
-
-2002-04-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (redirect_get_composer): Removed all
- Delivered-To headers before redirecting. Fixes bug #23635.
-
2002-04-18 Radek Doulik <rodo@ximian.com>
* mail-callbacks.c (do_mail_print): use default paper name in case
of wrong translation
-2002-04-15 Not Zed <NotZed@Ximian.com>
-
- * mail-identify.c (mail_identify_mime_part): Turn off the code
- which downloads the part if we can't identify it. See discussion
- in #11778.
-
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
-
- * folder-browser.c, mail-display.c: Updated these to match the new
- EPopupMenu.
-
-2002-04-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (handle_multipart_signed): Handle broken
- multipart/signed parts such as where the signature part is not the
- last part (as it should be). Fixes bug #23583.
-
- * folder-browser.c (message_list_drag_data_get): Free the temp
- GByteArrays.
-
-2002-04-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-local.c (mail_local_folder_construct): Just use g_basename.
- (mlf_finalize): Free the real_path.
-
- * folder-browser.c (on_right_click): Unref the GdkGC so we don't
- leak it.
-
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-tools.c (mail_tool_destroy_xevolution): Free the format
- string.
-
- * mail-config.c (config_write_signature): Don't leak the path
- strings here.
-
- * mail-signature-editor.c (menu_file_save_cb): Free the dirname
- string.
-
- * mail-config-factory.c (config_control_factory_cb): Ref the prefs
- widget here since we unref in the destroy callback. Caught this
- thanks to purify.
-
-2002-04-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Build fixes for --enable-nntp.
-
-2002-04-13 Christophe Merlet <redfox@eikonex.org>
-
- * mail-config.glade: Little typo. s/IS0/ISO/
-
-2002-04-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): Make it
- so that unchecking the "Enable Advanced Options" in the signature
- tab disables the advanced settings and vise versa.
-
- * mail-accounts.c (mail_accounts_tab_construct): Setup News
- preferences too if it is enabled.
-
- * mail-account-gui.c (mail_account_gui_new): Set the text of the
- reply-to.
- (mail_account_gui_save): Get the reply-to text here.
- (mail_account_gui_identity_complete): If there is text in the
- reply-to widget make sure it's valid.
-
- * mail-config.c (identity_copy): Copy the reply-to.
- (config_read): Read in the reply-to for all the accounts.
- (mail_config_write): Save the reply-to.
- (impl_GNOME_Evolution_MailConfig_addAccount): Get the reply-to.
- (identity_destroy): Free the reply-to.
-
-2002-04-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.etspec: s/Sent/Date. This fixes bug #11159.
-
-2002-04-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (confirm_expunge): Set the 'No' button as the
- default.
-
-2002-04-10 Dan Winship <danw@ximian.com>
-
- * mail-config.c (config_read, mail_config_write,
- mail_config_get_x_mailer_display_style,
- mail_config_set_x_mailer_display_style): Handle the X-Mailer
- display style. (There is currently no GUI for configuring this.)
-
- * mail-format.c (write_headers, write_xmailer_header): Show
- X-Mailer/User-Agent (and Rupert's stamp of approval) as
- appropriate.
-
-2002-04-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (setup_service): Kludge around the brokeness
- that is GtkOptionMenu just like we kludge around it for the
- authtype option menu.
-
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * component-factory.c (create_view): Add view_info arg, but don't
- do anything with it.
-
-2002-04-08 Not Zed <NotZed@Ximian.com>
-
- * mail-send-recv.c (receive_update_got_folderinfo): Argh!
- get_folder_info owns and frees its *OWN* folder info, it shouldn't
- be free'd here! See mail-ops.c:get_folderinfo_free.
- This should fix #17259 and friends.
-
-2002-04-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-signature-editor.c (menu_file_save_cb): Simplify a bit and
- write to a temp file first and then rename() it to the real
- filename. This protects against losing data if the drive is full
- too. Also use a real mode, not 0, so that we can actually
- save/read the content ;-)
-
- * GNOME_Evolution_Mail.oaf.in: Re-added the config wizard
- interfaces. Ettore accidently removed them thinking they were
- duplicates of the new mail-config interfaces.
-
- * mail-config.glade: Remove the OK, Apply, Cancel buttons from the
- keyboard shortcut tab in the composer_prefs dialog.
-
- * mail-account-gui.c: No need to check gui->source before using
- gui->source->url, since gui->source *has* to exist.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: add config_item:type
-
-2002-04-04 Dan Winship <danw@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_new): Make the drafts and
- sent folder buttons be EvolutionFolderSelectorButtons. Remove the
- code to deal with drafts_folder_name and sent_folder_name, since
- they were only used to construct the button and aren't needed now.
- (mail_account_gui_save): Remove drafts/sent name references.
- (mail_account_gui_destroy): Likewise
- (folder_selected): Handle the "selected" signal on the folder
- selector button by updating the URI in the MailAccountGui.
- (mail_account_gui_folder_selector_button_new): Glade custom widget
- constructor.
-
- * mail-callbacks.c (transfer_msg): Update for
- evolution_shell_client_user_select_folder change.
-
- * message-browser.c (transfer_msg): Likewise. (Sigh. Why is this
- cut+pasted?)
-
- * mail-config.glade: Make the drafts/sent folder buttons custom
- widgets.
-
- * mail-config.c (account_copy): Remove drafts/sent folder name
- handling.
- (account_destroy): Likewise.
- (config_read): Likewise.
- (mail_config_write): Likewise.
-
- * Mail.idl (MailConfig:Account): remove drafts_folder_name and
- sent_folder_name.
-
-2002-04-03 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (construct): Set the window title/icon
- here instead.
-
- * message-tag-editor.c (message_tag_editor_init): Don't set the
- title or window icon here, this is a generic class.
-
- * mail-format.c (handle_multipart_signed): Replace
- get_url_for_icon with the new mail_display_get_url_for_icon
- function.
- (handle_multipart_digest): Here too.
- (get_cid): Use mail_display_add_url instead.
- (get_location): Same.
- (handle_text_enriched): Here too.
- (handle_multipart_signed): And here.
-
- * message-tag-followup.c (message_tag_followup_i18n_name): Use the
- U_() macro, not the _() macro as it is what we really want.
-
- * mail-ops.c (mail_send_message): Don't cast the message into a
- CamelMedium before sending anymore.
-
- * mail-callbacks.c (expunge_folder): Set the followup argument to
- NULL here.
- (done_message_selected): Get the followup value here and pass it
- to the mail-display here.
- (do_mail_fetch_and_print): Again with the NULL followup here.
-
- * folder-browser.c (folder_browser_set_message_preview): Update to
- pass in NULL as the followup since we are setting the message to
- NULL here.
- (done_message_selected): Get and set the appropriate followup
- value here.
- (do_message_selected): Update to pass in NULL as the followup
- since we are setting the message to NULL here.
-
- * mail-display.c (mail_display_set_message): Now takes a followup
- tag value.
- (mail_display_init): Set md->followup to NULL.
- (mail_display_destroy): Free md->followup.
- (mail_display_add_url): New: replaces the static add_url function
- originally in mail-format.c
- (mail_display_get_url_for_icon): New: replaces get_url_for_icon
- which was originally in mail-format.c
-
-2002-04-03 Dan Winship <danw@ximian.com>
-
- * mail-account-gui.c: Changes to allow combined store/transport
- providers (like exchange and nntp). You can only select the
- transport if the account is also using that provider for the
- source.
- (source_type_changed): If changing away from a combined
- store/transport type, disable that provider on the transport page.
- If change to a combined store/transport type, enable and select
- that provider on the transport page.
- (mail_account_gui_setup): Do some additional bookkeeping here to
- make the above stuff work.
- (transport_type_changed): If the provider is a combined
- store/transport type, pretend it doesn't need any additional URL
- configuration.
- (mail_account_gui_transport_complete): if the transport provider
- is also a store provider, then as long as it matches the source
- for the account, it's considered complete.
- (mail_account_gui_save): If the selected transport is a combined
- store/transport provider, use the source page's information to
- fill in the transport url.
-
- * mail-local.c (mail_local_provider_init): Don't set up
- service_cache.
-
-2002-04-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (do_edit_messages): Pass the UID of the message
- being edited to the save-draft signal handler.
- (composer_save_draft_cb): Pass the old draft uid to our async
- append_message function and let the append_message callback worry
- about deleting the old draft message on success.
- (save_draft_done): Delete the old draft message if we successfully
- appended the new draft message.
-
-2002-04-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser-ui.c: Removed an unused pixmap from
- Tools/Settings to avoid a big nasty bonobo warning.
-
- * mail-composer-prefs.c (mail_composer_prefs_construct):
- Re-Implemented the signature editor stuff (mostly just copy/paste
- from Radeks original code).
-
- * mail-signature-editor.c (mail_signature_editor): Use the right
- oafiid for the html editor control.
-
-2002-04-01 Dan Winship <danw@ximian.com>
-
- * importers/Makefile.am (liboutlook_la_LDFLAGS,
- libmbox_la_LDFLAGS): Use -avoid-version -module. (From Max Horn
- <max@quendi.de>)
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: Added priorities for all the
- configuration pages [evolution:config_item:priority].
-
-2002-03-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-preferences.c (colorpicker_get_color): Don't shift the r, g
- and b values here either.
-
- * mail-composer-prefs.c (colorpicker_get_color): Don't shift the
- r, g, b values.
-
- * mail-preferences.c (mail_preferences_construct): Restore the
- labels & colours options from the grave.
- (mail_preferences_apply): Save these labels & colours options.
-
-2002-03-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): Same
- here.
-
- * mail-preferences.c (mail_preferences_construct): Do some gtk
- hackery action so we can detect if a option menu has changed.
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: Cleaned up a bunch [removing
- duplicates ;-)], set up icons for all the configuration pages.
-
-2002-03-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Use a GtkCList instead of an ETable, for some
- reason the etable was getting into some infinite resize loop or
- something. I probably did something wrong but I can't figure out
- what so I'm using a clist for now.
- (account_cursor_change): Make sure that event is non-NULL here.
-
-2002-03-27 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-accounts.c (mail_accounts_tab_construct): Use
- gtk_container_add() to put the toplevel in the parent widget,
- instead of just gtk_widget_set_parent().
- * mail-preferences.c (mail_preferences_construct): Likewise.
- * mail-composer-prefs.c (mail_composer_prefs_construct): Likewise.
-
-2002-03-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): Updated to respect the
- new mail-config options for default reply style that NotZed had
- started to implement before there was a gui.
-
-2002-03-27 Dan Winship <danw@ximian.com>
-
- * mail-display.c (do_attachment_header): unset GTK_CAN_FOCUS on
- the button so that it can't grab focus when you click it.
- (do_signature): Likewise on the signature button. #3904
-
-2002-03-26 Jeffrey Stedfast <fejj@ximian.com>
-
- Sync with yet-another-mail-config branch.
-
- * mail-composer-prefs.c: Updated to get the right widgets and
- whatnot. Also updated to tell the evolution-config-control that
- stuff has changed.
-
- * mail-preferences.c: Updated to get the right widgets and
- whatnot. Also updated to tell the evolution-config-control that
- stuff has changed.
-
- * mail-accounts.etspec: New file needed by mail-accounts.c
-
-2002-03-26 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (addrbook_sender): Changed to get the address
- from the messageinfo of the current selected message rather than
- from the current_message.
- (requeue_mail_reply): Only re-queue if we got a message, could
- potentially cause an infinite loop trying to get a message it
- can't.
- (reply_to_sender, reply_to_list, reply_to_all): Always pass NULL
- as the msg to mail_replay, this forces mail_reply to always load
- the message anew. Fixes FIXME's and popup behaviour. Basically
- this and stuff below fixes #8542. Its probably not the nicest
- way, but it works.
- (mark_as_important): Use the flags properly, we can set all flags
- to any combination of on or off as we want, so we just need to
- call set_flags once, thats why its set flags and not set_option.
- (toggle_flags): Fixed the logic here also, so we dont have to call
- set_message_flags more than once, and also implement a true toggle
- for any number of simultaneous flags (whilst simplifying code).
-
- * mail-vfolder.c (vfolder_gui_add_from_mlist): Removed the 'msg'
- parameter, its not used, fixed callers.
-
- * folder-browser.c (on_right_click): Lookup the mlist from
- messageinfo, and change the 'no selected' logic slightly, fixes
- most of #8542.
- (filter_data_free): Free filter data struct.
- (vfolder_type_got_message): Actually create vfolder once we have
- the message we need to use for it. Code could probably be changed
- to use messageinfo instead.
- (vfolder_type_uid): Lookup a message based on uid, and use that to
- create a vfolder based on type.
- (vfolder_subject_uid, vfolder_sender_uid, vfolder_receipient_uid,
- vfolder_mlist_uid): Callbacks for the popup menu, used to create
- rules based on the uid rather than the message, which it loads as
- required.
- (filter_type_got_message, filter_*_uid): Similar to vfolder
- stuff above.
- (filter_menu[]): Changed callbacks to popup specific ones, not
- folderbrowser specific ones used by bonobo.
- (on_right_click): Initialise callback data for the filter submenu
- so it can look up messages for callback implementation.
-
- * local-config.glade: New version from anna, with fixed widget
- names.
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-browser.c: Reorder folder_browser_search_menu_items
- according to #16246.
-
-2002-03-24 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-send-recv.c: Remove member current_folder from struct
- _send_data.
- (build_dialogue): Remove arg @current_folder.
- (mail_send_receive): Likewise.
- (free_send_data): No need to refresh the current folder here.
- [Well, hopefully, at least.]
-
- * component-factory.c (send_receive_callback): New.
- (create_component): Connect.
-
- * mail-callbacks.c (send_receive_mail): Removed.
-
- * folder-browser-ui.c: Remove "MailGetSend" verb.
-
-2002-03-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: Add info about the new config
- controls.
-
- * mail-config-factory.c: New file to handle the creation/etc of
- the config controls.
-
- * mail-accounts.c:
-
- * mail-preferences.c:
-
- * mail-composer-prefs.c: No longer handle their own bonobo control
- creation.
-
-2002-03-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (sig_new_text): Temporarily #if 0 this
- function out.
- (sig_new_html): Same.
-
- * mail-config.c (config_read): Read in the default reply style
- setting.
- (mail_config_write_on_exit): Same the default reply style.
- (mail_config_get_default_reply_style): New function to get the
- default reply style.
- (mail_config_set_default_reply_style): New function to set the
- default reply style.
-
- * folder-browser-ui.c: There is no longer a Tools/Mail Settings
- menu item.
-
- * mail-account-gui.c: Updated the widget types for the
- MailAccountsDialog->MailAccountsTab change.
-
- * mail_account_editor.c: Same.
-
- * mail-callbacks.c (providers_config): Removed.
-
- * mail-composer-prefs.c: New file that implements the composer
- preferences tab of anna's new config design.
-
-2002-03-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Reimplemented. This time we only have to worry
- about accounts. Also this now implements Annas config gui changes.
-
- * mail-preferences.c: Implements the mailer's Preferences tab in
- Anna's new config GUI.
-
-2002-03-19 Larry Ewing <lewing@ximian.com>
-
- * mail-display.c: add missing NULL closure data to popup menu
- initialization.
-
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * Makefile.am (evolution_mail_LDADD): s/libversit.la/libversit.a/
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (main): Report a message before entering bonobo_main() to
- simplify debugging.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-browser.c: Remove E_FILTERBAR_RESET menu entry.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (on_right_click): Draw colour rectangles for
- each of the colour items and set a closure on each.
- (colourise_msg): colourise the message, yo.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (colour_msg): New callback to set a colour on a
- message.
-
- * folder-browser.c (on_right_click): Setup our popup icons and
- stuff. Also add a submenu for Labels.
-
- * mail-display.c (pixmap_press): Sync up with the new EPopupMenu
- API. Note: This code can probably now be fixed to use per-item
- closures - yay!
-
- * mail-accounts.c (construct): Connect to the label GtkEntry's and
- GnomeColorPickers and also to the Restore Defaults button.
-
- * mail-config.c (mail_config_get_label_name): New function to get
- a label's name.
- (mail_config_set_label_name): New function to set the label name.
- (mail_config_get_label_color): New function to get the label
- color.
- (mail_config_set_label_color): New function to set the label
- color.
- (config_read): Read in the config options for the labels and their
- colors.
- (mail_config_write_on_exit): Save the label options.
-
-2002-03-15 Larry Ewing <lewing@ximian.com>
-
- * mail-display.c: expand the relative urls of the object at the
- point so that relative images can be saved correctly.
-
- * folder-browser.c: add a closing quote in a comment.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-browser-factory.c (control_activate): Set the UI
- component on the search bar.
-
-2002-03-14 Dan Winship <danw@ximian.com>
-
- * component-factory.c (folder_types): Remove "mailstorage", since
- it's not needed any more.
- (storage_activate): Gone, although some of it is moved to
- storage_connect.
- (create_view): Remove mailstorage code.
- (add_storage): Connect to the storage's open_folder signal.
- Instead of creating a "mailstorage" folder, call
- evolution_storage_has_subfolders to let the shell know we haven't
- finished filling it in yet.
- (storage_connect): Handler for the storage's asyncOpenFolder
- signal. Call mail_note_store() to try to connect.
- (storage_connected): Callback for above. If the connection attempt
- failed, call evolution_storage_has_subfolders again to make the
- shell re-close the storage.
-
- * mail-folder-cache.c (update_folders): Remove a piece of
- mailstorage legacy code from here.
-
-2002-03-14 Radek Doulik <rodo@ximian.com>
-
- * mail-config.c (get_new_signature_filename): create new signature
- file
- (delete_unused_signature_file): be more careful about signature
- file path before unlinking
-
-2002-03-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (next_thread): Implemented.
-
- * message-list.c (message_list_select_next_thread): New function
- to select the next thread.
-
-2002-03-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser-window.c (folder_browser_window_new): Set a
- default size of the window, so we don't get this itty-bitty window
- the size of a quarter on the screen when it first gets shown.
-
-2002-03-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-display.c (on_link_clicked): Handle digest: urls.
-
- * mail-format.c (setup_mime_tables): Add a handler for
- multipart/digest.
- (handle_multipart_digest): Handle multipart/digest parts.
-
-2002-03-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (folder_browser_set_folder): Set the folder on
- a folder-browser object.
-
- * folder-browser-window.c (folder_browser_window_new): Simple
- window to display a folder-browser.
-
- * mail-callbacks.c (view_digest): New callback to open a
- folder-browser-window with a digest folder.
-
-2002-03-08 Radek Doulik <rodo@ximian.com>
-
- * mail-signature-editor.c (menu_file_save_cb): truncate stream
- before saving
-
- * mail-config.c (mail_config_signature_set_html): new function
-
- * mail-accounts.c (sig_event_client): watch for HTML changed event
-
- * mail-signature-editor.c: added HTML check menu item to Format
- menu
-
-2002-03-08 Dan Winship <danw@ximian.com>
-
- * mail-config-druid.c (management_prepare): Rewrite this to not
- use stpcpy, which isn't portable.
-
-2002-03-08 Radek Doulik <rodo@ximian.com>
-
- * mail-accounts.c (sig_event_client): handle name changed event
- (sig_load_preview): don't run script before each reload
- (sig_script_activate): run script only if script entry is
- activated
-
- * mail-signature-editor.c (mail_signature_editor): added signature
- name entry
-
-2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config-druid.c (management_changed): Re-focus the account
- name entry widget.
- (identity_prepare): If a name is not set, try and get the user's
- full name for them and set the text on the entry widget.
- (management_prepare): If the account name is already taken,
- generate a unique one by appending " (%d)".
-
-2002-03-07 Radek Doulik <rodo@ximian.com>
-
- * mail-account-gui.c (sig_new_html): make edit button sensitive
- after new signature is created
- (sig_new_text): ditto
-
-2002-03-07 Anna Marie Dirks <anna@ximian.com>
-
- * folder-browser.c: Made all the acclerators in the context menu
- on a message work. (There are 22 different menu items here, so
- picking a unique accelerator for each label was tricky, and some
- of the choices I made are different from the ones I would have
- made if there weren't so many stinking menu items.)
-
-2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config.c (config_import_old_signatures): Don't use an
- uninitialized 'id'.
-
-2002-03-07 Radek Doulik <rodo@ximian.com>
-
- * mail-signature-editor.c: notify accounts dialog about signature
- content change
-
- * mail-accounts.c (run_script): run script only if file regular
- file exists and has x flag
-
- * mail-signature-editor.c (mail_signature_editor): set initial
- focus to editor
- (do_exit): use hasUndo to avoid question dialog when content is
- unchanged
-
-2002-03-07 Dan Winship <danw@ximian.com>
-
- * component-factory.c (add_storage): Update for storage changes:
- explicitly create a root folder.
-
-2002-03-06 Dan Winship <danw@ximian.com>
-
- * mail-display.c (mail_display_render): Fix the "don't scroll back
- to the top of the HTML widget when opening an attachment" hack
- again by moving it here from mail_display_redisplay(). (It has to
- happen after the gtk_html_begin.)
- (mail_display_redisplay): Pass reset_scroll arg to
- mail_display_render.
-
- * mail-callbacks.c (do_mail_print): Pass reset_scroll (TRUE) to
- mail_display_render.
-
-2002-03-05 Dan Winship <danw@ximian.com>
-
- * folder-browser-ui.c: Don't try to set pixmap for
- /Toolbar/MailCompose, since it doesn't exist any more.
-
-2002-03-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (save_service): "use_ssl" can now be 3
- options, modify the code to handle this.
- (setup_service): Toggle the correct ssl option.
- (source_type_changed): Show/hide the ssl hbox container widget.
- (transport_type_changed): Same.
-
-2002-03-05 Dan Winship <danw@ximian.com>
-
- * mail-folder-cache.c (mail_note_store): Pull up assertion change
- from evolution-1-0-branch to allow external storages.
-
-2002-03-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c (mail_unselect): If the clicked column was
- column 0, enable/disable it.
- (mail_select): Same.
-
- * mail-display.c (load_http): Added more debugging code to help
- figure out why a certain image isn't loading - looks like
- gnome-vfs is getting a premature EOF?
-
- * folder-browser.c (my_folder_browser_init): Connect to the
- focus-in/out events on the message-list so that we can disable the
- EditInvertSelection and EditSelectThread menu items when the
- message-list is not in focus.
-
- * folder-browser-ui.c (folder_browser_ui_message_list_unfocus):
- New function to de-sensitize some items if the message-list is not
- in focus.
- (folder_browser_ui_message_list_focus): New function to sensitize
- some items if the message-list is not in focus.
-
- * mail-callbacks.c (invert_selection): Only invert the selection
- of the message-list if it is the widget in focus.
-
- * message-list.c (message_list_select): Do not explicitly grab the
- focus here.
-
2002-03-04 Ettore Perazzoli <ettore@ximian.com>
[Fix #19303.]
@@ -907,33 +10,6 @@
* mail-ops.c (mail_send_message): Set X-Mailer to say "Ximian
Evolution", not just "Evolution".
-2002-03-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (forward_message): Forward all selected
- messages. Fixes bug #21190.
-
-2002-02-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (handle_text_html): Get the Content-Base if the
- header exists and use gtk_html_set_base to set this base url.
-
- * mail-display.c (on_link_clicked): No longer need to calculate
- the full url. This is now handled by GtkHTML.
- (on_set_base): Removed.
- (on_url_requested): No longer need to calculate the full url.
- (mail_display_initialize_gtkhtml): Don't connect to the set_base
- signal anymore. We don't care.
-
- * mail-display.h: No longer need base_url (it was broken anyway).
-
-2002-02-26 Not Zed <NotZed@Ximian.com>
-
- * mail-display.c (on_url_requested): If a related part is
- requested, remove it from the related undisplayed list.
-
- * mail-format.c (handle_multipart_related): Check if related parts
- are displayed, if not, remove them. For #2741.
-
2002-02-24 Chris Toshok <toshok@ximian.com>
* folder-browser.c (folder_browser_search_do_search): rename
@@ -942,549 +18,42 @@
search_activated up to folder_browser_search_do_search, preserving
current behavior.
-2002-02-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.c (on_message_list_built): Removed, this wasn't
- working as intended and seemed to break other features.
-
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * component-factory.c (create_component): Add an icon for the "New
- message" user creatable item.
-
-2002-02-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.c (on_message_list_built): Connect to our own
- message_list_built signal. Focus the list and select the first
- unread message (or frst message depending). Fixes bug #3900.
-
-2002-02-20 Anna Marie Dirks <anna@ximian.com>
-
- * message-tag-editor.c (message_tag_editor_init): Gave the editor
- window a title and an icon.
-
-2002-02-20 Anna Marie Dirks <anna@ximian.com>
-
- * message-tags.glade: Changed the policy for table2 so that it
- does not expand/fill. This was necessary to allow the message list
- as much growing room as possible. (And besides, there's no reason for
- table2 to expand/fill; its child widgets can't change size.
-
-2002-02-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (confirm_goto_next_folder): Prompt the user to
- find out if he/she wants to go to the next folder with unread mail
- in it.
- (find_current_folder): Find a given CamelFolderInfo node based on
- a given uri.
- (find_next_folder_r): Recursively look for a CamelFOlderInfo node
- which has unread messages.
- (find_next_folder): Given a currently selected CamelFolderInfo
- node, look for the next node containing unread messages.
- (do_evil_kludgy_goto_next_folder_hack): Find the currently
- selected folder and then find the very next folder after it that
- contains unread messages and then select it via a CORBA call to
- the shell.
- (next_unread_msg): If we fail to find an unread message in the
- message-list, prompt the user to find out if we should jump to the
- next fodler containing unread messages. If so, call
- do_evil_kludgy_goto_next_folder_hack().
-
- * message-list.c (message_list_select): Return a boolean value
- based on whether the call was successfull or not.
-
- * mail-config.c (mail_config_get_confirm_goto_next_folder):
- (mail_config_set_confirm_goto_next_folder):
- (mail_config_get_goto_next_folder):
- (mail_config_set_goto_next_folder): All new functions, yay.
- (config_read): Read in the confirm_goto_next_folder and
- goto_next_folder config options.
- (mail_config_write_on_exit): Same the options here.
-
2002-02-15 Jeffrey Stedfast <fejj@ximian.com>
- * mail-account-gui.c (basename_from_uri): Ack, strip off the
- leading '/' char and also only translate if it is a local uri,
- imap folders and other external folders will be named by the user
- so no need to translate those.
-
- * mail-display.c (do_attachment_header): Don't display a
- down-arrow if the attachment is undisplayable. Fixes bug #6919.
- (launch_cb): Some programs are buggy when it comes to parsing
- file: uris, so make sure we do file://%s. Fixes bug #20456.
-
-2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (basename_from_uri): Replacement for using
- g_basename and also translates the basename string to fix bug
- #7160.
- (mail_account_gui_save): Use basename_from_uri().
- (folder_picker_clicked): Here too.
-
- * mail-callbacks.c (mail_generate_reply): Default the from-account
- to the source account. If that fails, then guess the from-account
- based on the recipients. Fixes bug #20479.
-
-2002-02-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-display.c (drag_data_get_cb): Implement.
- (drag_data_delete_cb): Implement.
- (do_attachment_header): Setup Drag & Drop. This implements
- bugzilla bug #1066.
-
- * folder-browser-ui.c: Set the followup icon to use the new flag
- icon rather than the exclamation mark icon.
-
- * mail-callbacks.c (flag_for_followup): Append the selected
- messages to the clist in the followp editor.
-
- * message-list.c: Include the new flag-for-followup icon.
-
- * message-tag-followup.c (message_tag_followup_append_message):
- New method to add a message to the message-list.
- (construct): Get the message_list widget and load the flag icon
- pixmap.
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (set_widget_values): Fixed a bug.
-
- * mail-callbacks.c (flag_for_followup): If only 1 message is
- selected and it happens to already be marked for follow-up, set
- the value of the flag on the editor so the settings are restored.
-
- * folder-browser-ui.c: Set the pixmaps on MarkAsRead, MarkAsUnread
- and MarkAsImportant bonobo verbs. Also connect to
- flag-for-followup verb.
- (folder_browser_ui_set_selection_state): Added MessageFollowUpFlag
- verb to the array of verb strings.
-
- * folder-browser.c: Set key accelerators on the follow-up
- right-click menu items to match Outlook.
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (create_msg_composer): No longer need to call
- e_msg_composer_show_sig_file(). This gets handled auto-magically
- by a signal emition when the default From address chooser gets
- created.
- (do_forward_non_attached): No longer need to call it here either
- because e_msg_composer_set_body_text() now makes sure to re-show
- the signature.
+ * mail-display.c (launch_cb): Some programs are buggy when it
+ comes to parsing file: uris, so make sure we do file://%s. Fixes
+ bug #20456.
2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (do_forward_non_attached): Show the signature.
-2002-02-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.c (ml_tree_value_at): Get followup-up message-list
- values. Also highlight the message in red if the due-by date is
- past due (this is what Outlook does).
- (ml_duplicate_value): Handle follow-up columns.
- (ml_free_value): Same.
- (ml_initialize_value): Here too.
- (ml_value_is_empty): And here.
- (ml_value_to_string): And finally here.
-
- * message-tag-followup.c (message_tag_followup_i18n_name): New
- convenience function.
-
-2002-02-11 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (create_msg_composer): unset changed, drop
- editor undo
- (mail_generate_reply): drop editor undo
- (do_forward_non_attached): ditto
- (do_forward_attach): ditto
- (do_redirect): ditto
-
-2002-02-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (followup_tag_complete): Implemented.
- (on_right_click): Do better enabling/hiding of unwanted
- flag-for-followup options.
-
-2002-02-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (set_widget_values): Set the correct
- drop-down menu item.
- (message_tag_followup_encode): Return NULL if the type is NONE.
- (clear_clicked): Set the drop-down menu to None.
- (type_changed): Hide the None menu item.
- (construct): Create a None menu item and set it as the default.
-
-2002-02-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.[c,h]: New flag-for-followup tag editor
- dialog.
-
- * mail-callbacks.c (flag_for_followup): New callback that pops up
- a flag-for-followup editor dialog.
- (flag_followup_completed): Marks all flag-for-followup'd messages
- as 'complete'.
- (flag_followup_clear): Clears all flag-for-followup tags from the
- selected messages.
-
- * message-tags.glade: glade file for tag editors.
-
2002-02-08 Jeffrey Stedfast <fejj@ximian.com>
- * message-tag-editor.[c,h]: Base class for a message tag editor.
-
- * folder-browser.c (on_right_click): Setup the hide/enable masks
- for "Flag for Follow-up"
-
- * mail-callbacks.c (confirm_expunge): Instead of hiding deleted
- messages and then expunging, disable the use of the message-list
- completely during the expunge operation.
- (expunged_folder): Re-enable the use of the message-list widget
- here.
-
-2002-02-07 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): call set_body later to
- allow ignored words to be sent to gtkhtml control ahead
-
-2002-02-07 JP Rosevear <jpr@ximian.com>
-
- * component-factory.c (create_component): remove "New" from user
- creatable menu item
-
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
-
- * folder-browser.c, folder-browser.h, folder-browser-ui.c,
- folder-browser-ui.h
- (folder_browser_ui_setup_view_menus,
- folder_browser_ui_discard_view_menus): Changed this to use the new
- GalViewMenus stuff. Made these exported functions.
-
- * mail-callbacks.c, message-browser.c: Changed these to not pass
- the now removed row parameter to message_list_select.
-
- * mail-config.c, mail-config.h (mail_config_folder_to_safe_url):
- Refactored this out of mail_config_folder_to_cachename.
-
- * message-list.c, message-list.h (message_list_select): Removed
- the row argument. Changed this to use the new function in ETree
- for finding the next cursor row that matches a test.
- (message_list_construct): Handle a failed construction of the
- ETree here.
- (message_list_setup_etree, save_tree_state): Don't load or save
- the header state. folder-browser-ui.c deals with this now.
-
-2002-02-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_new): Rearranged the #if
- checks so that we don't ever try to access any smime widgets
- (since they are now being destroyed) if smime isn't enabled.
- (mail_account_gui_save): Same here.
-
- * message-list.c: Removed references to NEEDS_REPLY.
-
- * mail-callbacks.c (mark_as_needing_reply): Removed.
- (mark_as_not_needing_reply): Removed.
- (toggle_need_reply): Removed.
-
- * folder-browser.c (on_right_click): Remove CAN_MARK_NEEDS_REPLY
- stuff, this is going to be implemented in an entirely different
- way.
-
- * mail-format.c (handle_text_plain): Look for DOCTYPE XML comments
- too to decide if the message content is really HTML.
-
-2002-02-06 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): Dont double-free the
- text body data.
-
-2002-01-31 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): Add attachments after
- we've seen if the composer object is valid.
- (mail_generate_reply): Support new flag REPLY_NO_QUOTE - if set,
- then dont quote any of the message in the reply.
-
-2002-02-02 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_new): Destroy the S/MIME
- frame if not available, instead of just graying it out. [I would
- just hide it, but it looks like there is a show_all somewhere so
- that doesn't work.]
-
-2002-02-02 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-config.glade: Some touchups from me and Anna.
-
-2002-01-31 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Don't bother setting
- the auto-cc/bcc recipients here. I'm moving the code to add them
- in the GUI in the composer so they will already be in the
- recipient list by this point.
-
-2002-01-31 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): ignore spell checking of
- words in addresses, move set_body_text after all ignored words are
- set so we don't have to spell check whole document again
- (mail_ignore_address): helper function
- (mail_ignore): ditto
-
-2002-01-30 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c (mail_edit): Pass the parent window to
- mail_account_editor_new().
-
- * mail-account-editor.c (mail_account_editor_new): Set the parent
- window here because construct() inadvertantly
- gtk_widget_show_all's the editor.
-
- * mail-account-gui.c (mail_account_gui_save): Use g_basename()
- rather than strrchr for '/' especially since the strrchr code
- wasn't doing any NULL checks.
-
-2002-01-30 Radek Doulik <rodo@ximian.com>
-
- * mail-format.c (handle_text_plain_flowed): print quoted text in
- italic
-
-2002-01-30 Not Zed <NotZed@Ximian.com>
-
- * component-factory.c (create_component): re-enable popup menu.
- (populate_folder_context_menu): If we're on a vfolder, and its not
- UNMATCHED, create a change properties item, and set it up
- approriately.
- (change_prop_popup): Callback to edit the vfolder rule. For
- #3358.
-
-2002-01-29 Dave West <kat@unleashed.org>
-
- * mail-callbacks.c (create_msg_composer): Changed the function
- signature so that we can pass in whom we want to compose as.
- Should fix bug #10391.
- (compose_msg): Get the current profile account and pass it along
- to create_msg_composer.
- (send_to_url): Pass in a NULL profile account to cause
- create_msg_composer to use the default account.
-
-2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (mail_send_message): Make X-Evolution-Account take
- priority over X-Evolution-Transport. Should we just get rid of
- X-Evolution-Transport? Anyways, this ought to fix a number of
- complaints.
-
- * mail-accounts.c (construct): Don't pass NULL text to
- gtk_entry_set_text. Maybe this will fix bug #18971.
-
-2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (redirect): New function that implements the
- Redirect feature.
-
- * mail-ops.c (mail_send_message): If we are redirecting a message,
- get the Resent-* recipients otherwise get the normal To/Cc/Bcc
- recipients and use them in the CamelTransport::send_to() method.
-
- * mail-session.c (main_get_filter_driver): Set the beep_func to
- the beep_cb, not the play_sound_func. Oops ;-)
-
- * folder-browser-ui.c: Add Redirect bonobo verb thingy here.
- (folder_browser_ui_set_selection_state): Add MessageRedirect to
- the proper string arrays.
-
-2002-01-29 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (do_mail_print): initialize line to 0 to make
- everybody happy ;-)
- ops, set local_font to NULL
- (do_mail_print): get rid of static global variables, as they are
- not thread safe (thanks to clahey for pointing this out)
- (footer_info_free): unref footer font
-
-2002-01-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Don't bother checking
- for invalid recipients anymore. If a recipient is invalid, the
- transport error message will specify that now.
-
-2002-01-28 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (do_mail_print): print footer
- (footer_print_cb): print page number and number of pages
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * importers/Makefile.am: Use IMPORTERS_CFLAGS.
-
-2002-01-25 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (delete_event_cb): We need to return a value
- here. I think FALSE is fine (I hope).
-
- * mail-display.c (save_data_cb): Save the pathname.
- (save_part): Use the new mail_config cruft to get the last used
- save pathname.
-
- * mail-config.c (config_read): Read in last_filesel_dir string.
- (mail_config_write_on_exit): Save the last_filesel_dir setting.
- (mail_config_get_last_filesel_dir): New
- (mail_config_set_last_filesel_dir): New
-
- * component-factory.c (destination_folder_handle_motion): Do some
- NULL checking on the url before using it.
- (destination_folder_handle_drop): Make sure the uri is non-NULL
- before freeing.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: s/MAILER_CFLAGS/EVOLUTION_MAIL_CFLAGS/,
- s/MAILER_LIBS/EVOLUTION_MAIL_LIBS/.
-
-2002-01-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-session.c (session_system_beep): This wrapper for gdk_beep().
-
- * mail-account-gui.c (is_email): Don't bother trying to see if the
- domain looks like a FQDN.
-
- * mail-callbacks.c (select_all): If the mail-display is in focus,
- then select-all in the mail display rather than the
- message-list. Fixes bug #19126.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * component-factory.c (create_component): Pass a NULL icon to
- `evolution_shell_component_add_user_creatable_item()'.
-
-2002-01-23 Jeffrey Stedfast <fejj@ximian.com>
-
- Implements bug #15692
-
- * folder-browser.c (html_button_press_event): New callback that
- checks to make sure that the mouse isn't over a link or image in
- the html view and then calls the on_right_click handler after
- getting the appropriate args.
- (my_folder_browser_init): Connect to the button_press_event here.
+ * mail-format.c (try_inline_pgp_sig): Handle cases where there
+ isn't a hash header (apparently some PGP versions don't use them
+ and/or are configurable to not display them?). Fixes bug #18935.
2002-01-23 Dan Winship <danw@ximian.com>
- * Makefile.am (INCLUDES): Define CAMEL_PROVIDERDIR to be the
- configure.in-defined camel_providerdir. (Was supposed to have been
- committed a month ago... oops.)
-
-2002-01-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (mail_filter_folder): Now takes a boolean notify
- argument. If this is *not* set, then remove the sound-notify
- filter rule that mail-session adds. Kinda kludgy, but good enough
- for the moment.
-
- * mail-callbacks.c (guess_me): Simplified.
-
-2002-01-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (handle_text_plain): If the first "token" in the
- body is "<html>", then treat this as a text/html part rather than
- a text/plain part. Fixes bug #16817.
-
- * component-factory.c (destination_folder_handle_drop): Removed
- some unused variables.
-
-2002-01-17 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-folder-cache.c (mail_note_store): Allow this to be called
+ with both storage and corba_storage NULL.
- * mail-format.c (try_uudecoding): Update to match new uudecode
- interface (ie, no longer need a uulen state variable).
-
-2002-01-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-display.c (on_set_base): New callback to handle the
- set_base signal.
- (on_url_requested): If the base_url is set, prepend it to the data
- url (we don't want to do this for cid urls or part urls tho).
- (mail_display_init): Initialize md->base_url to NULL.
- (mail_display_destroy): Free the base_url.
- (mail_display_initialize_gtkhtml): Connect to the set_base signal.
- (on_link_clicked): If the base_url is set, prepend it to the url
- string passed to us from gtkhtml.
-
-2002-01-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (do_edit_messages): Don't remove any
- X-Evolution* headers here, the composer already knows to ignore
- these. Besides, it needs to know the X-Evolution-Format header.
+ * mail-send-recv.c (receive_update_got_store): Remove the
+ 2001-12-07 hack since it's no longer needed.
2002-01-08 Jeffrey Stedfast <fejj@ximian.com>
- * mail-callbacks.c (composer_save_draft_cb): Do proper refcounting
- on the draft folder.
-
* message-list.c (message_list_select): When performing a
- wraparound, check to see if the first (or last depending on
- direction) message fits the selection criteria before telling
- etable to find the next/previous matching node.
+ wraparound, check to see if the first message fits the selection
+ criteria before telling etable to find the next node.
+
+2002-01-08 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (mail_account_gui_new): When connecting to
the transport username changed event, pass the gui->transport not
the gui->source.
-2002-01-08 Iain Holmes <iain@ximian.com>
-
- * importers/evolution-mbox-importer.c (string_to_int): Takes a hex
- string and converts it to an int.
- (get_info_from_mozilla): Creates a CamelMessageInfo structure from
- the X-Mozilla-Status header.
- (process_item_fn): Check for the X-Mozilla-Status header and if it
- is present call get_info_from_mozilla. If get_info_from_mozilla
- returns that the message was marked as deleted but never expunged
- it isn't imported.
-
- * importers/mozilla-status-headers.h: Stuff Evolution cares about
- from the mozilla header.
-
-2002-01-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config.c (mail_config_set_new_mail_notify_sound_file): Renamed.
- (mail_config_get_new_mail_notify_sound_file): Renamed.
-
- * mail-accounts.c (notify_radio_toggled): Replace EXEC with
- PLAY_SOUND.
- (construct): renamed the exec_command stuff to play_sound.
-
- * main.c (main): Init and shutdown gnome_sound.
-
- * mail-ops.c (fetch_mail_fetch): Don't do any new-mail
- notification here.
- (filter_folder_filter): call camel_filter_driver_flush.
-
- * mail-session.c (main_get_filter_driver): Set the filter-driver
- exec_func here instead.
-
- * mail-ops.c (mail_fetch_mail): Don't set the filter-driver
- exec_func here.
-
-2002-01-03 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Add an Organization
- header.
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (list_add_addresses): Simplified. Also no
- longer needs an "ignore_addr" argument as far as I can tell so
- that has been removed.
- (mail_generate_reply): Don't pass an ignore_addr argument to
- list_add_addresses and also change to use g_strcase_hash and
- g_strcase_equal since addresses are not case snesitive
- (mostly). Also, Reply-To can contain multiple addresses, so handle
- this case too.
-
-2002-01-02 JP Rosevear <jpr@ximian.com>
-
- * mail-callbacks.c: remove e_gnome_dialog util functions and use
- e-util ones instead
-
2001-12-21 Jeffrey Stedfast <fejj@ximian.com>
The idea here is that if we consistantly name the movemail file
@@ -1502,84 +71,21 @@
provided.
(mail_tool_do_movemail): Pass along the source_uri.
-2001-12-20 Jon Trowbridge <trow@ximian.com>
+2001-12-21 Jon Trowbridge <trow@ximian.com>
* message-list.c (on_click): Makes the auto-undelete behavior when
changing message flags a bit more sane. (Fixes #17634)
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- [Fixes #17377, Evolution doesn't work on multi-depth displays.]
-
- * main.c (main): Push GdkRGB visual and colormap.
-
-2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Add the auto-cc/bcc
- recipients here. The problem with setting them in the composer is
- that what if the user changes which account he wants to use? We'd
- either have to clear the cc/bcc lists *or* we'd have to leave them
- alone. Either way is bad. We can't just clear the entries because
- the user may have added addresses since the composer was
- opened. We don't want to leave any old auto-cc/bcc addresses there
- because that isn't desirable either. So we give up and add them
- here after the user has already hit the send button.
-
- * mail-config.c (account_copy): Update to copy the always-[b]cc
- options.
- (account_destroy): Update to destroy the above options.
- (config_read): Update to read in those values.
- (mail_config_write): Save those options.
-
- * mail-account-gui.c (mail_account_gui_new): Setup Always Cc/Bcc
- widgets.
- (mail_account_gui_save): Get the user-entered values for the
- always-cc/bcc stuff.
-
-2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (setup_service): If the provider is NULL,
- don't do anything.
-
- * mail-accounts.c (construct): Oops, no wonder the exec command
- thing never stuck around... I wasn't getting the right widget from
- libglade. Also connect to the GtkEntry's changed event since a
- GnomeFileEntry doesn't have that signal in its ancestry.
-
-2001-12-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (filter_folder_free): Argh, don't notify about new
- mail here.
- (fetch_mail_fetch): Notify about new mail here instead.
-
- * mail-accounts.c (construct): Setup the new-mail-notification
- widgets.
- (notify_command_changed): Update the command-line for new mail
- notification.
- (notify_radio_toggled): Update the new-mail-notification type.
-
- * mail-ops.c (filter_folder_free): See if we got any new mail and
- "sound the alarm" if we did.
-
-2001-12-17 Jon Trowbridge <trow@ximian.com>
-
- * mail-format.c (handle_text_plain_flowed): Set citation color to
- black when we are printing.
+2001-12-17 Dan Winship <danw@ximian.com>
- * mail-format.c (attachment_header): Avoid embedding <object> tags
- when we are printing.
- (handle_multipart_signed): Don't do the click-for-info signature
- stuff when we are printing.
- (handle_via_bonobo): Don't embed an <object> tag if we are
- printing.
+ * Makefile.am (INCLUDES): Define CAMEL_PROVIDERDIR to be the
+ configure.in-defined camel_providerdir.
- * folder-browser.c: Changed context_menu[] array so that we can
- print when the preview pane is closed.
+2001-12-17 Ettore Perazzoli <ettore@ximian.com>
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
+ [Fixes #17377, Evolution doesn't work on multi-depth displays.]
- * mail-ops.c (mail_fetch_mail): Set the filter driver's shell-exec
- callback.
+ * main.c (main): Push GdkRGB visual and colormap.
2001-12-12 Jeffrey Stedfast <fejJ@ximian.com>
@@ -1591,123 +97,6 @@
* mail-format.c (handle_text_plain): Make sure i != num_specials
after we check for any special text markers. Fixes bug #12265.
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (compose_msg): Connect to the save-draft signal.
- (send_to_url): Here too.
- (mail_reply): And here...
- (forward_get_composer): Same.
- (do_edit_messages): And finally here.
-
- * mail-format.c (try_inline_pgp):
- (try_inline_pgp_sig): Start reiplementing The Right Way and not
- danw's fucking half-assed kludge that doesn't work.
-
-2001-12-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config.c (mail_config_set_new_mail_notification_command):
- set the new-mail-notify command.
- (mail_config_get_new_mail_notification_command): get the
- new-mail-notify command.
- (mail_config_set_new_mail_notification): set the
- new-mail-notification action.
- (mail_config_get_new_mail_notification): get the
- new-mail-notification action.
- (mail_config_write_on_exit): save the new-mail-notification
- settings.
- (config_read): Read in the new-mail-notification settings.
-
- * mail-ops.c (mail_execute_shell_command): New function to execute
- a shell command async. Will be used for playing sounds on new mail
- or whatever.
-
-2001-12-11 Jon Trowbridge <trow@ximian.com>
-
- * mail-identify.c (mail_identify_mime_part): Fixed for
- mail_content_loaded's new signature.
-
- * mail-format.c (attachment_header): Don't convert URLs, etc. if
- we are printing.
- (write_address): Don't convert addresses to mailto: links if we
- are printing.
- (write_one_text_plain_chunk): Add a printing flag, that we pass
- along to mail_text_write.
- (handle_text_plain): Pass our printing flag to
- write_one_text_plain_chunk.
- (mail_get_message_rfc822): Don't unneccesarily convert URLs.
- (mail_content_loaded): Add a GtkHTML parameter.
-
- * mail-display.c (mail_display_initialize_gtkhtml): Added. Breaks
- all of the signal hookups out of mail_display_new.
- (mail_display_new): Call mail_display_initialize_gtkhtml.
- (mail_text_write): Don't convert URLs, etc., if we are printing.
- Lots of other changes to pass around GtkHTML/GtkHTMLStream objects.
-
- * mail-callbacks.c (do_mail_print): Call
- mail_display_initialize_gtkhtml on our GtkHTML object.
-
- * folder-browser.c (update_status_bar): Make the status bar more
- useful when you have a large number of hidden messages.
-
- * message-list.etspec: Add ETable magic for our new "Needs Reply"
- column. (The next few entries are for bug #90)
-
- * message-list.h: Add COL_NEED_REPLY.
-
- * message-list.c: Move mail_need_reply_xpm to the end of
- states_pixmaps.
- (ml_duplicate_value): Handle COL_NEED_REPLY.
- (ml_free_value): Handle COL_NEED_REPLY.
- (ml_initialize_value): Handle COL_NEED_REPLY.
- (ml_value_is_empty): Handle COL_NEED_REPLY. Added
- needs_reply_map[] array.
- (ml_value_to_string): Handle COL_NEED_REPLY.
- (ml_tree_value_at): Fix magic numbers, undoing my changes from the
- otehr day. Add handler for COL_NEED_REPLY.
- (message_list_create_extras): Attach icons for COL_NEED_REPLY.
- (on_click): Undo my previous changes to display need-reply status
- in COL_MESSAGE_STATUS. Add handing for COL_NEED_REPLY.
-
- * mail.h: Change mail_format_mime_message, mail_format_raw_message
- and the MailMimeHandlerFn typedef to take GtkHTML and
- GtkHTMLStream args, as per our changes in mail-format.c.
-
- * mail-format.c: Giant refactoring. Remove the assumption
- throughout that we will always want to render into the GtkHTML
- object contained in the MailDisplay. Instead, always pass in the
- GtkHTML and GtkHTMLStream that we want to write to. Also, ignore
- theme work-arounds if the printing flag is set. (This and what
- follows fixes bug #82)
-
- * mail-display.h: Remove GtkHTMLStream *stream from MailDisplay.
- We don't need it anymore.
-
- * mail-display.c (mail_display_render): Added. Breaks the code
- that renders the message into the GtkHTML object out of
- mail_display_redisplay.
- (mail_display_redisplay): Call mail_display_render.
- (mail_display_init): Remove reference to ->stream.
- (mail_display_new): Remove reference to ->stream.
-
- * mail-callbacks.c (do_mail_print): Create a new GtkHTML to render
- our printed version into (via the new function
- mail_display_render. Set the MailDisplay's printing flag to TRUE
- before we render, and set it back to FALSE afterwards.
- (do_mail_fetch_and_print): If the preview pane isn't open when we
- try to print, fetch the message before printing.
- (print_msg): Call do_mail_fetch_and_print.
- (print_preview_msg): Call do_mail_fetch_and_print.
-
- * folder-browser-ui.c: Remove "PrintMessage" and
- "PrintPreviewMessage" from message_pane_enables... these now work
- when the preview pane is closed. Disable printing if multiple
- messages are selected.
-
-2001-12-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (filter_folder_filter): Don't expunge when we sync
- anymore, this fixes bug #4472.
-
2001-12-04 Jeffrey Stedfast <fejj@ximian.com>
* mail-autofilter.c (rule_from_message): Make sure that the
@@ -16904,48 +15293,48 @@ End of branch
current_message = NULL, which shouldn't happen, but has happened
to me.
-2000-07-25 Dan Winship <danw@helixcode.com>
-
- * message-thread.c (group_root_set): Don't group together messages
- with the same non-Re: subject and no References/In-Reply-To. More
- often than not, they're unrelated. (eg, "[No subject]".)
- (thread_messages): Handle messages with no Message-Id. "This
- shouldn't happen", but it does sometimes, and it's not much code
- to make it just work.
-
-2000-07-25 Ettore Perazzoli <ettore@helixcode.com>
-
- * mail-config.c (create_service_page): Call
- `gtk_option_menu_set_menu()' as the last thing, as `GtkOptionMenu'
- is fscking broken. Also, `gtk_widget_show()' the individual menu
- items.
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * message-list.c (mark_msg_seen, ml_tree_set_value_at,
- message_list_regenerate): Update for CamelFolder API changes.
- (Certain functions no longer take a CamelException.)
-
- * mail-ops.c (real_fetch_mail, real_send_mail, real_delete_msg):
- ditto
-
- * component-factory.c (real_create_imap_storage,
- real_create_news_storage): ditto
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * component-factory.c, folder-browser-factory.c, test-mail.c:
- Remove GOAD support.
-
- * main.c: Remove GOAD support.
- (main): More "guess the build mistake" fun, this time for the
- failure to initialize Bonobo case.
-
-2000-07-24 Peter Williams <peterw@helixcode.com>
-
- * mail-tools.c (mail_tool_set_uid_flags): Change
- function to faithfully pass parameters to
- camel_folder_set_message_flags; this function is
+2000-07-25 Dan Wnihspi d<na@wehilcxdo.eoc>m
+
+* m seasegt-rhae.d cg(orpur_oo_tes)t :oD'n trguo poteghtrem seaseg
+sw ti hht easemn noR-:es buejtca dnn oeRefercnseI/-neRlp-yoT .oMer
+foet nhtnan to ,htyer' enueralet.d( ge ,["oNs buejtc"]).
+t(rhae_demssgase:)H nald eemssgasew ti honM seasegI-.d" hTsi
+hsuodl'n tahppne,"b tui todses motemise ,na dtis'n tom cu hoced
+otm ka etij su towkr
+.2
+00-0702- 5E ttro eeParzzlo i< teoterh@lexiocedc.mo
+>
+ *amlic-noif.g cc(erta_eesvrci_eapeg:)C la
+l` tg_kpoitnom_ne_ues_temun)( 'sat ehl sa thtni,ga sG`ktpOitnoeMun
+'i ssfkcni grbkone .A sl,o` tg_kiwgdtes_oh(w')t ehi dnvidiau lemun
+time.s
+
+02000--742 aD niWsnih p< adwnh@lexiocedc.mo
+>
+ *emssga-eiltsc.( amkrm_gss_ee,nm _lrtees_tev_laeua_,t
+emssga_eiltsr_genereta)e :pUadetf roC maleoFdlreA IPc ahgnse
+.( eCtria nufcnitno sonl noeg rateka C malexEectpoi.n
+)
+ *amlio-spc.( erlaf_tehcm_ia,lr ae_lesdnm_ia,lr ae_ledeletm_gs:)
+idtt
+o
+ *ocpmnone-taftcro.y cr(ae_lrcaeeti_am_ptsroga,e
+erlac_erta_eensws_otareg:)d tiot
+
+02000--742 aD niWsnih p< adwnh@lexiocedc.mo
+>
+ *ocpmnone-taftcro.y,cf loed-rrbwoes-raftcro.y,ct se-tamlic.
+:R mevo eOGDAs puoptr
+.
+ *amnic. :eRomevG AO Dusppro.t
+m(ia)n :oMer" ugse sht eubli dimtska"ef nu ,htsit mi eof rht
+ef iaulert onitiaiilezB nobo oaces
+.2
+00-0702- 4P tereW liilma s< epetwrh@lexiocedc.mo
+>
+ *amlit-ooslc.( amlit_oo_les_tiu_dlfga)s :hCnaeg
+ufcnitnot oaftifhluylp sa saparemetsrt
+oc malef_loed_res_temssga_elfga;st ih sufnction is
somewhat useless now. Other files synced with
API change.
diff --git a/mail/Makefile.am b/mail/Makefile.am
index dba25abaf8..fe9eb71142 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -16,12 +16,11 @@ INCLUDES = \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/shell/importer \
-I$(top_builddir)/shell/importer \
- $(EVOLUTION_MAIL_CFLAGS) \
+ $(MAILER_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
- -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \
-DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
@@ -54,8 +53,6 @@ evolution_mail_SOURCES = \
folder-browser-factory.h \
folder-browser-ui.c \
folder-browser-ui.h \
- folder-browser-window.c \
- folder-browser-window.h \
folder-info.c \
mail-accounts.c \
mail-accounts.h \
@@ -67,16 +64,10 @@ evolution_mail_SOURCES = \
mail-autofilter.h \
mail-callbacks.c \
mail-callbacks.h \
- mail-composer-prefs.c \
- mail-composer-prefs.h \
- mail-font-prefs.c \
- mail-font-prefs.h \
mail-config.c \
mail-config.h \
mail-config-druid.c \
mail-config-druid.h \
- mail-config-factory.c \
- mail-config-factory.h \
mail-crypto.c \
mail-crypto.h \
mail-display.c \
@@ -95,8 +86,6 @@ evolution_mail_SOURCES = \
mail-offline-handler.h \
mail-ops.c \
mail-ops.h \
- mail-preferences.c \
- mail-preferences.h \
mail-search.c \
mail-search.h \
mail-search-dialogue.c \
@@ -105,8 +94,6 @@ evolution_mail_SOURCES = \
mail-send-recv.h \
mail-session.c \
mail-session.h \
- mail-signature-editor.c \
- mail-signature-editor.h \
mail-stream-gtkhtml.c \
mail-stream-gtkhtml.h \
mail-tools.c \
@@ -119,10 +106,6 @@ evolution_mail_SOURCES = \
main.c \
message-list.c \
message-list.h \
- message-tag-editor.c \
- message-tag-editor.h \
- message-tag-followup.c \
- message-tag-followup.h \
subscribe-dialog.c \
subscribe-dialog.h \
mail.h
@@ -134,12 +117,13 @@ evolution_mail_LDADD = \
$(top_builddir)/composer/libcomposer.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libibex/libibex.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/shell/importer/libevolution-importer.la \
$(top_builddir)/widgets/menus/libmenus.la \
- $(EVOLUTION_MAIL_LIBS)
+ $(MAILER_LIBS)
evolution_mail_LDFLAGS = \
-export-dynamic
@@ -151,10 +135,10 @@ oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
@XML_I18N_MERGE_OAF_RULE@
gladedir = $(datadir)/evolution/glade
-glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade
+glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade
etspecdir = $(datadir)/evolution/etspec/
-etspec_DATA = mail-accounts.etspec message-list.etspec subscribe-dialog.etspec
+etspec_DATA = message-list.etspec subscribe-dialog.etspec
iconsdir = $(datadir)/images/evolution
buttonsdir = $(datadir)/images/evolution/buttons
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index 577192cf71..e2b718c191 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -39,7 +39,7 @@ static BonoboUIVerb message_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("MailNext", next_msg),
BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", next_flagged_msg),
BONOBO_UI_UNSAFE_VERB ("MailNextUnread", next_unread_msg),
- BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread),
+/* BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread),*/
BONOBO_UI_UNSAFE_VERB ("MailPrevious", previous_msg),
BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", previous_flagged_msg),
BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", previous_unread_msg),
@@ -51,12 +51,10 @@ static BonoboUIVerb message_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached),
BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline),
BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted),
- BONOBO_UI_UNSAFE_VERB ("MessageRedirect", redirect),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", mark_as_unimportant),
- BONOBO_UI_UNSAFE_VERB ("MessageFollowUpFlag", flag_for_followup),
BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg),
BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message),
BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all),
@@ -108,8 +106,10 @@ static BonoboUIVerb global_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("EmptyTrash", empty_trash),
BONOBO_UI_UNSAFE_VERB ("ForgetPasswords", mail_session_forget_passwords),
BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg),
+ BONOBO_UI_UNSAFE_VERB ("MailGetSend", send_receive_mail),
BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads),
BONOBO_UI_UNSAFE_VERB ("ToolsFilters", filter_edit),
+ BONOBO_UI_UNSAFE_VERB ("ToolsSettings", providers_config),
BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", manage_subscriptions),
BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders),
/* ViewPreview is a toggle */
@@ -130,11 +130,7 @@ static EPixmap message_pixcache [] = {
E_PIXMAP ("/commands/MessageApplyFilters", "apply-filters-16.xpm"),
E_PIXMAP ("/commands/MessageSearch", "search-16.png"),
E_PIXMAP ("/commands/MessageSaveAs", "save-as-16.png"),
- E_PIXMAP ("/commands/MessageMarkAsRead", "mail-read.xpm"),
- E_PIXMAP ("/commands/MessageMarkAsUnRead", "mail-new.xpm"),
- E_PIXMAP ("/commands/MessageMarkAsImportant", "priority-high.xpm"),
- E_PIXMAP ("/commands/MessageFollowUpFlag", "flag-for-followup-16.png"),
-
+
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplySender", "buttons/reply.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplyAll", "buttons/reply-to-all.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageForward", "buttons/forward.png"),
@@ -142,7 +138,7 @@ static EPixmap message_pixcache [] = {
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "buttons/move-message.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "buttons/copy-message.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "buttons/delete-message.png"),
-
+
E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "buttons/next-message.png"),
E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "buttons/previous-message.png"),
@@ -154,7 +150,7 @@ static EPixmap list_pixcache [] = {
E_PIXMAP ("/commands/ViewHideRead", "hide_read_messages.xpm"),
E_PIXMAP ("/commands/ViewHideSelected", "hide_selected_messages.xpm"),
E_PIXMAP ("/commands/ViewShowAll", "show_all_messages.xpm"),
-
+
E_PIXMAP ("/commands/EditCut", "16_cut.png"),
E_PIXMAP ("/commands/EditCopy", "16_copy.png"),
E_PIXMAP ("/commands/EditPaste", "16_paste.png"),
@@ -164,7 +160,12 @@ static EPixmap list_pixcache [] = {
static EPixmap global_pixcache [] = {
E_PIXMAP ("/commands/MailCompose", "new-message.xpm"),
+ E_PIXMAP ("/commands/MailGetSend", "send-receive.xpm"),
+ E_PIXMAP ("/commands/ToolsSettings", "configure_16_mail.xpm"),
+ E_PIXMAP ("/Toolbar/MailGetSend", "buttons/send-24-receive.png"),
+ E_PIXMAP ("/Toolbar/MailCompose", "buttons/compose-message.png"),
+
E_PIXMAP_END
};
@@ -192,137 +193,66 @@ static void ui_add (FolderBrowser *fb,
/* more complex stuff */
static void
-display_view(GalViewInstance *instance,
+display_view(GalViewCollection *collection,
GalView *view,
gpointer data)
{
FolderBrowser *fb = data;
if (GAL_IS_VIEW_ETABLE(view)) {
- gal_view_etable_attach_tree (GAL_VIEW_ETABLE(view), fb->message_list->tree);
+ e_tree_set_state_object(fb->message_list->tree, GAL_VIEW_ETABLE(view)->state);
}
}
-void
-folder_browser_ui_setup_view_menus (FolderBrowser *fb)
+static void
+folder_browser_setup_view_menus (FolderBrowser *fb,
+ BonoboUIComponent *uic)
{
- static GalViewCollection *collection = NULL;
- char *id;
- gboolean outgoing;
-
- if (fb->uicomp == NULL || fb->folder == NULL)
- return;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ char *local_dir;
- g_assert (fb->view_instance == NULL);
+ g_assert (fb->view_collection == NULL);
g_assert (fb->view_menus == NULL);
- outgoing = folder_browser_is_drafts (fb) ||
- folder_browser_is_sent (fb) ||
- folder_browser_is_outbox (fb);
-
- if (collection == NULL) {
- ETableSpecification *spec;
- char *local_dir;
- GalViewFactory *factory;
-
- collection = gal_view_collection_new();
-
- local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
- gal_view_collection_set_storage_directories
- (collection,
- EVOLUTION_DATADIR "/evolution/views/mail/",
- local_dir);
- g_free (local_dir);
-
- spec = e_table_specification_new();
- e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
-
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
-
- gal_view_collection_load(collection);
- }
-
- id = mail_config_folder_to_safe_url(fb->folder);
- fb->view_instance = gal_view_instance_new (collection, id);
- g_free (id);
-
- if (outgoing)
- gal_view_instance_set_default_view (fb->view_instance, "As_Sent_Folder");
+ fb->view_collection = gal_view_collection_new();
- if (!gal_view_instance_exists (fb->view_instance)) {
- char *path;
- struct stat st;
+ local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
+ gal_view_collection_set_storage_directories(
+ fb->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/mail/",
+ local_dir);
+ g_free (local_dir);
- gal_view_instance_load (fb->view_instance);
+ spec = e_table_specification_new();
+ e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
- path = mail_config_folder_to_cachename (fb->folder, "et-header-");
- if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
- ETableSpecification *spec;
- ETableState *state;
- GalView *view;
+ factory = gal_view_factory_etable_new (spec);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (fb->view_collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
- spec = e_table_specification_new();
- e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
- view = gal_view_etable_new(spec, "");
- gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_load(fb->view_collection);
- state = e_table_state_new ();
- e_table_state_load_from_file (state, path);
- gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state);
- gtk_object_unref (GTK_OBJECT (state));
-
- gal_view_instance_set_custom_view (fb->view_instance, view);
- gtk_object_unref (GTK_OBJECT (view));
- }
- g_free (path);
- }
-
-
- fb->view_menus = gal_view_menus_new(fb->view_instance);
- gal_view_menus_apply(fb->view_menus, fb->uicomp, NULL);
- gtk_signal_connect(GTK_OBJECT(fb->view_instance), "display_view",
+ fb->view_menus = gal_view_menus_new(fb->view_collection);
+ gal_view_menus_apply(fb->view_menus, uic, NULL);
+ gtk_signal_connect(GTK_OBJECT(fb->view_collection), "display_view",
display_view, fb);
- display_view (fb->view_instance, gal_view_instance_get_current_view (fb->view_instance), fb);
}
-/* Gets rid of the view instance and view menus objects */
-void
-folder_browser_ui_discard_view_menus (FolderBrowser *fb)
+/* Gets rid of the view collection and view menus objects */
+static void
+folder_browser_discard_view_menus (FolderBrowser *fb)
{
- g_assert (fb->view_instance != NULL);
+ g_assert (fb->view_collection != NULL);
g_assert (fb->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (fb->view_instance));
- fb->view_instance = NULL;
+ gtk_object_unref (GTK_OBJECT (fb->view_collection));
+ fb->view_collection = NULL;
gtk_object_unref (GTK_OBJECT (fb->view_menus));
fb->view_menus = NULL;
}
-void
-folder_browser_ui_message_list_focus (FolderBrowser *fb)
-{
- g_assert (fb->uicomp != NULL);
-
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
- "sensitive", "1", NULL);
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
- "sensitive", "1", NULL);
-}
-
-void
-folder_browser_ui_message_list_unfocus (FolderBrowser *fb)
-{
- g_assert (fb->uicomp != NULL);
-
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
- "sensitive", "0", NULL);
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
- "sensitive", "0", NULL);
-}
-
static void
folder_browser_setup_property_menu (FolderBrowser *fb,
BonoboUIComponent *uic)
@@ -440,16 +370,14 @@ folder_browser_ui_add_list (FolderBrowser *fb)
folder_browser_setup_property_menu (fb, fb->uicomp);
/* View menu */
- if (fb->view_instance == NULL)
- folder_browser_ui_setup_view_menus (fb);
+ folder_browser_setup_view_menus (fb, fb->uicomp);
}
void
folder_browser_ui_rm_list (FolderBrowser *fb)
{
/* View menu */
- if (fb->view_instance != NULL)
- folder_browser_ui_discard_view_menus (fb);
+ folder_browser_discard_view_menus (fb);
}
void
@@ -592,6 +520,7 @@ static const char *message_pane_enables[] = {
/* these only work if there's a message in the message pane
* (preview pane). This state is independent of how many are
* selected. */
+ "PrintMessage", "PrintPreviewMessage",
"ViewFullHeaders", "ViewLoadImages", "ViewNormal", "ViewSource",
"MessageSearch", "AddSenderToAddressbook",
NULL
@@ -614,13 +543,13 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
static const char *none_disables[] = {
/* actions that work on > 0 messages */
- "MessageApplyFilters", "MessageCopy", "MessageMove",
+ "MessageApplyFilters",
+ "MessageCopy", "MessageMove",
"MessageDelete", "MessageUndelete",
"MessageMarkAsRead", "MessageMarkAsUnRead",
"MessageMarkAsImportant", "MessageMarkAsUnimportant",
- "MessageFollowUpFlag", "MessageOpen", "MessageSaveAs",
+ "MessageOpen", "MessageSaveAs",
"MessageForward", "MessageForwardAttached",
- "MessageRedirect",
"EditCut", "EditCopy", "EditPaste", "ViewHideSelected",
@@ -633,9 +562,7 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
static const char *multiple_disables[] = {
/* actions that work on exactly 1 message */
"MessageReplyAll", "MessageReplyList", "MessageReplySender", "MessageResend",
- "MessageForwardInline", "MessageForwardQuoted", "MessageRedirect", "MessageSearch",
-
- "PrintMessage", "PrintPreviewMessage",
+ "MessageForwardInline", "MessageForwardQuoted", "MessageSearch",
"ToolsFilterMailingList", "ToolsFilterRecipient", "ToolsFilterSender",
"ToolsFilterSubject", "ToolsVFolderMailingList", "ToolsVFolderRecipient",
@@ -644,6 +571,7 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
NULL
};
+
fbui_sensitize_items (fb, message_pane_enables, state != FB_SELSTATE_NONE && fb->loaded_uid && fb->preview_shown);
/* assumes that all the appropriate XML's have been loaded */
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index beae739c3c..889af4709e 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -3,7 +3,7 @@
* Authors: Miguel De Icaza <miguel@ximian.com>
* Jeffrey Stedfast <fejj@ximian.com>
*
- * Copyright 2000,2001 Ximian, Inc. (www.ximian.com)
+ * Copyright 2000,2001 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -38,11 +38,8 @@
#include <gal/widgets/e-unicode.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-pixmap.h>
#include <gtkhtml/htmlengine.h>
-#include <gtkhtml/htmlobject.h>
-#include <gtkhtml/htmlinterval.h>
#include <gtkhtml/htmlengine-edit-cut-and-paste.h>
#include "filter/vfolder-rule.h"
@@ -58,13 +55,13 @@
#include "mail.h"
#include "mail-callbacks.h"
#include "mail-tools.h"
+#include "message-list.h"
#include "mail-ops.h"
#include "mail-vfolder.h"
#include "mail-autofilter.h"
#include "mail-mt.h"
#include "mail-folder-cache.h"
#include "folder-browser-ui.h"
-#include "message-tag-followup.h"
#include "mail-local.h"
#include "mail-config.h"
@@ -133,11 +130,6 @@ folder_browser_finalise (GtkObject *object)
CORBA_exception_init (&ev);
- g_free (folder_browser->loading_uid);
- g_free (folder_browser->pending_uid);
- g_free (folder_browser->new_uid);
- g_free (folder_browser->loaded_uid);
-
if (folder_browser->search_full)
gtk_object_unref (GTK_OBJECT (folder_browser->search_full));
@@ -162,9 +154,9 @@ folder_browser_finalise (GtkObject *object)
CORBA_exception_free (&ev);
- if (folder_browser->view_instance) {
- gtk_object_unref (GTK_OBJECT (folder_browser->view_instance));
- folder_browser->view_instance = NULL;
+ if (folder_browser->view_collection) {
+ gtk_object_unref (GTK_OBJECT (folder_browser->view_collection));
+ folder_browser->view_collection = NULL;
}
if (folder_browser->view_menus) {
@@ -177,7 +169,7 @@ folder_browser_finalise (GtkObject *object)
if (folder_browser->clipboard_selection)
g_byte_array_free (folder_browser->clipboard_selection, TRUE);
-
+
if (folder_browser->sensitise_state) {
g_hash_table_destroy(folder_browser->sensitise_state);
folder_browser->sensitise_state = NULL;
@@ -215,7 +207,7 @@ folder_browser_destroy (GtkObject *object)
/* wait for all outstanding async events against us */
mail_async_event_destroy (folder_browser->async_event);
-
+
if (folder_browser->get_id != -1) {
mail_msg_cancel(folder_browser->get_id);
folder_browser->get_id = -1;
@@ -310,7 +302,6 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
for (i = 0; i < uids->len; i++)
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
- g_free (msg);
return;
}
@@ -320,7 +311,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
if (uids->len == 1) {
filename = camel_mime_message_get_subject (message);
if (!filename)
- filename = _("Unknown");
+ filename = "Unknown";
} else
filename = "mbox";
@@ -386,7 +377,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
gtk_selection_data_set (selection_data, selection_data->target, 8,
bytes->data, bytes->len);
- g_byte_array_free (bytes, TRUE);
+ g_byte_array_free (bytes, FALSE);
}
break;
case DND_TARGET_TYPE_X_EVOLUTION_MESSAGE:
@@ -414,7 +405,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
gtk_selection_data_set (selection_data, selection_data->target, 8,
array->data, array->len);
- g_byte_array_free (array, TRUE);
+ g_byte_array_free (array, FALSE);
}
break;
default:
@@ -727,7 +718,7 @@ static void
update_status_bar(FolderBrowser *fb)
{
CORBA_Environment ev;
- int tmp, total;
+ int tmp;
GString *work;
extern CamelFolder *outbox_folder, *sent_folder;
@@ -736,49 +727,44 @@ update_status_bar(FolderBrowser *fb)
|| fb->shell_view == CORBA_OBJECT_NIL)
return;
+ work = g_string_new("");
+ g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder));
+ tmp = message_list_hidden(fb->message_list);
+ if (tmp) {
+ g_string_append(work, _(", "));
+ g_string_sprintfa(work, _("%d hidden"), tmp);
+ }
+ tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree));
+ if (tmp) {
+ g_string_append(work, _(", "));
+ g_string_sprintfa(work, _("%d selected"), tmp);
+ }
if (!fb->message_list->hidedeleted || !camel_folder_has_summary_capability(fb->folder)) {
- total = camel_folder_get_message_count(fb->folder);
+ tmp = camel_folder_get_message_count(fb->folder);
} else {
GPtrArray *sum = camel_folder_get_summary(fb->folder);
int i;
if (sum) {
- total = 0;
+ tmp = 0;
for (i=0;i<sum->len;i++) {
CamelMessageInfo *info = sum->pdata[i];
if ((info->flags & CAMEL_MESSAGE_DELETED) == 0)
- total++;
+ tmp++;
}
camel_folder_free_summary(fb->folder, sum);
} else {
- total = camel_folder_get_message_count(fb->folder);
+ tmp = camel_folder_get_message_count(fb->folder);
}
}
-
- work = g_string_new("");
- g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder));
- tmp = message_list_hidden(fb->message_list);
- if (0 < tmp && tmp < total) {
- g_string_append(work, _(", "));
- if (tmp < total / 2)
- g_string_sprintfa(work, _("%d hidden"), tmp);
- else
- g_string_sprintfa(work, _("%d visible"), total - tmp);
- }
- tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree));
- if (tmp) {
- g_string_append(work, _(", "));
- g_string_sprintfa(work, _("%d selected"), tmp);
- }
g_string_append(work, _(", "));
-
if (fb->folder == outbox_folder)
- g_string_sprintfa(work, _("%d unsent"), total);
+ g_string_sprintfa(work, _("%d unsent"), tmp);
else if (fb->folder == sent_folder)
- g_string_sprintfa(work, _("%d sent"), total);
+ g_string_sprintfa(work, _("%d sent"), tmp);
else
- g_string_sprintfa(work, _("%d total"), total);
+ g_string_sprintfa(work, _("%d total"), tmp);
CORBA_exception_init(&ev);
GNOME_Evolution_ShellView_setFolderBarLabel(fb->shell_view, work->str, &ev);
@@ -858,11 +844,6 @@ got_folder(char *uri, CamelFolder *folder, void *data)
camel_object_hook_event(CAMEL_OBJECT(fb->folder), "message_changed",
folder_changed, fb);
- if (fb->view_instance != NULL && fb->view_menus != NULL)
- folder_browser_ui_discard_view_menus (fb);
-
- folder_browser_ui_setup_view_menus (fb);
-
/* when loading a new folder, nothing is selected initially */
if (fb->uicomp)
@@ -874,23 +855,6 @@ got_folder(char *uri, CamelFolder *folder, void *data)
}
void
-folder_browser_set_folder (FolderBrowser *fb, CamelFolder *folder, const char *uri)
-{
- g_return_if_fail (IS_FOLDER_BROWSER (fb));
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- if (fb->get_id != -1) {
- /* FIXME: cancel the get_folder request? */
- }
-
- g_free (fb->uri);
- fb->uri = g_strdup (uri);
-
- gtk_object_ref (GTK_OBJECT (fb));
- got_folder (NULL, folder, fb);
-}
-
-void
folder_browser_set_ui_component (FolderBrowser *fb, BonoboUIComponent *uicomp)
{
g_return_if_fail (IS_FOLDER_BROWSER (fb));
@@ -1070,7 +1034,7 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show
} else {
e_paned_set_position (E_PANED (folder_browser->vpaned), 10000);
gtk_widget_hide (GTK_WIDGET (folder_browser->mail_display));
- mail_display_set_message (folder_browser->mail_display, NULL, NULL);
+ mail_display_set_message(folder_browser->mail_display, NULL);
folder_browser_ui_message_loaded(folder_browser);
}
}
@@ -1080,13 +1044,11 @@ enum {
};
static ESearchBarItem folder_browser_search_menu_items[] = {
- E_FILTERBAR_ADVANCED,
- { NULL, 0, NULL },
+ E_FILTERBAR_RESET,
E_FILTERBAR_SAVE,
+ { N_("Create vFolder from Search"), ESB_SAVE, NULL },
E_FILTERBAR_EDIT,
- { NULL, 0, NULL },
- { N_("Create _Virtual Folder From Search..."), ESB_SAVE, NULL },
- { NULL, -1, NULL }
+ { NULL, -1, NULL }
};
static void
@@ -1278,7 +1240,6 @@ folder_browser_charset_changed (BonoboUIComponent *component,
}
}
-/* external api to vfolder/filter on X, based on current message */
void
vfolder_subject (GtkWidget *w, FolderBrowser *fb)
{
@@ -1307,7 +1268,7 @@ vfolder_mlist (GtkWidget *w, FolderBrowser *fb)
name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers);
if (name) {
g_strstrip (name);
- vfolder_gui_add_from_mlist(name, fb->uri);
+ vfolder_gui_add_from_mlist(fb->mail_display->current_message, name, fb->uri);
g_free(name);
}
}
@@ -1344,84 +1305,6 @@ filter_mlist (GtkWidget *w, FolderBrowser *fb)
}
}
-/* ************************************************************ */
-
-/* popup api to vfolder/filter on X, based on current selection */
-struct _filter_data {
- CamelFolder *folder;
- char *uid;
- int type;
- char *uri;
- char *mlist;
-};
-
-static void
-filter_data_free(struct _filter_data *fdata)
-{
- g_free(fdata->uid);
- g_free(fdata->uri);
- if (fdata->folder)
- camel_object_unref((CamelObject *)fdata->folder);
- g_free(fdata->mlist);
- g_free(fdata);
-}
-
-static void
-vfolder_type_got_message(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *d)
-{
- struct _filter_data *data = d;
-
- if (msg)
- vfolder_gui_add_from_message(msg, data->type, data->uri);
-
- filter_data_free(data);
-}
-
-static void
-vfolder_type_uid(struct _filter_data *fdata, int type)
-{
- struct _filter_data *data;
-
- /* sigh, we need to copy this because the menu will free the one we got passed in */
- data = g_malloc0(sizeof(*data));
- data->type = type;
- data->uri = fdata->uri;
- fdata->uri = NULL;
- mail_get_message(fdata->folder, fdata->uid, vfolder_type_got_message, data, mail_thread_new);
-}
-
-static void vfolder_subject_uid (GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_SUBJECT); }
-static void vfolder_sender_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_FROM); }
-static void vfolder_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_TO); }
-static void vfolder_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_gui_add_from_mlist(fdata->mlist, fdata->uri); }
-
-static void
-filter_type_got_message(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *d)
-{
- struct _filter_data *data = d;
-
- if (msg)
- filter_gui_add_from_message(msg, data->type);
-
- filter_data_free(data);
-}
-
-static void
-filter_type_uid(struct _filter_data *fdata, int type)
-{
- struct _filter_data *data;
-
- /* sigh, we need to copy this because the menu will free the one we got passed in */
- data = g_malloc0(sizeof(*data));
- data->type = type;
- mail_get_message(fdata->folder, fdata->uid, filter_type_got_message, data, mail_thread_new);
-}
-
-static void filter_subject_uid (GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_SUBJECT); }
-static void filter_sender_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_FROM); }
-static void filter_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_TO); }
-static void filter_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { filter_gui_add_from_mlist(fdata->mlist); }
-
void
hide_none(GtkWidget *w, FolderBrowser *fb)
{
@@ -1528,171 +1411,75 @@ hide_sender(GtkWidget *w, FolderBrowser *fb)
}
}
-struct _colour_data {
- FolderBrowser *fb;
- guint32 rgb;
-};
-
-#define COLOUR_NONE (~0)
-
-static void
-colourise_msg (GtkWidget *widget, gpointer user_data)
-{
- struct _colour_data *data = user_data;
- char *colour = NULL;
- GPtrArray *uids;
- int i;
-
- if (data->rgb != COLOUR_NONE) {
- colour = alloca (8);
- sprintf (colour, "#%.2x%.2x%.2x", (data->rgb & 0xff0000) >> 16,
- (data->rgb & 0xff00) >> 8, data->rgb & 0xff);
- }
-
- uids = g_ptr_array_new ();
- message_list_foreach (data->fb->message_list, enumerate_msg, uids);
- for (i = 0; i < uids->len; i++) {
- camel_folder_set_message_user_tag (data->fb->folder, uids->pdata[i], "colour", colour);
- }
- g_ptr_array_free (uids, TRUE);
-}
-
-
enum {
- SELECTION_SET = 1<<1,
- CAN_MARK_READ = 1<<2,
- CAN_MARK_UNREAD = 1<<3,
- CAN_DELETE = 1<<4,
- CAN_UNDELETE = 1<<5,
- IS_MAILING_LIST = 1<<6,
- CAN_RESEND = 1<<7,
- CAN_MARK_IMPORTANT = 1<<8,
- CAN_MARK_UNIMPORTANT = 1<<9,
- CAN_FLAG_FOR_FOLLOWUP = 1<<10,
- CAN_FLAG_COMPLETED = 1<<11,
- CAN_CLEAR_FLAG = 1<<12,
- CAN_ADD_SENDER = 1<<13
+ SELECTION_SET = 2,
+ CAN_MARK_READ = 4,
+ CAN_MARK_UNREAD = 8,
+ CAN_DELETE = 16,
+ CAN_UNDELETE = 32,
+ IS_MAILING_LIST = 64,
+ CAN_RESEND = 128,
+ CAN_MARK_IMPORTANT = 256,
+ CAN_MARK_UNIMPORTANT = 512
};
#define MLIST_VFOLDER (3)
#define MLIST_FILTER (8)
static EPopupMenu filter_menu[] = {
- E_POPUP_ITEM_CC (N_("VFolder on _Subject"), GTK_SIGNAL_FUNC (vfolder_subject_uid), NULL, SELECTION_SET),
- E_POPUP_ITEM_CC (N_("VFolder on Se_nder"), GTK_SIGNAL_FUNC (vfolder_sender_uid), NULL, SELECTION_SET),
- E_POPUP_ITEM_CC (N_("VFolder on _Recipients"), GTK_SIGNAL_FUNC (vfolder_recipient_uid), NULL, SELECTION_SET),
- E_POPUP_ITEM_CC (N_("VFolder on Mailing _List"), GTK_SIGNAL_FUNC (vfolder_mlist_uid), NULL, SELECTION_SET | IS_MAILING_LIST),
+ { N_("VFolder on _Subject"), NULL, GTK_SIGNAL_FUNC (vfolder_subject), NULL, SELECTION_SET },
+ { N_("VFolder on Se_nder"), NULL, GTK_SIGNAL_FUNC (vfolder_sender), NULL, SELECTION_SET },
+ { N_("VFolder on _Recipients"), NULL, GTK_SIGNAL_FUNC (vfolder_recipient), NULL, SELECTION_SET },
+ { N_("VFolder on Mailing _List"), NULL, GTK_SIGNAL_FUNC (vfolder_mlist), NULL, SELECTION_SET | IS_MAILING_LIST },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM_CC (N_("Filter on Sub_ject"), GTK_SIGNAL_FUNC (filter_subject_uid), NULL, SELECTION_SET),
- E_POPUP_ITEM_CC (N_("Filter on Sen_der"), GTK_SIGNAL_FUNC (filter_sender_uid), NULL, SELECTION_SET),
- E_POPUP_ITEM_CC (N_("Filter on Re_cipients"), GTK_SIGNAL_FUNC (filter_recipient_uid), NULL, SELECTION_SET),
- E_POPUP_ITEM_CC (N_("Filter on _Mailing List"), GTK_SIGNAL_FUNC (filter_mlist_uid), NULL, SELECTION_SET | IS_MAILING_LIST),
+ { N_("Filter on Sub_ject"), NULL, GTK_SIGNAL_FUNC (filter_subject), NULL, SELECTION_SET },
+ { N_("Filter on Sen_der"), NULL, GTK_SIGNAL_FUNC (filter_sender), NULL, SELECTION_SET },
+ { N_("Filter on Re_cipients"), NULL, GTK_SIGNAL_FUNC (filter_recipient), NULL, SELECTION_SET },
+ { N_("Filter on _Mailing List"), NULL, GTK_SIGNAL_FUNC (filter_mlist), NULL, SELECTION_SET | IS_MAILING_LIST },
E_POPUP_TERMINATOR
};
-static EPopupMenu label_menu[] = {
- E_POPUP_PIXMAP_WIDGET_ITEM_CC (N_("None"), NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0),
- E_POPUP_SEPARATOR,
- E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0),
- E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0),
- E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0),
- E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0),
- E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0),
- E_POPUP_TERMINATOR
-};
static EPopupMenu context_menu[] = {
- E_POPUP_ITEM (N_("_Open"), GTK_SIGNAL_FUNC (open_msg), 0),
- E_POPUP_ITEM (N_("_Edit as New Message..."), GTK_SIGNAL_FUNC (resend_msg), CAN_RESEND),
- E_POPUP_ITEM (N_("_Save As..."), GTK_SIGNAL_FUNC (save_msg), 0),
- E_POPUP_ITEM (N_("_Print"), GTK_SIGNAL_FUNC (print_msg), 0),
+ { N_("_Open"), NULL, GTK_SIGNAL_FUNC (open_msg), NULL, 0 },
+ { N_("_Edit as New Message..."), NULL, GTK_SIGNAL_FUNC (resend_msg), NULL, CAN_RESEND },
+ { N_("_Save As..."), NULL, GTK_SIGNAL_FUNC (save_msg), NULL, 0 },
+ { N_("_Print"), NULL, GTK_SIGNAL_FUNC (print_msg), NULL, SELECTION_SET },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Reply to Sender"), GTK_SIGNAL_FUNC (reply_to_sender), 0),
- E_POPUP_ITEM (N_("Reply to _List"), GTK_SIGNAL_FUNC (reply_to_list), 0),
- E_POPUP_ITEM (N_("Reply to _All"), GTK_SIGNAL_FUNC (reply_to_all), 0),
- E_POPUP_ITEM (N_("_Forward"), GTK_SIGNAL_FUNC (forward), 0),
+ { N_("_Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 },
+ { N_("Reply to _List"), NULL, GTK_SIGNAL_FUNC (reply_to_list), NULL, 0 },
+ { N_("Reply to _All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 },
+ { N_("_Forward"), NULL, GTK_SIGNAL_FUNC (forward), NULL, 0 },
+ { "", NULL, (NULL), NULL, 0 },
+ { N_("Mar_k as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), NULL, CAN_MARK_READ },
+ { N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD },
+ { N_("Mark as _Important"), NULL, GTK_SIGNAL_FUNC (mark_as_important), NULL, CAN_MARK_IMPORTANT },
+ { N_("Mark as Unim_portant"), NULL, GTK_SIGNAL_FUNC (mark_as_unimportant), NULL, CAN_MARK_UNIMPORTANT },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Follo_w Up..."), GTK_SIGNAL_FUNC (flag_for_followup), CAN_FLAG_FOR_FOLLOWUP),
- E_POPUP_ITEM (N_("Fla_g Completed"), GTK_SIGNAL_FUNC (flag_followup_completed), CAN_FLAG_COMPLETED),
- E_POPUP_ITEM (N_("Cl_ear Flag"), GTK_SIGNAL_FUNC (flag_followup_clear), CAN_CLEAR_FLAG),
-
- /* separator here? */
-
- E_POPUP_ITEM (N_("Mar_k as Read"), GTK_SIGNAL_FUNC (mark_as_seen), CAN_MARK_READ),
- E_POPUP_ITEM (N_("Mark as _Unread"), GTK_SIGNAL_FUNC (mark_as_unseen), CAN_MARK_UNREAD),
- E_POPUP_ITEM (N_("Mark as _Important"), GTK_SIGNAL_FUNC (mark_as_important), CAN_MARK_IMPORTANT),
- E_POPUP_ITEM (N_("_Mark as Unimportant"), GTK_SIGNAL_FUNC (mark_as_unimportant), CAN_MARK_UNIMPORTANT),
+ { N_("_Move to Folder..."), NULL, GTK_SIGNAL_FUNC (move_msg_cb), NULL, 0 },
+ { N_("_Copy to Folder..."), NULL, GTK_SIGNAL_FUNC (copy_msg_cb), NULL, 0 },
+ { N_("_Delete"), NULL, GTK_SIGNAL_FUNC (delete_msg), NULL, CAN_DELETE },
+ { N_("_Undelete"), NULL, GTK_SIGNAL_FUNC (undelete_msg), NULL, CAN_UNDELETE },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (delete_msg), CAN_DELETE),
- E_POPUP_ITEM (N_("U_ndelete"), GTK_SIGNAL_FUNC (undelete_msg), CAN_UNDELETE),
+ { N_("Add Sender to Address Book"), NULL, GTK_SIGNAL_FUNC (addrbook_sender), NULL, SELECTION_SET },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 },
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Mo_ve to Folder..."), GTK_SIGNAL_FUNC (move_msg_cb), 0),
- E_POPUP_ITEM (N_("_Copy to Folder..."), GTK_SIGNAL_FUNC (copy_msg_cb), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_SUBMENU (N_("Label"), label_menu, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Add Sender to Address_book"), GTK_SIGNAL_FUNC (addrbook_sender), SELECTION_SET | CAN_ADD_SENDER),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Appl_y Filters"), GTK_SIGNAL_FUNC (apply_filters), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_SUBMENU (N_("Crea_te Rule From Message"), filter_menu, SELECTION_SET),
+ { N_("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), NULL, 0 },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 },
+ { N_("Create Ru_le From Message"), NULL, GTK_SIGNAL_FUNC (NULL), filter_menu, SELECTION_SET },
E_POPUP_TERMINATOR
};
-/* Note: this must be kept in sync with the context_menu!!! */
-static char *context_pixmaps[] = {
- NULL, /* Open */
- NULL, /* Edit */
- "save-as-16.png",
- "print.xpm",
- NULL,
- "reply.xpm",
- NULL, /* Reply to List */
- "reply_to_all.xpm",
- "forward.xpm",
- NULL,
- "flag-for-followup-16.png",
- NULL, /* Flag */
- NULL, /* Clear */
- "mail-read.xpm",
- "mail-new.xpm",
- "priority-high.xpm",
- NULL, /* Mark as Unimportant */
- NULL,
- "evolution-trash-mini.png",
- "undelete_message-16.png",
- NULL,
- "move_message.xpm",
- "copy_16_message.xpm",
- NULL,
- NULL, /* Label */
- NULL,
- NULL, /* Add Sender to Addressbook */
- NULL,
- NULL, /* Apply Filters */
- NULL,
- NULL, /* Create Rule from Message */
-};
struct cmpf_data {
ETree *tree;
@@ -1705,7 +1492,7 @@ context_menu_position_func (GtkMenu *menu, gint *x, gint *y,
{
int tx, ty, tw, th;
struct cmpf_data *closure = user_data;
-
+
gdk_window_get_origin (GTK_WIDGET (closure->tree)->window, x, y);
e_tree_get_cell_geometry (closure->tree, closure->row, closure->col,
&tx, &ty, &tw, &th);
@@ -1713,82 +1500,45 @@ context_menu_position_func (GtkMenu *menu, gint *x, gint *y,
*y += ty + th / 2;
}
-static gboolean
-followup_tag_complete (const char *tag_value)
-{
- struct _FollowUpTag *tag;
- gboolean ret;
-
- tag = message_tag_followup_decode (tag_value);
- ret = tag->completed != (time_t) 0 ? TRUE : FALSE;
- g_free (tag);
-
- return ret;
-}
-
-static void
-setup_popup_icons (void)
-{
- int i;
-
- for (i = 0; context_menu[i].name; i++) {
- if (context_pixmaps[i]) {
- char *filename;
-
- filename = g_strdup_printf ("%s/%s", EVOLUTION_IMAGES, context_pixmaps[i]);
- context_menu[i].pixmap_widget = gnome_pixmap_new_from_file (filename);
- g_free (filename);
- }
- }
-}
-
-static void
-colour_closures_free (GPtrArray *closures)
-{
- struct _colour_data *data;
- int i;
-
- for (i = 0; i < closures->len; i++) {
- data = closures->pdata[i];
- gtk_object_unref (GTK_OBJECT (data->fb));
- g_free (data);
- }
- g_ptr_array_free (closures, TRUE);
-}
-
/* handle context menu over message-list */
-static int
+static gint
on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb)
{
+ extern CamelFolder *sent_folder;
CamelMessageInfo *info;
- GPtrArray *uids, *closures;
+ GPtrArray *uids;
int enable_mask = 0;
int hide_mask = 0;
int i;
char *mlist = NULL;
GtkMenu *menu;
- struct _filter_data *fdata = NULL;
- if (!folder_browser_is_sent (fb)) {
+ if (fb->folder != sent_folder) {
enable_mask |= CAN_RESEND;
hide_mask |= CAN_RESEND;
- } else {
- enable_mask |= CAN_ADD_SENDER;
- hide_mask |= CAN_ADD_SENDER;
}
- if (folder_browser_is_drafts (fb)) {
- enable_mask |= CAN_ADD_SENDER;
- hide_mask |= CAN_ADD_SENDER;
- }
-
- if (fb->folder == outbox_folder) {
- enable_mask |= CAN_ADD_SENDER;
- hide_mask |= CAN_ADD_SENDER;
+ if (fb->mail_display->current_message == NULL) {
+ enable_mask |= SELECTION_SET;
+ } else {
+ char *mname, *p, c, *o;
+
+ mname = header_raw_check_mailing_list (&((CamelMimePart *)fb->mail_display->current_message)->headers);
+ /* Escape the mailing list name before showing it */
+ if (mname) {
+ mlist = alloca (strlen (mname)+2);
+ p = mname;
+ o = mlist;
+ while ((c = *p++)) {
+ if (c == '_')
+ *o++ = '_';
+ *o++ = c;
+ }
+ *o = 0;
+ g_free (mname);
+ }
}
- enable_mask |= SELECTION_SET;
-
/* get a list of uids */
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
@@ -1800,46 +1550,12 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
gboolean have_unseen = FALSE;
gboolean have_important = FALSE;
gboolean have_unimportant = FALSE;
- gboolean have_flag_for_followup = FALSE;
- gboolean have_flag_completed = FALSE;
- gboolean have_flag_incomplete = FALSE;
- gboolean have_unflagged = FALSE;
- const char *tag;
for (i = 0; i < uids->len; i++) {
info = camel_folder_get_message_info (fb->folder, uids->pdata[i]);
if (info == NULL)
continue;
- if (i == 0 && uids->len == 1) {
- const char *mname, *p;
- char c, *o;
-
- /* used by filter/vfolder from X callbacks */
- fdata = g_malloc0(sizeof(*fdata));
- fdata->uid = g_strdup(uids->pdata[i]);
- fdata->uri = g_strdup(fb->uri);
- fdata->folder = fb->folder;
- camel_object_ref((CamelObject *)fdata->folder);
-
- enable_mask &= ~SELECTION_SET;
- mname = camel_message_info_mlist(info);
- if (mname && mname[0]) {
- fdata->mlist = g_strdup(mname);
-
- /* Escape the mailing list name before showing it */
- mlist = alloca (strlen (mname)+2);
- p = mname;
- o = mlist;
- while ((c = *p++)) {
- if (c == '_')
- *o++ = '_';
- *o++ = c;
- }
- *o = 0;
- }
- }
-
if (info->flags & CAMEL_MESSAGE_SEEN)
have_seen = TRUE;
else
@@ -1855,15 +1571,6 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
else
have_unimportant = TRUE;
- if ((tag = camel_tag_get (&info->user_tags, "follow-up"))) {
- have_flag_for_followup = TRUE;
- if (followup_tag_complete (tag))
- have_flag_completed = TRUE;
- else
- have_flag_incomplete = TRUE;
- } else
- have_unflagged = TRUE;
-
camel_folder_free_message_info (fb->folder, info);
if (have_seen && have_unseen && have_deleted && have_undeleted)
@@ -1885,43 +1592,29 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
if (!have_important)
enable_mask |= CAN_MARK_UNIMPORTANT;
- if (!have_flag_for_followup)
- enable_mask |= CAN_CLEAR_FLAG;
- if (!have_unflagged)
- enable_mask |= CAN_FLAG_FOR_FOLLOWUP;
- if (!have_flag_incomplete)
- enable_mask |= CAN_FLAG_COMPLETED;
-
/*
* Hide items that wont get used.
*/
- if (!(have_unseen && have_seen)) {
+ if (!(have_unseen && have_seen)){
if (have_seen)
hide_mask |= CAN_MARK_READ;
else
hide_mask |= CAN_MARK_UNREAD;
}
- if (!(have_undeleted && have_deleted)) {
+ if (!(have_undeleted && have_deleted)){
if (have_deleted)
hide_mask |= CAN_DELETE;
else
hide_mask |= CAN_UNDELETE;
}
- if (!(have_important && have_unimportant)) {
+ if (!(have_important && have_unimportant)){
if (have_important)
hide_mask |= CAN_MARK_IMPORTANT;
else
hide_mask |= CAN_MARK_UNIMPORTANT;
}
-
- if (!have_flag_for_followup)
- hide_mask |= CAN_CLEAR_FLAG;
- if (!have_unflagged)
- hide_mask |= CAN_FLAG_FOR_FOLLOWUP;
- if (!have_flag_incomplete)
- hide_mask |= CAN_FLAG_COMPLETED;
}
/* free uids */
@@ -1929,74 +1622,19 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
- /* generate the "Filter on Mailing List" menu item name */
+ /* generate the "Filter on Mailing List menu item name */
if (mlist == NULL) {
enable_mask |= IS_MAILING_LIST;
- filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on _Mailing List"));
- filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on M_ailing List"));
+ filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on Mailing List"));
+ filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on Mailing List"));
} else {
- filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on _Mailing List (%s)"), mlist);
- filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on M_ailing List (%s)"), mlist);
+ filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on Mailing List (%s)"), mlist);
+ filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on Mailing List (%s)"), mlist);
}
- /* create the label/colour menu */
- closures = g_ptr_array_new ();
- label_menu[0].closure = g_new (struct _colour_data, 1);
- g_ptr_array_add (closures, label_menu[0].closure);
- gtk_object_ref (GTK_OBJECT (fb));
- ((struct _colour_data *) label_menu[0].closure)->fb = fb;
- ((struct _colour_data *) label_menu[0].closure)->rgb = COLOUR_NONE;
-
- for (i = 0; i < 5; i++) {
- struct _colour_data *closure;
- GdkPixmap *pixmap;
- GdkColormap *map;
- GdkColor color;
- guint32 rgb;
- GdkGC *gc;
-
- rgb = mail_config_get_label_color (i);
-
- color.red = ((rgb & 0xff0000) >> 8) | 0xff;
- color.green = (rgb & 0xff00) | 0xff;
- color.blue = ((rgb & 0xff) << 8) | 0xff;
-
- map = gdk_colormap_get_system ();
- gdk_color_alloc (map, &color);
-
- pixmap = gdk_pixmap_new (GTK_WIDGET (fb)->window, 16, 16, -1);
- gc = gdk_gc_new (GTK_WIDGET (fb)->window);
- gdk_gc_set_foreground (gc, &color);
- gdk_draw_rectangle (pixmap, gc, TRUE, 0, 0, 16, 16);
- gdk_gc_unref (gc);
-
- closure = g_new (struct _colour_data, 1);
- gtk_object_ref (GTK_OBJECT (fb));
- closure->fb = fb;
- closure->rgb = rgb;
-
- g_ptr_array_add (closures, closure);
-
- label_menu[i + 2].name = e_utf8_to_locale_string (mail_config_get_label_name (i));
- label_menu[i + 2].pixmap_widget = gtk_pixmap_new (pixmap, NULL);
- label_menu[i + 2].closure = closure;
- }
-
- setup_popup_icons ();
-
- for (i = 0; i < sizeof (filter_menu) / sizeof (filter_menu[0]); i++)
- filter_menu[i].closure = fdata;
-
menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb);
e_auto_kill_popup_menu_on_hide (menu);
- gtk_object_set_data_full (GTK_OBJECT (menu), "colour_closures",
- closures, (GtkDestroyNotify) colour_closures_free);
-
- if (fdata)
- gtk_object_set_data_full (GTK_OBJECT (menu), "filter_data",
- fdata, (GtkDestroyNotify) filter_data_free);
-
if (event->type == GDK_KEY_PRESS) {
struct cmpf_data closure;
@@ -2013,76 +1651,28 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
g_free (filter_menu[MLIST_FILTER].name);
g_free (filter_menu[MLIST_VFOLDER].name);
- /* free the label/colour menu */
- for (i = 0; i < 5; i++) {
- g_free (label_menu[i + 2].name);
- }
-
return TRUE;
}
-static int
-html_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- FolderBrowser *fb = data;
- HTMLEngine *engine;
- HTMLPoint *point;
- ETreePath *path;
- int row;
-
- if (event->type != GDK_BUTTON_PRESS || event->button != 3)
- return FALSE;
-
- engine = GTK_HTML (widget)->engine;
- point = html_engine_get_point_at (engine, event->x + engine->x_offset,
- event->y + engine->y_offset, FALSE);
-
- if (point) {
- /* don't popup a menu if the mouse is hovering over a
- url or a source image because those situations are
- handled in mail-display.c's button_press_event
- callback */
- const char *src, *url;
-
- url = html_object_get_url (point->object);
- src = html_object_get_src (point->object);
-
- if (url || src) {
- html_point_destroy (point);
- return FALSE;
- }
-
- html_point_destroy (point);
- }
-
- path = e_tree_get_cursor (fb->message_list->tree);
- row = e_tree_row_of_node (fb->message_list->tree, path);
-
- on_right_click (fb->message_list->tree, row, path, 2,
- (GdkEvent *) event, fb);
-
- return TRUE;
-}
-
-static int
+static gint
on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
{
FolderBrowser *fb = data;
ETreePath *path;
int row;
-
+
if (key->state & GDK_CONTROL_MASK)
return FALSE;
-
+
path = e_tree_get_cursor (fb->message_list->tree);
row = e_tree_row_of_node (fb->message_list->tree, path);
-
+
switch (key->keyval) {
case GDK_Delete:
case GDK_KP_Delete:
delete_msg (NULL, fb);
return TRUE;
-
+
case GDK_Menu:
on_right_click (fb->message_list->tree, row, path, 2,
(GdkEvent *)key, fb);
@@ -2091,7 +1681,7 @@ on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
toggle_as_important (NULL, fb, NULL);
return TRUE;
}
-
+
return FALSE;
}
@@ -2264,15 +1854,12 @@ done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, vo
{
FolderBrowser *fb = data;
int timeout = mail_config_get_mark_as_seen_timeout ();
- const char *followup;
if (folder != fb->folder || fb->mail_display == NULL)
return;
- followup = camel_folder_get_message_user_tag (folder, uid, "follow-up");
-
- mail_display_set_message (fb->mail_display, (CamelMedium *) msg, followup);
-
+ mail_display_set_message (fb->mail_display, (CamelMedium *)msg);
+
/* FIXME: should this signal be emitted here?? */
gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [MESSAGE_LOADED], uid);
@@ -2321,7 +1908,7 @@ do_message_selected (FolderBrowser *fb)
fb->loading_uid = g_strdup (fb->new_uid);
mail_get_message (fb->folder, fb->loading_uid, done_message_selected, fb, mail_thread_new);
} else {
- mail_display_set_message (fb->mail_display, NULL, NULL);
+ mail_display_set_message (fb->mail_display, NULL);
}
}
@@ -2344,28 +1931,6 @@ on_message_selected (MessageList *ml, const char *uid, FolderBrowser *fb)
fb->loading_id = gtk_timeout_add (100, (GtkFunction)do_message_selected, fb);
}
-static gboolean
-on_message_list_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
-{
- FolderBrowser *fb = (FolderBrowser *) user_data;
-
- printf ("got focus!\n");
- folder_browser_ui_message_list_focus (fb);
-
- return FALSE;
-}
-
-static gboolean
-on_message_list_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
-{
- FolderBrowser *fb = (FolderBrowser *) user_data;
-
- printf ("got unfocus!\n");
- folder_browser_ui_message_list_unfocus (fb);
-
- return FALSE;
-}
-
static void
folder_browser_init (GtkObject *object)
{
@@ -2381,7 +1946,7 @@ my_folder_browser_init (GtkObject *object)
FolderBrowser *fb = FOLDER_BROWSER (object);
int i;
- fb->view_instance = NULL;
+ fb->view_collection = NULL;
fb->view_menus = NULL;
fb->pref_master = FALSE;
@@ -2402,8 +1967,6 @@ my_folder_browser_init (GtkObject *object)
gtk_signal_connect (GTK_OBJECT (fb->mail_display->html),
"key_press_event", GTK_SIGNAL_FUNC (on_key_press), fb);
- gtk_signal_connect (GTK_OBJECT (fb->mail_display->html),
- "button_press_event", GTK_SIGNAL_FUNC (html_button_press_event), fb);
gtk_signal_connect (GTK_OBJECT (fb->message_list->tree),
"key_press", GTK_SIGNAL_FUNC (etree_key), fb);
@@ -2414,12 +1977,6 @@ my_folder_browser_init (GtkObject *object)
gtk_signal_connect (GTK_OBJECT (fb->message_list->tree),
"double_click", GTK_SIGNAL_FUNC (on_double_click), fb);
- gtk_signal_connect (GTK_OBJECT (fb->message_list), "focus_in_event",
- GTK_SIGNAL_FUNC (on_message_list_focus_in), fb);
-
- gtk_signal_connect (GTK_OBJECT (fb->message_list), "focus_out_event",
- GTK_SIGNAL_FUNC (on_message_list_focus_out), fb);
-
gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected",
on_message_selected, fb);
@@ -2481,13 +2038,10 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri)
}
CORBA_exception_free (&ev);
-
- if (uri) {
- folder_browser->uri = g_strdup (uri);
- gtk_object_ref (GTK_OBJECT (folder_browser));
- folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder,
- folder_browser, mail_thread_new);
- }
+
+ folder_browser->uri = g_strdup (uri);
+ gtk_object_ref (GTK_OBJECT (folder_browser));
+ folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new);
return GTK_WIDGET (folder_browser);
}
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index 669be6b39c..514ffd717d 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -29,48 +29,40 @@
#include <string.h>
#include <stdarg.h>
+#include <bonobo.h>
+#include <bonobo/bonobo-stream-memory.h>
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-gui-utils.h>
-#include "evolution-folder-selector-button.h"
+#include "shell/evolution-shell-client.h"
#include "mail-account-gui.h"
#include "mail-session.h"
#include "mail-send-recv.h"
-#include "mail-signature-editor.h"
-#include "mail-composer-prefs.h"
+#include "e-msg-composer.h"
#define d(x)
extern char *default_drafts_folder_uri, *default_sent_folder_uri;
-extern EvolutionShellClient *global_shell_client;
static void save_service (MailAccountGuiService *gsvc, GHashTable *extra_conf, MailConfigService *service);
static void service_changed (GtkEntry *entry, gpointer user_data);
-struct {
- char *label;
- char *value;
-} ssl_options[] = {
- { N_("Always"), "always" },
- { N_("Whenever Possible"), "when-possible" },
- { N_("Never"), "never" }
-};
-
-static int num_ssl_options = sizeof (ssl_options) / sizeof (ssl_options[0]);
-
static gboolean
is_email (const char *address)
{
- /* This is supposed to check if the address's domain could be
- an FQDN but alas, it's not worth the pain and suffering. */
- const char *at;
+ const char *at, *hname;
at = strchr (address, '@');
/* make sure we have an '@' and that it's not the first or last char */
if (!at || at == address || *(at + 1) == '\0')
return FALSE;
- return TRUE;
+ hname = at + 1;
+ /* make sure the first and last chars aren't '.' */
+ if (*hname == '.' || hname[strlen (hname) - 1] == '.')
+ return FALSE;
+
+ return strchr (hname, '.') != NULL;
}
static GtkWidget *
@@ -107,7 +99,6 @@ mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete)
if (incomplete)
*incomplete = get_focused_widget (GTK_WIDGET (gui->full_name),
GTK_WIDGET (gui->email_address),
- GTK_WIDGET (gui->reply_to),
NULL);
return FALSE;
}
@@ -117,18 +108,6 @@ mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete)
if (incomplete)
*incomplete = get_focused_widget (GTK_WIDGET (gui->email_address),
GTK_WIDGET (gui->full_name),
- GTK_WIDGET (gui->reply_to),
- NULL);
- return FALSE;
- }
-
- /* make sure that if the reply-to field is filled in, that it is valid */
- text = gtk_entry_get_text (gui->reply_to);
- if (text && *text && !is_email (text)) {
- if (incomplete)
- *incomplete = get_focused_widget (GTK_WIDGET (gui->reply_to),
- GTK_WIDGET (gui->email_address),
- GTK_WIDGET (gui->full_name),
NULL);
return FALSE;
}
@@ -136,19 +115,12 @@ mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete)
return TRUE;
}
-static void
-auto_detected_foreach (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- g_free (value);
-}
-
static gboolean
-service_complete (MailAccountGuiService *service, GHashTable *extra_config, GtkWidget **incomplete)
+service_complete (MailAccountGuiService *service, GtkWidget **incomplete)
{
const CamelProvider *prov = service->provider;
- GtkWidget *path;
char *text;
+ GtkWidget *path;
if (!prov)
return TRUE;
@@ -206,135 +178,13 @@ service_complete (MailAccountGuiService *service, GHashTable *extra_config, GtkW
gboolean
mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete)
{
- return service_complete (&gui->source, gui->extra_config, incomplete);
-}
-
-void
-mail_account_gui_auto_detect_extra_conf (MailAccountGui *gui)
-{
- MailAccountGuiService *service = &gui->source;
- CamelProvider *prov = service->provider;
- GHashTable *auto_detected;
- GtkWidget *path;
- CamelURL *url;
- char *text;
-
- if (!prov)
- return;
-
- /* transports don't have a path */
- if (service->path)
- path = GTK_WIDGET (service->path);
- else
- path = NULL;
-
- url = g_new0 (CamelURL, 1);
- camel_url_set_protocol (url, prov->protocol);
-
- if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_HOST)) {
- text = g_strdup (gtk_entry_get_text (service->hostname));
- if (*text) {
- char *port;
-
- port = strchr (text, ':');
- if (port) {
- *port++ = '\0';
- camel_url_set_port (url, atoi (port));
- }
-
- camel_url_set_host (url, text);
- }
- g_free (text);
- }
-
- if (CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_USER)) {
- text = g_strdup (gtk_entry_get_text (service->username));
- g_strstrip (text);
- camel_url_set_user (url, text);
- g_free (text);
- }
-
- if (path && CAMEL_PROVIDER_ALLOWS (prov, CAMEL_URL_PART_PATH)) {
- text = gtk_entry_get_text (service->path);
- if (text && *text)
- camel_url_set_path (url, text);
- }
-
- camel_provider_auto_detect (prov, url, &auto_detected, NULL);
- camel_url_free (url);
-
- if (auto_detected) {
- CamelProviderConfEntry *entries;
- GtkToggleButton *toggle;
- GtkSpinButton *spin;
- GtkEntry *entry;
- char *value;
- int i;
-
- entries = service->provider->extra_conf;
-
- for (i = 0; entries[i].type != CAMEL_PROVIDER_CONF_END; i++) {
- if (!entries[i].name)
- continue;
-
- value = g_hash_table_lookup (auto_detected, entries[i].name);
- if (!value)
- continue;
-
- switch (entries[i].type) {
- case CAMEL_PROVIDER_CONF_CHECKBOX:
- toggle = g_hash_table_lookup (gui->extra_config, entries[i].name);
- gtk_toggle_button_set_active (toggle, atoi (value));
- break;
-
- case CAMEL_PROVIDER_CONF_ENTRY:
- entry = g_hash_table_lookup (gui->extra_config, entries[i].name);
- if (value)
- gtk_entry_set_text (entry, value);
- break;
-
- case CAMEL_PROVIDER_CONF_CHECKSPIN:
- {
- gboolean enable;
- double val;
- char *name;
-
- toggle = g_hash_table_lookup (gui->extra_config, entries[i].name);
- name = g_strdup_printf ("%s_value", entries[i].name);
- spin = g_hash_table_lookup (gui->extra_config, name);
- g_free (name);
-
- enable = *value++ == 'y';
- gtk_toggle_button_set_active (toggle, enable);
- g_assert (*value == ':');
- val = strtod (++value, NULL);
- gtk_spin_button_set_value (spin, val);
- }
- break;
- default:
- }
- }
-
- g_hash_table_foreach (auto_detected, auto_detected_foreach, NULL);
- g_hash_table_destroy (auto_detected);
- }
+ return service_complete (&gui->source, incomplete);
}
gboolean
mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete)
{
- /* If it's both source and transport, there's nothing extra to
- * configure on the transport page.
- */
- if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider)) {
- if (gui->transport.provider == gui->source.provider)
- return TRUE;
- if (incomplete)
- *incomplete = GTK_WIDGET (gui->transport.type);
- return FALSE;
- }
-
- if (!service_complete (&gui->transport, NULL, incomplete))
+ if (!service_complete (&gui->transport, incomplete))
return FALSE;
/* FIXME? */
@@ -434,27 +284,7 @@ build_auth_menu (MailAccountGuiService *service, GList *all_authtypes,
if (first) {
gtk_option_menu_set_history (service->authtype, history);
- gtk_signal_emit_by_name (GTK_OBJECT (first), "activate");
- }
-}
-
-static void
-transport_provider_set_available (MailAccountGui *gui, CamelProvider *provider,
- gboolean available)
-{
- GtkWidget *menuitem;
-
- menuitem = gtk_object_get_data (GTK_OBJECT (gui->transport.type),
- provider->protocol);
- g_return_if_fail (menuitem != NULL);
- gtk_widget_set_sensitive (menuitem, available);
-
- if (available) {
- gpointer number = gtk_object_get_data (GTK_OBJECT (menuitem), "number");
-
- gtk_signal_emit_by_name (GTK_OBJECT (menuitem), "activate");
- gtk_option_menu_set_history (gui->transport.type,
- GPOINTER_TO_UINT (number));
+ gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", service);
}
}
@@ -466,13 +296,6 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
CamelProvider *provider;
provider = gtk_object_get_data (GTK_OBJECT (widget), "provider");
-
- /* If the previously-selected provider has a linked transport,
- * disable it.
- */
- if (gui->source.provider &&
- CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->source.provider))
- transport_provider_set_available (gui, gui->source.provider, FALSE);
gui->source.provider = provider;
@@ -518,6 +341,23 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
if (!dwidget)
dwidget = GTK_WIDGET (gui->source.path);
+ if (!strcmp (provider->protocol, "mbox")
+ || !strcmp(provider->protocol, "spool")) {
+ char *path;
+
+ if (getenv ("MAIL"))
+ path = g_strdup (getenv ("MAIL"));
+ else
+ path = g_strdup_printf (SYSTEM_MAIL_DIR "/%s", g_get_user_name ());
+ gtk_entry_set_text (gui->source.path, path);
+ g_free (path);
+ } else if (!strcmp (provider->protocol, "maildir") &&
+ getenv ("MAILDIR")) {
+ gtk_entry_set_text (gui->source.path, getenv ("MAILDIR"));
+ } else {
+ gtk_entry_set_text (gui->source.path, "");
+ }
+
gtk_widget_show (GTK_WIDGET (file_entry));
gtk_widget_show (label);
} else {
@@ -529,13 +369,13 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
/* ssl */
#ifdef HAVE_SSL
if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL)
- gtk_widget_show (gui->source.ssl_hbox);
+ gtk_widget_show (GTK_WIDGET (gui->source.use_ssl));
else
- gtk_widget_hide (gui->source.ssl_hbox);
- gtk_widget_hide (gui->source.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl));
+ gtk_widget_hide (GTK_WIDGET (gui->source.no_ssl));
#else
- gtk_widget_hide (gui->source.ssl_hbox);
- gtk_widget_show (gui->source.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl));
+ gtk_widget_show (GTK_WIDGET (gui->source.no_ssl));
#endif
/* auth */
@@ -557,9 +397,6 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_grab_focus (dwidget);
mail_account_gui_build_extra_conf (gui, gui && gui->account && gui->account->source ? gui->account->source->url : NULL);
-
- if (provider && CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider))
- transport_provider_set_available (gui, provider, TRUE);
}
@@ -587,13 +424,15 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
gui->transport.provider = provider;
/* description */
- gtk_label_set_text (gui->transport.description, provider->description);
+ if (provider)
+ gtk_label_set_text (gui->transport.description, provider->description);
+ else
+ gtk_label_set_text (gui->transport.description, "");
frame = glade_xml_get_widget (gui->xml, "transport_frame");
- if (!CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider) &&
- (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
- (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
- !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH)))) {
+ if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
+ (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
+ !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH))) {
gtk_widget_show (frame);
label = glade_xml_get_widget (gui->xml, "transport_host_label");
@@ -609,13 +448,13 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
/* ssl */
#ifdef HAVE_SSL
if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL)
- gtk_widget_show (gui->transport.ssl_hbox);
+ gtk_widget_show (GTK_WIDGET (gui->transport.use_ssl));
else
- gtk_widget_hide (gui->transport.ssl_hbox);
- gtk_widget_hide (gui->transport.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl));
+ gtk_widget_hide (GTK_WIDGET (gui->transport.no_ssl));
#else
- gtk_widget_hide (gui->transport.ssl_hbox);
- gtk_widget_show (gui->transport.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl));
+ gtk_widget_show (GTK_WIDGET (gui->transport.no_ssl));
#endif
/* auth */
@@ -628,8 +467,7 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_hide (frame);
frame = glade_xml_get_widget (gui->xml, "transport_auth_frame");
- if (!CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider) &&
- CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) {
+ if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) {
gtk_widget_show (frame);
label = glade_xml_get_widget (gui->xml, "transport_user_label");
@@ -655,7 +493,7 @@ service_changed (GtkEntry *entry, gpointer user_data)
MailAccountGuiService *service = user_data;
gtk_widget_set_sensitive (GTK_WIDGET (service->check_supported),
- service_complete (service, NULL, NULL));
+ service_complete (service, NULL));
}
static void
@@ -722,8 +560,6 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
{
CamelURL *url;
GtkWidget *mailcheck_frame, *main_vbox, *cur_vbox;
- GtkWidget *hostname_label, *username_label, *path_label;
- GtkWidget *hostname, *username, *path;
CamelProviderConfEntry *entries;
GList *children, *child;
char *name;
@@ -734,18 +570,6 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
else
url = NULL;
- hostname_label = glade_xml_get_widget (gui->xml, "source_host_label");
- gtk_label_parse_uline (GTK_LABEL (hostname_label), _("_Host:"));
- hostname = glade_xml_get_widget (gui->xml, "source_host");
-
- username_label = glade_xml_get_widget (gui->xml, "source_user_label");
- gtk_label_parse_uline (GTK_LABEL (username_label), _("User_name:"));
- username = glade_xml_get_widget (gui->xml, "source_user");
-
- path_label = glade_xml_get_widget (gui->xml, "source_path_label");
- gtk_label_parse_uline (GTK_LABEL (path_label), _("_Path:"));
- path = glade_xml_get_widget (gui->xml, "source_path");
-
main_vbox = glade_xml_get_widget (gui->xml, "extra_vbox");
mailcheck_frame = glade_xml_get_widget (gui->xml, "extra_mailcheck_frame");
@@ -816,30 +640,12 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
cur_vbox = main_vbox;
break;
- case CAMEL_PROVIDER_CONF_LABEL:
- if (entries[i].name && entries[i].text) {
- GtkWidget *label;
-
- if (!strcmp (entries[i].name, "username")) {
- gtk_label_parse_uline (GTK_LABEL (username_label), _(entries[i].text));
- } else if (!strcmp (entries[i].name, "hostname")) {
- gtk_label_parse_uline (GTK_LABEL (hostname_label), _(entries[i].text));
- } else if (!strcmp (entries[i].name, "path")) {
- gtk_label_parse_uline (GTK_LABEL (path_label), _(entries[i].text));
- } else {
- /* make a new label */
- label = gtk_label_new (_(entries[i].text));
- gtk_box_pack_start (GTK_BOX (cur_vbox), label, FALSE, FALSE, 0);
- }
- }
- break;
-
case CAMEL_PROVIDER_CONF_CHECKBOX:
{
GtkWidget *checkbox;
gboolean active;
- checkbox = gtk_check_button_new_with_label (_(entries[i].text));
+ checkbox = gtk_check_button_new_with_label (entries[i].text);
if (url)
active = camel_url_get_param (url, entries[i].name) != NULL;
else
@@ -857,44 +663,25 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
GtkWidget *hbox, *label, *entry;
const char *text;
- if (!strcmp (entries[i].name, "username")) {
- gtk_label_parse_uline (GTK_LABEL (username_label), _(entries[i].text));
- label = username_label;
- entry = username;
- } else if (!strcmp (entries[i].name, "hostname")) {
- gtk_label_parse_uline (GTK_LABEL (hostname_label), _(entries[i].text));
- label = hostname_label;
- entry = hostname;
- } else if (!strcmp (entries[i].name, "path")) {
- gtk_label_parse_uline (GTK_LABEL (path_label), _(entries[i].text));
- label = path_label;
- entry = path;
- } else {
- /* make a new text entry with label */
- hbox = gtk_hbox_new (FALSE, 8);
- label = gtk_label_new (_(entries[i].text));
- entry = gtk_entry_new ();
-
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
- gtk_box_pack_end (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0);
- g_hash_table_insert (gui->extra_config, entries[i].name, entry);
- }
-
+ hbox = gtk_hbox_new (FALSE, 8);
+ label = gtk_label_new (entries[i].text);
+ entry = gtk_entry_new ();
if (url)
text = camel_url_get_param (url, entries[i].name);
else
text = entries[i].value;
-
if (text)
gtk_entry_set_text (GTK_ENTRY (entry), text);
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
+
+ gtk_box_pack_start (GTK_BOX (cur_vbox), hbox, FALSE, FALSE, 0);
+ g_hash_table_insert (gui->extra_config, entries[i].name, entry);
if (entries[i].depname) {
setup_toggle (entry, entries[i].depname, gui);
setup_toggle (label, entries[i].depname, gui);
}
-
break;
}
@@ -906,8 +693,7 @@ mail_account_gui_build_extra_conf (MailAccountGui *gui, const char *url_string)
double min, def, max;
gboolean enable;
- /* FIXME: this is pretty fucked... */
- data = _(entries[i].text);
+ data = entries[i].text;
p = strstr (data, "%s");
g_return_if_fail (p != NULL);
@@ -1025,34 +811,53 @@ extract_values (MailAccountGuiService *source, GHashTable *extra_config, CamelUR
}
+extern EvolutionShellClient *global_shell_client;
+
static void
-folder_selected (EvolutionFolderSelectorButton *button,
- GNOME_Evolution_Folder *corba_folder,
- gpointer user_data)
+set_folder_picker_label (GtkButton *button, const char *name)
{
- char **folder_name = user_data;
+ char *string;
- g_free (*folder_name);
- *folder_name = g_strdup (corba_folder->physicalUri);
+ string = e_utf8_to_gtk_string (GTK_WIDGET (button), name);
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), string);
+ g_free (string);
}
-GtkWidget *mail_account_gui_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2);
-
-GtkWidget *
-mail_account_gui_folder_selector_button_new (char *widget_name,
- char *string1, char *string2,
- int int1, int int2)
+static void
+folder_picker_clicked (GtkButton *button, gpointer user_data)
{
- return (GtkWidget *)gtk_type_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON);
+ MailAccountGuiFolder *folder = user_data;
+ const char *allowed_types[] = { "mail", NULL };
+ char *physical_uri, *evolution_uri;
+
+ physical_uri = evolution_uri = NULL;
+ evolution_shell_client_user_select_folder (
+ global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
+ _("Select Folder"), folder->uri,
+ allowed_types, &evolution_uri, &physical_uri);
+ if (!physical_uri || !*physical_uri) {
+ g_free (physical_uri);
+ g_free (evolution_uri);
+ return;
+ }
+
+ g_free (folder->uri);
+ folder->uri = physical_uri;
+ g_free (folder->name);
+ folder->name = g_strdup (g_basename (evolution_uri));
+ g_free (evolution_uri);
+ set_folder_picker_label (button, folder->name);
}
+
static gboolean
setup_service (MailAccountGuiService *gsvc, MailConfigService *service)
{
CamelURL *url = camel_url_new (service->url, NULL);
gboolean has_auth = FALSE;
- if (url == NULL || gsvc->provider == NULL)
+ if (url == NULL)
return FALSE;
if (url->user && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER))
@@ -1074,24 +879,8 @@ setup_service (MailAccountGuiService *gsvc, MailConfigService *service)
gtk_entry_set_text (gsvc->path, url->path);
if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) {
- GList *children, *item;
- const char *use_ssl;
- int i;
-
- use_ssl = camel_url_get_param (url, "use_ssl");
- if (!use_ssl)
- use_ssl = "never";
- else if (!*use_ssl) /* old config code just used an empty string as the value */
- use_ssl = "always";
-
- children = gtk_container_children (GTK_CONTAINER (gtk_option_menu_get_menu (gsvc->use_ssl)));
- for (item = children, i = 0; item; item = item->next, i++) {
- if (!strcmp (use_ssl, ssl_options[i].value)) {
- gtk_option_menu_set_history (gsvc->use_ssl, i);
- gtk_signal_emit_by_name (item->data, "activate", gsvc);
- break;
- }
- }
+ gboolean use_ssl = camel_url_get_param (url, "use_ssl") != NULL;
+ gtk_toggle_button_set_active (gsvc->use_ssl, use_ssl);
}
if (url->authmech && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH)) {
@@ -1136,411 +925,308 @@ provider_compare (const CamelProvider *p1, const CamelProvider *p2)
}
}
-static void
-ssl_option_activate (GtkWidget *widget, gpointer user_data)
-{
- MailAccountGuiService *service = user_data;
-
- service->ssl_selected = widget;
-}
+/*
+ * Signature editor
+ *
+ */
-static void
-construct_ssl_menu (MailAccountGuiService *service)
-{
- GtkWidget *menu, *item = NULL;
- int i;
-
- menu = gtk_menu_new ();
-
- for (i = 0; i < num_ssl_options; i++) {
- item = gtk_menu_item_new_with_label (_(ssl_options[i].label));
- gtk_object_set_data (GTK_OBJECT (item), "use_ssl", ssl_options[i].value);
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- ssl_option_activate, service);
- gtk_widget_show (item);
- gtk_menu_append (GTK_MENU (menu), item);
- }
-
- gtk_option_menu_remove_menu (service->use_ssl);
- gtk_option_menu_set_menu (service->use_ssl, menu);
+struct _ESignatureEditor {
+ MailAccountGui *gui;
+ GtkWidget *win;
+ GtkWidget *control;
- gtk_option_menu_set_history (service->use_ssl, i - 1);
- gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", service);
-}
+ gchar *filename;
+ gboolean html;
+ gboolean has_changed;
+};
+typedef struct _ESignatureEditor ESignatureEditor;
-static void
-clear_menu (GtkWidget *menu)
-{
- while (GTK_MENU_SHELL (menu)->children)
- gtk_container_remove (GTK_CONTAINER (menu), GTK_MENU_SHELL (menu)->children->data);
-}
+#define E_SIGNATURE_EDITOR(o) ((ESignatureEditor *) o)
-static inline int
-sig_get_index (MailConfigSignature *sig)
+#define DEFAULT_WIDTH 600
+#define DEFAULT_HEIGHT 500
+
+enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL };
+
+static void
+destroy_editor (ESignatureEditor *editor)
{
- return sig->id + (mail_config_get_signatures_random () ? 2 : 1);
+ gtk_widget_destroy (editor->win);
+ g_free (editor->filename);
+ g_free (editor);
}
-static gint
-sig_get_gui_index (MailAccountGui *gui, gboolean text)
-{
- MailConfigSignature *sig = text ? gui->text_signature : gui->html_signature;
- gboolean random = text ? gui->text_random : gui->html_random;
+static void
+menu_file_save_error (BonoboUIComponent *uic, CORBA_Environment *ev) {
+ e_notice (GTK_WINDOW (uic), GNOME_MESSAGE_BOX_ERROR,
+ _("Could not save signature file."));
- if (random)
- return 1;
- else if (!sig)
- return 0;
- else
- return sig_get_index (sig);
+ g_warning ("Exception while saving signature (%s)",
+ bonobo_exception_get_text (ev));
}
static void
-sig_fill_options (MailAccountGui *gui)
+menu_file_save_cb (BonoboUIComponent *uic,
+ void *data,
+ const char *path)
{
- GtkWidget *menu_text, *menu_html;
- GtkWidget *mi;
- GList *l;
- MailConfigSignature *sig;
-
- menu_text = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- menu_html = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
-
- clear_menu (menu_text);
- clear_menu (menu_html);
+ ESignatureEditor *editor;
+ Bonobo_PersistFile pfile_iface;
+ CORBA_Environment ev;
- gtk_menu_append (GTK_MENU (menu_text), gtk_menu_item_new_with_label (_("None")));
- gtk_menu_append (GTK_MENU (menu_html), gtk_menu_item_new_with_label (_("None")));
+ editor = E_SIGNATURE_EDITOR (data);
+ if (editor->html) {
+ CORBA_exception_init (&ev);
+
+ pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistFile:1.0", NULL);
+ Bonobo_PersistFile_save (pfile_iface, editor->filename, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ menu_file_save_error (uic, &ev);
+
+ CORBA_exception_free (&ev);
+ } else {
+ BonoboStream *stream;
+ CORBA_Environment ev;
+ Bonobo_PersistStream pstream_iface;
+
+ CORBA_exception_init (&ev);
- if (mail_config_get_signatures_random ()) {
- gtk_menu_append (GTK_MENU (menu_text), gtk_menu_item_new_with_label (_("Random")));
- gtk_menu_append (GTK_MENU (menu_html), gtk_menu_item_new_with_label (_("Random")));
- }
+ stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, editor->filename,
+ Bonobo_Storage_WRITE | Bonobo_Storage_CREATE, 0);
+
+ pstream_iface = bonobo_object_client_query_interface
+ (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistStream:1.0", NULL);
+
+ Bonobo_PersistStream_save (pstream_iface,
+ (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
+ "text/plain", &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ menu_file_save_error (uic, &ev);
- for (l = mail_config_get_signature_list (); l; l = l->next) {
- sig = l->data;
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_menu_append (GTK_MENU (menu_text), mi);
-
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_menu_append (GTK_MENU (menu_html), mi);
+ CORBA_exception_free (&ev);
+ bonobo_object_unref (BONOBO_OBJECT (stream));
}
}
static void
-sig_select_text_sig (MailAccountGui *gui)
+exit_dialog_cb (int reply, ESignatureEditor *editor)
{
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_gui_index (gui, TRUE));
+ switch (reply) {
+ case REPLY_YES:
+ menu_file_save_cb (NULL, editor, NULL);
+ destroy_editor (editor);
+ break;
+ case REPLY_NO:
+ destroy_editor (editor);
+ break;
+ case REPLY_CANCEL:
+ default:
+ }
}
static void
-sig_select_html_sig (MailAccountGui *gui)
+do_exit (ESignatureEditor *editor)
{
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_gui_index (gui, FALSE));
+ if (editor->has_changed) {
+ GtkWidget *dialog;
+ GtkWidget *label;
+ gint button;
+
+ dialog = gnome_dialog_new (_("Save signature"),
+ GNOME_STOCK_BUTTON_YES, /* Save */
+ GNOME_STOCK_BUTTON_NO, /* Don't save */
+ GNOME_STOCK_BUTTON_CANCEL, /* Cancel */
+ NULL);
+
+ label = gtk_label_new (_("This signature has been changed, but hasn't been saved.\n"
+ "\nDo you wish to save your changes?"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0);
+ gtk_widget_show (label);
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (editor->win));
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ exit_dialog_cb (button, editor);
+ } else
+ destroy_editor (editor);
}
-static void
-sig_changed_text (GtkWidget *w, MailAccountGui *gui)
+static int
+delete_event_cb (GtkWidget *w, GdkEvent *event, ESignatureEditor *editor)
{
- GtkWidget *active;
- int index;
-
- active = gtk_menu_get_active (GTK_MENU (w));
- index = g_list_index (GTK_MENU_SHELL (w)->children, active);
-
- gui->text_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
- gui->text_random = index == 1;
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_text), gui->text_signature != NULL);
+ do_exit (editor);
}
static void
-sig_changed_html (GtkWidget *w, MailAccountGui *gui)
+menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
- GtkWidget *active;
- int index;
-
- active = gtk_menu_get_active (GTK_MENU (w));
- index = g_list_index (GTK_MENU_SHELL (w)->children, active);
+ ESignatureEditor *editor;
- gui->html_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
- gui->html_random = index == 1;
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_html), gui->html_signature != NULL);
+ editor = E_SIGNATURE_EDITOR (data);
+ do_exit (editor);
}
static void
-sig_edit_text (GtkWidget *w, MailAccountGui *gui)
+menu_file_save_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
- MailConfigSignature *sig = gui->text_signature;
-
- if (!sig)
- return;
+ ESignatureEditor *editor;
- if (sig->filename && *sig->filename)
- mail_signature_editor (sig);
- else
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Please specify signature filename\nin Andvanced section of signature settings."));
-}
+ editor = E_SIGNATURE_EDITOR (data);
-static void
-sig_edit_html (GtkWidget *w, MailAccountGui *gui)
-{
- MailConfigSignature *sig = gui->html_signature;
-
- if (!sig)
- return;
-
- if (sig->filename && *sig->filename)
- mail_signature_editor (sig);
- else
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Please specify signature filename\nin Andvanced section of signature settings."));
+ menu_file_save_cb (uic, editor, path);
+ destroy_editor (editor);
}
-static void
-sig_switch_to_list (GtkWidget *w, MailAccountGui *gui)
-{
- gtk_window_set_transient_for (GTK_WINDOW (gtk_widget_get_toplevel (w)), NULL);
- gdk_window_raise (GTK_WIDGET (gui->dialog)->window);
- gtk_notebook_set_page (GTK_NOTEBOOK (glade_xml_get_widget (gui->dialog->gui, "notebook")), 3);
-}
+static BonoboUIVerb verbs [] = {
+
+ BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
+ BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
+ BONOBO_UI_VERB ("FileSaveClose", menu_file_save_close_cb),
+
+ BONOBO_UI_VERB_END
+};
static void
-sig_set_and_write (MailAccountGui *gui)
+load_signature (ESignatureEditor *editor)
{
- gui->account->id->text_signature = gui->text_signature;
- gui->account->id->text_random = gui->text_random;
- gui->account->id->html_signature = gui->html_signature;
- gui->account->id->html_random = gui->html_random;
+ CORBA_Environment ev;
- mail_config_write_account_sig (gui->account, -1);
+ if (editor->html) {
+ Bonobo_PersistFile pfile_iface;
+
+ pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistFile:1.0", NULL);
+ CORBA_exception_init (&ev);
+ Bonobo_PersistFile_load (pfile_iface, editor->filename, &ev);
+ CORBA_exception_free (&ev);
+ } else {
+ Bonobo_PersistStream pstream_iface;
+ BonoboStream *stream;
+ gchar *data, *html;
+
+ data = e_msg_composer_get_sig_file_content (editor->filename, FALSE);
+ html = g_strdup_printf ("<PRE>\n%s", data);
+ g_free (data);
+
+ pstream_iface = bonobo_object_client_query_interface
+ (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistStream:1.0", NULL);
+ CORBA_exception_init (&ev);
+ stream = bonobo_stream_mem_create (html, strlen (html), TRUE, FALSE);
+
+ if (stream == NULL) {
+ g_warning ("Couldn't create memory stream\n");
+ } else {
+ BonoboObject *stream_object;
+ Bonobo_Stream corba_stream;
+
+ stream_object = BONOBO_OBJECT (stream);
+ corba_stream = bonobo_object_corba_objref (stream_object);
+ Bonobo_PersistStream_load (pstream_iface, corba_stream,
+ "text/html", &ev);
+ }
+
+ Bonobo_Unknown_unref (pstream_iface, &ev);
+ CORBA_Object_release (pstream_iface, &ev);
+ CORBA_exception_free (&ev);
+ bonobo_object_unref (BONOBO_OBJECT (stream));
+
+ g_free (html);
+ }
}
static void
-sig_new_text (GtkWidget *w, MailAccountGui *gui)
+launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean html)
{
- if (!gui->dialog)
- return;
+ ESignatureEditor *editor;
+ BonoboUIComponent *component;
+ BonoboUIContainer *container;
+ gchar *title;
- sig_switch_to_list (w, gui);
-
- gui->text_signature = mail_composer_prefs_new_signature (NULL, FALSE);
- gui->text_random = FALSE;
+ if (!filename || !*filename)
+ return;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_index (gui->text_signature));
+ editor = g_new0 (ESignatureEditor, 1);
- sig_set_and_write (gui);
- gtk_widget_set_sensitive (gui->sig_edit_text, TRUE);
-}
+ editor->html = html;
+ editor->filename = g_strdup (filename);
+ editor->has_changed = TRUE;
-static void
-sig_new_html (GtkWidget *w, MailAccountGui *gui)
-{
- if (!gui->dialog)
- return;
+ title = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename);
+ editor->win = bonobo_window_new ("e-sig-editor", title);
+ editor->gui = gui;
+ gtk_window_set_default_size (GTK_WINDOW (editor->win), DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE);
+ gtk_window_set_modal (GTK_WINDOW (editor->win), TRUE);
+ g_free (title);
- sig_switch_to_list (w, gui);
+ container = bonobo_ui_container_new ();
+ bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->win));
- gui->html_signature = mail_composer_prefs_new_signature (NULL, TRUE);
- gui->html_random = FALSE;
+ component = bonobo_ui_component_new_default ();
+ bonobo_ui_component_set_container (component, bonobo_object_corba_objref (BONOBO_OBJECT (container)));
+ bonobo_ui_component_add_verb_list_with_data (component, verbs, editor);
+ bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, "evolution-signature-editor.xml", "evolution-signature-editor");
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_index (gui->html_signature));
+ editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor",
+ bonobo_ui_component_get_container (component));
- sig_set_and_write (gui);
- gtk_widget_set_sensitive (gui->sig_edit_html, TRUE);
+ if (editor->control == NULL) {
+ g_warning ("Cannot get 'OAFIID:GNOME_GtkHTML_Editor'.");
+
+ destroy_editor (editor);
+ return;
+ }
+
+ load_signature (editor);
+
+ gtk_signal_connect (GTK_OBJECT (editor->win), "delete_event",
+ GTK_SIGNAL_FUNC (delete_event_cb), editor);
+
+ bonobo_window_set_contents (BONOBO_WINDOW (editor->win), editor->control);
+ bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL);
+ gtk_widget_show (GTK_WIDGET (editor->win));
+ gtk_widget_show (GTK_WIDGET (editor->control));
+ gtk_widget_grab_focus (editor->control);
}
static void
-setup_signatures (MailAccountGui *gui)
+edit_signature (GtkWidget *w, MailAccountGui *gui)
{
- gui->text_signature = gui->account->id->text_signature;
- gui->text_random = gui->account->id->text_random;
- gui->html_signature = gui->account->id->html_signature;
- gui->html_random = gui->account->id->html_random;
-
- sig_select_text_sig (gui);
- sig_select_html_sig (gui);
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_text), gui->text_signature != NULL);
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_html), gui->html_signature != NULL);
+ launch_signature_editor (gui, gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature))), FALSE);
}
static void
-sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccountGui *gui)
+edit_html_signature (GtkWidget *w, MailAccountGui *gui)
{
- switch (event) {
- case MAIL_CONFIG_SIG_EVENT_ADDED: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("accounts ADDED\n"));
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_widget_show (mi);
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_menu_append (GTK_MENU (menu), mi);
-
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_widget_show (mi);
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_menu_append (GTK_MENU (GTK_MENU (menu)), mi);
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui NAME CHANGED\n"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_widget_ref (menu);
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child), sig->name);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_text), menu);
- gtk_widget_unref (menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_gui_index (gui, TRUE));
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_widget_ref (menu);
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child), sig->name);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_html), menu);
- gtk_widget_unref (menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_gui_index (gui, FALSE));
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_DELETED: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui DELETED\n"));
-
- if (sig == gui->text_signature) {
- gui->text_signature = NULL;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text),
- sig_get_gui_index (gui, TRUE));
- }
-
- if (sig == gui->html_signature) {
- gui->html_signature = NULL;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html),
- sig_get_gui_index (gui, FALSE));
- }
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_container_remove (GTK_CONTAINER (menu), mi);
+ launch_signature_editor (gui, gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature))), TRUE);
+}
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_RANDOM_ON: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui RANDOM ON\n"));
-
- mi = gtk_menu_item_new_with_label (_("Random"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_menu_insert (GTK_MENU (menu), mi, 1);
- gtk_widget_show (mi);
-
- mi = gtk_menu_item_new_with_label (_("Random"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_menu_insert (GTK_MENU (menu), mi, 1);
- gtk_widget_show (mi);
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_RANDOM_OFF: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui RANDOM OFF\n"));
-
- if (gui->text_random) {
- gui->text_random = FALSE;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text),
- sig_get_gui_index (gui, TRUE));
- }
-
- if (gui->html_random) {
- gui->html_random = FALSE;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html),
- sig_get_gui_index (gui, FALSE));
- }
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, 1);
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, 1);
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- break;
- }
- default:
- ;
- }
+static void
+signature_changed (GtkWidget *entry, MailAccountGui *gui)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_signature),
+ *gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature))) != 0);
}
static void
-prepare_signatures (MailAccountGui *gui)
+html_signature_changed (GtkWidget *entry, MailAccountGui *gui)
{
- gui->sig_option_text = glade_xml_get_widget (gui->xml, "option-sig-text");
- gui->sig_option_html = glade_xml_get_widget (gui->xml, "option-sig-html");
-
- sig_fill_options (gui);
-
- gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text))),
- "selection-done", sig_changed_text, gui);
- gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html))),
- "selection-done", sig_changed_html, gui);
-
- gui->sig_new_text = glade_xml_get_widget (gui->xml, "button-sig-new-text");
- gtk_signal_connect (GTK_OBJECT (gui->sig_new_text), "clicked", GTK_SIGNAL_FUNC (sig_new_text), gui);
- gui->sig_new_html = glade_xml_get_widget (gui->xml, "button-sig-new-html");
- gtk_signal_connect (GTK_OBJECT (gui->sig_new_html), "clicked", GTK_SIGNAL_FUNC (sig_new_html), gui);
- gui->sig_edit_text = glade_xml_get_widget (gui->xml, "button-sig-edit-text");
- gtk_signal_connect (GTK_OBJECT (gui->sig_edit_text), "clicked", GTK_SIGNAL_FUNC (sig_edit_text), gui);
- gui->sig_edit_html = glade_xml_get_widget (gui->xml, "button-sig-edit-html");
- gtk_signal_connect (GTK_OBJECT (gui->sig_edit_html), "clicked", GTK_SIGNAL_FUNC (sig_edit_html), gui);
-
- if (!gui->dialog) {
- gtk_widget_hide (glade_xml_get_widget (gui->xml, "label-sig-text"));
- gtk_widget_hide (glade_xml_get_widget (gui->xml, "label-sig-html"));
- gtk_widget_hide (gui->sig_option_text);
- gtk_widget_hide (gui->sig_option_html);
- gtk_widget_hide (gui->sig_new_text);
- gtk_widget_hide (gui->sig_new_html);
- gtk_widget_hide (gui->sig_edit_text);
- gtk_widget_hide (gui->sig_edit_html);
- } else {
- mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, gui);
- }
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_html_signature),
+ *gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature))) != 0);
}
MailAccountGui *
-mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
+mail_account_gui_new (MailConfigAccount *account)
{
MailAccountGui *gui;
- const char *allowed_types[] = { "mail", NULL };
gui = g_new0 (MailAccountGui, 1);
gui->account = account;
- gui->dialog = dialog;
gui->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
/* Management */
@@ -1555,22 +1241,41 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
/* Identity */
gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name"));
gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address"));
- gui->reply_to = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_reply_to"));
gui->organization = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_organization"));
-
- prepare_signatures (gui);
+ gui->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_signature"));
+ gui->html_signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_html_signature"));
+ gui->has_html_signature = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "check_html_signature"));
+ gnome_file_entry_set_default_path (gui->signature, g_get_home_dir ());
+ gnome_file_entry_set_default_path (gui->html_signature, g_get_home_dir ());
+ gui->edit_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_signature"));
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_signature), FALSE);
+ gui->edit_html_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_html_signature"));
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_html_signature), FALSE);
+
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->signature)), "changed", signature_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->html_signature)), "changed",
+ html_signature_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->edit_signature), "clicked", edit_signature, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->edit_html_signature), "clicked", edit_html_signature, gui);
if (account->id) {
if (account->id->name)
e_utf8_gtk_entry_set_text (gui->full_name, account->id->name);
if (account->id->address)
gtk_entry_set_text (gui->email_address, account->id->address);
- if (account->id->reply_to)
- gtk_entry_set_text (gui->reply_to, account->id->reply_to);
if (account->id->organization)
e_utf8_gtk_entry_set_text (gui->organization, account->id->organization);
-
- setup_signatures (gui);
+ if (account->id->signature) {
+ gnome_file_entry_set_default_path (gui->signature, account->id->signature);
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature)),
+ account->id->signature);
+ }
+ if (account->id->html_signature) {
+ gnome_file_entry_set_default_path (gui->html_signature, account->id->html_signature);
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature)),
+ account->id->html_signature);
+ }
+ gtk_toggle_button_set_active (gui->has_html_signature, account->id->has_html_signature);
}
/* Source */
@@ -1586,9 +1291,7 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gui->source.path = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_path"));
gtk_signal_connect (GTK_OBJECT (gui->source.path), "changed",
GTK_SIGNAL_FUNC (service_changed), &gui->source);
- gui->source.ssl_hbox = glade_xml_get_widget (gui->xml, "source_ssl_hbox");
- gui->source.use_ssl = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_use_ssl"));
- construct_ssl_menu (&gui->source);
+ gui->source.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_use_ssl"));
gui->source.no_ssl = glade_xml_get_widget (gui->xml, "source_ssl_disabled");
gui->source.authtype = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_auth_omenu"));
gui->source.remember = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_remember_password"));
@@ -1608,9 +1311,7 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gui->transport.username = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_user"));
gtk_signal_connect (GTK_OBJECT (gui->transport.username), "changed",
GTK_SIGNAL_FUNC (service_changed), &gui->transport);
- gui->transport.ssl_hbox = glade_xml_get_widget (gui->xml, "transport_ssl_hbox");
- gui->transport.use_ssl = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_use_ssl"));
- construct_ssl_menu (&gui->transport);
+ gui->transport.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_use_ssl"));
gui->transport.no_ssl = glade_xml_get_widget (gui->xml, "transport_ssl_disabled");
gui->transport_needs_auth = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_needs_auth"));
gtk_signal_connect (GTK_OBJECT (gui->transport_needs_auth), "toggled", transport_needs_auth_toggled, gui);
@@ -1622,43 +1323,29 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
/* Drafts folder */
gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button"));
- gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "selected",
- GTK_SIGNAL_FUNC (folder_selected), &gui->drafts_folder_uri);
- if (account->drafts_folder_uri)
- gui->drafts_folder_uri = g_strdup (account->drafts_folder_uri);
- else
- gui->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
- evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->drafts_folder_button),
- global_shell_client,
- _("Select Folder"),
- gui->drafts_folder_uri,
- allowed_types);
+ gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "clicked",
+ GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->drafts_folder);
+ if (account->drafts_folder_uri) {
+ gui->drafts_folder.uri = g_strdup (account->drafts_folder_uri);
+ gui->drafts_folder.name = g_strdup (account->drafts_folder_name);
+ } else {
+ gui->drafts_folder.uri = g_strdup (default_drafts_folder_uri);
+ gui->drafts_folder.name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1);
+ }
+ set_folder_picker_label (gui->drafts_folder_button, gui->drafts_folder.name);
/* Sent folder */
gui->sent_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "sent_button"));
- gtk_signal_connect (GTK_OBJECT (gui->sent_folder_button), "selected",
- GTK_SIGNAL_FUNC (folder_selected), &gui->sent_folder_uri);
- if (account->sent_folder_uri)
- gui->sent_folder_uri = g_strdup (account->sent_folder_uri);
- else
- gui->sent_folder_uri = g_strdup (default_sent_folder_uri);
- evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->sent_folder_button),
- global_shell_client,
- _("Select Folder"),
- gui->sent_folder_uri,
- allowed_types);
-
- /* Always Cc */
- gui->always_cc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_cc"));
- gtk_toggle_button_set_active (gui->always_cc, account->always_cc);
- gui->cc_addrs = GTK_ENTRY (glade_xml_get_widget (gui->xml, "cc_addrs"));
- e_utf8_gtk_entry_set_text (gui->cc_addrs, account->cc_addrs);
-
- /* Always Bcc */
- gui->always_bcc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_bcc"));
- gtk_toggle_button_set_active (gui->always_bcc, account->always_bcc);
- gui->bcc_addrs = GTK_ENTRY (glade_xml_get_widget (gui->xml, "bcc_addrs"));
- e_utf8_gtk_entry_set_text (gui->bcc_addrs, account->bcc_addrs);
+ gtk_signal_connect (GTK_OBJECT (gui->sent_folder_button), "clicked",
+ GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->sent_folder);
+ if (account->sent_folder_uri) {
+ gui->sent_folder.uri = g_strdup (account->sent_folder_uri);
+ gui->sent_folder.name = g_strdup (account->sent_folder_name);
+ } else {
+ gui->sent_folder.uri = g_strdup (default_sent_folder_uri);
+ gui->sent_folder.name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1);
+ }
+ set_folder_picker_label (gui->sent_folder_button, gui->sent_folder.name);
/* Security */
gui->pgp_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "pgp_key"));
@@ -1668,8 +1355,6 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gtk_toggle_button_set_active (gui->pgp_encrypt_to_self, account->pgp_encrypt_to_self);
gui->pgp_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_sign"));
gtk_toggle_button_set_active (gui->pgp_always_sign, account->pgp_always_sign);
-
-#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED)
gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key"));
if (account->smime_key)
e_utf8_gtk_entry_set_text (gui->smime_key, account->smime_key);
@@ -1677,15 +1362,16 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gtk_toggle_button_set_active (gui->smime_encrypt_to_self, account->smime_encrypt_to_self);
gui->smime_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_always_sign"));
gtk_toggle_button_set_active (gui->smime_always_sign, account->smime_always_sign);
-#else
+
+#if !defined(HAVE_NSS) || !defined(SMIME_SUPPORTED)
{
/* Since we don't have NSS, hide the S/MIME config options */
GtkWidget *frame;
frame = glade_xml_get_widget (gui->xml, "smime_frame");
- gtk_widget_destroy (frame);
+ gtk_widget_set_sensitive (frame, FALSE);
}
-#endif /* HAVE_NSS && SMIME_SUPPORTED */
+#endif
return gui;
}
@@ -1730,11 +1416,7 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
item = NULL;
if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) {
item = gtk_menu_item_new_with_label (provider->name);
- gtk_object_set_data (GTK_OBJECT (gui->source.type),
- provider->protocol, item);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
- gtk_object_set_data (GTK_OBJECT (item), "number",
- GUINT_TO_POINTER (si));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (source_type_changed),
gui);
@@ -1758,11 +1440,7 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) {
item = gtk_menu_item_new_with_label (provider->name);
- gtk_object_set_data (GTK_OBJECT (gui->transport.type),
- provider->protocol, item);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
- gtk_object_set_data (GTK_OBJECT (item), "number",
- GUINT_TO_POINTER (ti));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (transport_type_changed),
gui);
@@ -1770,9 +1448,6 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
gtk_menu_append (GTK_MENU (transports), item);
gtk_widget_show (item);
-
- if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider))
- gtk_widget_set_sensitive (item, FALSE);
if (!ftransport) {
ftransport = item;
@@ -1856,10 +1531,10 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
}
if (fstore)
- gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate");
+ gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", gui);
if (ftransport)
- gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate");
+ gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", gui);
if (source_proto) {
setup_service (&gui->source, gui->account->source);
@@ -1899,7 +1574,7 @@ save_service (MailAccountGuiService *gsvc, GHashTable *extra_config,
if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER)) {
str = gtk_entry_get_text (gsvc->username);
if (str && *str)
- url->user = g_strstrip (g_strdup (str));
+ url->user = g_strdup (str);
}
if (CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH) &&
@@ -1934,14 +1609,8 @@ save_service (MailAccountGuiService *gsvc, GHashTable *extra_config,
}
if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) {
- const char *use_ssl;
-
- use_ssl = gtk_object_get_data (GTK_OBJECT (gsvc->ssl_selected), "use_ssl");
-
- /* set the value to either "always" or "when-possible"
- but don't bother setting it for "never" */
- if (strcmp (use_ssl, "never"))
- camel_url_set_param (url, "use_ssl", use_ssl);
+ if (gtk_toggle_button_get_active (gsvc->use_ssl))
+ camel_url_set_param (url, "use_ssl", "");
}
if (extra_config)
@@ -1964,7 +1633,7 @@ mail_account_gui_save (MailAccountGui *gui)
const MailConfigAccount *old_account;
CamelProvider *provider = NULL;
CamelURL *source_url = NULL, *url;
- char *new_name, *string;
+ gchar *new_name;
gboolean old_enabled;
if (!mail_account_gui_identity_complete (gui, NULL) ||
@@ -1994,16 +1663,16 @@ mail_account_gui_save (MailAccountGui *gui)
account->id = g_new0 (MailConfigIdentity, 1);
account->id->name = e_utf8_gtk_entry_get_text (gui->full_name);
account->id->address = e_utf8_gtk_entry_get_text (gui->email_address);
- account->id->reply_to = e_utf8_gtk_entry_get_text (gui->reply_to);
account->id->organization = e_utf8_gtk_entry_get_text (gui->organization);
-
- sig_set_and_write (gui);
+ account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE);
+ account->id->html_signature = gnome_file_entry_get_full_path (gui->html_signature, TRUE);
+ account->id->has_html_signature = gtk_toggle_button_get_active (gui->has_html_signature);
old_enabled = account->source && account->source->enabled;
service_destroy (account->source);
account->source = g_new0 (MailConfigService, 1);
save_service (&gui->source, gui->extra_config, account->source);
- if (account->source->url) {
+ if (account->source && account->source->url) {
provider = camel_session_get_provider (session, account->source->url, NULL);
source_url = provider ? camel_url_new (account->source->url, NULL) : NULL;
@@ -2016,19 +1685,20 @@ mail_account_gui_save (MailAccountGui *gui)
service_destroy (account->transport);
account->transport = g_new0 (MailConfigService, 1);
- if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider))
- save_service (&gui->transport, gui->extra_config, account->transport);
- else
- save_service (&gui->transport, NULL, account->transport);
+ save_service (&gui->transport, NULL, account->transport);
/* Check to make sure that the Drafts folder uri is "valid" before assigning it */
- url = source_url && gui->drafts_folder_uri ? camel_url_new (gui->drafts_folder_uri, NULL) : NULL;
- if (mail_config_get_account_by_source_url (gui->drafts_folder_uri) ||
+ url = source_url && gui->drafts_folder.uri ? camel_url_new (gui->drafts_folder.uri, NULL) : NULL;
+ if (mail_config_get_account_by_source_url (gui->drafts_folder.uri) ||
(url && provider->url_equal (source_url, url))) {
+ g_free (account->drafts_folder_name);
+ account->drafts_folder_name = g_strdup (gui->drafts_folder.name);
g_free (account->drafts_folder_uri);
- account->drafts_folder_uri = g_strdup (gui->drafts_folder_uri);
+ account->drafts_folder_uri = g_strdup (gui->drafts_folder.uri);
} else {
/* assign defaults - the uri is unknown to us (probably pointed to an old source url) */
+ g_free (account->drafts_folder_name);
+ account->drafts_folder_name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1);
g_free (account->drafts_folder_uri);
account->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
}
@@ -2037,13 +1707,17 @@ mail_account_gui_save (MailAccountGui *gui)
camel_url_free (url);
/* Check to make sure that the Sent folder uri is "valid" before assigning it */
- url = source_url && gui->sent_folder_uri ? camel_url_new (gui->sent_folder_uri, NULL) : NULL;
- if (mail_config_get_account_by_source_url (gui->sent_folder_uri) ||
+ url = source_url && gui->sent_folder.uri ? camel_url_new (gui->sent_folder.uri, NULL) : NULL;
+ if (mail_config_get_account_by_source_url (gui->sent_folder.uri) ||
(url && provider->url_equal (source_url, url))) {
+ g_free (account->sent_folder_name);
+ account->sent_folder_name = g_strdup (gui->sent_folder.name);
g_free (account->sent_folder_uri);
- account->sent_folder_uri = g_strdup (gui->sent_folder_uri);
+ account->sent_folder_uri = g_strdup (gui->sent_folder.uri);
} else {
/* assign defaults - the uri is unknown to us (probably pointed to an old source url) */
+ g_free (account->sent_folder_name);
+ account->sent_folder_name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1);
g_free (account->sent_folder_uri);
account->sent_folder_uri = g_strdup (default_sent_folder_uri);
}
@@ -2054,22 +1728,14 @@ mail_account_gui_save (MailAccountGui *gui)
if (source_url)
camel_url_free (source_url);
- account->always_cc = gtk_toggle_button_get_active (gui->always_cc);
- account->cc_addrs = e_utf8_gtk_entry_get_text (gui->cc_addrs);
- account->always_bcc = gtk_toggle_button_get_active (gui->always_bcc);
- account->bcc_addrs = e_utf8_gtk_entry_get_text (gui->bcc_addrs);
-
g_free (account->pgp_key);
account->pgp_key = e_utf8_gtk_entry_get_text (gui->pgp_key);
account->pgp_encrypt_to_self = gtk_toggle_button_get_active (gui->pgp_encrypt_to_self);
account->pgp_always_sign = gtk_toggle_button_get_active (gui->pgp_always_sign);
-
-#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED)
g_free (account->smime_key);
account->smime_key = e_utf8_gtk_entry_get_text (gui->smime_key);
account->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self);
account->smime_always_sign = gtk_toggle_button_get_active (gui->smime_always_sign);
-#endif /* HAVE_NSS && SMIME_SUPPORTED */
if (!mail_config_find_account (account))
mail_config_add_account (account);
@@ -2084,13 +1750,12 @@ mail_account_gui_save (MailAccountGui *gui)
void
mail_account_gui_destroy (MailAccountGui *gui)
{
- if (gui->dialog)
- mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, gui);
-
gtk_object_unref (GTK_OBJECT (gui->xml));
if (gui->extra_config)
g_hash_table_destroy (gui->extra_config);
- g_free (gui->drafts_folder_uri);
- g_free (gui->sent_folder_uri);
+ g_free (gui->drafts_folder.name);
+ g_free (gui->drafts_folder.uri);
+ g_free (gui->sent_folder.name);
+ g_free (gui->sent_folder.uri);
g_free (gui);
}
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 580f31fa97..2b386e1b11 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -2,211 +2,292 @@
/*
* Authors: Jeffrey Stedfast <fejj@ximian.com>
*
- * Copyright 2002 Ximian, Inc. (www.ximian.com)
+ * Copyright 2001 Ximian, Inc. (www.ximian.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 free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * 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.
+ * 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.
+ * 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.
*
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "mail-accounts.h"
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-messagebox.h>
-#include <gal/e-table/e-table-memory-store.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/e-table/e-cell-toggle.h>
-#include <gal/util/e-unicode-i18n.h>
-#include <gal/widgets/e-unicode.h>
#include <camel/camel-url.h>
+#include <camel/camel-pgp-context.h>
+
+#include <gal/widgets/e-unicode.h>
-#include <bonobo/bonobo-generic-factory.h>
+#include "widgets/misc/e-charset-picker.h"
#include "mail.h"
+#include "mail-accounts.h"
#include "mail-config.h"
#include "mail-config-druid.h"
#include "mail-account-editor.h"
+#ifdef ENABLE_NNTP
#include "mail-account-editor-news.h"
+#endif
#include "mail-send-recv.h"
+#include "mail-session.h"
#include "art/mark.xpm"
-#define USE_ETABLE 0
-
-static void mail_accounts_tab_class_init (MailAccountsTabClass *class);
-static void mail_accounts_tab_init (MailAccountsTab *prefs);
-static void mail_accounts_tab_finalise (GtkObject *obj);
+static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class);
+static void mail_accounts_dialog_init (MailAccountsDialog *dialog);
+static void mail_accounts_dialog_finalise (GtkObject *obj);
+static void mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data);
-static void mail_accounts_load (MailAccountsTab *tab);
-
-static GdkPixbuf *disabled_pixbuf = NULL;
-static GdkPixbuf *enabled_pixbuf = NULL;
-
-static GtkVBoxClass *parent_class = NULL;
+static MailConfigDruid *druid = NULL;
+static MailAccountEditor *editor = NULL;
+#ifdef ENABLE_NNTP
+static MailAccountEditorNews *news_editor = NULL;
+#endif
+static GnomeDialogClass *parent_class;
GtkType
-mail_accounts_tab_get_type (void)
+mail_accounts_dialog_get_type ()
{
static GtkType type = 0;
if (!type) {
GtkTypeInfo type_info = {
- "MailAccountsTab",
- sizeof (MailAccountsTab),
- sizeof (MailAccountsTabClass),
- (GtkClassInitFunc) mail_accounts_tab_class_init,
- (GtkObjectInitFunc) mail_accounts_tab_init,
+ "MailAccountsDialog",
+ sizeof (MailAccountsDialog),
+ sizeof (MailAccountsDialogClass),
+ (GtkClassInitFunc) mail_accounts_dialog_class_init,
+ (GtkObjectInitFunc) mail_accounts_dialog_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_vbox_get_type (), &type_info);
+ type = gtk_type_unique (gnome_dialog_get_type (), &type_info);
}
return type;
}
static void
-mail_accounts_tab_class_init (MailAccountsTabClass *klass)
+mail_accounts_dialog_class_init (MailAccountsDialogClass *class)
{
GtkObjectClass *object_class;
- object_class = (GtkObjectClass *) klass;
- parent_class = gtk_type_class (gtk_vbox_get_type ());
+ object_class = (GtkObjectClass *) class;
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
- object_class->finalize = mail_accounts_tab_finalise;
+ object_class->finalize = mail_accounts_dialog_finalise;
/* override methods */
-
- /* setup static data */
- disabled_pixbuf = NULL;
- enabled_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm);
}
static void
-mail_accounts_tab_init (MailAccountsTab *prefs)
+mail_accounts_dialog_init (MailAccountsDialog *o)
+{
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm);
+ gdk_pixbuf_render_pixmap_and_mask (pixbuf, &(o->mark_pixmap), &(o->mark_bitmap), 128);
+ gdk_pixbuf_unref (pixbuf);
+}
+
+static void
+mail_accounts_dialog_finalise (GtkObject *obj)
{
- prefs->druid = NULL;
- prefs->editor = NULL;
+ MailAccountsDialog *dialog = (MailAccountsDialog *) obj;
- gdk_pixbuf_render_pixmap_and_mask (enabled_pixbuf, &prefs->mark_pixmap, &prefs->mark_bitmap, 128);
+ gtk_object_unref (GTK_OBJECT (dialog->gui));
+ gdk_pixmap_unref (dialog->mark_pixmap);
+ gdk_bitmap_unref (dialog->mark_bitmap);
+
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
}
static void
-mail_accounts_tab_finalise (GtkObject *obj)
+load_accounts (MailAccountsDialog *dialog)
{
- MailAccountsTab *prefs = (MailAccountsTab *) obj;
+ const MailConfigAccount *account, *default_account;
+ const GSList *node = dialog->accounts;
+ int i = 0;
- gtk_object_unref (GTK_OBJECT (prefs->gui));
- gdk_pixmap_unref (prefs->mark_pixmap);
- gdk_bitmap_unref (prefs->mark_bitmap);
+ gtk_clist_freeze (dialog->mail_accounts);
- ((GtkObjectClass *)(parent_class))->finalize (obj);
+ gtk_clist_clear (dialog->mail_accounts);
+
+ default_account = mail_config_get_default_account ();
+
+ while (node) {
+ CamelURL *url;
+ char *text[3];
+
+ account = node->data;
+
+ if (account->source && account->source->url)
+ url = camel_url_new (account->source->url, NULL);
+ else
+ url = NULL;
+
+ text[0] = "";
+ text[1] = e_utf8_to_gtk_string (GTK_WIDGET (dialog->mail_accounts), account->name);
+ text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"),
+ (account == default_account) ? _(" (default)") : "");
+
+ if (url)
+ camel_url_free (url);
+
+ gtk_clist_append (dialog->mail_accounts, text);
+ g_free (text[1]);
+ g_free (text[2]);
+
+ if (account->source->enabled)
+ gtk_clist_set_pixmap (dialog->mail_accounts, i, 0,
+ dialog->mark_pixmap,
+ dialog->mark_bitmap);
+
+ /* set the account on the row */
+ gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account);
+
+ node = node->next;
+ i++;
+ }
+
+ gtk_clist_thaw (dialog->mail_accounts);
+
+ /*
+ * The selection gets cleared when we rebuild the clist, but no
+ * unselect event is emitted. So we simulate it here.
+ * I hate the clist.
+ */
+ mail_unselect (dialog->mail_accounts, 0, 0, NULL, dialog);
+}
+
+
+/* mail callbacks */
+static void
+mail_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ MailConfigAccount *account = gtk_clist_get_row_data (clist, row);
+
+ dialog->accounts_row = row;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), TRUE);
+ if (account->source && account->source->enabled)
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Disable"));
+ else
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Enable"));
+}
+
+static void
+mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+
+ dialog->accounts_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
+
+ /*
+ * If an insensitive button in a button box has the focus, and if you hit tab,
+ * there is a segfault. I think that this might be a gtk bug. Anyway, this
+ * is a workaround.
+ */
+ gtk_widget_grab_focus (GTK_WIDGET (dialog->mail_add));
}
static void
-account_add_finished (GtkWidget *widget, gpointer user_data)
+mail_add_finished (GtkWidget *widget, gpointer data)
{
/* Either Cancel or Finished was clicked in the druid so reload the accounts */
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- prefs->druid = NULL;
- mail_accounts_load (prefs);
+ dialog->accounts = mail_config_get_accounts ();
+ load_accounts (dialog);
+ druid = NULL;
}
static void
-account_add_clicked (GtkButton *button, gpointer user_data)
+mail_add (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = (MailAccountsTab *) user_data;
+ MailAccountsDialog *dialog = data;
- if (prefs->druid == NULL) {
- prefs->druid = (GtkWidget *) mail_config_druid_new (prefs->shell);
- gtk_signal_connect (GTK_OBJECT (prefs->druid), "destroy",
- GTK_SIGNAL_FUNC (account_add_finished), prefs);
+ if (druid == NULL) {
+ druid = mail_config_druid_new (dialog->shell);
+ gtk_signal_connect (GTK_OBJECT (druid), "destroy",
+ GTK_SIGNAL_FUNC (mail_add_finished), dialog);
- gtk_widget_show (prefs->druid);
+ gtk_widget_show (GTK_WIDGET (druid));
} else {
- gdk_window_raise (prefs->druid->window);
+ gdk_window_raise (GTK_WIDGET (druid)->window);
}
}
static void
-account_edit_finished (GtkWidget *widget, gpointer user_data)
+mail_editor_destroyed (GtkWidget *widget, gpointer data)
{
- MailAccountsTab *prefs = user_data;
-
- prefs->editor = NULL;
- mail_accounts_load (prefs);
+ load_accounts (MAIL_ACCOUNTS_DIALOG (data));
+ editor = NULL;
}
static void
-account_edit_clicked (GtkButton *button, gpointer user_data)
+mail_edit (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = (MailAccountsTab *) user_data;
+ MailAccountsDialog *dialog = data;
- if (prefs->editor == NULL) {
- int row;
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
- if (row >= 0) {
+ if (editor == NULL) {
+ if (dialog->accounts_row >= 0) {
MailConfigAccount *account;
- GtkWidget *window;
-
- window = gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW);
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
- prefs->editor = (GtkWidget *) mail_account_editor_new (account, GTK_WINDOW (window), prefs);
- gtk_signal_connect (GTK_OBJECT (prefs->editor), "destroy",
- GTK_SIGNAL_FUNC (account_edit_finished),
- prefs);
- gtk_widget_show (prefs->editor);
+ account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row);
+ editor = mail_account_editor_new (account);
+ gnome_dialog_set_parent (GNOME_DIALOG (editor), GTK_WINDOW (dialog));
+ gtk_signal_connect (GTK_OBJECT (editor), "destroy",
+ GTK_SIGNAL_FUNC (mail_editor_destroyed),
+ dialog);
+ gtk_widget_show (GTK_WIDGET (editor));
}
} else {
- gdk_window_raise (prefs->editor->window);
+ gdk_window_raise (GTK_WIDGET (editor)->window);
}
}
static void
-account_delete_clicked (GtkButton *button, gpointer user_data)
+mail_double_click (GtkWidget *widget, GdkEventButton *event, gpointer data)
{
- MailAccountsTab *prefs = user_data;
- const MailConfigAccount *account;
+ if (event->type == GDK_2BUTTON_PRESS)
+ mail_edit (NULL, data);
+}
+
+static void
+mail_delete (GtkButton *button, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ MailConfigAccount *account;
GnomeDialog *confirm;
- const GSList *list;
- int row, ans;
-
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
+ int ans;
/* make sure we have a valid account selected and that we aren't editing anything... */
- if (row < 0 || prefs->editor != NULL)
+ if (dialog->accounts_row < 0 || editor != NULL)
return;
confirm = GNOME_DIALOG (gnome_message_box_new (_("Are you sure you want to delete this account?"),
@@ -217,281 +298,102 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE);
gtk_window_set_modal (GTK_WINDOW (confirm), TRUE);
gtk_window_set_title (GTK_WINDOW (confirm), _("Really delete account?"));
- gnome_dialog_set_parent (confirm, GTK_WINDOW (prefs));
+ gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog));
ans = gnome_dialog_run_and_close (confirm);
if (ans == 0) {
- int select, len;
+ int sel, row, len;
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
+ sel = dialog->accounts_row;
+
+ account = gtk_clist_get_row_data (dialog->mail_accounts, sel);
/* remove it from the folder-tree in the shell */
if (account->source && account->source->url && account->source->enabled)
mail_remove_storage_by_uri (account->source->url);
/* remove it from the config file */
- list = mail_config_remove_account ((MailConfigAccount *) account);
-
+ dialog->accounts = mail_config_remove_account (account);
mail_config_write ();
-
mail_autoreceive_setup ();
-#if USE_ETABLE
- e_table_memory_store_remove (E_TABLE_MEMORY_STORE (prefs->model), row);
-#else
- gtk_clist_remove (prefs->table, row);
-#endif
+ gtk_clist_remove (dialog->mail_accounts, sel);
- len = list ? g_slist_length ((GSList *) list) : 0;
+ len = dialog->accounts ? g_slist_length ((GSList *) dialog->accounts) : 0;
if (len > 0) {
- select = row >= len ? len - 1 : row;
-#if USE_ETABLE
- e_table_set_cursor_row (prefs->table, select);
-#else
- gtk_clist_select_row (prefs->table, select, 0);
-#endif
+ row = sel >= len ? len - 1 : sel;
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
} else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE);
+ dialog->accounts_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
}
}
}
static void
-account_default_clicked (GtkButton *button, gpointer user_data)
+mail_default (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
const MailConfigAccount *account;
- int row;
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
-
- if (row >= 0) {
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
+ if (dialog->accounts_row >= 0) {
+ int row;
+ row = dialog->accounts_row;
+ account = gtk_clist_get_row_data (dialog->mail_accounts, row);
mail_config_set_default_account (account);
-
mail_config_write ();
-
- mail_accounts_load (prefs);
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
}
}
static void
-account_able_clicked (GtkButton *button, gpointer user_data)
+mail_able (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
const MailConfigAccount *account;
- int row;
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
-
- if (row >= 0) {
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
+ if (dialog->accounts_row >= 0) {
+ int row;
+ row = dialog->accounts_row;
+ account = gtk_clist_get_row_data (dialog->mail_accounts, row);
account->source->enabled = !account->source->enabled;
if (account->source && account->source->url) {
if (account->source->enabled)
- mail_load_storage_by_uri (prefs->shell, account->source->url, account->name);
+ mail_load_storage_by_uri (dialog->shell, account->source->url, account->name);
else
mail_remove_storage_by_uri (account->source->url);
}
-#if USE_ETABLE
-
-#else
- if (account->source->enabled)
- gtk_clist_set_pixmap (prefs->table, row, 0,
- prefs->mark_pixmap,
- prefs->mark_bitmap);
- else
- gtk_clist_set_pixmap (prefs->table, row, 0, NULL, NULL);
-
- gtk_clist_select_row (prefs->table, row, 0);
-#endif
-
mail_autoreceive_setup ();
-
mail_config_write ();
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
}
}
-#if USE_ETABLE
-static void
-account_cursor_change (ETable *table, int row, gpointer user_data)
-{
- MailAccountsTab *prefs = user_data;
-
- if (row >= 0) {
- const MailConfigAccount *account;
-
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
- if (account->source && account->source->enabled)
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Disable"));
- else
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Enable"));
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), TRUE);
- } else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE);
-
- gtk_widget_grab_focus (GTK_WIDGET (prefs->mail_add));
- }
-}
-
-static void
-account_double_click (ETable *table, int row, int col, GdkEvent *event, gpointer user_data)
-{
- account_edit_clicked (NULL, user_data);
-}
-#else
-static void
-account_cursor_change (GtkCList *table, int row, int column, GdkEventButton *event, gpointer user_data)
-{
- MailAccountsTab *prefs = user_data;
-
- if (row >= 0) {
- const MailConfigAccount *account;
-
- account = gtk_clist_get_row_data (prefs->table, row);
- if (account->source && account->source->enabled)
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Disable"));
- else
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Enable"));
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), TRUE);
-
- if (event && event->type == GDK_2BUTTON_PRESS)
- account_edit_clicked (NULL, user_data);
- } else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE);
-
- gtk_widget_grab_focus (GTK_WIDGET (prefs->mail_add));
- }
-}
-#endif
-
-
-static void
-mail_accounts_load (MailAccountsTab *prefs)
-{
- const GSList *node;
- int row = 0;
-
-#if USE_ETABLE
- e_table_memory_freeze (E_TABLE_MEMORY (prefs->model));
-
- e_table_memory_store_clear (E_TABLE_MEMORY_STORE (prefs->model));
-#else
- gtk_clist_freeze (prefs->table);
-
- gtk_clist_clear (prefs->table);
-#endif
-
- node = mail_config_get_accounts ();
- while (node) {
- const MailConfigAccount *account;
- CamelURL *url;
-
- account = node->data;
-
- url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL;
-
-#if USE_ETABLE
- e_table_memory_store_insert_list (E_TABLE_MEMORY_STORE (prefs->model),
- row, GINT_TO_POINTER (account->source->enabled),
- account->name,
- url && url->protocol ? url->protocol : U_("None"));
-
- e_table_memory_set_data (E_TABLE_MEMORY (prefs->model), row, (gpointer) account);
-#else
- {
- char *text[3];
-
- text[0] = NULL;
- text[1] = e_utf8_to_gtk_string (GTK_WIDGET (prefs->table), account->name);
- text[2] = url && url->protocol ? url->protocol : (char *) U_("None");
-
- gtk_clist_insert (prefs->table, row, text);
-
- g_free (text[1]);
-
- if (account->source->enabled)
- gtk_clist_set_pixmap (prefs->table, row, 0,
- prefs->mark_pixmap,
- prefs->mark_bitmap);
-
- gtk_clist_set_row_data (prefs->table, row, (gpointer) account);
- }
-#endif
-
- if (url)
- camel_url_free (url);
-
- node = node->next;
- row++;
- }
-
-#if USE_ETABLE
- e_table_memory_thaw (E_TABLE_MEMORY (prefs->model));
-#else
- gtk_clist_thaw (prefs->table);
-#endif
-}
-
-
#ifdef ENABLE_NNTP
static void
-news_load (MailAccountsTab *prefs)
+load_news (MailAccountsDialog *dialog)
{
const MailConfigService *service;
- const GSList *node;
+ const GSList *node = dialog->news;
int i = 0;
+
+ gtk_clist_freeze (dialog->news_accounts);
- gtk_clist_freeze (prefs->news);
-
- gtk_clist_clear (prefs->news);
-
- node = mail_config_get_news ();
+ gtk_clist_clear (dialog->news_accounts);
while (node) {
CamelURL *url;
- char *text[1];
+ gchar *text[1];
service = node->data;
@@ -505,130 +407,128 @@ news_load (MailAccountsTab *prefs)
if (url)
camel_url_free (url);
- gtk_clist_append (prefs->news, text);
+ gtk_clist_append (dialog->news_accounts, text);
g_free (text[0]);
/* set the account on the row */
- gtk_clist_set_row_data (prefs->news, i, (gpointer) service);
+ gtk_clist_set_row_data (dialog->news_accounts, i, (gpointer) service);
node = node->next;
i++;
}
- gtk_clist_thaw (prefs->news);
+ gtk_clist_thaw (dialog->news_accounts);
}
/* news callbacks */
static void
-news_select_row (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer user_data)
+news_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- prefs->news_row = row;
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), TRUE);
+ dialog->news_row = row;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), TRUE);
}
static void
-news_unselect_row (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer user_data)
+news_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- prefs->news_row = -1;
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), FALSE);
+ dialog->news_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE);
}
static void
-news_editor_destroyed (GtkWidget *widget, gpointer user_data)
+news_editor_destroyed (GtkWidget *widget, gpointer data)
{
- MailAccountsTab *prefs = user_data;
-
- news_load (prefs);
- prefs->news_editor = NULL;
+ load_news (MAIL_ACCOUNTS_DIALOG (data));
+ news_editor = NULL;
}
static void
-news_edit_clicked (GtkButton *button, gpointer user_data)
+news_edit (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- if (prefs->news_editor == NULL) {
- if (prefs->news_row >= 0) {
+ if (news_editor == NULL) {
+ if (dialog->news_row >= 0) {
MailConfigService *service;
- service = gtk_clist_get_row_data (prefs->news, prefs->news_row);
- prefs->news_editor = mail_account_editor_news_new (service);
- gtk_signal_connect (GTK_OBJECT (prefs->news_editor), "destroy",
+ service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
+ news_editor = mail_account_editor_news_new (service);
+ gtk_signal_connect (GTK_OBJECT (news_editor), "destroy",
GTK_SIGNAL_FUNC (news_editor_destroyed),
- prefs);
- gtk_widget_show (GTK_WIDGET (prefs->news_editor));
+ dialog);
+ gtk_widget_show (GTK_WIDGET (news_editor));
}
} else {
- gdk_window_raise (GTK_WIDGET (prefs->news_editor)->window);
+ gdk_window_raise (GTK_WIDGET (news_editor)->window);
}
}
static void
-news_add_destroyed (GtkWidget *widget, gpointer user_data)
+news_add_destroyed (GtkWidget *widget, gpointer data)
{
- gpointer *send = user_data;
- MailAccountsTab *prefs;
+ gpointer *send = data;
+ MailAccountsDialog *dialog;
MailConfigService *service;
-
+
service = send[0];
- prefs = send[1];
- g_free (send);
-
- news_load (prefs);
+ dialog = send[1];
+ g_free(send);
+
+ dialog->news = mail_config_get_news ();
+ load_news (dialog);
+
+ mail_load_storage_by_uri(dialog->shell, service->url, NULL);
- mail_load_storage_by_uri (prefs->shell, service->url, NULL);
+ dialog->news = mail_config_get_news ();
+ load_news (dialog);
- /* FIXME: why do we re-load? */
- news_load (prefs);
}
static void
-news_add_clicked (GtkButton *button, gpointer user_data)
+news_add (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
MailConfigService *service;
gpointer *send;
- if (prefs->news_editor == NULL) {
+ if (news_editor == NULL) {
send = g_new (gpointer, 2);
service = g_new0 (MailConfigService, 1);
service->url = NULL;
- prefs->news_editor = mail_account_editor_news_new (service);
+ news_editor = mail_account_editor_news_new (service);
send[0] = service;
- send[1] = prefs;
- gtk_signal_connect (GTK_OBJECT (prefs->news_editor), "destroy",
+ send[1] = dialog;
+ gtk_signal_connect (GTK_OBJECT (news_editor), "destroy",
GTK_SIGNAL_FUNC (news_add_destroyed),
send);
- gtk_widget_show (GTK_WIDGET (prefs->news_editor));
+ gtk_widget_show (GTK_WIDGET (news_editor));
} else {
- gdk_window_raise (GTK_WIDGET (prefs->news_editor)->window);
+ gdk_window_raise (GTK_WIDGET (news_editor)->window);
}
}
static void
-news_delete_clicked (GtkButton *button, gpointer user_data)
+news_delete (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
- GtkWidget *window, *label;
+ MailAccountsDialog *dialog = data;
MailConfigService *server;
GnomeDialog *confirm;
+ GtkWidget *label;
int ans;
/* don't allow user to delete an account if he might be editing it */
- if (prefs->news_row < 0 || prefs->news_editor != NULL)
+ if (dialog->news_row < 0 || news_editor != NULL)
return;
- window = gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW);
-
confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"),
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL));
gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE);
@@ -637,14 +537,13 @@ news_delete_clicked (GtkButton *button, gpointer user_data)
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
- gnome_dialog_set_parent (confirm, GTK_WINDOW (window));
+ gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog));
ans = gnome_dialog_run_and_close (confirm);
if (ans == 0) {
- const GSList *servers;
int row, len;
- server = gtk_clist_get_row_data (prefs->news, prefs->news_row);
+ server = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
/* remove it from the folder-tree in the shell */
if (server && server->url) {
@@ -670,193 +569,426 @@ news_delete_clicked (GtkButton *button, gpointer user_data)
}
/* remove it from the config file */
- servers = mail_config_remove_news (server);
+ dialog->news = mail_config_remove_news (server);
mail_config_write ();
- gtk_clist_remove (prefs->news, prefs->news_row);
+ gtk_clist_remove (dialog->news_accounts, dialog->news_row);
- len = servers ? g_slist_length ((GSList *) servers) : 0;
+ len = dialog->news ? g_slist_length ((GSList *) dialog->news) : 0;
if (len > 0) {
- row = prefs->news_row;
+ row = dialog->news_row;
row = row >= len ? len - 1 : row;
- gtk_clist_select_row (prefs->news, row, 0);
+ gtk_clist_select_row (dialog->news_accounts, row, 0);
} else {
- prefs->news_row = -1;
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), FALSE);
+ dialog->news_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE);
}
}
}
#endif /* ENABLE_NNTP */
+/* temp widget callbacks */
+static void
+send_html_toggled (GtkToggleButton *button, gpointer data)
+{
+ mail_config_set_send_html (gtk_toggle_button_get_active (button));
+}
-GtkWidget *mail_accounts_etable_new (char *widget_name, char *string1, char *string2,
- int int1, int int2);
+static void
+citation_highlight_toggled (GtkToggleButton *button, gpointer data)
+{
+ mail_config_set_citation_highlight (gtk_toggle_button_get_active (button));
+}
-#if USE_ETABLE
-GtkWidget *
-mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int int1, int int2)
+static void
+timeout_toggled (GtkToggleButton *button, gpointer data)
{
- ETableModel *model;
- ETableExtras *extras;
- GdkPixbuf *images[2];
- ETableMemoryStoreColumnInfo columns[] = {
- E_TABLE_MEMORY_STORE_INTEGER,
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_TERMINATOR,
- };
-
- extras = e_table_extras_new ();
-
- images[0] = disabled_pixbuf; /* disabled */
- images[1] = enabled_pixbuf; /* enabled */
- e_table_extras_add_cell (extras, "render_able", e_cell_toggle_new (0, 2, images));
+ mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (button));
+}
+
+static void
+citation_color_set (GnomeColorPicker *cp, guint r, guint g, guint b, guint a)
+{
+ guint32 rgb;
+
+ rgb = r >> 8;
+ rgb <<= 8;
+ rgb |= g >> 8;
+ rgb <<= 8;
+ rgb |= b >> 8;
+
+ mail_config_set_citation_color (rgb);
+}
+
+/* FIXME: */
+
+static void
+timeout_changed (GtkEntry *entry, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ gint val;
- model = e_table_memory_store_new (columns);
+ val = (gint) (gtk_spin_button_get_value_as_float (dialog->timeout) * 1000);
- return e_table_scrolled_new_from_spec_file (model, extras, EVOLUTION_ETSPECDIR "/mail-accounts.etspec", NULL);
+ mail_config_set_mark_as_seen_timeout (val);
}
-#else
-GtkWidget *
-mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int int1, int int2)
+
+static void
+pgp_path_changed (GtkEntry *entry, gpointer data)
{
- GtkWidget *table, *scrolled;
- char *titles[3];
+ CamelPgpType type;
+ const char *path;
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ path = gtk_entry_get_text (entry);
- titles[0] = _("Enabled");
- titles[1] = _("Account name");
- titles[2] = _("Protocol");
- table = gtk_clist_new_with_titles (3, titles);
- gtk_clist_set_selection_mode (GTK_CLIST (table), GTK_SELECTION_SINGLE);
- gtk_clist_column_titles_show (GTK_CLIST (table));
+ type = mail_config_pgp_type_detect_from_path (path);
- gtk_container_add (GTK_CONTAINER (scrolled), table);
+ mail_config_set_pgp_path (path && *path ? path : NULL);
+ mail_config_set_pgp_type (type);
+}
+
+static void
+filter_log_path_changed (GtkEntry *entry, gpointer data)
+{
+ const char *path;
- gtk_object_set_data (GTK_OBJECT (scrolled), "table", table);
+ path = gtk_entry_get_text (entry);
- gtk_widget_show (scrolled);
- gtk_widget_show (table);
+ mail_config_set_filter_log_path (path && *path ? path : NULL);
+}
+
+static void
+set_color (GnomeColorPicker *cp)
+{
+ guint32 rgb = mail_config_get_citation_color ();
+
+ gnome_color_picker_set_i8 (cp, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff);
+}
+
+static void
+images_radio_toggled (GtkWidget *radio, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
+ return;
- return scrolled;
+ if (radio == (GtkWidget *)dialog->images_always)
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_ALWAYS);
+ else if (radio == (GtkWidget *)dialog->images_sometimes)
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_SOMETIMES);
+ else
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER);
+}
+
+static void
+empty_trash_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+prompt_empty_subject_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+prompt_bcc_only_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+prompt_unwanted_html_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+#if 0
+/* Note: Please see construct() for a reason as to why these 2 options are disabled */
+static void
+thread_list_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_thread_list (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+show_preview_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_show_preview (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
}
#endif
static void
-mail_accounts_tab_construct (MailAccountsTab *prefs)
+filter_log_toggled (GtkWidget *toggle, gpointer data)
{
- GtkWidget *toplevel, *widget;
- GladeXML *gui;
+ mail_config_set_filter_log (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+confirm_expunge_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_confirm_expunge (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+forward_style_activated (GtkWidget *item, gpointer data)
+{
+ int style = GPOINTER_TO_INT (data);
+
+ mail_config_set_default_forward_style (style);
+}
+
+static void
+attach_forward_style_signal (GtkWidget *item, gpointer data)
+{
+ int *num = data;
+
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ forward_style_activated, GINT_TO_POINTER (*num));
+ (*num)++;
+}
+
+static void
+charset_menu_deactivate (GtkWidget *menu, gpointer data)
+{
+ char *charset;
+
+ charset = e_charset_picker_get_charset (menu);
+ if (charset) {
+ mail_config_set_default_charset (charset);
+ g_free (charset);
+ }
+}
+
+static void
+dialog_destroy (GtkWidget *dialog, gpointer user_data)
+{
+ if (druid)
+ gtk_widget_destroy (GTK_WIDGET (druid));
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "accounts_tab");
- prefs->gui = gui;
+ if (editor)
+ gtk_widget_destroy (GTK_WIDGET (editor));
- /* get our toplevel widget */
#ifdef ENABLE_NNTP
- toplevel = glade_xml_get_widget (gui, "toplevel_notebook");
-#else
- toplevel = glade_xml_get_widget (gui, "toplevel");
+ if (news_editor)
+ gtk_widget_destroy (GTK_WIDGET (news_editor));
#endif
+}
+
+static void
+construct (MailAccountsDialog *dialog)
+{
+ GladeXML *gui;
+ GtkWidget *notebook, *menu;
+ int num;
- /* reparent */
- gtk_widget_ref (toplevel);
- gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel);
- gtk_container_add (GTK_CONTAINER (prefs), toplevel);
- gtk_widget_unref (toplevel);
-
- widget = glade_xml_get_widget (gui, "etableMailAccounts");
-
-#if USE_ETABLE
- prefs->table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
- prefs->model = prefs->table->model;
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
+ dialog->gui = gui;
- gtk_signal_connect (GTK_OBJECT (prefs->table), "cursor_change",
- account_cursor_change, prefs);
+ /* get our toplevel widget */
+ notebook = glade_xml_get_widget (gui, "notebook");
- gtk_signal_connect (GTK_OBJECT (prefs->table), "double_click",
- account_double_click, prefs);
+ /* reparent */
+ gtk_widget_reparent (notebook, GNOME_DIALOG (dialog)->vbox);
+
+ /* give our dialog an Close button and title */
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Mail Settings"));
+ gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
+ gnome_dialog_append_button (GNOME_DIALOG (dialog), GNOME_STOCK_BUTTON_OK);
+
+ gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
+ GTK_SIGNAL_FUNC (dialog_destroy), dialog);
+
+ dialog->mail_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "select-row",
+ GTK_SIGNAL_FUNC (mail_select), dialog);
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "unselect-row",
+ GTK_SIGNAL_FUNC (mail_unselect), dialog);
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "button_press_event",
+ mail_double_click, dialog);
+ dialog->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAdd"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_add), "clicked",
+ GTK_SIGNAL_FUNC (mail_add), dialog);
+ dialog->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailEdit"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_edit), "clicked",
+ GTK_SIGNAL_FUNC (mail_edit), dialog);
+ dialog->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDelete"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_delete), "clicked",
+ GTK_SIGNAL_FUNC (mail_delete), dialog);
+ dialog->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDefault"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_default), "clicked",
+ GTK_SIGNAL_FUNC (mail_default), dialog);
+ dialog->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAble"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_able), "clicked",
+ GTK_SIGNAL_FUNC (mail_able), dialog);
- mail_accounts_load (prefs);
+#ifdef ENABLE_NNTP
+ dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistNews"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "select-row",
+ GTK_SIGNAL_FUNC (news_select), dialog);
+ gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "unselect-row",
+ GTK_SIGNAL_FUNC (news_unselect), dialog);
+ dialog->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_add), "clicked",
+ GTK_SIGNAL_FUNC (news_add), dialog);
+ dialog->news_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_edit), "clicked",
+ GTK_SIGNAL_FUNC (news_edit), dialog);
+ dialog->news_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_delete), "clicked",
+ GTK_SIGNAL_FUNC (news_delete), dialog);
#else
- prefs->table = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "table"));
-
- gtk_signal_connect (GTK_OBJECT (prefs->table), "select-row",
- account_cursor_change, prefs);
-
- mail_accounts_load (prefs);
-
- {
- int col;
-
- for (col = 0; col < 3; col++) {
- gtk_clist_set_column_auto_resize (prefs->table, col, TRUE);
- }
- }
+ /* remove the news tab since we don't support nntp */
+ gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), 1);
#endif
- prefs->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAdd"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_add), "clicked",
- account_add_clicked, prefs);
-
- prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountEdit"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_edit), "clicked",
- account_edit_clicked, prefs);
-
- prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDelete"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_delete), "clicked",
- account_delete_clicked, prefs);
-
- prefs->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDefault"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_default), "clicked",
- account_default_clicked, prefs);
+ /* Display page */
+ dialog->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chckHighlightCitations"));
+ gtk_toggle_button_set_active (dialog->citation_highlight, mail_config_get_citation_highlight ());
+ gtk_signal_connect (GTK_OBJECT (dialog->citation_highlight), "toggled",
+ GTK_SIGNAL_FUNC (citation_highlight_toggled), dialog);
+ dialog->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerCitations"));
+ set_color (dialog->citation_color);
+ gtk_signal_connect (GTK_OBJECT (dialog->citation_color), "color_set",
+ GTK_SIGNAL_FUNC (citation_color_set), dialog);
+
+ dialog->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "checkMarkTimeout"));
+ gtk_toggle_button_set_active (dialog->timeout_toggle, mail_config_get_do_seen_timeout ());
+ gtk_signal_connect (GTK_OBJECT (dialog->timeout_toggle), "toggled",
+ GTK_SIGNAL_FUNC (timeout_toggled), dialog);
+
+ dialog->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
+ gtk_spin_button_set_value (dialog->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0);
+ gtk_signal_connect (GTK_OBJECT (dialog->timeout), "changed",
+ GTK_SIGNAL_FUNC (timeout_changed), dialog);
+
+ dialog->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesNever"));
+ gtk_toggle_button_set_active (dialog->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER);
+ gtk_signal_connect (GTK_OBJECT (dialog->images_never), "toggled",
+ GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
+ dialog->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesSometimes"));
+ gtk_toggle_button_set_active (dialog->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES);
+ gtk_signal_connect (GTK_OBJECT (dialog->images_sometimes), "toggled",
+ GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
+ dialog->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesAlways"));
+ gtk_toggle_button_set_active (dialog->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS);
+ gtk_signal_connect (GTK_OBJECT (dialog->images_always), "toggled",
+ GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
+
+#if 0
+ /* These options are disabled because they are completely non-intuitive and evil */
+ dialog->thread_list = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkThreadedList"));
+ gtk_toggle_button_set_active (dialog->thread_list, mail_config_get_thread_list (NULL));
+ gtk_signal_connect (GTK_OBJECT (dialog->thread_list), "toggled",
+ GTK_SIGNAL_FUNC (thread_list_toggled), dialog);
+
+ dialog->show_preview = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowPreview"));
+ gtk_toggle_button_set_active (dialog->show_preview, mail_config_get_show_preview (NULL));
+ gtk_signal_connect (GTK_OBJECT (dialog->show_preview), "toggled",
+ GTK_SIGNAL_FUNC (show_preview_toggled), dialog);
+#endif
- prefs->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAble"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_able), "clicked",
- account_able_clicked, prefs);
+ /* Composer page */
+ dialog->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML"));
+ gtk_toggle_button_set_active (dialog->send_html, mail_config_get_send_html ());
+ gtk_signal_connect (GTK_OBJECT (dialog->send_html), "toggled",
+ GTK_SIGNAL_FUNC (send_html_toggled), dialog);
+
+ dialog->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle"));
+ gtk_option_menu_set_history (dialog->forward_style, mail_config_get_default_forward_style ());
+ /* Hm. This sucks... */
+ num = 0;
+ gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (dialog->forward_style)),
+ attach_forward_style_signal, &num);
+
+ dialog->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject"));
+ gtk_toggle_button_set_active (dialog->prompt_empty_subject, mail_config_get_prompt_empty_subject ());
+ gtk_signal_connect (GTK_OBJECT (dialog->prompt_empty_subject), "toggled",
+ GTK_SIGNAL_FUNC (prompt_empty_subject_toggled), dialog);
+
+ dialog->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly"));
+ gtk_toggle_button_set_active (dialog->prompt_bcc_only, mail_config_get_prompt_only_bcc ());
+ gtk_signal_connect (GTK_OBJECT (dialog->prompt_bcc_only), "toggled",
+ GTK_SIGNAL_FUNC (prompt_bcc_only_toggled), dialog);
+
+ dialog->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML"));
+ gtk_toggle_button_set_active (dialog->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ());
+ gtk_signal_connect (GTK_OBJECT (dialog->prompt_unwanted_html), "toggled",
+ GTK_SIGNAL_FUNC (prompt_unwanted_html_toggled), dialog);
+
+ /* Other page */
+ dialog->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath"));
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->pgp_path)),
+ mail_config_get_pgp_path ());
+ gnome_file_entry_set_default_path (dialog->pgp_path, mail_config_get_pgp_path ());
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->pgp_path)),
+ "changed", GTK_SIGNAL_FUNC (pgp_path_changed), dialog);
+
+ dialog->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset"));
+ menu = e_charset_picker_new (mail_config_get_default_charset ());
+ gtk_option_menu_set_menu (dialog->charset, GTK_WIDGET (menu));
+ gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
+ GTK_SIGNAL_FUNC (charset_menu_deactivate), NULL);
+
+ dialog->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit"));
+ gtk_toggle_button_set_active (dialog->empty_trash, mail_config_get_empty_trash_on_exit ());
+ gtk_signal_connect (GTK_OBJECT (dialog->empty_trash), "toggled",
+ GTK_SIGNAL_FUNC (empty_trash_toggled), dialog);
+
+ dialog->filter_log = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkFilterLog"));
+ gtk_toggle_button_set_active (dialog->filter_log, mail_config_get_filter_log ());
+ gtk_signal_connect (GTK_OBJECT (dialog->filter_log), "toggled",
+ GTK_SIGNAL_FUNC (filter_log_toggled), dialog);
+
+ dialog->filter_log_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileFilterLog"));
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->filter_log_path)),
+ mail_config_get_filter_log_path ());
+ gnome_file_entry_set_default_path (dialog->filter_log_path, mail_config_get_filter_log_path ());
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->filter_log_path)),
+ "changed", GTK_SIGNAL_FUNC (filter_log_path_changed), dialog);
+
+ dialog->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge"));
+ gtk_toggle_button_set_active (dialog->confirm_expunge, mail_config_get_confirm_expunge ());
+ gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled",
+ GTK_SIGNAL_FUNC (confirm_expunge_toggled), dialog);
+
+ /* now to fill in the clists */
+ dialog->accounts_row = -1;
+ dialog->accounts = mail_config_get_accounts ();
+ if (dialog->accounts) {
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, 0, 0);
+ } else {
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ }
#ifdef ENABLE_NNTP
- prefs->news = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "clistNews"));
- gtk_signal_connect (GTK_OBJECT (prefs->news), "select-row",
- news_select_row, prefs);
- gtk_signal_connect (GTK_OBJECT (prefs->news), "unselect-row",
- news_unselect_row, prefs);
-
- news_load (prefs);
-
- prefs->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd"));
- gtk_signal_connect (GTK_OBJECT (prefs->news_add), "clicked",
- news_add_clicked, prefs);
-
- prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit"));
- gtk_signal_connect (GTK_OBJECT (prefs->news_edit), "clicked",
- news_edit_clicked, prefs);
-
- prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete"));
- gtk_signal_connect (GTK_OBJECT (prefs->news_delete), "clicked",
- news_delete_clicked, prefs);
+ dialog->news_row = -1;
+ dialog->news = mail_config_get_news ();
+ if (dialog->news) {
+ load_news (dialog);
+ gtk_clist_select_row (dialog->news_accounts, 0, 0);
+ } else {
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE);
+ }
#endif /* ENABLE_NNTP */
}
-
-GtkWidget *
-mail_accounts_tab_new (GNOME_Evolution_Shell shell)
+MailAccountsDialog *
+mail_accounts_dialog_new (GNOME_Evolution_Shell shell)
{
- MailAccountsTab *new;
+ MailAccountsDialog *new;
- new = (MailAccountsTab *) gtk_type_new (mail_accounts_tab_get_type ());
- mail_accounts_tab_construct (new);
+ new = (MailAccountsDialog *) gtk_type_new (mail_accounts_dialog_get_type ());
+ construct (new);
new->shell = shell;
- return (GtkWidget *) new;
-}
-
-
-void
-mail_accounts_tab_apply (MailAccountsTab *prefs)
-{
- /* nothing to do here... */
+ return new;
}
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index dc61f7267d..026769d005 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -31,6 +31,8 @@
#include <errno.h>
#include <time.h>
#include <libgnome/gnome-paper.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnome/gnome-paper.h>
#include <libgnomeprint/gnome-print-master.h>
@@ -40,10 +42,8 @@
#include <gal/e-table/e-table.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
-#include <e-util/e-dialog-utils.h>
#include <filter/filter-editor.h>
#include "mail.h"
-#include "folder-browser-window.h"
#include "message-browser.h"
#include "mail-callbacks.h"
#include "mail-config.h"
@@ -59,8 +59,6 @@
#include "mail-folder-cache.h"
#include "folder-browser.h"
#include "subscribe-dialog.h"
-#include "message-tag-editor.h"
-#include "message-tag-followup.h"
#include "e-messagebox.h"
#include "Evolution.h"
@@ -68,13 +66,59 @@
#include "evolution-shell-client.h"
+#ifndef HAVE_MKSTEMP
+#include <fcntl.h>
+#include <sys/stat.h>
+#endif
#define FB_WINDOW(fb) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), GTK_TYPE_WINDOW))
+/* These e_gnome_dialog* functions are to handle the brokenness that is gnome-dialog */
+static void
+e_gnome_dialog_parent_destroyed (GtkWidget *parent, GtkWidget *dialog)
+{
+ gnome_dialog_close (GNOME_DIALOG (dialog));
+}
+
+static void
+e_gnome_dialog_set_parent (GnomeDialog *dialog, GtkWindow *parent)
+{
+ gnome_dialog_set_parent (dialog, parent);
+ gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy",
+ e_gnome_dialog_parent_destroyed,
+ dialog, GTK_OBJECT (dialog));
+}
+
+static GtkWidget *
+e_gnome_warning_dialog_parented (const char *warning, GtkWindow *parent)
+{
+ GtkWidget *dialog;
+
+ dialog = gnome_warning_dialog_parented (warning, parent);
+ gtk_signal_connect (GTK_OBJECT (parent), "destroy",
+ e_gnome_dialog_parent_destroyed, dialog);
+
+ return dialog;
+}
+
+static GtkWidget *
+e_gnome_ok_cancel_dialog_parented (const char *message, GnomeReplyCallback callback,
+ gpointer data, GtkWindow *parent)
+{
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_cancel_dialog_parented (message, callback, data, parent);
+ gtk_signal_connect (GTK_OBJECT (parent), "destroy",
+ e_gnome_dialog_parent_destroyed, dialog);
+
+ return dialog;
+}
+
+
struct post_send_data {
CamelFolder *folder;
gchar *uid;
- guint32 flags, set;
+ guint32 flags;
};
static void
@@ -130,7 +174,7 @@ check_send_configuration (FolderBrowser *fb)
/* Check general */
if (!mail_config_is_configured () && !configure_mail (fb))
- return FALSE;
+ return FALSE;
/* Get the default account */
account = mail_config_get_default_account ();
@@ -167,6 +211,33 @@ check_send_configuration (FolderBrowser *fb)
return TRUE;
}
+void
+send_receive_mail (GtkWidget *widget, gpointer user_data)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ const MailConfigAccount *account;
+
+ if (FOLDER_BROWSER_IS_DESTROYED (fb))
+ return;
+
+ if (!mail_config_is_configured () && !configure_mail (fb))
+ return;
+
+ account = mail_config_get_default_account ();
+ if (!account || !account->transport) {
+ GtkWidget *dialog;
+
+ dialog = gnome_error_dialog_parented (_("You have not set a mail transport method"),
+ FB_WINDOW (fb));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gtk_widget_show (dialog);
+
+ return;
+ }
+
+ mail_send_receive (fb->folder);
+}
+
static void
msgbox_destroyed (GtkWidget *widget, gpointer data)
{
@@ -183,7 +254,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip
gboolean show_again = TRUE;
GString *str;
GtkWidget *mbox;
- int i, button;
+ gint i, button;
if (!mail_config_get_confirm_unwanted_html ()) {
g_message ("doesn't want to see confirm html messages!");
@@ -284,13 +355,13 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
if (!mail_config_get_prompt_only_bcc ())
return TRUE;
-
+
/* If the user is mailing a hidden contact list, it is possible for
them to create a message with only Bcc recipients without really
realizing it. To try to avoid being totally confusing, I've changed
this dialog to provide slightly different text in that case, to
better explain what the hell is going on. */
-
+
if (hidden_list_case) {
first_text = _("Since the contact list you are sending to "
"is configured to hide the list's addresses, "
@@ -315,7 +386,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox));
mail_config_set_prompt_only_bcc (show_again);
-
+
g_free (message_text);
if (button == 0)
@@ -349,7 +420,7 @@ composer_sent_cb (char *uri, CamelMimeMessage *message, gboolean sent, void *dat
if (sent) {
if (send->psd) {
camel_folder_set_message_flags (send->psd->folder, send->psd->uid,
- send->psd->flags, send->psd->set);
+ send->psd->flags, send->psd->flags);
}
gtk_widget_destroy (GTK_WIDGET (send->composer));
} else {
@@ -373,28 +444,53 @@ composer_get_message (EMsgComposer *composer)
const CamelInternetAddress *iaddr;
const MailConfigAccount *account;
CamelMimeMessage *message;
- EDestination **recipients;
const char *subject;
int num_addrs, i;
+ EDestination **recipients;
message = e_msg_composer_get_message (composer);
if (message == NULL)
return NULL;
- /* Add info about the sending account */
- account = e_msg_composer_get_preferred_account (composer);
+ recipients = e_msg_composer_get_recipients (composer);
- if (account) {
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
- if (account->id->organization)
- camel_medium_set_header (CAMEL_MEDIUM (message), "Organization", account->id->organization);
+ /* Check for invalid recipients */
+ if (recipients) {
+ gboolean have_invalid = FALSE;
+ gchar *msg, *new_msg;
+ GtkWidget *message_box;
+
+ for (i = 0; recipients[i] && !have_invalid; ++i) {
+ if (!e_destination_is_valid (recipients[i]))
+ have_invalid = TRUE;
+ }
+
+ if (have_invalid) {
+ msg = g_strdup (_("This message contains invalid recipients:"));
+ for (i = 0; recipients[i]; ++i) {
+ if (!e_destination_is_valid (recipients[i])) {
+ new_msg = g_strdup_printf ("%s\n %s", msg,
+ e_destination_get_address (recipients[i]));
+ g_free (msg);
+ msg = new_msg;
+ }
+ }
+
+ new_msg = e_utf8_from_locale_string (msg);
+ g_free (msg);
+ msg = new_msg;
+
+ message_box = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_WARNING, GNOME_STOCK_BUTTON_OK, NULL);
+ g_free (msg);
+
+ gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
+
+ camel_object_unref (CAMEL_OBJECT (message));
+ message = NULL;
+ goto finished;
+ }
}
- /* get the message recipients */
- recipients = e_msg_composer_get_recipients (composer);
-
/* Check for recipients */
for (num_addrs = 0, i = 0; i < 3; i++) {
iaddr = camel_mime_message_get_recipients (message, recipient_type[i]);
@@ -422,13 +518,13 @@ composer_get_message (EMsgComposer *composer)
/* this means that the only recipients are Bcc's */
/* OK, this is an abusive hack. If someone sends a mail with a
- hidden contact list on the To: line and no other recipients,
+ hidden contact list on to to: line and no other recipients,
they will unknowingly create a message with only bcc: recipients.
We try to detect this and pass a flag to ask_confirm_for_only_bcc,
so that it can present the user with a dialog whose text has been
modified to reflect this situation. */
- const char *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
+ const gchar *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
gboolean hidden_list_case = FALSE;
if (to_header && !strcmp (to_header, "Undisclosed-Recipient:;"))
@@ -449,12 +545,12 @@ composer_get_message (EMsgComposer *composer)
&& mail_config_get_confirm_unwanted_html ()) {
gboolean html_problem = FALSE;
for (i = 0; recipients[i] != NULL && !html_problem; ++i) {
- if (!e_destination_get_html_mail_pref (recipients[i]))
+ if (! e_destination_get_html_mail_pref (recipients[i]))
html_problem = TRUE;
}
if (html_problem) {
- html_problem = !ask_confirm_for_unwanted_html_mail (composer, recipients);
+ html_problem = ! ask_confirm_for_unwanted_html_mail (composer, recipients);
if (html_problem) {
camel_object_unref (CAMEL_OBJECT (message));
message = NULL;
@@ -473,13 +569,20 @@ composer_get_message (EMsgComposer *composer)
}
}
+ /* Add info about the sending account */
+ account = e_msg_composer_get_preferred_account (composer);
+ if (account) {
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
+ }
+
/* Get the message recipients and 'touch' them, boosting their use scores */
+ recipients = e_msg_composer_get_recipients (composer);
e_destination_touchv (recipients);
finished:
-
e_destination_freev (recipients);
-
return message;
}
@@ -536,7 +639,6 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
message = composer_get_message (composer);
if (message == NULL)
return;
-
info = camel_message_info_new ();
info->flags = CAMEL_MESSAGE_SEEN;
@@ -544,139 +646,27 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
camel_object_unref (CAMEL_OBJECT (message));
if (psd)
- camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->set);
+ camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->flags);
gtk_widget_destroy (GTK_WIDGET (composer));
}
-struct _save_draft_info {
- EMsgComposer *composer;
- const char *old_uid;
- int quit;
-};
-
-static void
-save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
-{
- struct _save_draft_info *sdi = data;
-
- /* delete the original draft message */
- if (ok && sdi->old_uid)
- camel_folder_set_message_flags (folder, sdi->old_uid,
- CAMEL_MESSAGE_DELETED,
- CAMEL_MESSAGE_DELETED);
-
- if (ok && sdi->quit)
- gtk_widget_destroy (GTK_WIDGET (sdi->composer));
- else
- gtk_object_unref (GTK_OBJECT (sdi->composer));
-
- g_free (info);
- g_free (sdi);
-}
-
-static void
-use_default_drafts_cb (int reply, gpointer data)
-{
- extern CamelFolder *drafts_folder;
- CamelFolder **folder = data;
-
- if (reply == 0) {
- *folder = drafts_folder;
- camel_object_ref (CAMEL_OBJECT (*folder));
- }
-}
-
-static void
-save_draft_folder (char *uri, CamelFolder *folder, gpointer data)
-{
- CamelFolder **save = data;
-
- if (folder) {
- *save = folder;
- camel_object_ref (CAMEL_OBJECT (folder));
- }
-}
-
-void
-composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_data)
-{
- extern char *default_drafts_folder_uri;
- extern CamelFolder *drafts_folder;
- CamelMimeMessage *msg;
- CamelMessageInfo *info;
- const MailConfigAccount *account;
- struct _save_draft_info *sdi;
- CamelFolder *folder = NULL;
-
- account = e_msg_composer_get_preferred_account (composer);
- if (account && account->drafts_folder_uri &&
- strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) {
- int id;
-
- id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_thread_new);
- mail_msg_wait (id);
-
- if (!folder) {
- GtkWidget *dialog;
-
- dialog = gnome_ok_cancel_dialog_parented (_("Unable to open the drafts folder for this account.\n"
- "Would you like to use the default drafts folder?"),
- use_default_drafts_cb, &folder, GTK_WINDOW (composer));
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
- if (!folder)
- return;
- }
- } else {
- folder = drafts_folder;
- camel_object_ref (CAMEL_OBJECT (folder));
- }
-
- msg = e_msg_composer_get_message_draft (composer);
-
- info = g_new0 (CamelMessageInfo, 1);
- info->flags = CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN;
-
- sdi = g_malloc (sizeof (struct _save_draft_info));
- sdi->composer = composer;
- gtk_object_ref (GTK_OBJECT (composer));
- sdi->old_uid = (const char *) user_data;
- sdi->quit = quit;
-
- /* FIXME: we need to have some way of getting the UID of the
- newly appended message so that we can update the data that
- this callback gets called with (user_data is the UID of the
- message being edited) so that if the user saves a
- second/third/fourth/etc time, we keep deleting the previous
- copy of the draft */
-
- mail_append_mail (folder, msg, info, save_draft_done, sdi);
- camel_object_unref (CAMEL_OBJECT (folder));
- camel_object_unref (CAMEL_OBJECT (msg));
-}
-
static GtkWidget *
-create_msg_composer (const MailConfigAccount *account, const char *url)
+create_msg_composer (const char *url)
{
- EMsgComposer *composer;
+ const MailConfigAccount *account;
gboolean send_html;
+ EMsgComposer *composer;
- /* Make sure that we've actually been passed in an account. If one has
- * not been passed in, grab the default account.
- */
- if (account == NULL) {
- account = mail_config_get_default_account ();
- }
-
+ account = mail_config_get_default_account ();
send_html = mail_config_get_send_html ();
-
+
composer = url ? e_msg_composer_new_from_url (url) : e_msg_composer_new ();
if (composer) {
e_msg_composer_hdrs_set_from_account (E_MSG_COMPOSER_HDRS (composer->hdrs), account->name);
e_msg_composer_set_send_html (composer, send_html);
- e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
+ e_msg_composer_show_sig_file (composer);
return GTK_WIDGET (composer);
} else
return NULL;
@@ -685,17 +675,13 @@ create_msg_composer (const MailConfigAccount *account, const char *url)
void
compose_msg (GtkWidget *widget, gpointer user_data)
{
- const MailConfigAccount *account;
FolderBrowser *fb = FOLDER_BROWSER (user_data);
GtkWidget *composer;
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- /* Figure out which account we want to initially compose from */
- account = mail_config_get_account_by_source_url (fb->uri);
-
- composer = create_msg_composer (account, NULL);
+ composer = create_msg_composer (NULL);
if (!composer)
return;
@@ -703,8 +689,6 @@ compose_msg (GtkWidget *widget, gpointer user_data)
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
gtk_widget_show (composer);
}
@@ -720,8 +704,7 @@ send_to_url (const char *url)
if (!check_send_configuration (NULL))
return;
- /* Tell create_msg_composer to use the default email profile */
- composer = create_msg_composer (NULL, url);
+ composer = create_msg_composer (url);
if (!composer)
return;
@@ -729,118 +712,102 @@ send_to_url (const char *url)
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
-
+
gtk_widget_show (composer);
}
static GList *
list_add_addresses (GList *list, const CamelInternetAddress *cia, const GSList *accounts,
- GHashTable *rcpt_hash, const MailConfigAccount **me)
+ GHashTable *rcpt_hash, const MailConfigAccount **me,
+ const char *ignore_addr)
{
- const MailConfigAccount *account;
- GHashTable *account_hash;
const char *name, *addr;
const GSList *l;
+ gboolean notme;
int i;
- account_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- l = accounts;
- while (l) {
- account = l->data;
- g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account);
- l = l->next;
- }
-
for (i = 0; camel_internet_address_get (cia, i, &name, &addr); i++) {
- /* Here I'll check to see if the cc:'d address is the address
- of the sender, and if so, don't add it to the cc: list; this
- is to fix Bugzilla bug #455. */
- account = g_hash_table_lookup (account_hash, addr);
- if (account && me && !*me)
- *me = account;
-
- if (!account && !g_hash_table_lookup (rcpt_hash, addr)) {
- EDestination *dest;
+ /* Make sure we don't want to ignore this address */
+ if (!ignore_addr || g_strcasecmp (ignore_addr, addr)) {
- dest = e_destination_new ();
- e_destination_set_name (dest, name);
- e_destination_set_email (dest, addr);
+ /* Here I'll check to see if the cc:'d address is the address
+ of the sender, and if so, don't add it to the cc: list; this
+ is to fix Bugzilla bug #455. */
+ notme = TRUE;
+ l = accounts;
+ while (l) {
+ const MailConfigAccount *acnt = l->data;
+
+ if (!g_strcasecmp (acnt->id->address, addr)) {
+ notme = FALSE;
+ if (me && !*me)
+ *me = acnt;
+ break;
+ }
+
+ l = l->next;
+ }
- list = g_list_append (list, dest);
- g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1));
- }
+ if (notme && !g_hash_table_lookup (rcpt_hash, addr)) {
+ EDestination *dest;
+
+ dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
+
+ list = g_list_append (list, dest);
+ g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1));
+ }
+ }
}
- g_hash_table_destroy (account_hash);
-
return list;
}
static const MailConfigAccount *
guess_me (const CamelInternetAddress *to, const CamelInternetAddress *cc, const GSList *accounts)
{
- const MailConfigAccount *account;
- GHashTable *account_hash;
- const char *addr;
+ const char *name, *addr;
const GSList *l;
+ gboolean notme;
+ char *full;
int i;
- /* "optimization" */
- if (!to && !cc)
- return NULL;
-
- account_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- l = accounts;
- while (l) {
- account = l->data;
- g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account);
- l = l->next;
- }
-
if (to) {
- for (i = 0; camel_internet_address_get (to, i, NULL, &addr); i++) {
- account = g_hash_table_lookup (account_hash, addr);
- if (account)
- goto found;
+ for (i = 0; camel_internet_address_get (to, i, &name, &addr); i++) {
+ full = camel_internet_address_format_address (name, addr);
+ l = accounts;
+ while (l) {
+ const MailConfigAccount *acnt = l->data;
+
+ if (!g_strcasecmp (acnt->id->address, addr)) {
+ notme = FALSE;
+ return acnt;
+ }
+
+ l = l->next;
+ }
}
}
if (cc) {
- for (i = 0; camel_internet_address_get (cc, i, NULL, &addr); i++) {
- account = g_hash_table_lookup (account_hash, addr);
- if (account)
- goto found;
+ for (i = 0; camel_internet_address_get (cc, i, &name, &addr); i++) {
+ full = camel_internet_address_format_address (name, addr);
+ l = accounts;
+ while (l) {
+ const MailConfigAccount *acnt = l->data;
+
+ if (!g_strcasecmp (acnt->id->address, addr)) {
+ notme = FALSE;
+ return acnt;
+ }
+
+ l = l->next;
+ }
}
}
- account = NULL;
-
- found:
-
- g_hash_table_destroy (account_hash);
-
- return account;
-}
-
-inline static void
-mail_ignore (EMsgComposer *composer, const gchar *name, const gchar *address)
-{
- e_msg_composer_ignore (composer, name && *name ? name : address);
-}
-
-static void
-mail_ignore_address (EMsgComposer *composer, const CamelInternetAddress *addr)
-{
- const gchar *name, *address;
- gint i, max;
-
- max = camel_address_length (CAMEL_ADDRESS (addr));
- for (i = 0; i < max; i++) {
- camel_internet_address_get (addr, i, &name, &address);
- mail_ignore (composer, name, address);
- }
+ return NULL;
}
static EMsgComposer *
@@ -849,34 +816,46 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs;
const char *name = NULL, *address = NULL, *source = NULL;
const char *message_id, *references, *reply_addr = NULL;
- char *text = NULL, *subject, date_str[100], *format;
+ char *text, *subject, date_str[100], *format;
const MailConfigAccount *me = NULL;
const GSList *accounts = NULL;
GList *to = NULL, *cc = NULL;
EDestination **tov, **ccv;
EMsgComposer *composer;
- CamelMimePart *part;
time_t date;
const int max_subject_length = 1024;
- composer = e_msg_composer_new ();
+ composer = e_msg_composer_new ();
+ e_msg_composer_add_message_attachments (composer, message, TRUE);
+
if (!composer)
return NULL;
- e_msg_composer_add_message_attachments (composer, message, TRUE);
+ sender = camel_mime_message_get_from (message);
+ if (sender != NULL && camel_address_length (CAMEL_ADDRESS (sender)) > 0) {
+ camel_internet_address_get (sender, 0, &name, &address);
+ } else {
+ name = _("an unknown sender");
+ }
+
+ date = camel_mime_message_get_date (message, NULL);
+
+ strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"),
+ localtime (&date));
+ format = e_utf8_from_locale_string (date_str);
+ text = mail_tool_quote_message (message, format, name && *name ? name : address);
+ g_free (format);
+
+ if (text) {
+ e_msg_composer_set_body_text (composer, text);
+ g_free (text);
+ }
/* Set the recipients */
accounts = mail_config_get_accounts ();
to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
- mail_ignore_address (composer, to_addrs);
- mail_ignore_address (composer, cc_addrs);
-
- /* default 'me' to the source account... */
- source = camel_mime_message_get_source (message);
- if (source)
- me = mail_config_get_account_by_source_url (source);
if (mode == REPLY_LIST) {
CamelMessageInfo *info;
@@ -919,21 +898,18 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
}
}
- if (!me)
- me = guess_me (to_addrs, cc_addrs, accounts);
+ me = guess_me (to_addrs, cc_addrs, accounts);
} else {
GHashTable *rcpt_hash;
- rcpt_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
+ rcpt_hash = g_hash_table_new (g_str_hash, g_str_equal);
reply_to = camel_mime_message_get_reply_to (message);
if (!reply_to)
reply_to = camel_mime_message_get_from (message);
if (reply_to) {
- int i;
-
- for (i = 0; camel_internet_address_get (reply_to, i, &name, &reply_addr); i++) {
- /* Get the Reply-To address so we can ignore references to it in the Cc: list */
+ /* Get the Reply-To address so we can ignore references to it in the Cc: list */
+ if (camel_internet_address_get (reply_to, 0, &name, &reply_addr)) {
EDestination *dest;
dest = e_destination_new ();
@@ -941,54 +917,24 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
e_destination_set_email (dest, reply_addr);
to = g_list_append (to, dest);
g_hash_table_insert (rcpt_hash, (char *) reply_addr, GINT_TO_POINTER (1));
- mail_ignore (composer, name, reply_addr);
}
}
if (mode == REPLY_ALL) {
- cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, me ? NULL : &me);
- cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me);
+ cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, &me, NULL);
+ cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me, reply_addr);
} else {
- if (!me)
- me = guess_me (to_addrs, cc_addrs, accounts);
+ me = guess_me (to_addrs, cc_addrs, accounts);
}
g_hash_table_destroy (rcpt_hash);
}
- /* set body text here as we want all ignored words to take effect */
- switch (mail_config_get_default_reply_style ()) {
- case MAIL_CONFIG_REPLY_DO_NOT_QUOTE:
- /* do nothing */
- break;
- case MAIL_CONFIG_REPLY_ATTACH:
- /* attach the original message as an attachment */
- part = mail_tool_make_message_attachment (message);
- e_msg_composer_attach (composer, part);
- camel_object_unref (CAMEL_OBJECT (part));
- break;
- case MAIL_CONFIG_REPLY_QUOTED:
- default:
- /* do what any sane user would want when replying... */
- sender = camel_mime_message_get_from (message);
- if (sender != NULL && camel_address_length (CAMEL_ADDRESS (sender)) > 0) {
- camel_internet_address_get (sender, 0, &name, &address);
- } else {
- name = _("an unknown sender");
- }
-
- date = camel_mime_message_get_date (message, NULL);
- strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"),
- localtime (&date));
- format = e_utf8_from_locale_string (date_str);
- text = mail_tool_quote_message (message, format, name && *name ? name : address);
- mail_ignore (composer, name, address);
- g_free (format);
- if (text) {
- e_msg_composer_set_body_text (composer, text);
- g_free (text);
- }
- break;
+ if (me == NULL) {
+ /* as a last resort, set the replying account (aka me)
+ to the account this was fetched from */
+ source = camel_mime_message_get_source (message);
+ me = mail_config_get_account_by_source_url (source);
}
/* Set the subject of the new message. */
@@ -1048,8 +994,6 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
e_msg_composer_add_header (composer, "References", references);
}
- e_msg_composer_drop_editor_undo (composer);
-
return composer;
}
@@ -1058,8 +1002,7 @@ requeue_mail_reply (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void
{
int mode = GPOINTER_TO_INT (data);
- if (msg != NULL)
- mail_reply (folder, msg, uid, mode);
+ mail_reply (folder, msg, uid, mode);
}
void
@@ -1081,8 +1024,7 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mod
psd->folder = folder;
camel_object_ref (CAMEL_OBJECT (psd->folder));
psd->uid = g_strdup (uid);
- psd->flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN;
- psd->set = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN;
+ psd->flags = CAMEL_MESSAGE_ANSWERED;
composer = mail_generate_reply (folder, msg, uid, mode);
if (!composer)
@@ -1092,8 +1034,6 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mod
GTK_SIGNAL_FUNC (composer_send_cb), psd);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), psd);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "destroy",
GTK_SIGNAL_FUNC (free_psd), psd);
@@ -1106,10 +1046,13 @@ reply_to_sender (GtkWidget *widget, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ /* FIXME: make this always load the message based on cursor */
+
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- mail_reply(fb->folder, NULL, fb->message_list->cursor_uid, REPLY_SENDER);
+ mail_reply (fb->folder, fb->mail_display->current_message,
+ fb->message_list->cursor_uid, REPLY_SENDER);
}
void
@@ -1120,7 +1063,10 @@ reply_to_list (GtkWidget *widget, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- mail_reply (fb->folder, NULL, fb->message_list->cursor_uid, REPLY_LIST);
+ /* FIXME: make this always load the message based on cursor */
+
+ mail_reply (fb->folder, fb->mail_display->current_message,
+ fb->message_list->cursor_uid, REPLY_LIST);
}
void
@@ -1131,7 +1077,10 @@ reply_to_all (GtkWidget *widget, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- mail_reply(fb->folder, NULL, fb->message_list->cursor_uid, REPLY_ALL);
+ /* FIXME: make this always load the message based on cursor */
+
+ mail_reply (fb->folder, fb->mail_display->current_message,
+ fb->message_list->cursor_uid, REPLY_ALL);
}
void
@@ -1176,8 +1125,6 @@ forward_get_composer (CamelMimeMessage *message, const char *subject)
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
e_msg_composer_set_headers (composer, account->name, NULL, NULL, NULL, subject);
} else {
g_warning ("Could not create composer");
@@ -1204,6 +1151,7 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
CamelDataWrapper *wrapper;
e_msg_composer_set_body_text (composer, text);
+ e_msg_composer_show_sig_file (composer);
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message));
if (CAMEL_IS_MULTIPART (wrapper))
@@ -1211,7 +1159,6 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
gtk_widget_show (GTK_WIDGET (composer));
e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
}
g_free (text);
}
@@ -1222,27 +1169,21 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
static void
forward_message (FolderBrowser *fb, MailConfigForwardStyle style)
{
- GPtrArray *uids;
- int i;
-
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
if (!check_send_configuration (fb))
return;
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- for (i = 0; i < uids->len; i++) {
- mail_get_message (fb->folder, uids->pdata[i],
- do_forward_non_attached,
- GINT_TO_POINTER (style),
+ if (fb->mail_display && fb->mail_display->current_message) {
+ do_forward_non_attached (fb->folder, NULL,
+ fb->mail_display->current_message,
+ GINT_TO_POINTER (style));
+ } else {
+ mail_get_message (fb->folder, fb->message_list->cursor_uid,
+ do_forward_non_attached, GINT_TO_POINTER (style),
mail_thread_new);
- g_free (uids->pdata[i]);
}
-
- g_ptr_array_free (uids, TRUE);
}
void
@@ -1268,7 +1209,6 @@ do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part
e_msg_composer_attach (composer, part);
gtk_widget_show (GTK_WIDGET (composer));
e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
}
}
}
@@ -1299,96 +1239,6 @@ forward (GtkWidget *widget, gpointer user_data)
forward_message (user_data, style);
}
-static EMsgComposer *
-redirect_get_composer (CamelMimeMessage *message)
-{
- const MailConfigAccount *account = NULL;
- const CamelInternetAddress *to_addrs, *cc_addrs;
- const GSList *accounts = NULL;
- EMsgComposer *composer;
-
- g_return_val_if_fail (message != NULL, NULL);
-
- accounts = mail_config_get_accounts ();
- to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
- cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
-
- account = guess_me (to_addrs, cc_addrs, accounts);
-
- if (!account) {
- const char *source;
-
- source = camel_mime_message_get_source (message);
- account = mail_config_get_account_by_source_url (source);
- }
-
- if (!account)
- account = mail_config_get_default_account ();
-
- /* QMail will refuse to send a message if it finds one of
- it's Delivered-To headers in the message, so remove all
- Delivered-To headers. Fixes bug #23635. */
- while (camel_medium_get_header (CAMEL_MEDIUM (message), "Delivered-To"))
- camel_medium_remove_header (CAMEL_MEDIUM (message), "Delivered-To");
-
- composer = e_msg_composer_new_redirect (message, account->name);
- if (composer) {
- gtk_signal_connect (GTK_OBJECT (composer), "send",
- GTK_SIGNAL_FUNC (composer_send_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "postpone",
- GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
- } else {
- g_warning ("Could not create composer");
- }
-
- return composer;
-}
-
-static void
-do_redirect (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
-{
- EMsgComposer *composer;
-
- if (!message)
- return;
-
- composer = redirect_get_composer (message);
- if (composer) {
- CamelDataWrapper *wrapper;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message));
- if (CAMEL_IS_MULTIPART (wrapper))
- e_msg_composer_add_message_attachments (composer, message, FALSE);
-
- gtk_widget_show (GTK_WIDGET (composer));
- e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
- }
-}
-
-void
-redirect (GtkWidget *widget, gpointer user_data)
-{
- FolderBrowser *fb = (FolderBrowser *) user_data;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- if (!check_send_configuration (fb))
- return;
-
- if (fb->mail_display && fb->mail_display->current_message) {
- do_redirect (fb->folder, NULL,
- fb->mail_display->current_message,
- NULL);
- } else {
- mail_get_message (fb->folder, fb->message_list->cursor_uid,
- do_redirect, NULL, mail_thread_new);
- }
-}
-
static void
transfer_msg_done (gboolean ok, void *data)
{
@@ -1403,10 +1253,10 @@ transfer_msg_done (gboolean ok, void *data)
are hidden, select the previous */
if ((row + 1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
@@ -1416,35 +1266,38 @@ transfer_msg_done (gboolean ok, void *data)
static void
transfer_msg (FolderBrowser *fb, gboolean delete_from_source)
{
- static const char *allowed_types[] = { "mail", "vtrash", NULL };
+ const char *allowed_types[] = { "mail", "vtrash", NULL };
extern EvolutionShellClient *global_shell_client;
- GNOME_Evolution_Folder *folder;
- static char *last_uri = NULL;
+ char *uri, *physical, *path, *desc;
+ static char *last = NULL;
GPtrArray *uids;
- char *desc;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (last_uri == NULL)
- last_uri = g_strdup ("");
+ if (last == NULL)
+ last = g_strdup ("");
if (delete_from_source)
desc = _("Move message(s) to");
else
desc = _("Copy message(s) to");
+ uri = NULL;
+ physical = NULL;
evolution_shell_client_user_select_folder (global_shell_client,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (fb))),
- desc, last_uri, allowed_types,
- &folder);
- if (!folder)
+ desc, last,
+ allowed_types, &uri, &physical);
+ if (!uri)
return;
- if (strcmp (last_uri, folder->evolutionUri) != 0) {
- g_free (last_uri);
- last_uri = g_strdup (folder->evolutionUri);
+ path = strchr (uri, '/');
+ if (path && strcmp (last, path) != 0) {
+ g_free (last);
+ last = g_strdup_printf ("evolution:%s", path);
}
+ g_free (uri);
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
@@ -1452,13 +1305,12 @@ transfer_msg (FolderBrowser *fb, gboolean delete_from_source)
if (delete_from_source) {
gtk_object_ref (GTK_OBJECT (fb));
mail_transfer_messages (fb->folder, uids, delete_from_source,
- folder->physicalUri, 0,
- transfer_msg_done, fb);
+ physical, 0, transfer_msg_done, fb);
} else {
mail_transfer_messages (fb->folder, uids, delete_from_source,
- folder->physicalUri, 0, NULL, NULL);
+ physical, 0, NULL, NULL);
}
- CORBA_free (folder);
+ g_free(physical);
}
void
@@ -1527,26 +1379,27 @@ void
addrbook_sender (GtkWidget *widget, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- const char *addr_str;
- CamelMessageInfo *info;
+ CamelMimeMessage *msg = NULL;
+ const CamelInternetAddress *addr;
+ gchar *addr_str;
GtkWidget *win;
GtkWidget *control;
GtkWidget *socket;
- GPtrArray *uids;
- int i;
-
+
+ /* FIXME: make this use the cursor message id */
+
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
-
- uids = g_ptr_array_new();
- message_list_foreach(fb->message_list, enumerate_msg, uids);
- if (uids->len != 1)
- goto done;
-
- info = camel_folder_get_message_info(fb->folder, uids->pdata[0]);
- if (info == NULL
- || (addr_str = camel_message_info_from(info)) == NULL)
- goto done;
+
+ msg = fb->mail_display->current_message;
+ if (msg == NULL)
+ return;
+
+ addr = camel_mime_message_get_from (msg);
+ if (addr == NULL)
+ return;
+
+ addr_str = camel_address_format (CAMEL_ADDRESS (addr));
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (win), _("Sender"));
@@ -1568,11 +1421,6 @@ addrbook_sender (GtkWidget *widget, gpointer user_data)
gtk_container_add (GTK_CONTAINER (win), control);
gtk_widget_show_all (win);
-
-done:
- for (i=0; i < uids->len; i++)
- g_free(uids->pdata[i]);
- g_ptr_array_free(uids, TRUE);
}
void
@@ -1605,13 +1453,9 @@ select_all (BonoboUIComponent *uih, void *user_data, const char *path)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (GTK_WIDGET_HAS_FOCUS (fb->mail_display->html)) {
- gtk_html_select_all (fb->mail_display->html);
- } else {
- etsm = e_tree_get_selection_model (fb->message_list->tree);
-
- e_selection_model_select_all (etsm);
- }
+ etsm = e_tree_get_selection_model (fb->message_list->tree);
+
+ e_selection_model_select_all (etsm);
}
/* Thread selection */
@@ -1636,7 +1480,7 @@ thread_select_foreach (ETreePath path, gpointer user_data)
thread_select_info_t *tsi = (thread_select_info_t *) user_data;
ETreeModel *tm = tsi->ml->model;
ETreePath node;
-
+
/* @path part of the initial selection. If it has children,
* we select them as well. If it doesn't, we select its siblings and
* their children (ie, the current node must be inside the thread
@@ -1695,11 +1539,9 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (GTK_WIDGET_HAS_FOCUS (fb->message_list)) {
- etsm = e_tree_get_selection_model (fb->message_list->tree);
-
- e_selection_model_invert_selection (etsm);
- }
+ etsm = e_tree_get_selection_model (fb->message_list->tree);
+
+ e_selection_model_invert_selection (etsm);
}
/* flag all selected messages. Return number flagged */
@@ -1741,24 +1583,18 @@ toggle_flags (FolderBrowser *fb, guint32 mask)
message_list_foreach (fb->message_list, enumerate_msg, uids);
camel_folder_freeze (fb->folder);
for (i = 0; i < uids->len; i++) {
- guint32 flags;
+ int flags;
- flags = ~(camel_folder_get_message_flags (fb->folder, uids->pdata[i]));
-
- /* if we're flagging a message important, always undelete it too */
- if (mask & flags & CAMEL_MESSAGE_FLAGGED) {
- flags &= ~CAMEL_MESSAGE_DELETED;
- mask |= CAMEL_MESSAGE_DELETED;
- }
-
- /* if we're flagging a message deleted, always mark it seen too */
- if (mask & flags & CAMEL_MESSAGE_DELETED) {
- flags |= CAMEL_MESSAGE_SEEN;
- mask |= CAMEL_MESSAGE_SEEN;
+ flags = camel_folder_get_message_flags (fb->folder, uids->pdata[i]);
+
+ if (flags & mask)
+ camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, 0);
+ else {
+ if ((mask & CAMEL_MESSAGE_FLAGGED) && (flags & CAMEL_MESSAGE_DELETED))
+ camel_folder_set_message_flags (fb->folder, uids->pdata[i], CAMEL_MESSAGE_DELETED, 0);
+ camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, mask);
}
-
- camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, flags);
-
+
g_free (uids->pdata[i]);
}
camel_folder_thaw (fb->folder);
@@ -1812,7 +1648,8 @@ mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path)
void
mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path)
{
- flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_FLAGGED);
+ flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0);
+ flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED);
}
void
@@ -1827,170 +1664,6 @@ toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path)
toggle_flags (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED);
}
-
-struct _tag_editor_data {
- MessageTagEditor *editor;
- FolderBrowser *fb;
- GPtrArray *uids;
-};
-
-static void
-tag_editor_ok (GtkWidget *button, gpointer user_data)
-{
- struct _tag_editor_data *data = user_data;
- const char *name, *value;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (data->fb))
- goto done;
-
- name = message_tag_editor_get_name (data->editor);
- if (!name)
- goto done;
-
- value = message_tag_editor_get_value (data->editor);
-
- camel_folder_freeze (data->fb->folder);
- for (i = 0; i < data->uids->len; i++) {
- camel_folder_set_message_user_tag (data->fb->folder, data->uids->pdata[i], name, value);
- }
- camel_folder_thaw (data->fb->folder);
-
- done:
- gtk_widget_destroy (GTK_WIDGET (data->editor));
-}
-
-static void
-tag_editor_cancel (GtkWidget *button, gpointer user_data)
-{
- struct _tag_editor_data *data = user_data;
-
- gtk_widget_destroy (GTK_WIDGET (data->editor));
-}
-
-static void
-tag_editor_destroy (GnomeDialog *dialog, gpointer user_data)
-{
- struct _tag_editor_data *data = user_data;
-
- gtk_object_unref (GTK_OBJECT (data->fb));
- g_ptr_array_free (data->uids, TRUE);
- g_free (data);
-}
-
-void
-flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- struct _tag_editor_data *data;
- GtkWidget *editor;
- GPtrArray *uids;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- editor = (GtkWidget *) message_tag_followup_new ();
-
- data = g_new (struct _tag_editor_data, 1);
- data->editor = MESSAGE_TAG_EDITOR (editor);
- gtk_widget_ref (GTK_WIDGET (fb));
- data->fb = fb;
- data->uids = uids;
-
- for (i = 0; i < uids->len; i++) {
- CamelMessageInfo *info;
-
- info = camel_folder_get_message_info (fb->folder, uids->pdata[i]);
- message_tag_followup_append_message (MESSAGE_TAG_FOLLOWUP (editor),
- camel_message_info_from (info),
- camel_message_info_subject (info));
- }
-
- gnome_dialog_button_connect (GNOME_DIALOG (editor), 0, tag_editor_ok, data);
- gnome_dialog_button_connect (GNOME_DIALOG (editor), 1, tag_editor_cancel, data);
- gnome_dialog_set_close (GNOME_DIALOG (editor), TRUE);
-
- /* special-case... */
- if (uids->len == 1) {
- const char *tag_value;
-
- tag_value = camel_folder_get_message_user_tag (fb->folder, uids->pdata[0], "follow-up");
- if (tag_value)
- message_tag_editor_set_value (MESSAGE_TAG_EDITOR (editor), tag_value);
- }
-
- gtk_signal_connect (GTK_OBJECT (editor), "destroy",
- tag_editor_destroy, data);
-
- gtk_widget_show (editor);
-}
-
-void
-flag_followup_completed (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- time_t now;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- now = time (NULL);
-
- camel_folder_freeze (fb->folder);
- for (i = 0; i < uids->len; i++) {
- struct _FollowUpTag *tag;
- const char *tag_value;
- char *value;
-
- tag_value = camel_folder_get_message_user_tag (fb->folder, uids->pdata[i], "follow-up");
- if (!tag_value)
- continue;
-
- tag = message_tag_followup_decode (tag_value);
- tag->completed = now;
-
- value = message_tag_followup_encode (tag);
- g_free (tag);
-
- camel_folder_set_message_user_tag (fb->folder, uids->pdata[i], "follow-up", value);
- g_free (value);
- }
- camel_folder_thaw (fb->folder);
-
- g_ptr_array_free (uids, TRUE);
-}
-
-void
-flag_followup_clear (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- camel_folder_freeze (fb->folder);
- for (i = 0; i < uids->len; i++) {
- camel_folder_set_message_user_tag (fb->folder, uids->pdata[i], "follow-up", NULL);
- }
- camel_folder_thaw (fb->folder);
-
- g_ptr_array_free (uids, TRUE);
-}
-
void
zoom_in (BonoboUIComponent *uih, void *user_data, const char *path)
{
@@ -2035,8 +1708,10 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi
for (i = 0; i < messages->len; i++) {
EMsgComposer *composer;
- char *uid;
+ XEvolution *hdrs;
+ hdrs = mail_tool_remove_xevolution_headers (messages->pdata[i]);
+ mail_tool_destroy_xevolution (hdrs);
camel_medium_remove_header (CAMEL_MEDIUM (messages->pdata[i]), "X-Mailer");
composer = e_msg_composer_new_with_message (messages->pdata[i]);
@@ -2047,12 +1722,6 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
composer_postpone_cb, NULL);
- uid = g_strdup (uids->pdata[i]);
- gtk_object_set_data_full (GTK_OBJECT (composer), "uid", uid, (GtkDestroyNotify) g_free);
-
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- composer_save_draft_cb, uid);
-
gtk_widget_show (GTK_WIDGET (composer));
}
}
@@ -2311,12 +1980,6 @@ save_msg (GtkWidget *widget, gpointer user_data)
}
void
-colour_msg (GtkWidget *widget, gpointer user_data)
-{
- /* FIXME: implement me? */
-}
-
-void
delete_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
@@ -2324,8 +1987,6 @@ delete_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (!(fb->folder->permanent_flags & CAMEL_MESSAGE_DELETED))
- return;
deleted = flag_messages (fb, CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN,
CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_SEEN);
@@ -2339,10 +2000,10 @@ delete_msg (GtkWidget *button, gpointer user_data)
are hidden, select the previous */
if ((row+1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
}
@@ -2353,210 +2014,58 @@ undelete_msg (GtkWidget *button, gpointer user_data)
flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0);
}
-
-static gboolean
-confirm_goto_next_folder (FolderBrowser *fb)
-{
- GtkWidget *dialog, *label, *checkbox;
- int button;
-
- if (!mail_config_get_confirm_goto_next_folder ())
- return mail_config_get_goto_next_folder ();
-
- dialog = gnome_dialog_new (_("Go to next folder with unread messages?"),
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
-
- e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb));
-
- label = gtk_label_new (_("There are no more new messages in this folder.\n"
- "Would you like to go to the next folder?"));
-
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
-
- checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
- gtk_object_ref (GTK_OBJECT (checkbox));
- gtk_widget_show (checkbox);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
-
- button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
- mail_config_set_confirm_goto_next_folder (FALSE);
-
- gtk_object_unref (GTK_OBJECT (checkbox));
-
- if (button == 0) {
- mail_config_set_goto_next_folder (TRUE);
- return TRUE;
- } else {
- mail_config_set_goto_next_folder (FALSE);
- return FALSE;
- }
-}
-
-static CamelFolderInfo *
-find_current_folder (CamelFolderInfo *root, const char *current_uri)
-{
- CamelFolderInfo *node, *current = NULL;
-
- node = root;
- while (node) {
- if (!strcmp (current_uri, node->url)) {
- current = node;
- break;
- }
-
- current = find_current_folder (node->child, current_uri);
- if (current)
- break;
-
- node = node->sibling;
- }
-
- return current;
-}
-
-static CamelFolderInfo *
-find_next_folder_r (CamelFolderInfo *node)
-{
- CamelFolderInfo *next;
-
- while (node) {
- if (node->unread_message_count > 0)
- return node;
-
- next = find_next_folder_r (node->child);
- if (next)
- return next;
-
- node = node->sibling;
- }
-
- return NULL;
-}
-
-static CamelFolderInfo *
-find_next_folder (CamelFolderInfo *current)
-{
- CamelFolderInfo *next;
-
- /* first search subfolders... */
- next = find_next_folder_r (current->child);
- if (next)
- return next;
-
- /* now search siblings... */
- next = find_next_folder_r (current->sibling);
- if (next)
- return next;
-
- /* now go up one level (if we can) and search... */
- if (current->parent && current->parent->sibling) {
- return find_next_folder_r (current->parent->sibling);
- } else {
- return NULL;
- }
-}
-
-static void
-do_evil_kludgy_goto_next_folder_hack (FolderBrowser *fb)
-{
- CamelFolderInfo *root, *current, *node;
- CORBA_Environment ev;
- CamelStore *store;
-
- store = camel_folder_get_parent_store (fb->folder);
-
- /* FIXME: loop over all available mail stores? */
-
- root = camel_store_get_folder_info (store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE |
- CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL);
-
- if (!root)
- return;
-
- current = find_current_folder (root, fb->uri);
- g_assert (current != NULL);
-
- node = find_next_folder (current);
- if (node) {
- g_warning ("doin' my thang...");
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellView_changeCurrentView (fb->shell_view, "evolution:/local/Inbox", &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("got an exception");
- CORBA_exception_free (&ev);
- } else {
- g_warning ("can't find a folder with unread mail?");
- }
-
- camel_store_free_folder_info (store, root);
-}
-
void
next_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
}
void
next_unread_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (!message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE)) {
-#if 0
- if (confirm_goto_next_folder (fb))
- do_evil_kludgy_goto_next_folder_hack (fb);
-#endif
- }
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_SEEN, TRUE);
}
void
next_flagged_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, FALSE);
}
void
-next_thread (GtkWidget *button, gpointer user_data)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- message_list_select_next_thread (fb->message_list);
-}
-
-void
previous_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, 0, FALSE);
}
@@ -2564,11 +2073,13 @@ void
previous_unread_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_SEEN, TRUE);
}
@@ -2576,24 +2087,34 @@ void
previous_flagged_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, TRUE);
}
+struct _expunged_folder_data {
+ FolderBrowser *fb;
+ gboolean hidedeleted;
+};
+
static void
expunged_folder (CamelFolder *f, void *data)
{
- FolderBrowser *fb = data;
+ FolderBrowser *fb = ((struct _expunged_folder_data *) data)->fb;
+ gboolean hidedeleted = ((struct _expunged_folder_data *) data)->hidedeleted;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
fb->expunging = NULL;
- gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), TRUE);
+ message_list_set_hidedeleted (fb->message_list, hidedeleted);
+
+ g_free (data);
}
static gboolean
@@ -2624,9 +2145,6 @@ confirm_expunge (FolderBrowser *fb)
gtk_widget_show (checkbox);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
- /* Set the 'No' button as the default */
- gnome_dialog_set_default (GNOME_DIALOG (dialog), 1);
-
button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
@@ -2649,10 +2167,15 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
return;
if (fb->folder && (fb->expunging == NULL || fb->folder != fb->expunging) && confirm_expunge (fb)) {
+ struct _expunged_folder_data *data;
CamelMessageInfo *info;
+ data = g_malloc (sizeof (*data));
+ data->fb = fb;
+ data->hidedeleted = fb->message_list->hidedeleted;
+
/* hide the deleted messages so user can't click on them while we expunge */
- gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), FALSE);
+ message_list_set_hidedeleted (fb->message_list, TRUE);
/* Only blank the mail display if the message being
viewed is one of those to be expunged */
@@ -2660,11 +2183,11 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
info = camel_folder_get_message_info (fb->folder, fb->loaded_uid);
if (!info || info->flags & CAMEL_MESSAGE_DELETED)
- mail_display_set_message (fb->mail_display, NULL, NULL);
+ mail_display_set_message (fb->mail_display, NULL);
}
fb->expunging = fb->folder;
- mail_expunge_folder (fb->folder, expunged_folder, fb);
+ mail_expunge_folder (fb->folder, expunged_folder, data);
}
}
@@ -2754,84 +2277,52 @@ vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path
}
-/* static void
-header_print_cb (GtkHTML *html, GnomePrintContext *print_context,
- double x, double y, double width, double height, gpointer user_data)
-{
- printf ("header_print_cb %f,%f x %f,%f\n", x, y, width, height);
-
- gnome_print_newpath (print_context);
- gnome_print_setlinewidth (print_context, 12.0);
- gnome_print_setrgbcolor (print_context, 1.0, 0.0, 0.0);
- gnome_print_moveto (print_context, x, y);
- gnome_print_lineto (print_context, x+width, y-height);
- gnome_print_strokepath (print_context);
-} */
-
-struct footer_info {
- GnomeFont *local_font;
- gint page_num, pages;
-};
-
-static void
-footer_print_cb (GtkHTML *html, GnomePrintContext *print_context,
- double x, double y, double width, double height, gpointer user_data)
-{
- struct footer_info *info = (struct footer_info *) user_data;
-
- if (info->local_font) {
- gchar *text = g_strdup_printf (_("Page %d of %d"), info->page_num, info->pages);
- gdouble tw = gnome_font_get_width_string (info->local_font, text);
-
- gnome_print_newpath (print_context);
- gnome_print_setrgbcolor (print_context, .0, .0, .0);
- gnome_print_moveto (print_context, x + width - tw, y - gnome_font_get_ascender (info->local_font));
- gnome_print_setfont (print_context, info->local_font);
- gnome_print_show (print_context, text);
-
- g_free (text);
- info->page_num++;
- }
-}
+static MailAccountsDialog *accounts_dialog = NULL;
static void
-footer_info_free (struct footer_info *info)
+accounts_dialog_close (GtkWidget *widget, gpointer user_data)
{
- if (info->local_font)
- gnome_font_unref (info->local_font);
- g_free (info);
+ accounts_dialog = NULL;
}
-static struct footer_info *
-footer_info_new (GtkHTML *html, GnomePrintContext *pc, gdouble *line)
+void
+providers_config (BonoboUIComponent *uih, void *user_data, const char *path)
{
- struct footer_info *info;
-
- info = g_new (struct footer_info, 1);
- info->local_font = gnome_font_new_closest ("Helvetica", GNOME_FONT_BOOK, FALSE, 10);
- if (info->local_font) {
- *line = gnome_font_get_ascender (info->local_font) + gnome_font_get_descender (info->local_font);
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+
+ if (FOLDER_BROWSER_IS_DESTROYED (fb))
+ return;
+
+ if (!accounts_dialog) {
+ accounts_dialog = mail_accounts_dialog_new (fb->shell);
+ gtk_widget_set_parent_window (GTK_WIDGET (accounts_dialog),
+ GTK_WIDGET (FB_WINDOW (fb))->window);
+ gtk_signal_connect (GTK_OBJECT (accounts_dialog), "destroy",
+ accounts_dialog_close, NULL);
+ gnome_dialog_set_close (GNOME_DIALOG (accounts_dialog), TRUE);
+ gtk_widget_show (GTK_WIDGET (accounts_dialog));
+ } else {
+ gdk_window_raise (GTK_WIDGET (accounts_dialog)->window);
+ gtk_widget_grab_focus (GTK_WIDGET (accounts_dialog));
}
- info->page_num = 1;
- info->pages = gtk_html_print_get_pages_num (html, pc, 0.0, *line);
-
- return info;
}
+/*
+ * FIXME: This routine could be made generic, by having a closure
+ * function plus data, and having the whole process be taken care
+ * of for you
+ */
static void
do_mail_print (FolderBrowser *fb, gboolean preview)
{
- GtkHTML *html;
GnomePrintContext *print_context;
GnomePrintMaster *print_master;
GnomePrintDialog *dialog;
GnomePrinter *printer = NULL;
GnomePaper *paper;
- gdouble line = 0.0;
int copies = 1;
int collate = FALSE;
- struct footer_info *info;
-
+
if (!preview) {
dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"),
GNOME_PRINT_DIALOG_COPIES));
@@ -2866,24 +2357,8 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
gnome_print_master_set_paper (print_master, paper);
gnome_print_master_set_copies (print_master, copies, collate);
print_context = gnome_print_master_get_context (print_master);
-
- html = GTK_HTML (gtk_html_new ());
- mail_display_initialize_gtkhtml (fb->mail_display, html);
-
- /* Set our 'printing' flag to true and render. This causes us
- to ignoring any adjustments we made to accomodate the
- user's theme. */
- fb->mail_display->printing = TRUE;
-
- mail_display_render (fb->mail_display, html, TRUE);
- gtk_html_print_set_master (html, print_master);
-
- info = footer_info_new (html, print_context, &line);
- gtk_html_print_with_header_footer (html, print_context, 0.0, line, NULL, footer_print_cb, info);
- footer_info_free (info);
-
- fb->mail_display->printing = FALSE;
-
+ gtk_html_print_set_master (fb->mail_display->html, print_master);
+ gtk_html_print (fb->mail_display->html, print_context);
gnome_print_master_close (print_master);
if (preview){
@@ -2901,76 +2376,9 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
_("Printing of message failed"));
}
}
-
- /* FIXME: We are leaking the GtkHTML object */
-}
-
-/* This is pretty evil. FolderBrowser's API should be extended to allow these sorts of
- things to be done in a more natural way. */
-
-/* <evil_code> */
-
-struct blarg_this_sucks {
- FolderBrowser *fb;
- gboolean preview;
-};
-
-static void
-done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
-{
- struct blarg_this_sucks *blarg = data;
- FolderBrowser *fb = blarg->fb;
- gboolean preview = blarg->preview;
- const char *followup;
-
- g_free (blarg);
-
- followup = camel_folder_get_message_user_tag (folder, uid, "follow-up");
-
- mail_display_set_message (fb->mail_display, (CamelMedium *) msg, followup);
-
- g_free (fb->loaded_uid);
- fb->loaded_uid = fb->loading_uid;
- fb->loading_uid = NULL;
-
- do_mail_print (fb, preview);
-}
-
-/* Ack! Most of this is copied from folder-browser.c */
-static void
-do_mail_fetch_and_print (FolderBrowser *fb, gboolean preview)
-{
- if (!fb->preview_shown) {
- /* If the preview pane is closed, we have to do some
- extra magic to load the message. */
- struct blarg_this_sucks *blarg = g_new (struct blarg_this_sucks, 1);
-
- blarg->fb = fb;
- blarg->preview = preview;
-
- fb->loading_id = 0;
-
- /* if we are loading, then set a pending, but leave the loading, coudl cancel here (?) */
- if (fb->loading_uid) {
- g_free (fb->pending_uid);
- fb->pending_uid = g_strdup (fb->new_uid);
- } else {
- if (fb->new_uid) {
- fb->loading_uid = g_strdup (fb->new_uid);
- mail_get_message (fb->folder, fb->loading_uid, done_message_selected, blarg, mail_thread_new);
- } else {
- mail_display_set_message (fb->mail_display, NULL, NULL);
- g_free (blarg);
- }
- }
- } else {
- do_mail_print (fb, preview);
- }
+ gtk_object_unref (GTK_OBJECT (print_master));
}
-/* </evil_code> */
-
-
void
print_msg (GtkWidget *button, gpointer user_data)
{
@@ -2979,7 +2387,7 @@ print_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- do_mail_fetch_and_print (fb, FALSE);
+ do_mail_print (fb, FALSE);
}
void
@@ -2990,7 +2398,7 @@ print_preview_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- do_mail_fetch_and_print (fb, TRUE);
+ do_mail_print (fb, TRUE);
}
/******************** Begin Subscription Dialog ***************************/
@@ -3038,63 +2446,6 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
-do_view_digest (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
-{
- FolderBrowser *folder_browser = FOLDER_BROWSER (data);
-
- if (FOLDER_BROWSER_IS_DESTROYED (folder_browser))
- return;
-
- if (message) {
- CamelFolder *digest;
- CamelStore *store;
- FolderBrowser *fb;
- GtkWidget *window;
-
- store = camel_digest_store_new ("digest:/");
-
- digest = camel_digest_folder_new (store, message);
- camel_object_unref (CAMEL_OBJECT (store));
- if (!digest)
- return;
-
- camel_folder_set_message_flags (folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-
- fb = (FolderBrowser *) folder_browser_new (folder_browser->shell, NULL);
- folder_browser_set_message_preview (fb, TRUE);
- folder_browser_set_folder (fb, digest, "digest:/");
- camel_object_unref (CAMEL_OBJECT (digest));
- gtk_widget_show (GTK_WIDGET (fb));
-
- window = folder_browser_window_new (fb);
- gtk_widget_show (window);
- }
-}
-
-void
-view_digest (GtkWidget *widget, gpointer user_data)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
- return;
-
- for (i = 0; i < uids->len; i++) {
- mail_get_message (fb->folder, uids->pdata [i], do_view_digest, fb, mail_thread_queued);
- g_free (uids->pdata [i]);
- }
- g_ptr_array_free (uids, TRUE);
-}
-
-static void
do_view_message (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
{
FolderBrowser *fb = FOLDER_BROWSER (data);
@@ -3126,7 +2477,7 @@ view_msg (GtkWidget *widget, gpointer user_data)
if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
return;
-
+
for (i = 0; i < uids->len; i++) {
mail_get_message (fb->folder, uids->pdata [i], do_view_message, fb, mail_thread_queued);
g_free (uids->pdata [i]);
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index 3c453623e0..f2bee415cf 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -37,14 +37,14 @@ extern "C" {
enum {
REPLY_SENDER,
REPLY_LIST,
- REPLY_ALL,
- REPLY_NO_QUOTE = 0x80 /* dont quote reply */
+ REPLY_ALL
};
void enumerate_msg (MessageList *ml, const char *uid, gpointer data);
void fetch_mail (GtkWidget *widget, gpointer user_data);
void send_queued_mail (GtkWidget *widget, gpointer user_data);
+void send_receive_mail (GtkWidget *widget, gpointer user_data);
void compose_msg (GtkWidget *widget, gpointer user_data);
void send_to_url (const char *url);
@@ -54,13 +54,10 @@ void forward_quoted (GtkWidget *widget, gpointer user_data);
void forward_attached (GtkWidget *widget, gpointer user_data);
void forward (GtkWidget *widget, gpointer user_data);
-void redirect (GtkWidget *widget, gpointer user_data);
-
void reply_to_sender (GtkWidget *widget, gpointer user_data);
void reply_to_list (GtkWidget *widget, gpointer user_data);
void reply_to_all (GtkWidget *widget, gpointer user_data);
-void colour_msg (GtkWidget *widget, gpointer user_data);
void delete_msg (GtkWidget *widget, gpointer user_data);
void undelete_msg (GtkWidget *widget, gpointer user_data);
void move_msg_cb (GtkWidget *widget, gpointer user_data);
@@ -73,12 +70,10 @@ void edit_msg (GtkWidget *widget, gpointer user_data);
void open_msg (GtkWidget *widget, gpointer user_data);
void save_msg (GtkWidget *widget, gpointer user_data);
void view_msg (GtkWidget *widget, gpointer user_data);
-void view_digest (GtkWidget *widget, gpointer user_data);
void view_source (GtkWidget *widget, gpointer user_data);
void next_msg (GtkWidget *widget, gpointer user_data);
void next_unread_msg (GtkWidget *widget, gpointer user_data);
void next_flagged_msg (GtkWidget *widget, gpointer user_data);
-void next_thread (GtkWidget *widget, gpointer user_data);
void previous_msg (GtkWidget *widget, gpointer user_data);
void previous_unread_msg (GtkWidget *widget, gpointer user_data);
void previous_flagged_msg (GtkWidget *widget, gpointer user_data);
@@ -86,21 +81,19 @@ void resend_msg (GtkWidget *widget, gpointer user_data);
void search_msg (GtkWidget *widget, gpointer user_data);
void load_images (GtkWidget *widget, gpointer user_data);
-void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path);
-void move_msg (BonoboUIComponent *uih, void *user_data, const char *path);
-void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path);
-void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
-void select_thread (BonoboUIComponent *uih, void *user_data, const char *path);
-void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path);
-void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
-void flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path);
-void flag_followup_completed (BonoboUIComponent *uih, void *user_data, const char *path);
-void flag_followup_clear (BonoboUIComponent *uih, void *user_data, const char *path);
+void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path);
+void move_msg (BonoboUIComponent *uih, void *user_data, const char *path);
+void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path);
+void add_sender_to_addrbook(BonoboUIComponent *uih, void *user_data, const char *path);
+void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
+void select_thread (BonoboUIComponent *uih, void *user_data, const char *path);
+void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path);
+void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
void zoom_in (BonoboUIComponent *uih, void *user_data, const char *path);
void zoom_out (BonoboUIComponent *uih, void *user_data, const char *path);
@@ -111,6 +104,7 @@ void open_message (BonoboUIComponent *uih, void *user_data, const char
void expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path);
void filter_edit (BonoboUIComponent *uih, void *user_data, const char *path);
void vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path);
+void providers_config (BonoboUIComponent *uih, void *user_data, const char *path);
void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path);
void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path);
@@ -123,7 +117,6 @@ void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const ch
void composer_send_cb (EMsgComposer *composer, gpointer data);
void composer_postpone_cb (EMsgComposer *composer, gpointer data);
-void composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer data);
void forward_messages (CamelFolder *folder, GPtrArray *uids, gboolean inline);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index 3cb1dc9636..aa64ee2e61 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Jeffrey Stedfast <fejj@ximian.com>
- * Radek Doulik <rodo@ximian.com>
*
* Copyright 2001 Ximian, Inc. (www.ximian.com)
*
@@ -69,15 +68,6 @@
#include "Mail.h"
-
-MailConfigLabel label_defaults[5] = {
- { N_("Important"), 0x00ff0000 }, /* red */
- { N_("Work"), 0x00ff8c00 }, /* orange */
- { N_("Personal"), 0x00008b00 }, /* forest green */
- { N_("To Do"), 0x000000ff }, /* blue */
- { N_("Later"), 0x008b008b } /* magenta */
-};
-
typedef struct {
Bonobo_ConfigDatabase db;
@@ -86,7 +76,7 @@ typedef struct {
gboolean show_preview;
gboolean thread_list;
gboolean hide_deleted;
- int paned_size;
+ gint paned_size;
gboolean send_html;
gboolean confirm_unwanted_html;
gboolean citation_highlight;
@@ -94,14 +84,12 @@ typedef struct {
gboolean prompt_empty_subject;
gboolean prompt_only_bcc;
gboolean confirm_expunge;
- gboolean confirm_goto_next_folder;
- gboolean goto_next_folder;
gboolean do_seen_timeout;
- int seen_timeout;
+ gint seen_timeout;
gboolean empty_trash_on_exit;
GSList *accounts;
- int default_account;
+ gint default_account;
GSList *news;
@@ -110,9 +98,7 @@ typedef struct {
MailConfigHTTPMode http_mode;
MailConfigForwardStyle default_forward_style;
- MailConfigReplyStyle default_reply_style;
MailConfigDisplayStyle message_display_style;
- MailConfigXMailerDisplayStyle x_mailer_display_style;
char *default_charset;
GHashTable *threaded_hash;
@@ -120,17 +106,6 @@ typedef struct {
gboolean filter_log;
char *filter_log_path;
-
- MailConfigNewMailNotify notify;
- char *notify_filename;
-
- char *last_filesel_dir;
-
- GList *signature_list;
- int signatures;
- int signatures_random;
-
- MailConfigLabel labels[5];
} MailConfig;
static MailConfig *config = NULL;
@@ -139,36 +114,8 @@ static MailConfig *config = NULL;
/* Prototypes */
static void config_read (void);
-static void mail_config_set_default_account_num (int new_default);
-
-/* signatures */
-MailConfigSignature *
-signature_copy (const MailConfigSignature *sig)
-{
- MailConfigSignature *ns;
-
- g_return_val_if_fail (sig != NULL, NULL);
-
- ns = g_new (MailConfigSignature, 1);
-
- ns->id = sig->id;
- ns->name = g_strdup (sig->name);
- ns->filename = g_strdup (sig->filename);
- ns->script = g_strdup (sig->script);
- ns->random = sig->random;
- ns->html = sig->html;
-
- return ns;
-}
+static void mail_config_set_default_account_num (gint new_default);
-void
-signature_destroy (MailConfigSignature *sig)
-{
- g_free (sig->name);
- g_free (sig->filename);
- g_free (sig->script);
- g_free (sig);
-}
/* Identity */
MailConfigIdentity *
@@ -181,13 +128,11 @@ identity_copy (const MailConfigIdentity *id)
new = g_new0 (MailConfigIdentity, 1);
new->name = g_strdup (id->name);
new->address = g_strdup (id->address);
- new->reply_to = g_strdup (id->reply_to);
new->organization = g_strdup (id->organization);
- new->text_signature = id->text_signature;
- new->text_random = id->text_random;
- new->html_signature = id->html_signature;
- new->html_random = id->html_random;
-
+ new->signature = g_strdup (id->signature);
+ new->html_signature = g_strdup (id->html_signature);
+ new->has_html_signature = id->has_html_signature;
+
return new;
}
@@ -199,8 +144,9 @@ identity_destroy (MailConfigIdentity *id)
g_free (id->name);
g_free (id->address);
- g_free (id->reply_to);
g_free (id->organization);
+ g_free (id->signature);
+ g_free (id->html_signature);
g_free (id);
}
@@ -256,14 +202,11 @@ account_copy (const MailConfigAccount *account)
new->source = service_copy (account->source);
new->transport = service_copy (account->transport);
+ new->drafts_folder_name = g_strdup (account->drafts_folder_name);
new->drafts_folder_uri = g_strdup (account->drafts_folder_uri);
+ new->sent_folder_name = g_strdup (account->sent_folder_name);
new->sent_folder_uri = g_strdup (account->sent_folder_uri);
- new->always_cc = account->always_cc;
- new->cc_addrs = g_strdup (account->cc_addrs);
- new->always_bcc = account->always_bcc;
- new->bcc_addrs = g_strdup (account->bcc_addrs);
-
new->pgp_key = g_strdup (account->pgp_key);
new->pgp_encrypt_to_self = account->pgp_encrypt_to_self;
new->pgp_always_sign = account->pgp_always_sign;
@@ -287,12 +230,11 @@ account_destroy (MailConfigAccount *account)
service_destroy (account->source);
service_destroy (account->transport);
+ g_free (account->drafts_folder_name);
g_free (account->drafts_folder_uri);
+ g_free (account->sent_folder_name);
g_free (account->sent_folder_uri);
- g_free (account->cc_addrs);
- g_free (account->bcc_addrs);
-
g_free (account->pgp_key);
g_free (account->smime_key);
@@ -340,8 +282,6 @@ mail_config_init (void)
void
mail_config_clear (void)
{
- int i;
-
if (!config)
return;
@@ -356,263 +296,14 @@ mail_config_clear (void)
g_slist_free (config->news);
config->news = NULL;
}
-
- g_free (config->pgp_path);
- config->pgp_path = NULL;
-
- g_free (config->default_charset);
- config->default_charset = NULL;
-
- g_free (config->filter_log_path);
- config->filter_log_path = NULL;
-
- g_free (config->notify_filename);
- config->notify_filename = NULL;
-
- g_free (config->last_filesel_dir);
- config->last_filesel_dir = NULL;
-
- for (i = 0; i < 5; i++) {
- g_free (config->labels[i].name);
- config->labels[i].name = NULL;
- }
-}
-
-static MailConfigSignature *
-config_read_signature (gint i)
-{
- MailConfigSignature *sig;
- char *path, *val;
-
- sig = g_new0 (MailConfigSignature, 1);
-
- sig->id = i;
-
- path = g_strdup_printf ("/Mail/Signatures/name_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val)
- sig->name = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/filename_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val)
- sig->filename = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/script_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val)
- sig->script = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/random_%d", i);
- sig->random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/html_%d", i);
- sig->html = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
- g_free (path);
-
- return sig;
-}
-
-static void
-config_read_signatures ()
-{
- MailConfigSignature *sig;
- gint i;
-
- config->signature_list = NULL;
- config->signatures_random = 0;
- config->signatures = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", 0, NULL);
-
- for (i = 0; i < config->signatures; i ++) {
- sig = config_read_signature (i);
- config->signature_list = g_list_append (config->signature_list, sig);
- if (sig->random)
- config->signatures_random ++;
- }
-}
-
-static void
-config_write_signature (MailConfigSignature *sig, gint i)
-{
- char *path;
-
- printf ("config_write_signature i: %d id: %d\n", i, sig->id);
-
- path = g_strdup_printf ("/Mail/Signatures/name_%d", i);
- bonobo_config_set_string (config->db, path, sig->name ? sig->name : "", NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/filename_%d", i);
- bonobo_config_set_string (config->db, path, sig->filename ? sig->filename : "", NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/script_%d", i);
- bonobo_config_set_string (config->db, path, sig->script ? sig->script : "", NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/random_%d", i);
- bonobo_config_set_boolean (config->db, path, sig->random, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/html_%d", i);
- bonobo_config_set_boolean (config->db, path, sig->html, NULL);
- g_free (path);
-}
-
-static void
-config_write_signatures_num ()
-{
- bonobo_config_set_long (config->db, "/Mail/Signatures/num", config->signatures, NULL);
-}
-
-static void
-config_write_signatures ()
-{
- GList *l;
- gint id;
-
- for (id = 0, l = config->signature_list; l; l = l->next, id ++) {
- config_write_signature ((MailConfigSignature *) l->data, id);
- }
-
- config_write_signatures_num ();
-}
-
-static MailConfigSignature *
-lookup_signature (gint i)
-{
- MailConfigSignature *sig;
- GList *l;
-
- if (i == -1)
- return NULL;
-
- for (l = config->signature_list; l; l = l->next) {
- sig = (MailConfigSignature *) l->data;
- if (sig->id == i)
- return sig;
- }
-
- return NULL;
-}
-
-static void
-config_write_imported_signature (gchar *filename, gint i, gboolean html)
-{
- MailConfigSignature *sig = g_new0 (MailConfigSignature, 1);
- gchar *name;
-
- name = strrchr (filename, '/');
- if (!name)
- name = filename;
- else
- name ++;
-
- sig->name = g_strdup (name);
- sig->filename = filename;
- sig->html = html;
-
- config_write_signature (sig, i);
- signature_destroy (sig);
-}
-
-static void
-config_import_old_signatures ()
-{
- gint num;
-
- num = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", -1, NULL);
-
- if (num == -1) {
- /* there are no signatures defined
- * look for old config to create new ones from old ones
- */
-
- GHashTable *cache;
- gint i, accounts;
-
- cache = g_hash_table_new (g_str_hash, g_str_equal);
- accounts = bonobo_config_get_long_with_default (config->db, "/Mail/Accounts/num", 0, NULL);
- num = 0;
- for (i = 0; i < accounts; i ++) {
- gchar *path, *val;
-
- /* read text signature file */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val) {
- gint id;
- gpointer orig_key, node_val;
-
- if (g_hash_table_lookup_extended (cache, val, &orig_key, &node_val)) {
- id = GPOINTER_TO_INT (node_val);
- } else {
- g_hash_table_insert (cache, g_strdup (val), GINT_TO_POINTER (num));
- config_write_imported_signature (val, num, FALSE);
- id = num;
- num ++;
- }
-
- /* set new text signature to this identity */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- bonobo_config_set_long (config->db, path, id, NULL);
- g_free (path);
- } else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i);
- if (bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL)) {
- g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- if (val && *val) {
- gint id;
- gpointer orig_key, node_val;
-
- if (g_hash_table_lookup_extended (cache, val, &orig_key, &node_val)) {
- id = GPOINTER_TO_INT (node_val);
- } else {
- g_hash_table_insert (cache, g_strdup (val), GINT_TO_POINTER (num));
- config_write_imported_signature (val, num, TRUE);
- id = num;
- num ++;
- }
-
- /* set new html signature to this identity */
- g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- bonobo_config_set_long (config->db, path, id, NULL);
- } else
- g_free (val);
- }
- g_free (path);
- }
- bonobo_config_set_long (config->db, "/Mail/Signatures/num", num, NULL);
- g_hash_table_destroy (cache);
- }
}
static void
config_read (void)
{
int len, i, default_num;
- char *path, *val, *p;
mail_config_clear ();
-
- config_import_old_signatures ();
- config_read_signatures ();
len = bonobo_config_get_long_with_default (config->db,
"/Mail/Accounts/num", 0, NULL);
@@ -622,6 +313,7 @@ config_read (void)
MailConfigIdentity *id;
MailConfigService *source;
MailConfigService *transport;
+ char *path, *val;
account = g_new0 (MailConfigAccount, 1);
path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i);
@@ -635,45 +327,35 @@ config_read (void)
config->corrupt = TRUE;
}
- path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->drafts_folder_uri = val;
+ account->drafts_folder_name = val;
else
g_free (val);
- path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->sent_folder_uri = val;
+ account->drafts_folder_uri = val;
else
g_free (val);
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i);
- account->always_cc = bonobo_config_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->cc_addrs = val;
+ account->sent_folder_name = val;
else
g_free (val);
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i);
- account->always_bcc = bonobo_config_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->bcc_addrs = val;
+ account->sent_folder_uri = val;
else
g_free (val);
@@ -725,29 +407,19 @@ config_read (void)
id->address = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_reply_to_%d", i);
- id->reply_to = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
-
path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i);
id->organization = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- /* id signatures */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- id->text_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- id->html_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
+ path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
+ id->signature = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_random_%d", i);
- id->text_random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
+ path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i);
+ id->html_signature = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_random_%d", i);
- id->html_random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
+ path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i);
+ id->has_html_signature = bonobo_config_get_boolean_with_default (
+ config->db, path, FALSE, NULL);
g_free (path);
/* get the source */
@@ -825,14 +497,13 @@ config_read (void)
"/News/Sources/num", 0, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- char *path, *r;
+ gchar *path, *r;
path = g_strdup_printf ("/News/Sources/url_%d", i);
if ((r = bonobo_config_get_string (config->db, path, NULL))) {
n = g_new0 (MailConfigService, 1);
n->url = r;
- n->enabled = TRUE;
config->news = g_slist_append (config->news, n);
}
@@ -879,10 +550,6 @@ config_read (void)
config->paned_size = bonobo_config_get_long_with_default (config->db,
"/Mail/Display/paned_size", 200, NULL);
- /* Goto next folder when user has reached the bottom of the message-list */
- config->goto_next_folder = bonobo_config_get_boolean_with_default (
- config->db, "/Mail/MessageList/goto_next_folder", FALSE, NULL);
-
/* Empty Subject */
config->prompt_empty_subject = bonobo_config_get_boolean_with_default (
config->db, "/Mail/Prompts/empty_subject", TRUE, NULL);
@@ -895,10 +562,6 @@ config_read (void)
config->confirm_expunge = bonobo_config_get_boolean_with_default (
config->db, "/Mail/Prompts/confirm_expunge", TRUE, NULL);
- /* Goto next folder */
- config->confirm_goto_next_folder = bonobo_config_get_boolean_with_default (
- config->db, "/Mail/Prompts/confirm_goto_next_folder", TRUE, NULL);
-
/* PGP/GPG */
config->pgp_path = bonobo_config_get_string (config->db,
"/Mail/PGP/path", NULL);
@@ -915,11 +578,6 @@ config_read (void)
config->db, "/Mail/Format/default_forward_style",
MAIL_CONFIG_FORWARD_ATTACHED, NULL);
- /* Replying */
- config->default_reply_style = bonobo_config_get_long_with_default (
- config->db, "/Mail/Format/default_reply_style",
- MAIL_CONFIG_REPLY_QUOTED, NULL);
-
/* Message Display */
config->message_display_style = bonobo_config_get_long_with_default (
config->db, "/Mail/Format/message_display_style",
@@ -948,87 +606,11 @@ config_read (void)
config->filter_log_path = bonobo_config_get_string (
config->db, "/Mail/Filters/log_path", NULL);
-
- /* New Mail Notification */
- config->notify = bonobo_config_get_long_with_default (
- config->db, "/Mail/Notify/new_mail_notification",
- MAIL_CONFIG_NOTIFY_NOT, NULL);
-
- config->notify_filename = bonobo_config_get_string (
- config->db, "/Mail/Notify/new_mail_notification_sound_file", NULL);
-
- /* X-Mailer header display */
- config->x_mailer_display_style = bonobo_config_get_long_with_default (
- config->db, "/Mail/Display/x_mailer_display_style",
- MAIL_CONFIG_XMAILER_NONE, NULL);
-
- /* last filesel dir */
- config->last_filesel_dir = bonobo_config_get_string (
- config->db, "/Mail/Filesel/last_filesel_dir", NULL);
-
- /* Color labels */
- /* Note: we avoid having to malloc/free 10 times this way... */
- path = g_malloc (sizeof ("/Mail/Labels/") + sizeof ("label_#") + 1);
- strcpy (path, "/Mail/Labels/label_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- val = bonobo_config_get_string (config->db, path, NULL);
- if (!(val && *val)) {
- g_free (val);
- val = NULL;
- }
- config->labels[i].name = val;
- }
- strcpy (path, "/Mail/Labels/color_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- config->labels[i].color = bonobo_config_get_long_with_default (config->db, path,
- label_defaults[i].color, NULL);
- }
- g_free (path);
}
#define bonobo_config_set_string_wrapper(db, path, val, ev) bonobo_config_set_string (db, path, val ? val : "", ev)
void
-mail_config_write_account_sig (MailConfigAccount *account, gint i)
-{
- char *path;
-
- if (i == -1) {
- GSList *link;
-
- link = g_slist_find (config->accounts, account);
- if (!link) {
- g_warning ("Can't find account in accounts list");
- return;
- }
- i = g_slist_position (config->accounts, link);
- }
-
- /* id signatures */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- bonobo_config_set_long (config->db, path, account->id->text_signature
- ? account->id->text_signature->id : -1, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- bonobo_config_set_long (config->db, path, account->id->html_signature
- ? account->id->html_signature->id : -1, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_random_%d", i);
- bonobo_config_set_boolean (config->db, path, account->id->text_random, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_random_%d", i);
- bonobo_config_set_boolean (config->db, path, account->id->html_random, NULL);
- g_free (path);
-}
-
-void
mail_config_write (void)
{
CORBA_Environment ev;
@@ -1046,8 +628,6 @@ mail_config_write (void)
CORBA_exception_init (&ev);
Bonobo_ConfigDatabase_sync (config->db, &ev);
- config_write_signatures ();
-
len = g_slist_length (config->accounts);
bonobo_config_set_long (config->db,
"/Mail/Accounts/num", len, NULL);
@@ -1067,32 +647,24 @@ mail_config_write (void)
bonobo_config_set_string_wrapper (config->db, path, account->name, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->drafts_folder_uri, NULL);
+ account->drafts_folder_name, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->sent_folder_uri, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i);
- bonobo_config_set_boolean (config->db, path, account->always_cc, NULL);
+ account->drafts_folder_uri, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->cc_addrs, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i);
- bonobo_config_set_boolean (config->db, path, account->always_bcc, NULL);
+ account->sent_folder_name, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->bcc_addrs, NULL);
+ account->sent_folder_uri, NULL);
g_free (path);
/* account pgp options */
@@ -1131,15 +703,21 @@ mail_config_write (void)
bonobo_config_set_string_wrapper (config->db, path, account->id->address, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_reply_to_%d", i);
- bonobo_config_set_string_wrapper (config->db, path, account->id->reply_to, NULL);
- g_free (path);
-
path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i);
bonobo_config_set_string_wrapper (config->db, path, account->id->organization, NULL);
g_free (path);
- mail_config_write_account_sig (account, i);
+ path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
+ bonobo_config_set_string_wrapper (config->db, path, account->id->signature, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i);
+ bonobo_config_set_string_wrapper (config->db, path, account->id->html_signature, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i);
+ bonobo_config_set_boolean (config->db, path, account->id->has_html_signature, NULL);
+ g_free (path);
/* source info */
path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i);
@@ -1183,7 +761,7 @@ mail_config_write (void)
bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- char *path;
+ gchar *path;
n = g_slist_nth_data (config->news, i);
@@ -1220,8 +798,6 @@ mail_config_write_on_exit (void)
CORBA_Environment ev;
MailConfigAccount *account;
const GSList *accounts;
- char *path, *p;
- int i;
/* Show Messages Threaded */
bonobo_config_set_boolean (config->db, "/Mail/Display/thread_list",
@@ -1249,7 +825,7 @@ mail_config_write_on_exit (void)
/* Format */
bonobo_config_set_boolean (config->db, "/Mail/Format/send_html",
config->send_html, NULL);
-
+
/* Confirm Sending Unwanted HTML */
bonobo_config_set_boolean (config->db, "/Mail/Format/confirm_unwanted_html",
config->confirm_unwanted_html, NULL);
@@ -1262,10 +838,6 @@ mail_config_write_on_exit (void)
bonobo_config_set_long (config->db, "/Mail/Display/citation_color",
config->citation_color, NULL);
- /* Goto next folder */
- bonobo_config_set_boolean (config->db, "/Mail/MessageList/goto_next_folder",
- config->goto_next_folder, NULL);
-
/* Empty Subject */
bonobo_config_set_boolean (config->db, "/Mail/Prompts/empty_subject",
config->prompt_empty_subject, NULL);
@@ -1278,10 +850,6 @@ mail_config_write_on_exit (void)
bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_expunge",
config->confirm_expunge, NULL);
- /* Goto next folder */
- bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_goto_next_folder",
- config->confirm_goto_next_folder, NULL);
-
/* PGP/GPG */
bonobo_config_set_string_wrapper (config->db, "/Mail/PGP/path",
config->pgp_path, NULL);
@@ -1298,11 +866,6 @@ mail_config_write_on_exit (void)
"/Mail/Format/default_forward_style",
config->default_forward_style, NULL);
- /* Replying */
- bonobo_config_set_long (config->db,
- "/Mail/Format/default_reply_style",
- config->default_reply_style, NULL);
-
/* Message Display */
bonobo_config_set_long (config->db,
"/Mail/Format/message_display_style",
@@ -1322,45 +885,10 @@ mail_config_write_on_exit (void)
bonobo_config_set_string_wrapper (config->db, "/Mail/Filters/log_path",
config->filter_log_path, NULL);
-
- /* New Mail Notification */
- bonobo_config_set_long (config->db, "/Mail/Notify/new_mail_notification",
- config->notify, NULL);
-
- bonobo_config_set_string_wrapper (config->db, "/Mail/Notify/new_mail_notification_sound_file",
- config->notify_filename, NULL);
-
- /* X-Mailer Display */
- bonobo_config_set_long (config->db,
- "/Mail/Display/x_mailer_display_style",
- config->x_mailer_display_style, NULL);
-
- /* last filesel dir */
- bonobo_config_set_string_wrapper (config->db, "/Mail/Filesel/last_filesel_dir",
- config->last_filesel_dir, NULL);
-
- /* Color labels */
- /* Note: we avoid having to malloc/free 10 times this way... */
- path = g_malloc (sizeof ("/Mail/Labels/") + sizeof ("label_#") + 1);
- strcpy (path, "/Mail/Labels/label_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- bonobo_config_set_string_wrapper (config->db, path, config->labels[i].name, NULL);
- }
- strcpy (path, "/Mail/Labels/color_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- bonobo_config_set_long (config->db, path, config->labels[i].color, NULL);
- }
- g_free (path);
-
- /* Message Threading */
+
if (config->threaded_hash)
g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads");
- /* Message Preview */
if (config->preview_hash)
g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview");
@@ -1369,7 +897,7 @@ mail_config_write_on_exit (void)
CORBA_exception_free (&ev);
/* Passwords */
-
+
/* then we make sure the ones we want to remember are in the
session cache */
accounts = mail_config_get_accounts ();
@@ -1390,21 +918,21 @@ mail_config_write_on_exit (void)
g_free (passwd);
}
}
-
+
/* then we clear out our component passwords */
e_passwords_clear_component_passwords ();
-
+
/* then we remember them */
accounts = mail_config_get_accounts ();
for ( ; accounts; accounts = accounts->next) {
account = accounts->data;
if (account->source->save_passwd && account->source->url)
mail_session_remember_password (account->source->url);
-
+
if (account->transport->save_passwd && account->transport->url)
mail_session_remember_password (account->transport->url);
}
-
+
/* now do cleanup */
mail_config_clear ();
}
@@ -1590,22 +1118,6 @@ mail_config_set_filter_log_path (const char *path)
config->filter_log_path = g_strdup (path);
}
-const char *
-mail_config_get_last_filesel_dir (void)
-{
- if (config->last_filesel_dir)
- return config->last_filesel_dir;
- else
- return g_get_home_dir ();
-}
-
-void
-mail_config_set_last_filesel_dir (const char *path)
-{
- g_free (config->last_filesel_dir);
- config->last_filesel_dir = g_strdup (path);
-}
-
gboolean
mail_config_get_hide_deleted (void)
{
@@ -1618,14 +1130,14 @@ mail_config_set_hide_deleted (gboolean value)
config->hide_deleted = value;
}
-int
+gint
mail_config_get_paned_size (void)
{
return config->paned_size;
}
void
-mail_config_set_paned_size (int value)
+mail_config_set_paned_size (gint value)
{
config->paned_size = value;
}
@@ -1690,14 +1202,14 @@ mail_config_set_do_seen_timeout (gboolean do_seen_timeout)
config->do_seen_timeout = do_seen_timeout;
}
-int
+gint
mail_config_get_mark_as_seen_timeout (void)
{
return config->seen_timeout;
}
void
-mail_config_set_mark_as_seen_timeout (int timeout)
+mail_config_set_mark_as_seen_timeout (gint timeout)
{
config->seen_timeout = timeout;
}
@@ -1738,29 +1250,6 @@ mail_config_set_confirm_expunge (gboolean value)
config->confirm_expunge = value;
}
-gboolean
-mail_config_get_confirm_goto_next_folder (void)
-{
- return config->confirm_goto_next_folder;
-}
-
-void
-mail_config_set_confirm_goto_next_folder (gboolean value)
-{
- config->confirm_goto_next_folder = value;
-}
-
-gboolean
-mail_config_get_goto_next_folder (void)
-{
- return config->goto_next_folder;
-}
-
-void
-mail_config_set_goto_next_folder (gboolean value)
-{
- config->goto_next_folder = value;
-}
struct {
char *bin;
@@ -2095,18 +1584,6 @@ mail_config_set_default_forward_style (MailConfigForwardStyle style)
config->default_forward_style = style;
}
-MailConfigReplyStyle
-mail_config_get_default_reply_style (void)
-{
- return config->default_reply_style;
-}
-
-void
-mail_config_set_default_reply_style (MailConfigReplyStyle style)
-{
- config->default_reply_style = style;
-}
-
MailConfigDisplayStyle
mail_config_get_message_display_style (void)
{
@@ -2132,82 +1609,6 @@ mail_config_set_default_charset (const char *charset)
config->default_charset = g_strdup (charset);
}
-MailConfigNewMailNotify
-mail_config_get_new_mail_notify (void)
-{
- return config->notify;
-}
-
-void
-mail_config_set_new_mail_notify (MailConfigNewMailNotify type)
-{
- config->notify = type;
-}
-
-const char *
-mail_config_get_new_mail_notify_sound_file (void)
-{
- return config->notify_filename;
-}
-
-void
-mail_config_set_new_mail_notify_sound_file (const char *filename)
-{
- g_free (config->notify_filename);
- config->notify_filename = g_strdup (filename);
-}
-
-MailConfigXMailerDisplayStyle
-mail_config_get_x_mailer_display_style (void)
-{
- return config->x_mailer_display_style;
-}
-
-void
-mail_config_set_x_mailer_display_style (MailConfigXMailerDisplayStyle style)
-{
- config->x_mailer_display_style = style;
-}
-
-const char *
-mail_config_get_label_name (int label)
-{
- g_return_val_if_fail (label >= 0 && label < 5, NULL);
-
- if (!config->labels[label].name)
- config->labels[label].name = g_strdup (U_(label_defaults[label].name));
-
- return config->labels[label].name;
-}
-
-void
-mail_config_set_label_name (int label, const char *name)
-{
- g_return_if_fail (label >= 0 && label < 5);
-
- if (!name)
- name = U_(label_defaults[label].name);
-
- g_free (config->labels[label].name);
- config->labels[label].name = g_strdup (name);
-}
-
-guint32
-mail_config_get_label_color (int label)
-{
- g_return_val_if_fail (label >= 0 && label < 5, 0);
-
- return config->labels[label].color;
-}
-
-void
-mail_config_set_label_color (int label, guint32 color)
-{
- g_return_if_fail (label >= 0 && label < 5);
-
- config->labels[label].color = color;
-}
-
gboolean
mail_config_find_account (const MailConfigAccount *account)
@@ -2432,8 +1833,8 @@ new_source_created (MailConfigAccount *account)
CamelProvider *prov;
CamelFolder *inbox;
CamelException ex;
- char *name;
- char *url;
+ gchar *name;
+ gchar *url;
/* no source, don't bother. */
if (!account->source || !account->source->url)
@@ -2571,14 +1972,14 @@ mail_config_remove_account (MailConfigAccount *account)
return config->accounts;
}
-int
+gint
mail_config_get_default_account_num (void)
{
return config->default_account;
}
static void
-mail_config_set_default_account_num (int new_default)
+mail_config_set_default_account_num (gint new_default)
{
config->default_account = new_default;
}
@@ -2677,25 +2078,17 @@ mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_p
}
char *
-mail_config_folder_to_safe_url (CamelFolder *folder)
+mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
{
CamelService *service = CAMEL_SERVICE (folder->parent_store);
- char *service_url, *url;
+ char *service_url, *url, *filename;
service_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL);
url = g_strdup_printf ("%s/%s", service_url, folder->full_name);
g_free (service_url);
e_filename_make_safe (url);
- return url;
-}
-
-char *
-mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
-{
- char *url, *filename;
- url = mail_config_folder_to_safe_url (folder);
filename = g_strdup_printf ("%s/config/%s%s", evolution_dir, prefix, url);
g_free (url);
@@ -2793,7 +2186,7 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth
id = m->msg.seq;
e_thread_put(mail_thread_queued, (EMsg *)m);
-
+
dialog = gnome_dialog_new (_("Connecting to server..."),
GNOME_STOCK_BUTTON_CANCEL,
NULL);
@@ -2808,9 +2201,9 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth
GTK_SIGNAL_FUNC (check_cancelled), &id);
gtk_window_set_modal (GTK_WINDOW (dialog), FALSE);
gtk_widget_show_all (dialog);
-
+
mail_msg_wait(id);
-
+
gtk_widget_destroy (dialog);
dialog = NULL;
@@ -2859,8 +2252,10 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_id = g_new0 (MailConfigIdentity, 1);
mail_id->name = g_strdup (id.name);
mail_id->address = g_strdup (id.address);
- mail_id->reply_to = g_strdup (id.reply_to);
mail_id->organization = g_strdup (id.organization);
+ mail_id->signature = g_strdup (id.signature);
+ mail_id->html_signature = g_strdup (id.html_signature);
+ mail_id->has_html_signature = id.has_html_signature;
mail_account->id = mail_id;
@@ -2946,246 +2341,3 @@ evolution_mail_config_factory_init (void)
bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
return TRUE;
}
-
-GList *
-mail_config_get_signature_list (void)
-{
- return config->signature_list;
-}
-
-static gchar *
-get_new_signature_filename ()
-{
- struct stat st_buf;
- gchar *filename;
- gint i;
-
- filename = g_strconcat (evolution_dir, "/signatures", NULL);
- if (lstat (filename, &st_buf)) {
- if (errno == ENOENT) {
- if (mkdir (filename, 0700))
- g_warning ("Fatal problem creating %s/signatures directory.", evolution_dir);
- } else
- g_warning ("Fatal problem with %s/signatures directory.", evolution_dir);
- }
- g_free (filename);
-
- for (i = 0; ; i ++) {
- filename = g_strdup_printf ("%s/signatures/signature-%d", evolution_dir, i);
- if (lstat (filename, &st_buf) == - 1 && errno == ENOENT) {
- gint fd;
-
- fd = creat (filename, 0600);
- if (fd >= 0) {
- close (fd);
- return filename;
- }
- }
- g_free (filename);
- }
-
- return NULL;
-}
-
-MailConfigSignature *
-mail_config_signature_add (gboolean html)
-{
- MailConfigSignature *sig;
-
- sig = g_new0 (MailConfigSignature, 1);
-
- /* printf ("mail_config_signature_add %d\n", config->signatures); */
- sig->id = config->signatures;
- sig->name = g_strdup (_("Unnamed"));
- sig->filename = get_new_signature_filename ();
- sig->html = html;
-
- config->signature_list = g_list_append (config->signature_list, sig);
- config->signatures ++;
-
- config_write_signature (sig, sig->id);
- config_write_signatures_num ();
-
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_ADDED, sig);
- /* printf ("mail_config_signature_add end\n"); */
-
- return sig;
-}
-
-static void
-delete_unused_signature_file (const gchar *filename)
-{
- gint len;
- gchar *signatures_dir;
-
- signatures_dir = g_strconcat (evolution_dir, "/signatures", NULL);
-
- /* remove signature file if it's in evolution dir and no other signature uses it */
- len = strlen (signatures_dir);
- if (filename && !strncmp (filename, signatures_dir, len)) {
- GList *l;
- gboolean only_one = TRUE;
-
- for (l = config->signature_list; l; l = l->next) {
- if (((MailConfigSignature *)l->data)->filename
- && !strcmp (filename, ((MailConfigSignature *)l->data)->filename)) {
- only_one = FALSE;
- break;
- }
- }
-
- if (only_one) {
- unlink (filename);
- }
- }
-
- g_free (signatures_dir);
-}
-
-void
-mail_config_signature_delete (MailConfigSignature *sig)
-{
- GList *l, *next;
- GSList *al;
- gboolean after = FALSE;
-
- for (al = config->accounts; al; al = al->next) {
- MailConfigAccount *account;
-
- account = (MailConfigAccount *) al->data;
-
- if (account->id->text_signature == sig)
- account->id->text_signature = NULL;
- if (account->id->html_signature == sig)
- account->id->html_signature = NULL;
- }
-
- for (l = config->signature_list; l; l = next) {
- next = l->next;
- if (after)
- ((MailConfigSignature *) l->data)->id --;
- else if (l->data == sig) {
- config->signature_list = g_list_remove_link (config->signature_list, l);
- after = TRUE;
- config->signatures --;
- if (sig->random)
- config->signatures_random --;
- }
- }
-
- config_write_signatures ();
- delete_unused_signature_file (sig->filename);
- /* printf ("signatures: %d\n", config->signatures); */
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_DELETED, sig);
- signature_destroy (sig);
-}
-
-void
-mail_config_signature_write (MailConfigSignature *sig)
-{
- config_write_signature (sig, sig->id);
-}
-
-void
-mail_config_signature_set_filename (MailConfigSignature *sig, const gchar *filename)
-{
- gchar *old_filename = sig->filename;
-
- sig->filename = g_strdup (filename);
- if (old_filename) {
- delete_unused_signature_file (old_filename);
- g_free (old_filename);
- }
- mail_config_signature_write (sig);
-}
-
-void
-mail_config_signature_set_name (MailConfigSignature *sig, const gchar *name)
-{
- g_free (sig->name);
- sig->name = g_strdup (name);
-
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_NAME_CHANGED, sig);
-}
-
-void
-mail_config_signature_set_random (MailConfigSignature *sig, gboolean random)
-{
- if (random != sig->random) {
- if (random && !sig->random) {
- config->signatures_random ++;
- if (config->signatures_random == 1)
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_ON, sig);
- } else if (!random && sig->random) {
- config->signatures_random --;
- if (config->signatures_random == 0)
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_OFF, sig);
- }
- sig->random = random;
- mail_config_signature_write (sig);
- }
-}
-
-gint
-mail_config_get_signatures_random (void)
-{
- return config->signatures_random;
-}
-
-static GList *clients = NULL;
-
-void
-mail_config_signature_register_client (MailConfigSignatureClient client, gpointer data)
-{
- clients = g_list_append (clients, client);
- clients = g_list_append (clients, data);
-}
-
-void
-mail_config_signature_unregister_client (MailConfigSignatureClient client, gpointer data)
-{
- GList *link;
-
- link = g_list_find (clients, data);
- clients = g_list_remove_link (clients, link->prev);
- clients = g_list_remove_link (clients, link);
-}
-
-void
-mail_config_signature_emit_event (MailConfigSigEvent event, MailConfigSignature *sig)
-{
- GList *l, *next;
-
- for (l = clients; l; l = next) {
- next = l->next->next;
- (*((MailConfigSignatureClient) l->data)) (event, sig, l->next->data);
- }
-}
-
-void
-mail_config_signature_run_script (gchar *script)
-{
- if (script) {
- gchar *argv[2];
- gint pid, status;
-
- printf ("running script %s\n", script);
- argv [0] = script;
- argv [1] = NULL;
- pid = gnome_execute_async (NULL, 1, argv);
- if (pid < 0)
- gnome_error_dialog (_("Cannot execute signature script"));
- else
- waitpid (pid, &status, 0);
- }
-}
-
-void
-mail_config_signature_set_html (MailConfigSignature *sig, gboolean html)
-{
- if (sig->html != html) {
- sig->html = html;
- mail_config_signature_write (sig);
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_HTML_CHANGED, sig);
- }
-}
diff --git a/mail/mail-display.c b/mail/mail-display.c
index a1c3e04ed7..e979ae8878 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -29,11 +29,9 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
#include <gal/util/e-util.h>
-#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-unicode.h>
#include <gtk/gtkinvisible.h>
-#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <gtkhtml/htmlengine.h> /* XXX */
#include <gtkhtml/htmlobject.h> /* XXX */
@@ -48,9 +46,6 @@
#include "e-searching-tokenizer.h"
#include "folder-browser-factory.h"
#include "mail-stream-gtkhtml.h"
-#include "message-tag-followup.h"
-#include "folder-browser-window.h"
-#include "folder-browser.h"
#include "mail-display.h"
#include "mail-config.h"
#include "mail-ops.h"
@@ -76,18 +71,7 @@ struct _PixbufLoader {
};
static GHashTable *thumbnail_cache = NULL;
-/* Drag & Drop types */
-#define TEXT_URI_LIST_TYPE "text/uri-list"
-
-enum DndTargetType {
- DND_TARGET_TYPE_TEXT_URI_LIST,
-};
-
-static GtkTargetEntry drag_types[] = {
- { TEXT_URI_LIST_TYPE, 0, DND_TARGET_TYPE_TEXT_URI_LIST },
-};
-
-static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
+static gchar *save_pathname = NULL; /* preserves last directory in save dialog */
/*----------------------------------------------------------------------*
* Callbacks
@@ -142,7 +126,7 @@ make_safe_filename (const char *prefix,CamelMimePart *part)
{
const char *name = NULL;
char *safe, *p;
-
+
if (part) {
name = camel_mime_part_get_filename (part);
}
@@ -151,7 +135,7 @@ make_safe_filename (const char *prefix,CamelMimePart *part)
/* This is a filename. Translators take note. */
name = _("attachment");
}
-
+
p = strrchr (name, '/');
if (p)
safe = g_strdup_printf ("%s%s", prefix, p);
@@ -170,18 +154,24 @@ save_data_cb (GtkWidget *widget, gpointer user_data)
{
GtkFileSelection *file_select = (GtkFileSelection *)
gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION);
- char *dir;
-
+ gchar *p;
+
/* uh, this doesn't really feel right, but i dont know what to do better */
gtk_widget_hide (GTK_WIDGET (file_select));
- write_data_to_file (user_data, gtk_file_selection_get_filename (file_select),
+ write_data_to_file (user_data,
+ gtk_file_selection_get_filename (file_select),
FALSE);
-
+
/* preserve the pathname */
- dir = g_dirname (gtk_file_selection_get_filename (file_select));
- mail_config_set_last_filesel_dir (dir);
- g_free (dir);
-
+ g_free(save_pathname);
+ save_pathname = g_strdup(gtk_file_selection_get_filename(file_select));
+ if((p = strrchr(save_pathname, '/')) != NULL)
+ p[0] = 0;
+ else {
+ g_free(save_pathname);
+ save_pathname = NULL;
+ }
+
gtk_widget_destroy (GTK_WIDGET (file_select));
}
@@ -222,46 +212,17 @@ mail_display_jump_to_anchor (MailDisplay *md, const char *url)
}
static void
-mail_display_digest_clicked (MailDisplay *md, const char *url)
-{
- FolderBrowser *fb, *parent_fb;
- CamelFolder *digest;
- CamelStore *store;
- GtkWidget *window;
-
- parent_fb = (FolderBrowser *) gtk_widget_get_ancestor (GTK_WIDGET (md), FOLDER_BROWSER_TYPE);
-
- store = camel_digest_store_new (url);
-
- digest = camel_digest_folder_new (store, md->current_message);
- camel_object_unref (CAMEL_OBJECT (store));
- if (!digest)
- return;
-
- fb = (FolderBrowser *) folder_browser_new (parent_fb->shell, NULL);
- folder_browser_set_message_preview (fb, TRUE);
- folder_browser_set_folder (fb, digest, url);
- camel_object_unref (CAMEL_OBJECT (digest));
- gtk_widget_show (GTK_WIDGET (fb));
-
- window = folder_browser_window_new (fb);
- gtk_widget_show (window);
-}
-
-static void
on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md)
{
- if (!g_strncasecmp (url, "news:", 5) || !g_strncasecmp (url, "nntp:", 5)) {
+ if (!g_strncasecmp (url, "news:", 5) ||
+ !g_strncasecmp (url, "nntp:", 5))
g_warning ("Can't handle news URLs yet.");
- } else if (!g_strncasecmp (url, "mailto:", 7)) {
+ else if (!g_strncasecmp (url, "mailto:", 7))
send_to_url (url);
- } else if (!g_strncasecmp (url, "digest:", 7)) {
- mail_display_digest_clicked (md, url);
- } else if (*url == '#') {
+ else if (*url == '#')
mail_display_jump_to_anchor (md, url);
- } else {
+ else
gnome_url_show (url);
- }
}
static void
@@ -273,7 +234,10 @@ save_part (CamelMimePart *part)
g_return_if_fail (part != NULL);
camel_object_ref (CAMEL_OBJECT (part));
- filename = make_safe_filename (mail_config_get_last_filesel_dir (), part);
+ if (save_pathname == NULL)
+ save_pathname = g_strdup (g_get_home_dir ());
+
+ filename = make_safe_filename (save_pathname, part);
file_select = GTK_FILE_SELECTION (
gtk_file_selection_new (_("Save Attachment")));
@@ -299,7 +263,7 @@ static void
save_cb (GtkWidget *widget, gpointer user_data)
{
CamelMimePart *part = gtk_object_get_data (GTK_OBJECT (user_data), "CamelMimePart");
-
+
save_part (part);
}
@@ -331,7 +295,8 @@ launch_cb (GtkWidget *widget, gpointer user_data)
tmpdir = e_mkdtemp ("evolution.XXXXXX");
if (!tmpdir) {
- char *msg = g_strdup_printf (_("Could not create temporary directory: %s"),
+ char *msg = g_strdup_printf (_("Could not create temporary "
+ "directory: %s"),
g_strerror (errno));
gnome_error_dialog (msg);
g_free (msg);
@@ -341,21 +306,16 @@ launch_cb (GtkWidget *widget, gpointer user_data)
filename = make_safe_filename (tmpdir, part);
if (!write_data_to_file (part, filename, TRUE)) {
- char *msg = g_strdup_printf (_("Could not create temporary file '%s': %s"),
- filename, g_strerror (errno));
- gnome_error_dialog (msg);
g_free (filename);
- g_free (msg);
return;
}
command = g_strdup_printf ("%s %s%s &", app->command,
app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS ? "file://" : "",
filename);
- g_free (filename);
-
system (command);
g_free (command);
+ g_free (filename);
}
static void
@@ -387,14 +347,17 @@ static gboolean
pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
{
EPopupMenu *menu;
- EPopupMenu save_item = E_POPUP_ITEM (N_("Save to Disk..."), GTK_SIGNAL_FUNC (save_cb), 0);
- EPopupMenu view_item = E_POPUP_ITEM (N_("View Inline"), GTK_SIGNAL_FUNC (inline_cb), 2);
- EPopupMenu open_item = E_POPUP_ITEM (N_("Open in %s..."), GTK_SIGNAL_FUNC (launch_cb), 1);
+ EPopupMenu save_item = { N_("Save to Disk..."), NULL,
+ GTK_SIGNAL_FUNC (save_cb), NULL, 0 };
+ EPopupMenu view_item = { N_("View Inline"), NULL,
+ GTK_SIGNAL_FUNC (inline_cb), NULL, 2 };
+ EPopupMenu open_item = { N_("Open in %s..."), NULL,
+ GTK_SIGNAL_FUNC (launch_cb), NULL, 1 };
MailDisplay *md;
CamelMimePart *part;
MailMimeHandler *handler;
int mask = 0, i, nitems;
-
+
#ifdef USE_OLD_DISPLAY_STYLE
if (event->button != 3) {
gtk_propagate_event (GTK_WIDGET (user_data),
@@ -402,27 +365,27 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
return TRUE;
}
#endif
-
+
if (event->button != 1 && event->button != 3) {
gtk_propagate_event (GTK_WIDGET (user_data),
(GdkEvent *)event);
return TRUE;
}
-
+
/* Stop the signal, since we don't want the button's class method to
mess up our popup. */
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
-
+
part = gtk_object_get_data (GTK_OBJECT (widget), "CamelMimePart");
handler = mail_lookup_handler (gtk_object_get_data (GTK_OBJECT (widget),
"mime_type"));
-
+
if (handler && handler->applications)
nitems = g_list_length (handler->applications) + 2;
else
nitems = 3;
menu = g_new0 (EPopupMenu, nitems + 1);
-
+
/* Save item */
memcpy (&menu[0], &save_item, sizeof (menu[0]));
menu[0].name = _(menu[0].name);
@@ -621,7 +584,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png");
} else
pixbuf = gdk_pixbuf_loader_get_pixbuf (pbl->loader);
-
+
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
@@ -798,7 +761,7 @@ save_url (MailDisplay *md, const char *url)
g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL);
data = camel_medium_get_content_object ((CamelMedium *)part);
- if (!mail_content_loaded (data, md, TRUE, NULL, NULL, NULL)) {
+ if (!mail_content_loaded (data, md, TRUE, NULL, NULL)) {
return NULL;
}
@@ -811,75 +774,6 @@ save_url (MailDisplay *md, const char *url)
return NULL;
}
-static void
-drag_data_get_cb (GtkWidget *widget,
- GdkDragContext *drag_context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer user_data)
-{
- CamelMimePart *part = user_data;
- const char *filename, *tmpdir;
- char *uri_list;
-
- switch (info) {
- case DND_TARGET_TYPE_TEXT_URI_LIST:
- /* Kludge around Nautilus requesting the same data many times */
- uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list");
- if (uri_list) {
- gtk_selection_data_set (selection_data, selection_data->target, 8,
- uri_list, strlen (uri_list));
- return;
- }
-
- tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX");
- if (!tmpdir) {
- char *msg;
-
- msg = g_strdup_printf (_("Could not create temporary directory: %s"),
- g_strerror (errno));
- gnome_error_dialog (msg);
- g_free (msg);
- }
-
- filename = camel_mime_part_get_filename (part);
- if (!filename)
- filename = _("Unknown");
-
- uri_list = g_strdup_printf ("file://%s/%s", tmpdir, filename);
-
- if (!write_data_to_file (part, uri_list + 7, TRUE)) {
- g_free (uri_list);
- return;
- }
-
- gtk_selection_data_set (selection_data, selection_data->target, 8,
- uri_list, strlen (uri_list));
-
- gtk_object_set_data_full (GTK_OBJECT (widget), "uri-list", uri_list, g_free);
-
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-drag_data_delete_cb (GtkWidget *widget,
- GdkDragContext *drag_context,
- gpointer user_data)
-{
- char *uri_list;
-
- uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list");
- if (uri_list) {
- gtk_object_set_data (GTK_OBJECT (widget), "uri-list", NULL);
- unlink (uri_list + 7);
- g_free (uri_list);
- }
-}
-
static gboolean
do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
CamelMimePart *part, MailDisplay *md)
@@ -887,11 +781,11 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
GtkWidget *button, *mainbox, *hbox, *arrow, *popup;
MailMimeHandler *handler;
struct _PixbufLoader *pbl;
-
+
pbl = g_new0 (struct _PixbufLoader, 1);
if (g_strncasecmp (eb->type, "image/", 6) == 0) {
CamelDataWrapper *content;
-
+
content = camel_medium_get_content_object (CAMEL_MEDIUM (part));
if (!camel_data_wrapper_is_offline (content)) {
pbl->mstream = camel_stream_mem_new ();
@@ -906,65 +800,54 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
pbl->eb = eb;
pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy",
embeddable_destroy_cb, pbl);
-
+
g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle,
pbl, NULL);
-
+
mainbox = gtk_hbox_new (FALSE, 0);
-
+
button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md);
-
+
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (button_press), part);
-
- handler = mail_lookup_handler (eb->type);
- if (handler && handler->builtin)
- gtk_widget_set_sensitive (button, TRUE);
- else
- gtk_widget_set_sensitive (button, FALSE);
-
- /* Drag & Drop */
- gtk_drag_source_set (button, GDK_BUTTON1_MASK,
- drag_types, num_drag_types,
- GDK_ACTION_MOVE);
- gtk_signal_connect (GTK_OBJECT (button), "drag-data-get",
- drag_data_get_cb, part);
- gtk_signal_connect (GTK_OBJECT (button), "drag-data-delete",
- drag_data_delete_cb, part);
-
+
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
-
- if (handler && mail_part_is_displayed_inline (part, md))
+
+ if (mail_part_is_displayed_inline (part, md))
arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_DOWN);
else
arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_FORWARD);
gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pbl->pixmap, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button), hbox);
-
+
popup = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (popup, GTK_CAN_FOCUS);
gtk_container_add (GTK_CONTAINER (popup),
gtk_arrow_new (GTK_ARROW_DOWN,
GTK_SHADOW_ETCHED_IN));
-
+
gtk_object_set_data (GTK_OBJECT (popup), "MailDisplay", md);
gtk_object_set_data (GTK_OBJECT (popup), "CamelMimePart", part);
gtk_object_set_data_full (GTK_OBJECT (popup), "mime_type",
g_strdup (eb->type), (GDestroyNotify)g_free);
-
+
gtk_signal_connect (GTK_OBJECT (popup), "button_press_event",
GTK_SIGNAL_FUNC (pixmap_press), md->scroll);
-
+
gtk_box_pack_start (GTK_BOX (mainbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (mainbox), popup, TRUE, TRUE, 0);
gtk_widget_show_all (mainbox);
-
+
+ handler = mail_lookup_handler (eb->type);
+ if (handler && handler->builtin)
+ gtk_widget_set_sensitive (button, TRUE);
+ else
+ gtk_widget_set_sensitive (button, FALSE);
+
gtk_container_add (GTK_CONTAINER (eb), mainbox);
-
+
return TRUE;
}
@@ -1052,7 +935,6 @@ do_signature (GtkHTML *html, GtkHTMLEmbedded *eb,
pbl, NULL);
button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (button_press), part);
@@ -1076,7 +958,7 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
urls = g_datalist_get_data (md->data, "part_urls");
if (!urls)
return FALSE;
-
+
if (!strncmp (eb->classid, "popup:", 6) && eb->type) {
part = g_hash_table_lookup (urls, eb->classid + 6);
if (!CAMEL_IS_MIME_PART (part))
@@ -1104,11 +986,9 @@ load_http (MailDisplay *md, gpointer data)
GHashTable *urls;
GnomeVFSHandle *handle;
GnomeVFSFileSize read;
- GnomeVFSResult result;
GByteArray *ba;
char buf[8192];
- size_t total = 0;
-
+
urls = g_datalist_get_data (md->data, "data_urls");
ba = g_hash_table_lookup (urls, url);
g_return_if_fail (ba != NULL);
@@ -1121,15 +1001,10 @@ load_http (MailDisplay *md, gpointer data)
return;
}
- while ((result = gnome_vfs_read (handle, buf, sizeof (buf), &read)) == GNOME_VFS_OK) {
- printf ("%s: read %d bytes\n", url, (int) read);
+ while (gnome_vfs_read (handle, buf, sizeof (buf), &read) == GNOME_VFS_OK)
g_byte_array_append (ba, buf, read);
- total += read;
- }
gnome_vfs_close (handle);
-
- printf ("gnome_vfs_read result is %d; read %d total bytes\n", result, total);
-
+
#if 0
if (!ba->len)
printf ("no data in %s\n", url);
@@ -1176,11 +1051,8 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- if (md->related)
- g_hash_table_remove(md->related, medium);
-
data = camel_medium_get_content_object (medium);
- if (!mail_content_loaded (data, md, FALSE, url, html, handle))
+ if (!mail_content_loaded (data, md, FALSE, url, handle))
return;
content_type = camel_data_wrapper_get_mime_type_field (data);
@@ -1203,7 +1075,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
return;
}
-
+
urls = g_datalist_get_data (md->data, "data_urls");
g_return_if_fail (urls != NULL);
@@ -1219,23 +1091,23 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
return;
}
-
+
/* See if it's something we can load. */
if (strncmp (url, "http:", 5) == 0) {
if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS ||
g_datalist_get_data (md->data, "load_images")) {
ba = g_byte_array_new ();
g_hash_table_insert (urls, g_strdup (url), ba);
- mail_display_stream_write_when_loaded (md, ba, url, load_http, html, handle,
+ mail_display_stream_write_when_loaded (md, ba, url, load_http, handle,
g_strdup (url));
} else if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES &&
!g_datalist_get_data (md->data, "checking_from")) {
const CamelInternetAddress *from = camel_mime_message_get_from (md->current_message);
const char *name, *addr;
-
+
g_datalist_set_data (md->data, "checking_from",
GINT_TO_POINTER (1));
-
+
/* Make sure we aren't deal w/ some sort of a pathological message w/o a From: header */
if (from != NULL && camel_internet_address_get (from, 0, &name, &addr))
e_book_query_address_locally (addr, ebook_callback, md);
@@ -1249,11 +1121,10 @@ struct _load_content_msg {
struct _mail_msg msg;
MailDisplay *display;
- GtkHTML *html;
GtkHTMLStream *handle;
- int redisplay_counter;
- char *url;
+ gint redisplay_counter;
+ gchar *url;
CamelMimeMessage *message;
void (*callback)(MailDisplay *, gpointer);
gpointer data;
@@ -1291,16 +1162,16 @@ try_part_urls (struct _load_content_msg *m)
g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), FALSE);
data = camel_medium_get_content_object (medium);
- if (!mail_content_loaded (data, m->display, FALSE, m->url, m->html, m->handle)) {
+ if (!mail_content_loaded (data, m->display, FALSE, m->url, m->handle)) {
g_warning ("This code should not be reached\n");
return TRUE;
}
- html_stream = mail_stream_gtkhtml_new (m->html, m->handle);
+ html_stream = mail_stream_gtkhtml_new (m->display->html, m->handle);
camel_data_wrapper_write_to_stream (data, html_stream);
camel_object_unref (CAMEL_OBJECT (html_stream));
- gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1320,9 +1191,9 @@ try_data_urls (struct _load_content_msg *m)
if (ba) {
if (ba->len) {
printf ("writing ...\n");
- gtk_html_write (m->html, m->handle, ba->data, ba->len);
+ gtk_html_write (m->display->html, m->handle, ba->data, ba->len);
}
- gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1344,7 +1215,7 @@ load_content_loaded (struct _mail_msg *mm)
m->display->redisplay_counter);
if (m->redisplay_counter == m->display->redisplay_counter) {
if (!try_part_urls (m) && !try_data_urls (m))
- gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_ERROR);
+ gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_ERROR);
}
} else
mail_display_redisplay (m->display, FALSE);
@@ -1357,7 +1228,6 @@ load_content_free (struct _mail_msg *mm)
struct _load_content_msg *m = (struct _load_content_msg *)mm;
g_free (m->url);
- gtk_object_unref (GTK_OBJECT (m->html));
gtk_object_unref (GTK_OBJECT (m->display));
camel_object_unref (CAMEL_OBJECT (m->message));
}
@@ -1371,7 +1241,6 @@ static struct _mail_msg_op load_content_op = {
static void
stream_write_or_redisplay_when_loaded (MailDisplay *md,
- GtkHTML *html,
gconstpointer key,
const gchar *url,
void (*callback)(MailDisplay *, gpointer),
@@ -1398,8 +1267,6 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
m = mail_msg_new (&load_content_op, NULL, sizeof (*m));
m->display = md;
gtk_object_ref (GTK_OBJECT (m->display));
- m->html = html;
- gtk_object_ref (GTK_OBJECT (html));
m->handle = handle;
m->url = g_strdup (url);
m->redisplay_counter = md->redisplay_counter;
@@ -1415,40 +1282,34 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
void
mail_display_stream_write_when_loaded (MailDisplay *md,
gconstpointer key,
- const char *url,
+ const gchar *url,
void (*callback)(MailDisplay *, gpointer),
- GtkHTML *html,
GtkHTMLStream *handle,
gpointer data)
{
- stream_write_or_redisplay_when_loaded (md, html, key, url, callback, handle, data);
+ stream_write_or_redisplay_when_loaded (md, key, url, callback, handle, data);
}
void
mail_display_redisplay_when_loaded (MailDisplay *md,
gconstpointer key,
void (*callback)(MailDisplay *, gpointer),
- GtkHTML *html,
gpointer data)
{
- stream_write_or_redisplay_when_loaded (md, html, key, NULL, callback, NULL, data);
+ stream_write_or_redisplay_when_loaded (md, key, NULL, callback, NULL, data);
}
void
-mail_text_write (GtkHTML *html, GtkHTMLStream *stream, gboolean printing, const char *text)
+mail_text_write (GtkHTML *html, GtkHTMLStream *stream, const char *text)
{
- guint flags;
char *htmltext;
- flags = E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_SPACES;
-
- if (!printing)
- flags |= E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_CONVERT_ADDRESSES;
-
- if (mail_config_get_citation_highlight () && ! printing)
- flags |= E_TEXT_TO_HTML_MARK_CITATION;
-
- htmltext = e_text_to_html_full (text, flags, mail_config_get_citation_color ());
+ htmltext = e_text_to_html_full (text, E_TEXT_TO_HTML_CONVERT_URLS |
+ E_TEXT_TO_HTML_CONVERT_ADDRESSES |
+ E_TEXT_TO_HTML_CONVERT_NL |
+ E_TEXT_TO_HTML_CONVERT_SPACES |
+ (mail_config_get_citation_highlight () ? E_TEXT_TO_HTML_MARK_CITATION : 0),
+ mail_config_get_citation_color ());
gtk_html_write (html, stream, "<tt>", 4);
gtk_html_write (html, stream, htmltext, strlen (htmltext));
@@ -1481,114 +1342,19 @@ static void
clear_data (CamelObject *object, gpointer event_data, gpointer user_data)
{
GData *data = user_data;
-
- g_datalist_clear (&data);
-}
-
-#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
-
-void
-mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll)
-{
- GtkHTMLStream *stream;
- char bgcolor[7], fontcolor[7];
- GtkStyle *style = NULL;
-
- g_return_if_fail (IS_MAIL_DISPLAY (md));
- g_return_if_fail (GTK_IS_HTML (html));
-
- stream = gtk_html_begin (html);
- if (!reset_scroll) {
- /* This is a hack until there's a clean way to do this. */
- GTK_HTML (md->html)->engine->newPage = FALSE;
- }
-
- mail_html_write (html, stream,
- "<!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");
- mail_html_write (html, stream, "<body marginwidth=0 marginheight=0>\n");
-
- if (md->followup) {
- const char *overdue;
- char due_date[100];
- struct tm due;
- time_t now;
-
- /* my favorite thing to do... muck around with colors so we respect people's stupid themes. */
- style = gtk_widget_get_style (GTK_WIDGET (html));
- if (style && !md->printing) {
- int state = GTK_WIDGET_STATE (GTK_WIDGET (html));
- gushort r, g, b;
-
- r = style->base[state].red / 256;
- g = style->base[state].green / 256;
- b = style->base[state].blue / 256;
-
- if (COLOR_IS_LIGHT (r, g, b)) {
- r *= 1.0;
- g *= 0.97;
- b *= 0.75;
- } else {
- r = 255 - (1.0 * (255 - r));
- g = 255 - (0.97 * (255 - g));
- b = 255 - (0.75 * (255 - b));
- }
-
- sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b);
-
- r = style->text[state].red / 256;
- g = style->text[state].green / 256;
- b = style->text[state].blue / 256;
-
- sprintf (fontcolor, "%.2X%.2X%.2X", r, g, b);
- } else {
- strcpy (bgcolor, "EEEEEE");
- strcpy (fontcolor, "000000");
- }
-
- now = time (NULL);
- if (now >= md->followup->target_date)
- overdue = U_("<b>Overdue:</b>&nbsp;");
- else
- overdue = "";
-
- /* copy the due date into 'now' because localtime_r destroys the time_t value */
- now = md->followup->target_date;
- localtime_r (&now, &due);
-
- e_strftime (due_date, 100, "%B %d, %Y, %l:%M %P", &due);
-
- gtk_html_stream_printf (stream, "<font color=\"#%s\">"
- "<table cellspacing=1 cellpadding=1 bgcolor=\"#000000\"><tr><td>"
- "<table cellspacing=0 bgcolor=\"#%s\" cellpadding=2 cellspacing=2>"
- "<tr><td align=\"left\" width=20><img src=\"%s\" align=\"middle\"></td>"
- "<td>%s%s by %s</td></table></td></tr></table></font>", fontcolor, bgcolor,
- mail_display_get_url_for_icon (md, EVOLUTION_IMAGES "/flag-for-followup-16.png"),
- overdue, message_tag_followup_i18n_name (md->followup->type), due_date);
- }
-
- if (md->current_message) {
- if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
- mail_format_raw_message (md->current_message, md, html, stream);
- else
- mail_format_mime_message (md->current_message, md, html, stream);
- }
-
- mail_html_write (html, stream, "</body></html>\n");
- gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
+ g_datalist_clear (&data);
}
/**
* mail_display_redisplay:
* @mail_display: the mail display object
- * @reset_scroll: specifies whether or not to reset current scroll
+ * @unscroll: specifies whether or not to lose current scroll
*
* Force a redraw of the message display.
**/
void
-mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
+mail_display_redisplay (MailDisplay *md, gboolean unscroll)
{
if (GTK_OBJECT_DESTROYED (md))
return;
@@ -1597,7 +1363,25 @@ mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
md->redisplay_counter++;
/* printf ("md %p redisplay %d\n", md, md->redisplay_counter); */
- mail_display_render (md, md->html, reset_scroll);
+ md->stream = gtk_html_begin (GTK_HTML (md->html));
+ if (!unscroll) {
+ /* This is a hack until there's a clean way to do this. */
+ GTK_HTML (md->html)->engine->newPage = FALSE;
+ }
+
+ mail_html_write (md->html, md->stream, "<!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");
+ mail_html_write (md->html, md->stream, "<body marginwidth=0 marginheight=0>\n");
+
+ if (md->current_message) {
+ if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
+ mail_format_raw_message (md->current_message, md);
+ else
+ mail_format_mime_message (md->current_message, md);
+ }
+
+ mail_html_write (md->html, md->stream, "</body></html>\n");
+ gtk_html_end (md->html, md->stream, GTK_HTML_STREAM_OK);
+ md->stream = NULL;
}
@@ -1605,30 +1389,25 @@ mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
* mail_display_set_message:
* @mail_display: the mail display object
* @medium: the input camel medium, or %NULL
- * @followup: followup value
*
* Makes the mail_display object show the contents of the medium
* param.
**/
void
-mail_display_set_message (MailDisplay *md, CamelMedium *medium, const char *followup)
+mail_display_set_message (MailDisplay *md, CamelMedium *medium)
{
/* For the moment, we deal only with CamelMimeMessage, but in
* the future, we should be able to deal with any medium.
*/
if (medium && !CAMEL_IS_MIME_MESSAGE (medium))
return;
-
+
/* Clean up from previous message. */
if (md->current_message)
camel_object_unref (CAMEL_OBJECT (md->current_message));
-
- g_free (md->followup);
-
- md->current_message = (CamelMimeMessage *) medium;
-
- md->followup = followup ? message_tag_followup_decode (followup) : NULL;
-
+
+ md->current_message = (CamelMimeMessage*)medium;
+
g_datalist_init (md->data);
mail_display_redisplay (md, TRUE);
if (medium) {
@@ -1680,31 +1459,25 @@ mail_display_init (GtkObject *object)
mail_display->scroll = NULL;
mail_display->html = NULL;
mail_display->redisplay_counter = 0;
+ mail_display->stream = NULL;
mail_display->last_active = NULL;
mail_display->idle_id = 0;
mail_display->selection = NULL;
- mail_display->charset = NULL;
- mail_display->followup = NULL;
mail_display->current_message = NULL;
mail_display->data = NULL;
-
+
mail_display->invisible = gtk_invisible_new ();
mail_display->display_style = mail_config_get_message_display_style ();
-
- mail_display->printing = FALSE;
}
static void
mail_display_destroy (GtkObject *object)
{
MailDisplay *mail_display = MAIL_DISPLAY (object);
-
- gtk_object_unref (GTK_OBJECT (mail_display->html));
-
+
g_free (mail_display->charset);
g_free (mail_display->selection);
- g_free (mail_display->followup);
g_datalist_clear (mail_display->data);
g_free (mail_display->data);
@@ -1829,12 +1602,16 @@ enum {
#define TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
static EPopupMenu link_menu [] = {
- E_POPUP_ITEM (N_("Open Link in Browser"), GTK_SIGNAL_FUNC (link_open_in_browser), MASK_URL),
- E_POPUP_ITEM (N_("Copy Link Location"), GTK_SIGNAL_FUNC (link_copy_location), MASK_URL),
+ { N_("Open Link in Browser"), NULL,
+ GTK_SIGNAL_FUNC (link_open_in_browser), NULL, MASK_URL },
+ { N_("Copy Link Location"), NULL,
+ GTK_SIGNAL_FUNC (link_copy_location), NULL, MASK_URL },
#if 0
- E_POPUP_ITEM (N_("Save Link as (FIXME)"), GTK_SIGNAL_FUNC (link_save_as), MASK_URL),
+ { N_("Save Link as (FIXME)"), NULL,
+ GTK_SIGNAL_FUNC (link_save_as), NULL, MASK_URL },
#endif
- E_POPUP_ITEM (N_("Save Image as..."), GTK_SIGNAL_FUNC (image_save_as), MASK_SRC),
+ { N_("Save Image as..."), NULL,
+ GTK_SIGNAL_FUNC (image_save_as), NULL, MASK_SRC },
TERMINATOR
};
@@ -2052,11 +1829,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
if (url && !g_strncasecmp (url, "mailto:", 7)) {
PopupInfo *pop;
- gchar *url_decoded;
-
- url_decoded = gtk_html_get_url_object_relative (GTK_HTML (widget),
- point->object,
- url);
+ gchar *url_decoded = g_strdup (url);
camel_url_decode (url_decoded);
popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup",
@@ -2083,10 +1856,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
hide_mask |= MASK_SRC;
g_free (gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri"));
- gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri",
- gtk_html_get_url_object_relative (GTK_HTML (widget),
- point->object,
- src));
+ gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri", g_strdup (src));
e_popup_menu_run (link_menu, (GdkEvent *) event, 0, hide_mask, mail_display);
@@ -2210,32 +1980,33 @@ set_status_message (const char *message, int busy)
{
EList *controls;
EIterator *it;
-
+
controls = folder_browser_factory_get_control_list ();
for (it = e_list_get_iterator (controls); e_iterator_is_valid (it); e_iterator_next (it)) {
BonoboControl *control;
GNOME_Evolution_ShellView shell_view_interface;
CORBA_Environment ev;
-
+
control = BONOBO_CONTROL (e_iterator_get (it));
-
+
shell_view_interface = gtk_object_get_data (GTK_OBJECT (control), "mail_threads_shell_view_interface");
-
+
if (shell_view_interface == CORBA_OBJECT_NIL)
shell_view_interface = retrieve_shell_view_interface_from_control (control);
-
+
CORBA_exception_init (&ev);
-
+
if (shell_view_interface != CORBA_OBJECT_NIL) {
+
if (message != NULL)
GNOME_Evolution_ShellView_setMessage (shell_view_interface,
message[0] ? message: "",
busy,
&ev);
}
-
+
CORBA_exception_free (&ev);
-
+
/* yeah we only set the first one. Why? Because it seems to leave
random ones lying around otherwise. Shrug. */
break;
@@ -2270,10 +2041,10 @@ mail_display_new (void)
GtkWidget *scroll, *html;
GdkAtom clipboard_atom;
HTMLTokenizer *tok;
-
+
gtk_box_set_homogeneous (GTK_BOX (mail_display), FALSE);
gtk_widget_show (GTK_WIDGET (mail_display));
-
+
scroll = e_scroll_frame_new (NULL, NULL);
e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll),
GTK_POLICY_AUTOMATIC,
@@ -2281,48 +2052,16 @@ mail_display_new (void)
e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll), GTK_SHADOW_IN);
gtk_box_pack_start_defaults (GTK_BOX (mail_display), GTK_WIDGET (scroll));
gtk_widget_show (GTK_WIDGET (scroll));
-
+
html = gtk_html_new ();
tok = e_searching_tokenizer_new ();
html_engine_set_tokenizer (GTK_HTML (html)->engine, tok);
gtk_object_unref (GTK_OBJECT (tok));
-
- mail_display_initialize_gtkhtml (mail_display, GTK_HTML (html));
-
- gtk_container_add (GTK_CONTAINER (scroll), html);
- gtk_widget_show (GTK_WIDGET (html));
-
- gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get",
- GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display);
- gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event",
- GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display);
-
- gtk_selection_add_target (mail_display->invisible,
- GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1);
-
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
- if (clipboard_atom != GDK_NONE)
- gtk_selection_add_target (mail_display->invisible,
- clipboard_atom, GDK_SELECTION_TYPE_STRING, 1);
-
- mail_display->scroll = E_SCROLL_FRAME (scroll);
- mail_display->html = GTK_HTML (html);
- gtk_object_ref (GTK_OBJECT (mail_display->html));
- mail_display->last_active = NULL;
- mail_display->data = g_new0 (GData *, 1);
- g_datalist_init (mail_display->data);
-
- return GTK_WIDGET (mail_display);
-}
-void
-mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html)
-{
gtk_html_set_default_content_type (GTK_HTML (html),
"text/html; charset=utf-8");
-
+
gtk_html_set_editable (GTK_HTML (html), FALSE);
-
gtk_signal_connect (GTK_OBJECT (html), "url_requested",
GTK_SIGNAL_FUNC (on_url_requested),
mail_display);
@@ -2342,81 +2081,31 @@ mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html)
GTK_SIGNAL_FUNC (html_iframe_created), mail_display);
gtk_signal_connect (GTK_OBJECT (html), "on_url",
GTK_SIGNAL_FUNC (html_on_url), mail_display);
-}
-static void
-free_url (gpointer key, gpointer value, gpointer data)
-{
- g_free (key);
- if (data)
- g_byte_array_free (value, TRUE);
-}
+ gtk_container_add (GTK_CONTAINER (scroll), html);
+ gtk_widget_show (GTK_WIDGET (html));
-static void
-free_data_urls (gpointer urls)
-{
- g_hash_table_foreach (urls, free_url, GINT_TO_POINTER (1));
- g_hash_table_destroy (urls);
-}
+ gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get",
+ GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display);
+ gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event",
+ GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display);
-char *
-mail_display_add_url (MailDisplay *md, const char *kind, char *url, gpointer data)
-{
- GHashTable *urls;
- gpointer old_key, old_value;
-
- urls = g_datalist_get_data (md->data, kind);
- if (!urls) {
- urls = g_hash_table_new (g_str_hash, g_str_equal);
- g_datalist_set_data_full (md->data, "data_urls", urls,
- free_data_urls);
- }
-
- if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) {
- g_free (url);
- url = old_key;
- }
-
- g_hash_table_insert (urls, url, data);
-
- return url;
-}
+ gtk_selection_add_target (mail_display->invisible,
+ GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1);
-const char *
-mail_display_get_url_for_icon (MailDisplay *md, const char *icon_name)
-{
- char *icon_path, buf[1024], *url;
- int fd, nread;
- GByteArray *ba;
-
- /* FIXME: cache */
-
- if (*icon_name == '/')
- icon_path = g_strdup (icon_name);
- else {
- icon_path = gnome_pixmap_file (icon_name);
- if (!icon_path)
- return "file:///dev/null";
- }
-
- fd = open (icon_path, O_RDONLY);
- g_free (icon_path);
- if (fd == -1)
- return "file:///dev/null";
-
- ba = g_byte_array_new ();
- while (1) {
- nread = read (fd, buf, sizeof (buf));
- if (nread < 1)
- break;
- g_byte_array_append (ba, buf, nread);
- }
- close (fd);
-
- url = g_strdup_printf ("x-evolution-data:%p", ba);
-
- return mail_display_add_url (md, "data_urls", url, ba);
-}
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ if (clipboard_atom != GDK_NONE)
+ gtk_selection_add_target (mail_display->invisible,
+ clipboard_atom, GDK_SELECTION_TYPE_STRING, 1);
+ mail_display->scroll = E_SCROLL_FRAME (scroll);
+ mail_display->html = GTK_HTML (html);
+ mail_display->stream = NULL;
+ mail_display->last_active = NULL;
+ mail_display->data = g_new0 (GData *, 1);
+ g_datalist_init (mail_display->data);
+
+ 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-folder-cache.c b/mail/mail-folder-cache.c
index a9479f3d36..9bf7d12025 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -46,7 +46,7 @@
#include "mail-vfolder.h"
#include "mail-autofilter.h"
-#define w(x)
+#define w(x)
#define d(x)
/* note that many things are effectively serialised by having them run in
@@ -302,8 +302,6 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info)
} else if (info)
unread = info->unread_message_count;
- d(printf("folder updated: unread %d: '%s'\n", unread, mfi->full_name));
-
if (unread == -1)
return;
@@ -356,7 +354,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si)
static void
create_folders(CamelFolderInfo *fi, struct _store_info *si)
{
- d(printf("Setup new folder: %s\n %s\n", fi->url, fi->full_name));
+ d(printf("Setup new folder: %s\n", fi->url));
setup_folder(fi, si);
@@ -711,8 +709,11 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data)
/* otherwise its not, and we're on our own and free anyway */
e_dlist_remove((EDListNode *)ud);
- if (fi)
+ if (fi) {
+ if (si->storage)
+ gtk_object_set_data (GTK_OBJECT (si->storage), "connected", GINT_TO_POINTER (TRUE));
create_folders(fi, si);
+ }
}
UNLOCK(info_lock);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index eb5723da17..23fae80837 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -31,8 +31,7 @@
#include <fcntl.h>
#include <liboaf/liboaf.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
+#include <libgnome/libgnome.h>
#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gal/widgets/e-unicode.h>
@@ -52,67 +51,62 @@
#include "mail-crypto.h"
static char *try_inline_pgp (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static char *try_inline_pgp_sig (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static char *try_uudecoding (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static char *try_inline_binhex (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static gboolean handle_text_plain (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_text_plain_flowed (char *text,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_text_enriched (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_text_html (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_image (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_mixed (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_related (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_alternative (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_appledouble (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_encrypted (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_signed (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
-static gboolean handle_multipart_digest (CamelMimePart *part,
- const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_message_rfc822 (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_message_external_body (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_via_bonobo (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
/* writes the header info for a mime message into an html stream */
-static void write_headers (CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream);
+static void write_headers (CamelMimeMessage *message, MailDisplay *md);
/* dispatch html printing via mimetype */
-static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream);
+static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md);
static void
free_url (gpointer key, gpointer value, gpointer data)
@@ -136,6 +130,22 @@ free_data_urls (gpointer urls)
g_hash_table_destroy (urls);
}
+static char *
+add_url (const char *kind, char *url, gpointer data, MailDisplay *md)
+{
+ GHashTable *urls;
+ gpointer old_key, old_value;
+
+ urls = g_datalist_get_data (md->data, kind);
+ g_return_val_if_fail (urls != NULL, NULL);
+ if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) {
+ g_free (url);
+ url = old_key;
+ }
+ g_hash_table_insert (urls, url, data);
+ return url;
+}
+
/**
* mail_format_mime_message:
* @mime_message: the input mime message
@@ -144,13 +154,12 @@ free_data_urls (gpointer urls)
* Writes a CamelMimeMessage out into a MailDisplay
**/
void
-mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md)
{
GHashTable *hash;
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
-
+
hash = g_datalist_get_data (md->data, "part_urls");
if (!hash) {
hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -177,8 +186,8 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
(GDestroyNotify) g_hash_table_destroy);
}
- write_headers (mime_message, md, html, stream);
- format_mime_part (CAMEL_MIME_PART (mime_message), md, html, stream);
+ write_headers (mime_message, md);
+ format_mime_part (CAMEL_MIME_PART (mime_message), md);
}
@@ -190,33 +199,32 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
* Writes a CamelMimeMessage source out into a MailDisplay
**/
void
-mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md)
{
GByteArray *bytes;
- char *html_str;
+ char *html;
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
if (!mail_content_loaded (CAMEL_DATA_WRAPPER (mime_message), md,
- TRUE, NULL, html, NULL))
+ TRUE, NULL, NULL))
return;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td><tt>\n");
bytes = mail_format_get_data_wrapper_text (CAMEL_DATA_WRAPPER (mime_message), md);
if (bytes) {
g_byte_array_append (bytes, "", 1);
- html_str = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT);
+ html = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL |
+ E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT);
g_byte_array_free (bytes, TRUE);
- mail_html_write (html, stream, html_str);
- g_free (html_str);
+ mail_html_write (md->html, md->stream, html);
+ g_free (html);
}
- mail_html_write (html, stream, "</tt></td></tr></table>");
+ mail_html_write (md->html, md->stream, "</tt></td></tr></table>");
}
static const char *
@@ -233,8 +241,8 @@ get_cid (CamelMimePart *part, MailDisplay *md)
camel_mime_part_get_content_id (part));
} else
cid = g_strdup_printf ("cid:@@@%d", fake_cid_counter++);
-
- return mail_display_add_url (md, "part_urls", cid, part);
+
+ return add_url ("part_urls", cid, part, md);
}
static const char *
@@ -247,7 +255,42 @@ get_location (CamelMimePart *part, MailDisplay *md)
if (!loc)
return NULL;
- return mail_display_add_url (md, "part_urls", g_strdup (loc), part);
+ return add_url ("part_urls", g_strdup (loc), part, md);
+}
+
+static const char *
+get_url_for_icon (const char *icon_name, MailDisplay *md)
+{
+ char *icon_path, buf[1024], *url;
+ int fd, nread;
+ GByteArray *ba;
+
+ /* FIXME: cache */
+
+ if (*icon_name == '/')
+ icon_path = g_strdup (icon_name);
+ else {
+ icon_path = gnome_pixmap_file (icon_name);
+ if (!icon_path)
+ return "file:///dev/null";
+ }
+
+ fd = open (icon_path, O_RDONLY);
+ g_free (icon_path);
+ if (fd == -1)
+ return "file:///dev/null";
+
+ ba = g_byte_array_new ();
+ while (1) {
+ nread = read (fd, buf, sizeof (buf));
+ if (nread < 1)
+ break;
+ g_byte_array_append (ba, buf, nread);
+ }
+ close (fd);
+
+ url = g_strdup_printf ("x-evolution-data:%p", ba);
+ return add_url ("data_urls", url, ba, md);
}
@@ -316,8 +359,6 @@ setup_mime_tables (void)
handle_multipart_encrypted);
g_hash_table_insert (mime_function_table, "multipart/signed",
handle_multipart_signed);
- g_hash_table_insert (mime_function_table, "multipart/digest",
- handle_multipart_digest);
/* RFC 2046 says unrecognized text subtypes can be treated
* as text/plain (as long as you recognize the character set),
@@ -572,34 +613,27 @@ mail_part_set_default_displayed_inline (CamelMimePart *part, MailDisplay *md,
}
static void
-attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md)
{
- char *htmlinfo, *html_str, *fmt;
+ char *htmlinfo, *html, *fmt;
const char *info;
/* Start the table, create the pop-up object. */
- mail_html_write (html, stream,
- "<table cellspacing=0 cellpadding=0>"
- "<tr><td><table width=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>");
-
- if (! md->printing) {
- gtk_html_stream_printf (stream, "<td><object classid=\"popup:%s\" type=\"%s\"></object></td>",
- get_cid (part, md), mime_type);
- }
-
- mail_html_write (html, stream,
- "<td><table width=3 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
- "<td><font size=-1>");
-
+ gtk_html_stream_printf (md->stream,
+ "<table cellspacing=0 cellpadding=0>"
+ "<tr><td><table width=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
+ "<td><object classid=\"popup:%s\" type=\"%s\"></object></td>"
+ "<td><table width=3 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
+ "<td><font size=-1>",
+ get_cid (part, md), mime_type);
/* Write the MIME type */
info = gnome_vfs_mime_get_value (mime_type, "description");
- html_str = e_text_to_html (info ? info : mime_type, 0);
- htmlinfo = e_utf8_from_locale_string (html_str);
- g_free (html_str);
+ html = e_text_to_html (info ? info : mime_type, 0);
+ htmlinfo = e_utf8_from_locale_string (html);
+ g_free (html);
fmt = e_utf8_from_locale_string (_("%s attachment"));
- gtk_html_stream_printf (stream, fmt, htmlinfo);
+ gtk_html_stream_printf (md->stream, fmt, htmlinfo);
g_free (htmlinfo);
g_free (fmt);
@@ -607,48 +641,47 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
info = camel_mime_part_get_filename (part);
if (info) {
htmlinfo = e_text_to_html (info, 0);
- gtk_html_stream_printf (stream, " (%s)", htmlinfo);
+ gtk_html_stream_printf (md->stream, " (%s)", htmlinfo);
g_free (htmlinfo);
}
/* Write a description, if we have one. */
info = camel_mime_part_get_description (part);
if (info) {
- htmlinfo = e_text_to_html (info, md->printing ? 0 : E_TEXT_TO_HTML_CONVERT_URLS);
- gtk_html_stream_printf (stream, ", \"%s\"", htmlinfo);
+ htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS);
+ gtk_html_stream_printf (md->stream, ", \"%s\"", htmlinfo);
g_free (htmlinfo);
}
- mail_html_write (html, stream, "</font></td></tr><tr>"
+ mail_html_write (md->html, md->stream, "</font></td></tr><tr>"
"<td height=10><table height=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td></tr></table>\n");
}
static gboolean
-format_mime_part (CamelMimePart *part, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+format_mime_part (CamelMimePart *part, MailDisplay *md)
{
CamelDataWrapper *wrapper;
char *mime_type;
MailMimeHandler *handler;
gboolean output;
int inline_flags;
-
+
/* Record URLs associated with this part */
get_cid (part, md);
get_location (part, md);
-
+
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
-
+
if (CAMEL_IS_MULTIPART (wrapper) &&
camel_multipart_get_number (CAMEL_MULTIPART (wrapper)) == 0) {
char *mesg;
mesg = e_utf8_from_locale_string (_("Could not parse MIME message. Displaying as source."));
- mail_error_printf (html, stream, "\n%s\n", mesg);
+ mail_error_printf (md->html, md->stream, "\n%s\n", mesg);
g_free (mesg);
- if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL))
- handle_text_plain (part, "text/plain", md, html, stream);
+ if (mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
+ handle_text_plain (part, "text/plain", md);
return TRUE;
}
@@ -680,11 +713,11 @@ format_mime_part (CamelMimePart *part, MailDisplay *md,
/* No header for anonymous inline parts. */
if (!((inline_flags & I_ACTUALLY) && is_anonymous (part, mime_type)))
- attachment_header (part, mime_type, md, html, stream);
+ attachment_header (part, mime_type, md);
if (handler && handler->builtin && inline_flags & I_DISPLAYED &&
- mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL))
- output = (*handler->builtin) (part, mime_type, md, html, stream);
+ mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
+ output = (*handler->builtin) (part, mime_type, md);
else
output = TRUE;
@@ -741,7 +774,7 @@ static void
write_text_header (const char *name, const char *value, int flags, GtkHTML *html, GtkHTMLStream *stream)
{
char *encoded;
-
+
if (value && *value)
encoded = e_text_to_html (value, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
else
@@ -756,8 +789,7 @@ write_text_header (const char *name, const char *value, int flags, GtkHTML *html
}
static void
-write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
- const CamelInternetAddress *addr, const char *field_name, int flags)
+write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *field_name, int flags)
{
const char *name, *email;
gint i;
@@ -765,7 +797,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
if (addr == NULL || !camel_internet_address_get (addr, 0, NULL, NULL))
return;
- write_field_row_begin (field_name, flags, html, stream);
+ write_field_row_begin (field_name, flags, md->html, md->stream);
i = 0;
while (camel_internet_address_get (addr, i, &name, &email)) {
@@ -791,7 +823,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
}
if (i)
- mail_html_write (html, stream, ", ");
+ mail_html_write (md->html, md->stream, ", ");
if (have_email || have_name) {
if (!have_email) {
@@ -799,28 +831,20 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
}
if (have_name) {
- if (md->printing) {
- gtk_html_stream_printf (stream, "%s &lt;%s&gt;", name_disp, email_disp);
- } else {
- gtk_html_stream_printf (stream,
- "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
- name_disp, addr_url, email_disp);
- }
+ gtk_html_stream_printf (md->stream,
+ "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
+ name_disp, addr_url, email_disp);
} else {
- if (md->printing) {
- mail_html_write (html, stream, email_disp);
- } else {
- gtk_html_stream_printf (stream,
- "<a href=\"mailto:%s\">%s</a>",
- addr_url, email_disp);
- }
+ gtk_html_stream_printf (md->stream,
+ "<a href=\"mailto:%s\">%s</a>",
+ addr_url, email_disp);
}
} else {
char *str;
str = e_utf8_from_locale_string (_("Bad Address"));
- gtk_html_stream_printf (stream, "<i>%s</i>", str);
+ gtk_html_stream_printf (md->stream, "<i>%s</i>", str);
g_free (str);
}
@@ -832,7 +856,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
i++;
}
- mail_html_write (html, stream, "</td></tr>");
+ mail_html_write (md->html, md->stream, "</td></tr>");
}
/* order of these must match write_header code */
@@ -855,87 +879,53 @@ default_header_index(const char *name)
/* index is index of header in default_headers array */
static void
-write_default_header(CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream,
- int index, int flags)
+write_default_header(CamelMimeMessage *message, MailDisplay *md, int index, int flags)
{
switch(index) {
case 0:
- write_address (md, html, stream,
- camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD);
+ write_address (md, camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD);
break;
case 1:
- write_address (md, html, stream,
- camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD);
+ write_address (md, camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD);
break;
case 2:
- write_address(md, html, stream,
- camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO),
+ write_address(md, camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO),
_("To"), flags | WRITE_BOLD);
break;
case 3:
- write_address (md, html, stream,
- camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC),
+ write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC),
_("Cc"), flags | WRITE_BOLD);
break;
case 4:
- write_address (md, html, stream,
- camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC),
+ write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC),
_("Bcc"), flags | WRITE_BOLD);
break;
case 5:
write_text_header (_("Subject"), camel_mime_message_get_subject (message),
- flags | WRITE_BOLD, html, stream);
+ flags | WRITE_BOLD, md->html, md->stream);
break;
case 6:
- write_date (message, flags | WRITE_BOLD, html, stream);
+ write_date (message, flags | WRITE_BOLD, md->html, md->stream);
break;
default:
g_assert_not_reached();
}
}
-static gboolean
-write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream,
- MailConfigXMailerDisplayStyle xm)
-{
- const char *xmailer, *evolution;
-
- xmailer = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Mailer");
- if (!xmailer) {
- xmailer = camel_medium_get_header (CAMEL_MEDIUM (message), "User-Agent");
- if (!xmailer)
- return FALSE;
- }
-
- evolution = strstr (xmailer, "Evolution");
- if ((xm & MAIL_CONFIG_XMAILER_OTHER) ||
- (evolution && (xm & MAIL_CONFIG_XMAILER_EVO)))
- write_text_header (_("Mailer"), xmailer, WRITE_BOLD, html, stream);
-
- return evolution != NULL && (xm & MAIL_CONFIG_XMAILER_RUPERT_APPROVED);
-}
-
#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
static void
-write_headers (CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+write_headers (CamelMimeMessage *message, MailDisplay *md)
{
- MailConfigXMailerDisplayStyle xm = mail_config_get_x_mailer_display_style ();
gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
char bgcolor[7], fontcolor[7];
GtkStyle *style = NULL;
- gboolean evo_icon = FALSE;
int i;
- /* My favorite thing to do... muck around with colors so we respect people's stupid themes.
- However, we only do this if we are rendering to the screen -- we ignore the theme
- when we are printing. */
- style = gtk_widget_get_style (GTK_WIDGET (html));
- if (style && !md->printing) {
- int state = GTK_WIDGET_STATE (GTK_WIDGET (html));
+ /* My favorite thing to do...much around with colors so we respect people's stupid themes */
+ style = gtk_widget_get_style (GTK_WIDGET (md->html));
+ if (style) {
+ int state = GTK_WIDGET_STATE (GTK_WIDGET (md->html));
gushort r, g, b;
r = style->base[state].red / 256;
@@ -954,7 +944,7 @@ write_headers (CamelMimeMessage *message, MailDisplay *md,
sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b);
- r = style->text[state].red / 256;
+ r = style->text[state].red;
g = style->text[state].green / 256;
b = style->text[state].blue / 256;
@@ -964,68 +954,47 @@ write_headers (CamelMimeMessage *message, MailDisplay *md,
strcpy (fontcolor, "000000");
}
- gtk_html_stream_printf (
- stream,
- "<table width=\"100%%\" cellpadding=0 cellspacing=0>"
- /* Top margin */
- "<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td></tr>"
- /* Left margin */
- "<tr><td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
- /* Black border */
- "<td width=\"100%%\"><table bgcolor=\"#000000\" width=\"100%%\" cellspacing=0 cellpadding=1>"
- /* Main header box */
- "<tr><td><table bgcolor=\"#%s\" width=\"100%%\" cellpadding=0 cellspacing=0>"
- /* Internal header table */
- "<tr valign=top><td><table><font color=\"#%s\">\n",
- bgcolor, fontcolor);
+ gtk_html_stream_printf (md->stream,
+ "<table width=\"100%%\" cellpadding=0 cellspacing=0>"
+ "<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0>"
+ "<tr><td></td></tr></table></td></tr>"
+ "<tr><td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
+ "<td width=\"100%%\"><font color=\"#%s\">"
+ "<table bgcolor=\"#000000\" width=\"100%%\" "
+ "cellspacing=0 cellpadding=1><tr><td>"
+ "<table bgcolor=\"#%s\" width=\"100%%\" cellpadding=0 cellspacing=0>"
+ "<tr><td><table>\n", fontcolor, bgcolor);
if (full) {
struct _header_raw *header;
const char *charset;
CamelContentType *ct;
char *value;
-
+
ct = camel_mime_part_get_content_type(CAMEL_MIME_PART(message));
charset = header_content_type_param(ct, "charset");
charset = e_iconv_charset_name(charset);
-
+
header = CAMEL_MIME_PART(message)->headers;
while (header) {
i = default_header_index(header->name);
if (i == -1) {
value = header_decode_string(header->value, charset);
- write_text_header(header->name, value, WRITE_NOCOLUMNS, html, stream);
+ write_text_header(header->name, value, WRITE_NOCOLUMNS, md->html, md->stream);
g_free(value);
} else
- write_default_header(message, md, html, stream, i, WRITE_NOCOLUMNS);
+ write_default_header(message, md, i, WRITE_NOCOLUMNS);
header = header->next;
}
} else {
for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++)
- write_default_header(message, md, html, stream, i, 0);
- if (xm != MAIL_CONFIG_XMAILER_NONE)
- evo_icon = write_xmailer_header(message, md, html, stream, xm);
+ write_default_header(message, md, i, 0);
}
- /* Close off the internal header table */
- mail_html_write (html, stream, "</font></table></td>");
-
- if (!md->printing && evo_icon) {
- gtk_html_stream_printf (stream,
- "<td align=right><table><tr><td width=16>"
- "<img src=\"%s\">"
- "</td></tr></table></td>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/monkey-16.png"));
- }
-
- mail_html_write (html, stream,
- /* Main header box */
- "</tr></table>"
- /* Black border */
- "</td></tr></table></td>"
- /* Right margin */
- "<td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
- "</tr></table>\n");
+ mail_html_write (md->html, md->stream,
+ "</table></td></tr></table></td></tr></table></font></td>"
+ "<td><table width=10 cellpadding=0 cellspacing=0><tr><td>"
+ "</td></tr></table></td></tr></table>\n");
}
static void
@@ -1041,17 +1010,16 @@ load_offline_content (MailDisplay *md, gpointer data)
}
gboolean
-mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url,
- GtkHTML *html, GtkHTMLStream *handle)
+mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url, GtkHTMLStream *handle)
{
if (!camel_data_wrapper_is_offline (wrapper))
return TRUE;
camel_object_ref (CAMEL_OBJECT (wrapper));
if (redisplay)
- mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, html, wrapper);
+ mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, wrapper);
else
- mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, html, handle, wrapper);
+ mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, handle, wrapper);
return FALSE;
}
@@ -1131,9 +1099,9 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_
}
static void
-write_hr (GtkHTML *html, GtkHTMLStream *stream)
+write_hr (MailDisplay *md)
{
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td width=\"100%\">"
"<hr noshadow size=1></td></tr></table>\n");
}
@@ -1145,7 +1113,7 @@ write_hr (GtkHTML *html, GtkHTMLStream *stream)
struct {
char *start;
char * (*handler) (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
} text_specials[] = {
{ "-----BEGIN PGP MESSAGE-----\n", try_inline_pgp },
{ "-----BEGIN PGP SIGNED MESSAGE-----\n", try_inline_pgp_sig },
@@ -1156,23 +1124,23 @@ struct {
static int num_specials = (sizeof (text_specials) / sizeof (text_specials[0]));
static void
-write_one_text_plain_chunk (const char *text, int len, GtkHTML *html, GtkHTMLStream *stream, gboolean printing)
+write_one_text_plain_chunk (const char *text, int len, MailDisplay *md)
{
char *buf;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n");
buf = g_strndup (text, len);
- mail_text_write (html, stream, printing, buf);
+ mail_text_write (md->html, md->stream, buf);
g_free (buf);
- mail_html_write (html, stream, "</td></tr></table>\n");
+ mail_html_write (md->html, md->stream, "</td></tr></table>\n");
}
static gboolean
handle_text_plain (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1191,20 +1159,11 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
text = bytes->data;
g_byte_array_free (bytes, FALSE);
- /* Check to see if this is a broken text/html part with content-type text/plain */
- start = text;
- while (isspace ((unsigned) *start))
- start++;
- if (!g_strncasecmp (start, "<html>", 6) || !g_strncasecmp (start, "<!DOCTYPE HTML", 14)) {
- g_free (text);
- return handle_text_html (part, "text/html", md, html, stream);
- }
-
/* Check for RFC 2646 flowed text. */
type = camel_mime_part_get_content_type (part);
format = header_content_type_param (type, "format");
if (format && !g_strcasecmp (format, "flowed"))
- return handle_text_plain_flowed (text, md, html, stream);
+ return handle_text_plain_flowed (text, md);
/* Only look for binhex and stuff if this is real text/plain.
* (and not, say, application/mac-binhex40 that mail-identify
@@ -1226,9 +1185,9 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
/* Deal with special case */
if (start != p)
- write_one_text_plain_chunk (p, start - p, html, stream, md->printing);
+ write_one_text_plain_chunk (p, start - p, md);
- p = text_specials[i].handler (start, part, start - text, md, html, stream);
+ p = text_specials[i].handler (start, part, start - text, md);
if (p == start) {
/* Oops. That failed. Output this line normally and
* skip over it.
@@ -1240,13 +1199,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
break;
}
p++;
- write_one_text_plain_chunk (start, p - start, html, stream, md->printing);
+ write_one_text_plain_chunk (start, p - start, md);
} else if (p)
- write_hr (html, stream);
+ write_hr (md);
}
/* Finish up (or do the whole thing if there were no specials). */
if (p)
- write_one_text_plain_chunk (p, strlen (p), html, stream, md->printing);
+ write_one_text_plain_chunk (p, strlen (p), md);
g_free (text);
@@ -1254,13 +1213,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
}
static gboolean
-handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+handle_text_plain_flowed (char *buf, MailDisplay *md)
{
char *text, *line, *eol, *p;
int prevquoting = 0, quoting, len, br_pending = 0;
guint32 citation_color = mail_config_get_citation_color ();
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"\n<!-- text/plain, flowed -->\n"
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n<tt>\n");
@@ -1269,29 +1228,26 @@ handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStre
eol = strchr (line, '\n');
if (eol)
*eol = '\0';
-
+
quoting = 0;
for (p = line; *p == '>'; p++)
quoting++;
if (quoting != prevquoting) {
if (prevquoting == 0) {
- if (md->printing)
- mail_html_write (html, stream, "<i>");
- else
- gtk_html_stream_printf (stream, "<font color=\"#%06x\">", citation_color);
+ gtk_html_stream_printf (md->stream, "<font color=\"#%06x\">", citation_color);
if (br_pending)
br_pending--;
}
while (quoting > prevquoting) {
- mail_html_write (html, stream, "<blockquote>");
+ mail_html_write (md->html, md->stream, "<blockquote>");
prevquoting++;
}
while (quoting < prevquoting) {
- mail_html_write (html, stream, "</blockquote>");
+ mail_html_write (md->html, md->stream, "</blockquote>");
prevquoting--;
}
if (quoting == 0) {
- mail_html_write (html, stream, md->printing ? "</i>" : "</font>\n");
+ mail_html_write (md->html, md->stream, "</font>\n");
if (br_pending)
br_pending--;
}
@@ -1306,30 +1262,27 @@ handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStre
}
while (br_pending) {
- mail_html_write (html, stream, "<br>\n");
+ mail_html_write (md->html, md->stream, "<br>\n");
br_pending--;
}
/* replace '<' with '&lt;', etc. */
- text = e_text_to_html (p,
- md->printing ?
- E_TEXT_TO_HTML_CONVERT_SPACES :
- E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_CONVERT_URLS);
+ 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, text);
+ mail_html_write (md->html, md->stream, text);
g_free (text);
- if ((len > 0 && p[len - 1]) != ' ' || !strcmp (p, "-- "))
+ if (p[len - 1] != ' ' || !strcmp (p, "-- "))
br_pending++;
if (!eol)
break;
}
-
g_free (buf);
-
- mail_html_write (html, stream, "</tt>\n</td></tr></table>\n");
-
+
+ mail_html_write (md->html, md->stream, "</tt>\n</td></tr></table>\n");
+
return TRUE;
}
@@ -1368,24 +1321,121 @@ destroy_part (CamelObject *root, gpointer event_data, gpointer user_data)
static char *
try_inline_pgp (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
- return start;
+ CamelMimePart *part;
+ CamelMultipart *multipart;
+ char *end;
+
+ end = strstr (start, "\n-----END PGP MESSAGE-----\n");
+ if (!end)
+ return start;
+
+ end += sizeof ("\n-----END PGP MESSAGE-----\n") - 1;
+
+ multipart = camel_multipart_new ();
+ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
+ "multipart/encrypted; "
+ "protocol=\"application/pgp-encrypted\"; "
+ "x-inline-pgp-hack=true");
+
+ part = fake_mime_part_from_data ("Version: 1\n",
+ sizeof ("Version: 1\n") - 1,
+ "application/pgp-encrypted",
+ offset + 1, md);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = fake_mime_part_from_data (start, end - start + 1,
+ "application/octet-stream",
+ offset, md);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (part),
+ CAMEL_DATA_WRAPPER (multipart));
+
+ camel_object_hook_event (CAMEL_OBJECT (md->current_message),
+ "finalize", destroy_part, part);
+
+ write_hr (md);
+ format_mime_part (part, md);
+
+ return end;
}
static char *
try_inline_pgp_sig (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
- return start;
+ CamelMimePart *part;
+ CamelMultipart *multipart;
+ char *msg_start, *msg_end, *sig_start, *sig_end;
+ CamelContentType *type;
+ char *type_str;
+
+ /* We know start points to "-----BEGIN PGP SIGNED MESSAGE-----\n" */
+ msg_start = start + sizeof ("-----BEGIN PGP SIGNED MESSAGE-----\n") - 1;
+
+ if (*msg_start != '\n') {
+ /* Skip 'One or more "Hash" Armor Headers' followed by
+ * 'Exactly one empty line'.
+ */
+ msg_start = strstr (msg_start, "\n\n");
+ if (!msg_start)
+ return start;
+ msg_start += 2;
+ }
+
+ msg_end = strstr (msg_start, "\n-----BEGIN PGP SIGNATURE-----\n");
+ if (!msg_end || msg_end == msg_start)
+ return start;
+
+ sig_start = msg_end;
+ sig_end = strstr (sig_start, "\n-----END PGP SIGNATURE-----\n");
+ if (!sig_end)
+ return start;
+ sig_end += sizeof ("\n-----END PGP SIGNATURE-----\n") - 1;
+
+ multipart = camel_multipart_new ();
+ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
+ "multipart/signed; micalg=pgp-sha1;"
+ "x-inline-pgp-hack=true");
+
+ type = camel_mime_part_get_content_type (mime_part);
+ type_str = header_content_type_format (type);
+ part = fake_mime_part_from_data (msg_start, msg_end - msg_start,
+ type_str, offset, md);
+ g_free (type_str);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = fake_mime_part_from_data (sig_start, sig_end - sig_start,
+ "application/pgp-signature",
+ offset + 1, md);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (part),
+ CAMEL_DATA_WRAPPER (multipart));
+
+ camel_object_hook_event (CAMEL_OBJECT (md->current_message),
+ "finalize", destroy_part, part);
+
+ write_hr (md);
+ format_mime_part (part, md);
+
+ return sig_end;
}
static char *
try_uudecoding (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
- int mode, len, state = CAMEL_UUDECODE_STATE_INIT;
- char *filename, *estart, *p, *out;
+ int mode, len, state = 0;
+ char *filename, *estart, *p, *out, uulen = 0;
guint32 save = 0;
CamelMimePart *part;
@@ -1411,7 +1461,7 @@ try_uudecoding (char *start, CamelMimePart *mime_part,
}
out = g_malloc (p - estart);
- len = uudecode_step (estart, p - estart, out, &state, &save);
+ len = uudecode_step (estart, p - estart, out, &state, &save, &uulen);
part = fake_mime_part_from_data (out, len, "application/octet-stream",
offset, md);
@@ -1421,15 +1471,15 @@ try_uudecoding (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (html, stream);
- format_mime_part (part, md, html, stream);
+ write_hr (md);
+ format_mime_part (part, md);
return p + 4;
}
static char *
try_inline_binhex (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
char *p;
CamelMimePart *part;
@@ -1451,8 +1501,8 @@ try_inline_binhex (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (html, stream);
- format_mime_part (part, md, html, stream);
+ write_hr (md);
+ format_mime_part (part, md);
return p;
}
@@ -1472,7 +1522,7 @@ g_string_append_len (GString *string, const char *str, int len)
/* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */
static gboolean
handle_text_enriched (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
static GHashTable *translations = NULL;
CamelDataWrapper *wrapper =
@@ -1522,11 +1572,11 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
if (!g_strcasecmp (mime_type, "text/richtext")) {
enriched = FALSE;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"\n<!-- text/richtext -->\n");
} else {
enriched = TRUE;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"\n<!-- text/enriched -->\n");
}
@@ -1620,56 +1670,39 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
g_string_free (string, TRUE);
xed = g_strdup_printf ("x-evolution-data:%p", part);
- gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
- mail_display_add_url (md, "data_urls", xed, ba);
+ gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
+ add_url ("data_urls", xed, ba, md);
return TRUE;
}
static gboolean
handle_text_html (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
- const char *location, *base;
+ const char *location;
- mail_html_write (html, stream, "\n<!-- text/html -->\n");
-
- if ((base = camel_medium_get_header (CAMEL_MEDIUM (part), "Content-Base"))) {
- char *base_url;
- size_t len;
-
- len = strlen (base);
-
- if (*base == '"' && *(base + len - 1) == '"') {
- len -= 2;
- base_url = alloca (len + 1);
- memcpy (base_url, base + 1, len);
- base_url[len] = '\0';
- base = base_url;
- }
-
- gtk_html_set_base (html, base);
- }
+ mail_html_write (md->html, md->stream, "\n<!-- text/html -->\n");
/* FIXME: deal with relative URLs */
location = get_location (part, md);
if (!location)
location = get_cid (part, md);
- gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location);
+ gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location);
return TRUE;
}
static gboolean
-handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md)
{
- gtk_html_stream_printf (stream, "<img hspace=10 vspace=10 src=\"%s\">",
+ gtk_html_stream_printf (md->stream, "<img hspace=10 vspace=10 src=\"%s\">",
get_cid (part, md));
return TRUE;
}
static gboolean
handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1683,35 +1716,19 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts; i++) {
if (i != 0 && output)
- write_hr (html, stream);
+ write_hr (md);
part = camel_multipart_get_part (mp, i);
- output = format_mime_part (part, md, html, stream);
+ output = format_mime_part (part, md);
}
return TRUE;
}
static gboolean
-handle_multipart_digest (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
-
- g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
-
- gtk_html_stream_printf (stream, "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"digest:\"><img src=\"%s\">%s</a>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/envelope.png"),
- U_("View messages..."));
-
- return TRUE;
-}
-
-static gboolean
handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper;
CamelMimePart *mime_part;
@@ -1723,7 +1740,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
/* Currently we only handle RFC2015-style PGP encryption. */
if (!camel_pgp_mime_is_rfc2015_encrypted (part))
- return handle_multipart_mixed (part, mime_type, md, html, stream);
+ return handle_multipart_mixed (part, mime_type, md);
camel_exception_init (&ex);
mime_part = mail_crypto_pgp_mime_part_decrypt (part, &ex);
@@ -1733,7 +1750,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
error = e_utf8_from_locale_string (camel_exception_get_description (&ex));
- mail_error_printf (html, stream, "\n%s\n", error);
+ mail_error_printf (md->html, md->stream, "\n%s\n", error);
g_free (error);
camel_exception_clear (&ex);
@@ -1745,13 +1762,13 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
camel_object_unref (CAMEL_OBJECT (mime_part));
/* and continue on our merry way... */
- return format_mime_part (part, md, html, stream);
+ return format_mime_part (part, md);
}
}
static gboolean
handle_multipart_signed (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelMimePart *subpart;
CamelDataWrapper *wrapper;
@@ -1763,43 +1780,31 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
- /* Display all the subparts (there should be only 1) up to, but not including,
- * the signature. (this should be the last part but we all know that most
- * mailers are broken, so attempt to handle broken multipart/signed messages).
- * See bug #23583 for details.
+ /* Display all the subparts (there should be only 1)
+ * except the signature (last part).
*/
mp = CAMEL_MULTIPART (wrapper);
nparts = camel_multipart_get_number (mp);
- for (i = 0; i < nparts; i++) {
- CamelContentType *content_type;
+ for (i = 0; i < nparts - 1; i++) {
+ if (i != 0 && output)
+ write_hr (md);
subpart = camel_multipart_get_part (mp, i);
- content_type = camel_mime_part_get_content_type (subpart);
-
- if (header_content_type_is (content_type, "application", "pgp-signature"))
- break;
-
- if (i != 0 && output)
- write_hr (html, stream);
- output = format_mime_part (subpart, md, html, stream);
- }
-
- if (i >= nparts) {
- /* no signature part? wtf? */
- return TRUE;
+ output = format_mime_part (subpart, md);
}
+ subpart = camel_multipart_get_part (mp, i);
mail_part_set_default_displayed_inline (subpart, md, FALSE);
- if (!mail_part_is_displayed_inline (subpart, md) && !md->printing) {
+ if (!mail_part_is_displayed_inline (subpart, md)) {
char *url;
/* Write out the click-for-info object */
url = g_strdup_printf ("signature:%p/%lu", subpart,
(unsigned long)time (NULL));
- gtk_html_stream_printf (stream,
+ gtk_html_stream_printf (md->stream,
"<br><table cellspacing=0 cellpadding=0>"
"<tr><td><table width=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td>"
@@ -1807,13 +1812,13 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
"<td><table width=3 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td>"
"<td><font size=-1>", url);
- mail_display_add_url (md, "part_urls", url, subpart);
+ add_url ("part_urls", url, subpart, md);
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
U_("This message is digitally signed. "
"Click the lock icon for more information."));
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"</font></td></tr><tr><td height=10><table height=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td></tr></table>\n");
} else {
@@ -1836,61 +1841,50 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
message = U_("Evolution does not recognize this type of signed message.");
if (good) {
- gtk_html_stream_printf (stream,
+ gtk_html_stream_printf (md->stream,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-ok.png"),
+ get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-ok.png", md),
U_("This message is digitally signed and "
"has been found to be authentic."));
} else {
- gtk_html_stream_printf (stream,
+ gtk_html_stream_printf (md->stream,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-bad.png"),
+ get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-bad.png", md),
U_("This message is digitally signed but can "
"not be proven to be authentic."));
}
if (message) {
- gtk_html_stream_printf (stream, "<font size=-1 %s>", good || md->printing ? "" : "color=red");
- mail_text_write (html, stream, md->printing, message);
- mail_html_write (html, stream, "</font>");
+ gtk_html_stream_printf (md->stream, "<font size=-1 %s>",
+ good ? "" : "color=red");
+ mail_text_write (md->html, md->stream, message);
+ mail_html_write (md->html, md->stream, "</font>");
}
- mail_html_write (html, stream, "</td></tr></table>");
+ mail_html_write (md->html, md->stream, "</td></tr></table>");
camel_exception_clear (&ex);
camel_cipher_validity_free (valid);
}
- /* continuation of handling broken multipart/signed
- * parts... write out any extra parts that were added after
- * the signature part. */
- for (i++; i < nparts; i++) {
- subpart = camel_multipart_get_part (mp, i);
-
- write_hr (html, stream);
-
- output = format_mime_part (subpart, md, html, stream);
- }
-
return TRUE;
}
/* As seen in RFC 2387! */
static gboolean
handle_multipart_related (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
- CamelDataWrapper *wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ CamelDataWrapper *wrapper =
+ camel_medium_get_content_object (CAMEL_MEDIUM (part));
CamelMultipart *mp;
CamelMimePart *body_part, *display_part = NULL;
CamelContentType *content_type;
const char *start;
int i, nparts;
- GHashTable *related_save;
- int ret;
g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
@@ -1926,13 +1920,9 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
if (!display_part) {
/* Oops. Hrmph. */
- return handle_multipart_mixed (part, mime_type, md, html, stream);
+ return handle_multipart_mixed (part, mime_type, md);
}
- /* setup a 'stack' of related parts */
- related_save = md->related;
- md->related = g_hash_table_new(NULL, NULL);
-
/* Record the Content-ID/Content-Location of any non-displayed parts. */
for (i = 0; i < nparts; i++) {
body_part = camel_multipart_get_part (mp, i);
@@ -1941,33 +1931,10 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
get_cid (body_part, md);
get_location (body_part, md);
- g_hash_table_insert(md->related, body_part, body_part);
}
/* Now, display the displayed part. */
- ret = format_mime_part (display_part, md, html, stream);
-
- /* FIXME: flush html stream via gtkhtml_stream_flush which doens't exist yet ... */
- while (gtk_events_pending())
- gtk_main_iteration();
-
- /* Now check for related parts which didn't display, display them as attachments */
- for (i = 0; i < nparts; i++) {
- body_part = camel_multipart_get_part (mp, i);
- if (body_part == display_part)
- continue;
-
- if (g_hash_table_lookup(md->related, body_part)) {
- if (ret)
- write_hr (html, stream);
- ret |= format_mime_part(body_part, md, html, stream);
- }
- }
-
- g_hash_table_destroy(md->related);
- md->related = related_save;
-
- return ret;
+ return format_mime_part (display_part, md);
}
/* RFC 2046 says "display the last part that you are able to display". */
@@ -1998,7 +1965,7 @@ find_preferred_alternative (CamelMultipart *multipart, gboolean want_plain)
static gboolean
handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -2011,15 +1978,15 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
mime_part = find_preferred_alternative (multipart, FALSE);
if (mime_part)
- return format_mime_part (mime_part, md, html, stream);
+ return format_mime_part (mime_part, md);
else
- return handle_multipart_mixed (part, mime_type, md, html, stream);
+ return handle_multipart_mixed (part, mime_type, md);
}
/* RFC 1740 */
static gboolean
handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -2034,28 +2001,28 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
* likely it's application/octet-stream though.
*/
part = camel_multipart_get_part (multipart, 1);
- return format_mime_part (part, md, html, stream);
+ return format_mime_part (part, md);
}
static gboolean
handle_message_rfc822 (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE);
- mail_html_write (html, stream, "<blockquote>");
- mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md, html, stream);
- mail_html_write (html, stream, "</blockquote>");
+ mail_html_write (md->html, md->stream, "<blockquote>");
+ mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md);
+ mail_html_write (md->html, md->stream, "</blockquote>");
return TRUE;
}
static gboolean
handle_message_external_body (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelContentType *type;
const char *access_type;
@@ -2179,14 +2146,11 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type,
static gboolean
handle_via_bonobo (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
- if (! md->printing) {
- gtk_html_stream_printf (stream,
- "<object classid=\"%s\" type=\"%s\"></object>",
- get_cid (part, md), mime_type);
- }
-
+ gtk_html_stream_printf (md->stream,
+ "<object classid=\"%s\" type=\"%s\"></object>",
+ get_cid (part, md), mime_type);
return TRUE;
}
@@ -2228,7 +2192,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_from (message);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>From:</b> %s<br>",
citation, html);
g_free (html);
@@ -2238,7 +2202,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>To:</b> %s<br>",
citation, html);
g_free (html);
@@ -2248,7 +2212,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>Cc:</b> %s<br>",
citation, html);
g_free (html);
@@ -2265,7 +2229,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
date_val = camel_mime_message_get_date (message, &offset);
buf = header_format_date (date_val, offset);
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>Date:</b> %s<br>", citation, html);
g_free (html);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 13cd285f37..a0629ac093 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -30,8 +30,6 @@
/* #include <ctype.h> */
#include <errno.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-exec.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
#include <gal/util/e-unicode-i18n.h>
@@ -121,14 +119,13 @@ filter_folder_filter (struct _mail_msg *mm)
folder_uids = uids = camel_folder_get_uids (folder);
camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &mm->ex);
- camel_filter_driver_flush (m->driver, &mm->ex);
if (folder_uids)
camel_folder_free_uids (folder, folder_uids);
- /* sync our source folder */
+ /* sync and expunge */
if (!m->cache)
- camel_folder_sync (folder, FALSE, camel_exception_is_set (&mm->ex) ? NULL : &mm->ex);
+ camel_folder_sync (folder, TRUE, camel_exception_is_set (&mm->ex) ? NULL : &mm->ex);
camel_folder_thaw (folder);
if (m->destination)
@@ -178,8 +175,7 @@ static struct _mail_msg_op filter_folder_op = {
void
mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
- const char *type, gboolean notify,
- CamelOperation *cancel)
+ const char *type, CamelOperation *cancel)
{
struct _filter_mail_msg *m;
@@ -196,12 +192,6 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
m->driver = camel_session_get_filter_driver (session, type, NULL);
- if (!notify) {
- /* FIXME: have a #define NOTIFY_FILTER_NAME macro? */
- /* the filter name has to stay in sync with mail-session::get_filter_driver */
- camel_filter_driver_remove_rule_by_name (m->driver, "new-mail-notification");
- }
-
e_thread_put (mail_thread_new, (EMsg *)m);
}
@@ -209,7 +199,7 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
void
mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids)
{
- mail_filter_folder (folder, uids, FILTER_SOURCE_INCOMING, FALSE, NULL);
+ mail_filter_folder (folder, uids, FILTER_SOURCE_INCOMING, NULL);
}
/* ********************************************************************** */
@@ -427,42 +417,28 @@ mail_fetch_mail (const char *source, int keep, const char *type, CamelOperation
extern CamelFolder *sent_folder;
-static char *normal_recipients[] = {
- CAMEL_RECIPIENT_TYPE_TO,
- CAMEL_RECIPIENT_TYPE_CC,
- CAMEL_RECIPIENT_TYPE_BCC
-};
-
-static char *resent_recipients[] = {
- CAMEL_RECIPIENT_TYPE_RESENT_TO,
- CAMEL_RECIPIENT_TYPE_RESENT_CC,
- CAMEL_RECIPIENT_TYPE_RESENT_BCC
-};
-
/* send 1 message to a specific transport */
static void
mail_send_message (CamelMimeMessage *message, const char *destination,
CamelFilterDriver *driver, CamelException *ex)
{
- const CamelInternetAddress *iaddr;
- CamelAddress *from, *recipients;
CamelMessageInfo *info;
CamelTransport *xport = NULL;
char *transport_url = NULL;
char *sent_folder_uri = NULL;
- const char *resent_from;
CamelFolder *folder;
XEvolution *xev;
- int i;
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer",
+ camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer",
"Ximian Evolution " VERSION SUB_VERSION " " VERSION_COMMENT);
camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);
xev = mail_tool_remove_xevolution_headers (message);
- if (xev->account) {
+ if (xev->transport) {
+ transport_url = g_strstrip (g_strdup (xev->transport));
+ } else if (xev->account) {
const MailConfigAccount *account;
char *name;
@@ -472,8 +448,6 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
if (account && account->transport && account->transport->url)
transport_url = g_strdup (account->transport->url);
- } else if (xev->transport) {
- transport_url = g_strstrip (g_strdup (xev->transport));
}
if (xev->fcc)
@@ -488,27 +462,7 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
return;
}
- from = (CamelAddress *) camel_internet_address_new ();
- resent_from = camel_medium_get_header (CAMEL_MEDIUM (message), "Resent-From");
- if (resent_from) {
- camel_address_decode (from, resent_from);
- } else {
- iaddr = camel_mime_message_get_from (message);
- camel_address_copy (from, CAMEL_ADDRESS (iaddr));
- }
-
- recipients = (CamelAddress *) camel_internet_address_new ();
- for (i = 0; i < 3; i++) {
- const char *type;
-
- type = resent_from ? resent_recipients[i] : normal_recipients[i];
- iaddr = camel_mime_message_get_recipients (message, type);
- camel_address_cat (recipients, CAMEL_ADDRESS (iaddr));
- }
-
- camel_transport_send_to (xport, message, from, recipients, ex);
- camel_object_unref (CAMEL_OBJECT (recipients));
- camel_object_unref (CAMEL_OBJECT (from));
+ camel_transport_send (xport, CAMEL_MEDIUM (message), ex);
mail_tool_restore_xevolution_headers (message, xev);
mail_tool_destroy_xevolution (xev);
@@ -2216,57 +2170,3 @@ mail_store_set_offline (CamelStore *store, gboolean offline,
e_thread_put(mail_thread_queued, (EMsg *)m);
}
-
-
-/* ** Execute Shell Command ***************************************************** */
-
-struct _execute_shell_command_msg {
- struct _mail_msg msg;
-
- char *command;
-};
-
-static char *execute_shell_command_desc (struct _mail_msg *mm, int done)
-{
- struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm;
- char *msg;
-
- msg = g_strdup_printf (_("Executing shell command: %s"), m->command);
-
- return msg;
-}
-
-static void execute_shell_command_do (struct _mail_msg *mm)
-{
- struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm;
-
- gnome_execute_shell (NULL, m->command);
-}
-
-static void execute_shell_command_free (struct _mail_msg *mm)
-{
- struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm;
-
- g_free (m->command);
-}
-
-static struct _mail_msg_op execute_shell_command_op = {
- execute_shell_command_desc,
- execute_shell_command_do,
- NULL,
- execute_shell_command_free,
-};
-
-void
-mail_execute_shell_command (CamelFilterDriver *driver, const char *command, void *data)
-{
- struct _execute_shell_command_msg *m;
-
- if (command == NULL)
- return;
-
- m = mail_msg_new (&execute_shell_command_op, NULL, sizeof (*m));
- m->command = g_strdup (command);
-
- e_thread_put (mail_thread_queued, (EMsg *) m);
-}
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index bac7e17f46..baa4e108e4 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -78,6 +78,8 @@ struct _send_data {
CamelFolder *inbox; /* since we're never asked to update this one, do it ourselves */
time_t inbox_update;
+ CamelFolder *current_folder;
+
GMutex *lock;
GHashTable *folders;
@@ -177,7 +179,10 @@ free_send_data(void)
/*camel_folder_thaw (data->inbox); */
camel_object_unref((CamelObject *)data->inbox);
}
-
+ if (data->current_folder) {
+ mail_refresh_folder(data->current_folder, NULL, NULL);
+ camel_object_unref((CamelObject *)data->current_folder);
+ }
g_list_free(data->infos);
g_hash_table_foreach(data->active, (GHFunc)free_send_info, NULL);
g_hash_table_destroy(data->active);
@@ -269,7 +274,7 @@ static send_info_t get_receive_type(const char *url)
}
static struct _send_data *
-build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
+build_dialogue (GSList *sources, CamelFolder *current_folder, CamelFolder *outbox, const char *destination)
{
GnomeDialog *gd;
GtkTable *table;
@@ -428,6 +433,8 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
data->infos = list;
data->gd = gd;
+ data->current_folder = current_folder;
+ camel_object_ref (CAMEL_OBJECT (current_folder));
return data;
}
@@ -609,12 +616,6 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep
}
static void
-receive_update_got_folderinfo (CamelStore *store, CamelFolderInfo *info, void *data)
-{
- receive_done ("", data);
-}
-
-static void
receive_update_got_store (char *uri, CamelStore *store, void *data)
{
struct _send_info *info = data;
@@ -622,23 +623,13 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
if (store) {
EvolutionStorage *storage = mail_lookup_storage (store);
- if (storage) {
- mail_note_store(store, storage, CORBA_OBJECT_NIL, receive_update_done, info);
- /*bonobo_object_unref (BONOBO_OBJECT (storage));*/
- } else {
- /* If we get here, store must be an external
- * storage other than /local. (Eg, Exchange).
- * Do a get_folder_info just to force it to
- * update itself.
- */
- mail_get_folderinfo(store, receive_update_got_folderinfo, info);
- }
+ mail_note_store(store, storage, CORBA_OBJECT_NIL, receive_update_done, info);
} else {
receive_done ("", info);
}
}
-void mail_send_receive (void)
+void mail_send_receive (CamelFolder *current_folder)
{
GSList *sources;
GList *scan;
@@ -665,7 +656,7 @@ void mail_send_receive (void)
Well, probably hook into receive_done or receive_status on
the right pop account, and when it is, then kick off the
smtp one. */
- data = build_dialogue(sources, outbox_folder, account->transport->url);
+ data = build_dialogue(sources, current_folder, outbox_folder, account->transport->url);
scan = data->infos;
while (scan) {
struct _send_info *info = scan->data;
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index 7d43d610fb..19afea853b 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -31,7 +31,7 @@ extern "C" {
#include "mail-config.h"
/* send/receive all uri's */
-void mail_send_receive(void);
+void mail_send_receive(CamelFolder *current_folder);
/* receive a single uri */
void mail_receive_uri(const char *uri, int keep);
/* setup auto receive stuff */
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index ba1de929dd..d80b3c04fa 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -237,7 +237,6 @@ mail_tool_destroy_xevolution (XEvolution *xev)
g_free (xev->source);
g_free (xev->transport);
g_free (xev->account);
- g_free (xev->format);
g_free (xev->fcc);
g_free (xev);
}
@@ -340,15 +339,11 @@ mail_tool_quote_message (CamelMimeMessage *message, const char *fmt, ...)
gboolean want_plain;
gchar *text;
+ want_plain = !mail_config_get_send_html ();
contents = camel_medium_get_content_object (CAMEL_MEDIUM (message));
/* We pass "want_plain" for "cite", since if it's HTML, we'll
* do the citing ourself below.
*/
- /* FIXME the citing logic has changed and we basically never want_plain
- * to be true now, but I don't want to remove all that logic until I
- * am sure --Larry
- */
- want_plain = FALSE;
text = mail_get_message_body (contents, want_plain, want_plain);
/* Set the quoted reply text. */
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 0c2ee4e2f7..44d0556fee 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -919,12 +919,11 @@ vfolder_gui_add_from_message(CamelMimeMessage *msg, int flags, const char *sourc
}
void
-vfolder_gui_add_from_mlist(const char *mlist, const char *source)
+vfolder_gui_add_from_mlist(CamelMimeMessage *msg, const char *mlist, const char *source)
{
VfolderRule *rule;
- g_return_if_fail (mlist != NULL);
- g_return_if_fail (source != NULL);
+ g_return_if_fail (msg != NULL);
rule = (VfolderRule*)vfolder_rule_from_mlist(context, mlist, source);
vfolder_gui_add_rule(rule);
diff --git a/mail/main.c b/mail/main.c
index d6c2e7ffcb..10497a145d 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -14,7 +14,6 @@
#include <signal.h>
#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-sound.h>
#include <libgnomeui/gnome-init.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object-directory.h>
@@ -104,7 +103,7 @@ main (int argc, char *argv [])
gnome_init_with_popt_table ("evolution-mail-component", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
-
+
sigaction (SIGSEGV, NULL, &osa);
if (osa.sa_handler != SIG_DFL) {
sa.sa_flags = 0;
@@ -145,8 +144,6 @@ main (int argc, char *argv [])
mail_config_init ();
mail_msg_init ();
- gnome_sound_init ("localhost");
-
component_factory_init ();
evolution_composer_factory_init (composer_send_cb,
composer_postpone_cb);
@@ -156,8 +153,6 @@ main (int argc, char *argv [])
gdk_threads_mutex = NULL;
}
- g_print ("Evolution Mail ready and running.\n");
-
GDK_THREADS_ENTER ();
bonobo_main ();
@@ -168,8 +163,6 @@ main (int argc, char *argv [])
mail_config_write_on_exit ();
e_passwords_shutdown ();
-
- gnome_sound_shutdown ();
-
+
return 0;
}
diff --git a/mail/message-list.c b/mail/message-list.c
index 79f24f14a8..6aead391f3 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -44,8 +44,6 @@
#include "mail-ops.h"
#include "Mail.h"
-#include "message-tag-followup.h"
-
#include "art/mail-new.xpm"
#include "art/mail-read.xpm"
#include "art/mail-replied.xpm"
@@ -59,7 +57,6 @@
#include "art/score-high.xpm"
#include "art/score-higher.xpm"
#include "art/score-highest.xpm"
-#include "art/flag-for-followup.xpm"
/*#define TIMEIT */
@@ -153,7 +150,6 @@ static struct {
{ score_high_xpm, NULL },
{ score_higher_xpm, NULL },
{ score_highest_xpm, NULL },
- { flag_for_followup_xpm,NULL },
{ NULL, NULL }
};
@@ -261,7 +257,7 @@ address_compare (gconstpointer address1, gconstpointer address2)
#ifdef SMART_ADDRESS_COMPARE
EMailAddress *addr1, *addr2;
#endif /* SMART_ADDRESS_COMPARE */
- gint retval;
+ int retval;
g_return_val_if_fail (address1 != NULL, 1);
g_return_val_if_fail (address2 != NULL, -1);
@@ -361,30 +357,6 @@ get_message_info (MessageList *message_list, ETreePath node)
return info;
}
-struct search_func_data {
- MessageList *message_list;
- guint32 flags;
- guint32 mask;
-};
-
-static gboolean
-search_func (ETreeModel *model, ETreePath path, struct search_func_data *data)
-{
- CamelMessageInfo *info;
-
- if (e_tree_model_node_is_root (data->message_list->model, path))
- return FALSE;
-
- info = get_message_info (data->message_list, path);
-
- if (info && (info->flags & data->mask) == data->flags) {
- gtk_signal_emit (GTK_OBJECT (data->message_list), message_list_signals[MESSAGE_SELECTED],
- camel_message_info_uid (info));
- return TRUE;
- }
- return FALSE;
-}
-
/**
* message_list_select:
* @message_list: a MessageList
@@ -403,32 +375,90 @@ search_func (ETreeModel *model, ETreePath path, struct search_func_data *data)
* message, or %MESSAGE_LIST_SELECT_PREVIOUS if it should find the
* previous. If no suitable row is found, the selection will be
* unchanged.
- *
- * Returns %TRUE if a new message has been selected or %FALSE otherwise.
**/
-gboolean
+void
message_list_select (MessageList *message_list,
+ int base_row,
MessageListSelectDirection direction,
guint32 flags,
guint32 mask,
gboolean wraparound)
{
- struct search_func_data data;
- ETreeFindNextParams params = 0;
+ CamelMessageInfo *info;
+ int vrow, last;
- data.message_list = message_list;
- data.flags = flags;
- data.mask = mask;
+ if (!GTK_WIDGET_HAS_FOCUS (message_list))
+ gtk_widget_grab_focus (GTK_WIDGET (message_list));
- if (direction == MESSAGE_LIST_SELECT_NEXT)
- params |= E_TREE_FIND_NEXT_FORWARD;
+ switch (direction) {
+ case MESSAGE_LIST_SELECT_PREVIOUS:
+ last = -1;
+ break;
+ case MESSAGE_LIST_SELECT_NEXT:
+ last = e_tree_row_count (message_list->tree);
+ if (last <= base_row)
+ return;
+ break;
+ default:
+ g_warning("Invalid argument to message_list_select");
+ return;
+ }
+
+ /* If it's -1, we want the last view row, not the last model row. */
+ /* model_to_view_row etc simply dont work for sorted views. Sigh. */
+ if (base_row == -1)
+ vrow = e_tree_row_count (message_list->tree) - 1;
else
- params |= E_TREE_FIND_NEXT_BACKWARD;
+ vrow = e_tree_model_to_view_row (message_list->tree, base_row);
+
+ if (vrow <= -1)
+ return;
+
+ /* This means that we'll move at least one message in 'direction'. */
+ if (vrow != last)
+ vrow += direction;
- if (wraparound)
- params |= E_TREE_FIND_NEXT_WRAP;
+ /* We don't know whether to use < or > due to "direction" */
+ while (vrow != last) {
+ ETreePath node = e_tree_node_at_row (message_list->tree, vrow);
+
+ info = get_message_info (message_list, node);
+
+ if (info && (info->flags & mask) == flags) {
+ e_tree_set_cursor (message_list->tree, node);
+
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
+ camel_message_info_uid (info));
+ return;
+ }
+ vrow += direction;
+ }
- return e_tree_find_next (message_list->tree, params, (ETreePathFunc) search_func, &data);
+ if (wraparound) {
+ ETreePath node;
+
+ if (direction == MESSAGE_LIST_SELECT_NEXT) {
+ base_row = 0;
+ vrow = 0;
+ } else {
+ base_row = -1;
+ vrow = e_tree_row_count (message_list->tree) - 1;
+ }
+
+ /* lets see if the first/last (depending on direction)
+ row matches our selection criteria */
+ node = e_tree_node_at_row (message_list->tree, vrow);
+ info = get_message_info (message_list, node);
+ if (info && (info->flags & mask) == flags) {
+ e_tree_set_cursor (message_list->tree, node);
+
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
+ camel_message_info_uid (info));
+ return;
+ }
+
+ message_list_select (message_list, base_row, direction, flags, mask, FALSE);
+ }
}
@@ -463,40 +493,6 @@ message_list_select_uid (MessageList *message_list, const char *uid)
}
}
-
-void
-message_list_select_next_thread (MessageList *message_list)
-{
- ETreePath node, last;
-
- if (!message_list->cursor_uid)
- return;
-
- /* get the thread parent node */
- last = node = g_hash_table_lookup (message_list->uid_nodemap, message_list->cursor_uid);
- while (!e_tree_model_node_is_root (message_list->model, node)) {
- last = node;
- node = e_tree_model_node_get_parent (message_list->model, node);
- }
-
- /* get the next toplevel node */
- node = e_tree_model_node_get_next (message_list->model, last);
-
- if (node) {
- CamelMessageInfo *info;
-
- info = get_message_info (message_list, node);
- e_tree_set_cursor (message_list->tree, node);
-
- g_free (message_list->cursor_uid);
- message_list->cursor_uid = g_strdup (camel_message_info_uid (info));
-
- gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
- camel_message_info_uid (info));
- }
-}
-
-
/*
* SimpleTableModel::col_count
*/
@@ -567,16 +563,13 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
return (void *) value;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
return g_strdup (value);
-
+
default:
g_assert_not_reached ();
}
@@ -596,14 +589,11 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
break;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
g_free (value);
break;
default:
@@ -624,15 +614,12 @@ ml_initialize_value (ETreeModel *etm, int col, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
return NULL;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
- return g_strdup ("");
+ return g_strdup("");
default:
g_assert_not_reached ();
}
@@ -653,14 +640,11 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
return value == NULL;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
return !(value && *(char *)value);
default:
g_assert_not_reached ();
@@ -686,44 +670,40 @@ static const char *score_map[] = {
N_("Highest"),
};
-
static char *
ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data)
{
unsigned int i;
-
+
switch (col){
case COL_MESSAGE_STATUS:
i = (unsigned int)value;
if (i > 4)
- return g_strdup ("");
- return g_strdup (_(status_map[i]));
-
+ return g_strdup("");
+ return g_strdup(_(status_map[i]));
+
case COL_SCORE:
- i = (unsigned int) value + 3;
+ i = (unsigned int)value + 3;
if (i > 6)
i = 3;
- return g_strdup (_(score_map[i]));
+ return g_strdup(_(score_map[i]));
case COL_ATTACHMENT:
case COL_FLAGGED:
case COL_DELETED:
case COL_UNREAD:
- case COL_FOLLOWUP_FLAG_STATUS:
- return g_strdup_printf ("%d", (int) value);
+ return g_strdup_printf("%d", (int) value);
case COL_SENT:
case COL_RECEIVED:
- case COL_FOLLOWUP_DUE_BY:
- return filter_date (GPOINTER_TO_INT (value));
+ return filter_date (GPOINTER_TO_INT(value));
case COL_SIZE:
- return filter_size (GPOINTER_TO_INT (value));
-
+ return filter_size (GPOINTER_TO_INT(value));
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
return g_strdup (value);
default:
g_assert_not_reached ();
@@ -744,14 +724,14 @@ subtree_unread(MessageList *ml, ETreePath node)
{
CamelMessageInfo *info;
ETreePath child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
if (!(info->flags & CAMEL_MESSAGE_SEEN))
return TRUE;
-
+
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
if (subtree_unread(ml, child))
return TRUE;
@@ -766,15 +746,15 @@ subtree_size(MessageList *ml, ETreePath node)
CamelMessageInfo *info;
int size = 0;
ETreePath child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
size += info->size;
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
size += subtree_size(ml, child);
-
+
node = e_tree_model_node_get_next (ml->model, node);
}
return size;
@@ -786,28 +766,28 @@ subtree_earliest(MessageList *ml, ETreePath node, int sent)
CamelMessageInfo *info;
time_t earliest = 0, date;
ETreePath *child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
if (sent)
date = info->date_sent;
else
date = info->date_received;
-
+
if (earliest == 0 || date < earliest)
earliest = date;
-
+
if ((child = e_tree_model_node_get_first_child (ml->model, node))) {
date = subtree_earliest(ml, child, sent);
if (earliest == 0 || (date != 0 && date < earliest))
earliest = date;
}
-
+
node = e_tree_model_node_get_next (ml->model, node);
}
-
+
return earliest;
}
@@ -816,15 +796,15 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
{
MessageList *message_list = model_data;
CamelMessageInfo *msg_info;
-
+
/* retrieve the message information array */
msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path);
g_assert(msg_info);
-
+
switch (col){
case COL_MESSAGE_STATUS: {
ETreePath child;
-
+
/* if a tree is collapsed, then scan its insides for details */
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)) {
@@ -833,7 +813,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
else
return (void *)4;
}
-
+
if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
return GINT_TO_POINTER (2);
else if (msg_info->flags & CAMEL_MESSAGE_SEEN)
@@ -854,46 +834,6 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER (score);
}
- case COL_FOLLOWUP_FLAG_STATUS: {
- const char *tag;
-
- tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (tag)
- return GINT_TO_POINTER (TRUE);
- else
- return GINT_TO_POINTER (FALSE);
- }
- case COL_FOLLOWUP_DUE_BY: {
- struct _FollowUpTag *tag;
- const char *tag_value;
- time_t due_by;
-
- tag_value = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (tag_value) {
- tag = message_tag_followup_decode (tag_value);
- due_by = tag->target_date;
- g_free (tag);
- return GINT_TO_POINTER (due_by);
- } else {
- return GINT_TO_POINTER (0);
- }
- }
- case COL_FOLLOWUP_FLAG: {
- struct _FollowUpTag *tag;
- const char *tag_value;
- int flag_type;
-
- tag_value = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (tag_value) {
- tag = message_tag_followup_decode (tag_value);
- flag_type = tag ? tag->type : FOLLOWUP_FLAG_NONE;
- g_free (tag);
-
- return (void *) message_tag_followup_i18n_name (flag_type);
- } else {
- return NULL;
- }
- }
case COL_ATTACHMENT:
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
case COL_FROM:
@@ -912,40 +852,29 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0);
case COL_UNREAD: {
ETreePath child;
-
+
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)
&& (msg_info->flags & CAMEL_MESSAGE_SEEN)) {
return GINT_TO_POINTER (subtree_unread (message_list, child));
}
-
+
return GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN));
}
case COL_COLOUR: {
- const char *colour, *followup;
-
+ const char *colour;
+
colour = camel_tag_get ((CamelTag **) &msg_info->user_tags, "colour");
- followup = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED) {
+ if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED)
/* FIXME: extract from the xpm somehow. */
colour = "#A7453E";
- } else if (followup != NULL) {
- struct _FollowUpTag *tag;
- time_t now = time (NULL);
-
- tag = message_tag_followup_decode (followup);
- if (tag && now >= tag->target_date) {
- /* FIXME: extract from the xpm somehow. */
- colour = "#A7453E";
- }
- g_free (tag);
- }
return (void *)colour;
}
- default:
- g_assert_not_reached ();
- return NULL;
}
+
+ g_assert_not_reached ();
+
+ return NULL;
}
static void
@@ -986,10 +915,10 @@ filter_date (time_t date)
struct tm then, now, yesterday;
char buf[26];
gboolean done = FALSE;
-
+
if (date == 0)
return g_strdup (_("?"));
-
+
localtime_r (&date, &then);
localtime_r (&nowdate, &now);
if (then.tm_mday == now.tm_mday &&
@@ -1047,37 +976,33 @@ message_list_create_extras (void)
GdkPixbuf *images [7];
ETableExtras *extras;
ECell *cell;
+
+ extras = e_table_extras_new();
+ e_table_extras_add_pixbuf(extras, "status", states_pixmaps [0].pixbuf);
+ e_table_extras_add_pixbuf(extras, "score", states_pixmaps [13].pixbuf);
+ e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [6].pixbuf);
+ e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [7].pixbuf);
- extras = e_table_extras_new ();
- e_table_extras_add_pixbuf (extras, "status", states_pixmaps [0].pixbuf);
- e_table_extras_add_pixbuf (extras, "score", states_pixmaps [13].pixbuf);
- e_table_extras_add_pixbuf (extras, "attachment", states_pixmaps [6].pixbuf);
- e_table_extras_add_pixbuf (extras, "flagged", states_pixmaps [7].pixbuf);
- e_table_extras_add_pixbuf (extras, "followup", states_pixmaps [15].pixbuf);
-
- e_table_extras_add_compare (extras, "address_compare", address_compare);
- e_table_extras_add_compare (extras, "subject_compare", subject_compare);
+ e_table_extras_add_compare(extras, "address_compare", address_compare);
+ e_table_extras_add_compare(extras, "subject_compare", subject_compare);
for (i = 0; i < 5; i++)
images [i] = states_pixmaps [i].pixbuf;
-
- e_table_extras_add_cell (extras, "render_message_status", e_cell_toggle_new (0, 5, images));
-
+
+ e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 5, images));
+
for (i = 0; i < 2; i++)
images [i] = states_pixmaps [i + 5].pixbuf;
- e_table_extras_add_cell (extras, "render_attachment", e_cell_toggle_new (0, 2, images));
+ e_table_extras_add_cell(extras, "render_attachment", e_cell_toggle_new (0, 2, images));
images [1] = states_pixmaps [7].pixbuf;
- e_table_extras_add_cell (extras, "render_flagged", e_cell_toggle_new (0, 2, images));
-
- images[1] = states_pixmaps [15].pixbuf;
- e_table_extras_add_cell (extras, "render_flag_status", e_cell_toggle_new (0, 2, images));
-
+ e_table_extras_add_cell(extras, "render_flagged", e_cell_toggle_new (0, 2, images));
+
for (i = 0; i < 7; i++)
images[i] = states_pixmaps [i + 7].pixbuf;
- e_table_extras_add_cell (extras, "render_score", e_cell_toggle_new (0, 7, images));
+ e_table_extras_add_cell(extras, "render_score", e_cell_toggle_new (0, 7, images));
/* date cell */
cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1085,7 +1010,7 @@ message_list_create_extras (void)
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell (extras, "render_date", cell);
+ e_table_extras_add_cell(extras, "render_date", cell);
/* text cell */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1093,20 +1018,20 @@ message_list_create_extras (void)
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell (extras, "render_text", cell);
-
- e_table_extras_add_cell (extras, "render_tree",
- e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */
- TRUE, cell));
+ e_table_extras_add_cell(extras, "render_text", cell);
+ e_table_extras_add_cell(extras, "render_tree",
+ e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */
+ TRUE, cell));
+
/* size cell */
cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT);
gtk_object_set (GTK_OBJECT (cell),
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell (extras, "render_size", cell);
-
+ e_table_extras_add_cell(extras, "render_size", cell);
+
return extras;
}
@@ -1118,14 +1043,26 @@ save_tree_state(MessageList *ml)
if (ml->folder == NULL || ml->tree == NULL)
return;
+ filename = mail_config_folder_to_cachename(ml->folder, "et-header-");
+ e_tree_save_state(ml->tree, filename);
+ g_free(filename);
+
filename = mail_config_folder_to_cachename(ml->folder, "et-expanded-");
e_tree_save_expanded_state(ml->tree, filename);
g_free(filename);
}
+static void
+sort_info_changed (GtkWidget *widget, MessageList *ml)
+{
+ save_tree_state(ml);
+}
+
static void
message_list_setup_etree (MessageList *message_list, gboolean outgoing)
{
+ ETableState *etstate;
+
/* build the spec based on the folder, and possibly from a saved file */
/* otherwise, leave default */
if (message_list->folder) {
@@ -1140,6 +1077,21 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing)
name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE);
d(printf ("folder name is '%s'\n", name));
+ path = mail_config_folder_to_cachename (message_list->folder, "et-header-");
+ if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
+ /* build based on saved file */
+ e_tree_load_state (message_list->tree, path);
+ } else if (outgoing) {
+ /* Swap From/To for Drafts, Sent, Outbox */
+ char *state = "<ETableState>"
+ "<column source=\"0\"/> <column source=\"1\"/> "
+ "<column source=\"8\"/> <column source=\"5\"/> "
+ "<column source=\"6\"/> <grouping> </grouping> </ETableState>";
+
+ e_tree_set_state (message_list->tree, state);
+ }
+ g_free (path);
+
path = mail_config_folder_to_cachename (message_list->folder, "et-expanded-");
if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
/* build based on saved file */
@@ -1148,6 +1100,18 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing)
g_free (path);
g_free (name);
+
+ etstate = e_tree_get_state_object (message_list->tree);
+ gtk_signal_connect (GTK_OBJECT (etstate->sort_info),
+ "sort_info_changed",
+ GTK_SIGNAL_FUNC (sort_info_changed),
+ message_list);
+ gtk_signal_connect (GTK_OBJECT (etstate->sort_info),
+ "group_info_changed",
+ GTK_SIGNAL_FUNC (sort_info_changed),
+ message_list);
+
+ gtk_object_unref (GTK_OBJECT (etstate));
}
}
@@ -1256,7 +1220,6 @@ message_list_class_init (GtkObjectClass *object_class)
static void
message_list_construct (MessageList *message_list)
{
- gboolean construct_failed;
message_list->model =
e_tree_memory_callbacks_new (ml_tree_icon_at,
@@ -1288,16 +1251,14 @@ message_list_construct (MessageList *message_list)
* The etree
*/
message_list->extras = message_list_create_extras ();
- construct_failed = (e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list),
- message_list->model,
- message_list->extras,
- EVOLUTION_ETSPECDIR "/message-list.etspec",
- NULL)
- == NULL);
-
+ e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list),
+ message_list->model,
+ message_list->extras,
+ EVOLUTION_ETSPECDIR "/message-list.etspec",
+ NULL);
+
message_list->tree = e_tree_scrolled_get_tree(E_TREE_SCROLLED (message_list));
- if (!construct_failed)
- e_tree_root_node_set_visible (message_list->tree, FALSE);
+ e_tree_root_node_set_visible (message_list->tree, FALSE);
gtk_signal_connect (GTK_OBJECT (message_list->tree), "cursor_activated",
GTK_SIGNAL_FUNC (on_cursor_activated_cmd),
@@ -1491,6 +1452,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c
diff -= start.tv_sec * 1000 + start.tv_usec/1000;
printf("Building tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000);
#endif
+
}
/* this is about 20% faster than build_subtree_diff,
@@ -2076,9 +2038,9 @@ on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_dat
static gint
on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list)
{
- CamelMessageInfo *info;
int flag;
-
+ CamelMessageInfo *info;
+
if (col == COL_MESSAGE_STATUS)
flag = CAMEL_MESSAGE_SEEN;
else if (col == COL_FLAGGED)
@@ -2092,12 +2054,12 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess
}
/* If a message was marked as deleted and the user flags it as
- important, marks it as needing a reply, marks it as unread,
- then undelete the message. */
- if (info->flags & CAMEL_MESSAGE_DELETED) {
+ important or marks it as unread, undelete it. */
+ if (info->flags & CAMEL_MESSAGE_DELETED) {
+
if (col == COL_FLAGGED && !(info->flags & CAMEL_MESSAGE_FLAGGED))
flag |= CAMEL_MESSAGE_DELETED;
-
+
if (col == COL_MESSAGE_STATUS && (info->flags & CAMEL_MESSAGE_SEEN))
flag |= CAMEL_MESSAGE_DELETED;
}
@@ -2601,5 +2563,5 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
m->folder = ml->folder;
camel_object_ref (CAMEL_OBJECT (m->folder));
- e_thread_put (mail_thread_queued, (EMsg *)m);
+ e_thread_put (mail_thread_new, (EMsg *)m);
}