aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/.cvsignore20
-rw-r--r--composer/ChangeLog1415
-rw-r--r--composer/Composer.idl4
-rw-r--r--composer/Evolution-Composer.idl96
-rw-r--r--composer/Makefile.am89
-rw-r--r--composer/bad-icon.xpm53
-rw-r--r--composer/e-icon-list.c2667
-rw-r--r--composer/e-icon-list.h178
-rw-r--r--composer/e-msg-composer-attachment-bar.c800
-rw-r--r--composer/e-msg-composer-attachment-bar.h76
-rw-r--r--composer/e-msg-composer-attachment.c451
-rw-r--r--composer/e-msg-composer-attachment.glade332
-rw-r--r--composer/e-msg-composer-attachment.h75
-rw-r--r--composer/e-msg-composer-hdrs.c816
-rw-r--r--composer/e-msg-composer-hdrs.h101
-rw-r--r--composer/e-msg-composer-select-file.c173
-rw-r--r--composer/e-msg-composer-select-file.h32
-rw-r--r--composer/e-msg-composer.c2369
-rw-r--r--composer/e-msg-composer.h141
-rw-r--r--composer/evolution-composer.c373
-rw-r--r--composer/evolution-composer.h70
-rw-r--r--composer/listener.c225
-rw-r--r--composer/listener.h56
23 files changed, 0 insertions, 10612 deletions
diff --git a/composer/.cvsignore b/composer/.cvsignore
deleted file mode 100644
index ec7a9d7288..0000000000
--- a/composer/.cvsignore
+++ /dev/null
@@ -1,20 +0,0 @@
-.deps
-.libs
-evolution-msg-composer
-Makefile
-Makefile.in
-*.lo
-*.la
-Composer-stubs.c
-Composer-skels.c
-Composer-common.c
-Composer.h
-Editor-stubs.c
-Editor-skels.c
-Editor.h
-Editor-common.c
-Evolution-Addressbook-SelectNames-common.c
-Evolution-Addressbook-SelectNames-skels.c
-Evolution-Addressbook-SelectNames-stubs.c
-Evolution-Addressbook-SelectNames.h
-HTMLEditor*.[ch]
diff --git a/composer/ChangeLog b/composer/ChangeLog
deleted file mode 100644
index d3aad74928..0000000000
--- a/composer/ChangeLog
+++ /dev/null
@@ -1,1415 +0,0 @@
-2001-02-27 Dan Winship <danw@ximian.com>
-
- * evolution-composer.c (factory_fn): If
- !mail_config_is_configured(), give an error and return NULL.
-
-2001-02-22 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (INCLUDES): Add `-I$(top_srcdir)/shell'.
-
-2001-02-21 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer.c (menu_file_save_draft_cb):
- (exit_dialog_cb): Use mail_append_mail to save to drafts instead
- of custom thread handler.
-
-2001-02-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (build_message): Handle exceptions a little
- nicer and pop up a nice GnomeDialog with the error message - also,
- don't return a CamelMimeMessage if it fails to sign/decrypt
- because we want to let the user decide what to do based on the
- error message he/she gets.
-
-2001-02-15 Dan Winship <danw@ximian.com>
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_from_account): If
- @account_name is NULL, pick the default account rather than giving
- a g_warning.
-
- * e-msg-composer.c (e_msg_composer_set_headers): Note in the
- doc comment that @from can be NULL if you want the default account
- (since there is code that expects this).
-
-2001-02-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * evolution-composer.c (corba_recipientlist_to_glist): Use the
- camel-internet-address code to format the address rather than
- doing it the broken way.
-
-2001-02-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * evolution-composer.c (impl_Composer_set_headers): Updated. We
- might want to change the corba interface for this to allow setting
- the from-address as well.
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Updated.
- (e_msg_composer_set_headers): Now takes a 'From' argument so that
- we can try to pre-determine the account the user will want to send
- from.
-
-2001-02-11 Gediminas Paulauskas <menesis@delfi.lt>
-
- * e-msg-composer-attachment.glade.h: removed.
- * e-msg-composer-attachment.glade: do not write strings to above.
- * Makefile.am: don't include glade.h in EXTRA_DIST.
-
-2001-02-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart):
- multipart/* is another mime type we DO NOT want to encode ;-)
-
-2001-02-06 Christopher James Lahey <clahey@ximian.com>
-
- * e-msg-composer-hdrs.c (address_button_clicked_cb, add_header):
- Set the default argument to
- GNOME_Evolution_Addressbook_SelectNames_activateDialog correctly.
-
-2001-01-30 Larry Ewing <lewing@ximian.com>
-
- * e-msg-composer-hdrs.c (create_optionmenu): make sure we convert
- from utf-8 before creating the option menu items.
-
-2001-01-25 Jason Leach <jasonleach@usa.net>
-
- (Moving the flag for has_changed from the Hdrs to the Composer
- itself. Providing public methods to set/unset a composer as
- changed. Adding attachments now flags the composer as changed)
-
- * e-msg-composer.c (e_msg_composer_unset_changed): New function.
- (e_msg_composer_set_changed): New function.
-
- * e-msg-composer.c (hdrs_changed_cb): Callback to the new signal,
- uses the new composer_set_changed.
- (attachment_bar_changed_cb): Add a call to the new
- composer_set_changed.
-
- * e-msg-composer-hdrs.c (class_init): New signal "hdrs_changed" to
- tell the parent composer that any of the headers have changed.
- (addressbook_entry_changed): emit the new signal here.
- (entry_changed): And here.
-
-2001-01-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (menu_security_pgp_encrypt_cb): New callback.
- (menu_security_pgp_sign_cb): Another new callback.
- (setup_ui): Added initialization for the PGP sign and encrypt
- bonobo menu items.
- (e_msg_composer_set_pgp_encrypt): Change the Bonobo UI name to
- SecurityPGPEncrypt.
- (e_msg_composer_set_pgp_sign): Change the Bonobo UI name to
- SecurityPGPSign.
-
-2001-01-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (build_message): Fixed some memory leaks
- dealing with content-type temp strings. Also implemented code to
- sign and/or encrypt the message if the user has specified that it
- should.
-
-2001-01-20 Jason Leach <jasonleach@usa.net>
-
- (Fix #1222: doing File->New->Mail Message doesn't include .sig)
-
- * evolution-composer.c (init): Get the users account information,
- see if they've specified a sig file, if they do, create a composer
- with that sig.
-
-2001-01-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-hdrs.c (create_optionmenu): Use "Full Name
- <address>" for the label in the menu rather than the account
- name. Specify the account name only if it's not the same as the
- address.
-
-2001-01-19 Jason Leach <jasonleach@usa.net>
-
- * e-msg-composer-hdrs.c (create_addressbook_entry): Listen for
- property bag changes to "entry_changed" on here, which means on
- the To, Cc, and Bcc entries.
- (addressbook_entry_changed): New function that gets called when
- "entry_changed" property is changed (to TRUE).
-
-2001-01-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (build_message): Updated to reflect changes to
- e_msg_composer_hdrs_get_from().
-
- * e-msg-composer-hdrs.c (set_recipients): Don't do anymore utf8
- conversions, the widget already does this (or should unless there
- is brokenness).
- (e_msg_composer_hdrs_get_from): Return a CamelInternetAddress like
- we should.
- (e_msg_composer_hdrs_to_message): Update to reflect changes made
- the the above function.
-
-2001-01-12 Miguel de Icaza <miguel@gnu.org>
-
- * Makefile.am: Make the composer a standard library, not a libtool
- one. Nobody ever uses it as a shared library and it is not
- installed.
-
-2001-01-17 Jason Leach <jasonleach@usa.net>
-
- (Bug #1192: Set the Composer window title to something useful)
-
- * e-msg-composer.c (e_msg_composer_construct): Connect up the new
- signal here.
- (subject_changed_cb): Set the composer window title to the subject
- as it's changed, or if it goes blank make it the default "Compose
- a message".
-
- * e-msg-composer-hdrs.c (class_init): Create a new signal
- "subject_changed".
- (entry_changed): Emit the signal here when the subject entry is
- changed.
-
-2001-01-17 Iain Holmes <iain@ximian.com>
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
- Get the option menu from the XML file.
- (ok_cb): Set the attachment disposition depending on the option
- menu results.
- (option_menu_get_history): Really should have been in GTK at some
- point.
-
- * e-msg-composer-attachment.glade: Add the option menu.
-
-2001-01-17 Michael Meeks <michael@helixcode.com>
-
- * evolution-composer.c (enum_objects): comment out for now
- to ease compat issues.
- (evolution_composer_construct): pass in NULL for the item
- handler enum_objects fn + calm warning.
-
-2001-01-17 JP Rosevear <jpr@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Use the
- to/cc/bcc addresses insted of just the to.
-
-2001-01-17 Federico Mena Quintero <federico@ximian.com>
-
- * e-icon-list.[ch]: Ximianified email addresses.
-
-2001-01-16 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_mark_text_orig): publicate
- mark_orig_text
- (set_editor_text): don't call mark_orig_text, let it for reply
-
-2001-01-15 Jason Leach <jasonleach@usa.net>
-
- (Plug leaking the subject string on each message sent)
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_subject): Don't
- strdup before returning the subject, it's already been strdup'd
- from the gtk_object_get().
-
-2001-01-13 Jason Leach <jasonleach@usa.net>
-
- (Fix Bug #1083: Composer IDLs not getting installed)
-
- * Makefile.am: add @idl and @idl_DATA vars.
-
-2001-01-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-hdrs.c (create_optionmenu): Oops. Make sure to
- attach the item to the menu ;-)
-
-2001-01-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (build_message): Call set_from_account which
- means we no longer have to do all the crap involved in formatting
- strings into an internet-address.
- (e_msg_composer_get_preferred_account): New access function.
-
- * e-msg-composer-hdrs.c (add_header): case COMBOBOX has changed to
- OPTIOMENU.
- (create_optionmenu): Update to use an optionmenu of accounts.
- (from_changed): New callback for the From optionmenu.
- (setup_headers): s/COMBOBOX/OPTIONMENU
- (init): Set the account and from_options to NULL.
- (e_msg_composer_hdrs_get_from): Updated.
- (destroy): free the from_options.
- (e_msg_composer_hdrs_set_from_address): Renamed from set_from
- because it no longer takes a string arg but rather an account arg.
-
-2001-01-12 Miguel de Icaza <miguel@ximian.com>
-
- * e-msg-composer-hdrs.c (add_header): Only attach to "changed" if
- the widget is an EEntry. The HEADER_COMBOBOX and the
- HEADER_ADDRBOOK are a ComboBox and a remote Bonobo control
- respectively.
-
- * evolution-composer.c (get_object): Move getObject functionality
- here from e-msg-composer.c
-
-2001-01-11 Miguel de Icaza <miguel@ximian.com>
-
- * e-msg-composer-hdrs.c (create_dropdown_entry): Only set the
- popdown strings if we have anything to popdown.
-
-2001-01-10 Miguel de Icaza <miguel@helixcode.com>
-
- * evolution-composer.c (evolution_composer_construct): Add an
- ItemContainer Bonobo interface to allow client applications to
- locate the Message Composer component.
-
-2001-01-11 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (menu_file_save_draft_cb): New callback to save
- draft. Fixes bug #1045.
-
-2001-01-10 Miguel de Icaza <miguel@helixcode.com>
-
- * e-msg-composer.c: Removed more UNSAFE stuff. Maybe we should
- kill this macro, and have people that want these broken things
- define their own macros.
- (setup_item_container): Add an ItemContainer bonobo interface to
- handle options to the window component.
-
-2001-01-08 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (create_dropdown_entry): Updated for new
- config code - this time it works!
-
-2001-01-08 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (create_dropdown_entry): Reverted back to
- old config code temporarily until I get the new config code
- working 100%.
-
-2001-01-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (create_dropdown_entry): Updated to
- reflect changes to the mail-config API.
-
-2001-01-05 Radek Doulik <rodo@helixcode.com>
-
- * listener.c (impl_event): disable indenting for now, it crashes
- editor
-
-2001-01-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (do_exit): If the headers have changed, then
- continue with the prompt else just destroy the window.
-
- * e-msg-composer-hdrs.c (init): Initialize has_changed to FALSE.
- (entry_changed): New callback to set the value of has_changed.
- (add_header): Attach the "changed" signal.
-
-2001-01-02 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
- * e-msg-composer-attachment-bar.c (update): Use
- header_content_type_simple, not header_content_type_format.
-
- * e-msg-composer-hdrs.c (create_dropdown_entry): Call
- e_utf8_to_gtk_string on the combobox strings.
-
-2000-12-28 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (handle_multipart_alternative,
- handle_multipart, e_msg_composer_new_with_message): Use
- CamelContentType instead of GMimeContentField.
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
- * e-msg-composer-attachment-bar.c (update, attach_to_multipart):
- Use CamelContentType, and use the header_content_type_* functions
- rather than operating on the structure by hand.
-
-2000-12-15 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_get_pgp_encrypt): New function
- to get whether or not to encrypt the message.
- (e_msg_composer_set_pgp_encrypt): New function to set encryption.
- (e_msg_composer_get_pgp_sign): New function to get whether or not
- to sign the message.
- (e_msg_composer_set_pgp_sign): New function to set pgp_sign.
- (init): Initialize pgp_sign and pgp_encrypt to FALSE.
-
-2000-12-14 Christopher James Lahey <clahey@helixcode.com>
-
- * e-msg-composer-hdrs.c (add_header): Made it so that carriage
- return doesn't insert a newline in the subject entry.
-
-2000-12-12 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (set_entry): Don't convert the utf-8
- string to a gtkstring because the widget expects to get a utf-8
- string.
-
-2000-12-12 Dan Winship <danw@helixcode.com>
-
- * Makefile.am (EXTRA_DIST): Add $(IDLS). (From campd.)
-
-2000-12-07 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer.c (prepare_engine): added warnings
- (prepare_engine): updated to IDL:GNOME/GtkHTML/Editor/Engine:1.0
-
- * Makefile.am: renamed HTMLEditor* to Editor*, added Editor-common.c:
- $(HTML_EDITOR_GENERATED) rule
-
-2000-12-05 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (add_recipients): Use camel to construct the
- list of recipients rather than just strchr(recips, ',') which is
- very prone to errors.
-
-2000-11-03 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (update): Pass NULL
- instead of icon_name to the e_icon_list_append_pixbuf
- function.
- (init) Take the font size into account when setting the
- height of the bar.
-
-2000-11-02 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (update): Use the
- pixbuf_for_mime_type function to get the icon.
- (pixbuf_for_mime_type): Functino that searches nautilus/
- and mc/ for icon files.
-
-2000-11-15 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer.c (prepare_engine): update namespace
-
- * updates for HTMLEditor API changes
-
- * e-msg-composer.c: added #include <libgnomevfs/gnome-vfs.h>
-
- * e-msg-composer.h: e_msg_composer_guess_mime_type renamed and
- moved mime_guess_type_from_file_name from camel as it uses VFS
-
-2000-11-14 Radek Doulik <rodo@helixcode.com>
-
- * listener.c (reply_indent): rename command to runCommand
-
- * e-msg-composer.c: updated to HTMLEditor API changes
-
- * listener.c: updated to HTMLEditor API changes
-
-2000-11-13 Radek Doulik <rodo@helixcode.com>
-
- * listener.c (reply_indent): extracted function, does reply
- indentation, use updated editor engine api
-
-2000-11-10 Michael Meeks <michael@helixcode.com>
-
- * Makefile.am ($(HTML_EDITOR_GENERATED)): rearrnace
- includes.
-
-2000-11-10 Larry Ewing <lewing@helixcode.com>
-
- * e-msg-composer.c (build_message): set the HTML charset to utf-8
- for all the html message parts.
- (build_message): make sure we set the proper encoding on the html
- part now that it may contain utf-8 characters
-
-2000-11-08 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_clear_inlined_table): new
- function
- (destroy): use e_msg_composer_clear_inlined_table, destroy
- inlined_images hash table
- (get_signature): added in_html arg, it tells if we should use HTML
- signature
- (set_editor_text): try to use HTML signature
- (e_msg_composer_new_with_sig_file): added send_html arg to be able
- to use HTML signature
-
- * listener.c (resolve_image_url): don't add inlined images to
- attachement bar
-
- * e-msg-composer.c (add_inlined_images): new function, adds
- inlined images to multipart
- (add_inlined_image): helper function, adds one image to multipart
- (build_message): store HTML messages with inlined images to
- multipart/related
-
- * e-msg-composer-attachment-bar.c (add_from_file): removed
- content_id arg
- (e_msg_composer_attachment_bar_attach): likewise
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_new):
- removed content_id arg
-
-2000-11-06 Not Zed <NotZed@HelixCode.com>
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_message): Changed
- for message api changes. Use camel_address_unformat to convert
- the editable->usable.
- (set_recipients): Same. Now we set the recipients as
- camel_internet_address's. Fixed a memleak indirectly.
- (decode_addresses): Removed, no longer needed.
- (create_dropdown_entry): We dont want to use _encode(), we want to
- _format, as we are displaying the result. We can use the static
- function too to avoid the object creation, and the memory leak!
- (set_entry): Convert the args to gtk-safe characters, since the
- entry doesn't understand utf8.
- (set_recipients): And likewise do the reverse when retrieving the
- contents of the widget.
-
-2000-11-06 Larry Ewing <lewing@helixcode.com>
-
- * e-msg-composer.c (build_message): set the content type on the
- plain part of outgoing messages.
- (best_content): a helper function to get the best content type for
- the attachment. This should probably use the helper functions in
- the future.
-
-2000-11-06 Kjartan Maraas <kmaraas@gnome.org>
-
- * e-msg-composer-attachment.c: Added #include <config.h>
- * e-msg-composer-hdrs.c: s/_HAVE_CONFIG_H/HAVE_CONFIG_H for
- working i18n.
-
-2000-11-04 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_new): fix
- test for regular file to !S_ISREG (statbuf.st_mode)
-
- * listener.c (resolve_image_url): use inline images hash table
-
- * e-msg-composer.c (init): create inlined images hash table
- (destroy): destroy it
- (clear_inline_images): helper function, used from
- g_hash_table_foreach_remove to destroy one inline image record
-
- * e-msg-composer.h: added hash table with inlined images url ->
- cid info
-
-2000-11-03 Radek Doulik <rodo@helixcode.com>
-
- * listener.c (impl_event): updated for API changed
- implemented image_url event
- (resolve_image_url): new helper function, attaches image to mail
- and returns new (resolved) url pointing to mime component
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_new):
- added conponent_id parameter
-
- * e-msg-composer-attachment-bar.c
- (e_msg_composer_attachment_bar_attach): added parameter content_id
- (add_from_file): likewise
-
-2000-11-03 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_new):
- Don't allow attaching anything but regular files.
-
-2000-11-03 Federico Mena Quintero <federico@helixcode.com>
-
- * Makefile.am: Clean the idl-generated files properly.
-
-2000-11-02 Peter Williams <peterw@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): CamelStreamMem
- steals our byte array; we can't destroy the byte array explicitly, and
- we must unref the stream only when done using the array.
-
-2000-11-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Don't create
- the To, Cc, and Bcc lists based only on the address, use both the
- name and address and camel_address_encode() them.
-
-2000-11-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): Fix the
- CTE kludge, calculate the best mime transfer encoding for the mime
- part and use that. Include e-msg-composer-select-file.h
-
-2000-10-31 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer.c (prepare_engine): new function, tries prepare
- editor engine
- (mark_orig_text): marks original text in editor
- (set_editor_text): call mark_orig_text
- (create_composer): call prepare_engine
-
- * Makefile.am (IDL_GENERATED): added HTMLEditor generated files to
- IDL_GENERATED
- ($(IDL_GENERATED)): generate also files from HTMLEditor.idl
- (libcomposer_la_SOURCES): added listener.[ch]
-
- * e-msg-composer.h: added editor_engine and editor_listener to
- EMsgComposer
-
- * listener.[ch]: new files, implementation of HTMLEditor::Listener
-
-2000-10-27 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am ($(IDL_GENERATED)): Get `Composer.idl' from
- `$(srcdir)' so that it builds with builddir != srcdir.
-
-2000-10-27 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Fixed my
- not-quite-right logic so that we don't accidently set the body
- contents using a plain text attachment instead of the actual body
- of the message :-)
-
-2000-10-25 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Populate the
- composer with any attachments.
-
-2000-10-25 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-select-file.c (create_file_selection): Set the
- wmclass and wmclass_name for the file selectors so that Sawfish
- doesn't make the dialogs the same size as the parent.
-
-2000-10-25 Dan Winship <danw@helixcode.com>
-
- * evolution-composer.c (init): Attach send/postpone signal
- handlers to the EMsgComposer.
- (evolution_composer_factory_init): Take send/postpone signal
- handlers as arguments.
-
-2000-10-23 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c, e-msg-composer-attachment-bar.c: add some
- missing _()s.
-
- * e-msg-composer-address-dialog.*, e-msg-composer-address-entry.*:
- Old cruft. Remove.
-
- * Makefile.am: Update for removed files.
-
- * e-msg-composer-hdrs.c: Remove e-msg-composer-address-entry.h
- include.
-
- * e-msg-composer.c: Remove e-msg-composer-address-dialog.h include
-
-2000-10-23 Ariel Rios <ariel@arcavia.com>
-
- * e-msg-composer-hdrs.c: Include Composer.h
- instead of volution-Addressbook-SelectNames.h
-
-2000-10-22 Dan Winship <danw@helixcode.com>
-
- * .cvsignore: No, don't ignore Evolution-Addressbook-SelectNames*.
- They're not supposed to be there any more.
-
-2000-10-22 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (attach_cb): Removed.
- (add_from_user): Use `e_msg_composer_select_file()' instead of
- doing the file selector widget magic by yourself.
-
-2000-10-20 Jeffrey Stedfast <fejj@helixcode.com>
-
- * .cvsignore: Ignore Evolution-Addressbook-SelectNames*
-
-2000-10-20 Dan Winship <danw@helixcode.com>
-
- * Evolution-Composer.idl: Evolution::Composer interface
-
- * evolution-composer.[ch]: Implementation and factory. So
- entirely not tested.
-
- * Makefile.am (libcomposer_la_SOURCES): Add
- evolution-composer.[ch]
- (IDLS): Update this for Evolution-Composer.idl / Composer.idl
-
- * main.c: Removed. (Old, dead code)
-
-2000-10-19 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am (glade_data): Add `e-msg-composer-attachment.glade'.
- (glade_messages): New.
- (EXTRA_DIST): Add `$(glade_messages)'.
-
-2000-10-19 Michael Meeks <michael@helixcode.com>
-
- * e-msg-composer.c (create_menubar_file, create_menubar_edit),
- (create_menubar_format, create_menubar_view, create_menubar): kill.
- (create_toolbar): die.
- (setup_ui): impl.
- (e_msg_composer_construct): hook in.
- (menu_format_html_cb): update.
- (menu_view_attachments_activate_cb): ditto.
- (destroy): upd.
- (e_msg_composer_construct): upd.
- (e_msg_composer_set_send_html): upd.
-
-2000-10-16 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-hdrs.c (init): Don't need the ID anymore.
-
-2000-10-17 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): If the body
- text was NULL, then don't bother turning it into HTML (besides, it
- causes a nasty segfault).
-
-2000-10-15 Dan Winship <danw@helixcode.com>
-
- * Makefile.am: Move CPPFLAGS flags to INCLUDES to avoid bashing
- any CPPFLAGS set at configure time.
-
-2000-10-14 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-attachment.c (set_entry): If the entry widget is
- NULL, obviously we can't set any text on it.
-
-2000-10-14 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-hdrs.c (init): Create a unique-ish id for this set
- of headers, so that only one select-names dialog will be created for
- a given set of headers.
- (address_button_clicked_cb): Pass the unique-ish id to the activate
- dialog command.
-
-2000-10-13 Larry Ewing <lewing@helixcode.com>
-
- * e-msg-composer.c (build_message): stop using format_text,
- gtkhtml handles this now.
- (format_text): function removed.
-
-2000-10-10 Iain Holmes <iain@helixcode.com>
-
- * e-icon-list.c: Allow NULL pixbufs, and load the "broken" image
-
- * e-msg-composer-attachment-bar.c (update): If the image isn't
- found load the default text/plain icon.
-
-2000-10-02 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (build_message): If the body of the message has
- 8-bit chars, set the Content-Transfer-Encoding type to the best
- encoding.
-
-2000-10-02 Dan Winship <danw@helixcode.com>
-
- * e-icon-list.c: fix #include of gnome-canvas-pixbuf.h
-
-2000-10-02 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-attachment-bar.c: If the description of an attachment
- is a blank string, revert to displaying the filename.
-
-2000-10-01 Iain Holmes <iain@helixcode.com>
-
- * e-icon-list.c: If you try to add an icon from a file that doesn't
- exist put a "Broken icon" image.
-
- * bad-icon.xpm: Broken icon image.
-
-2000-10-01 Iain Holmes <iain@helixcode.com>
-
- * e-msg-composer-attachment-bar.[ch] (update): If the attachment is
- an image, then make a thumbnail for it.
- Base the attachment bar on e-icon-list instead of gnome-icon-list.
-
- * e-icon-list.[ch]: New files. These are modified versions of
- gnome-icon-list from gnome-libs HEAD that uses gdk-pixbuf instead
- of the evil Imlib.
-
- * e-msg-composer-attachment.[ch]: Add a pixbuf_cache member, to
- save us having to generate a thumbnail for the attachment every
- time the bar changes.
-
- * e-msg-composer.c (e_msg_composer_construct): Add dnd support for
- files. Drag a file to the composer to add it as an attachment.
-
-2000-09-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (build_message): Check to see if the body has
- 8bit chars, if so - set the Content-Transfer-Encoding to 8bit.
- Addresses Bugzilla bug #652.
-
-2000-09-25 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-hdrs.c (setup_headers): fix typo in tooltip.
- * e-msg-composer.c (create_menubar_file): fix accelerator for
- "Save as" to be different from "Save". (Both problems pointed out
- by menthos@menthos.com.)
-
-2000-09-24 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (get_signature): Updated to handle FIFO
- streams.
-
-2000-09-19 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_construct): Don't g_error out
- if the html-editor-control fails.
- (create_composer): New internal function to create and construct a
- msg_composer and pop up an error message if it fails.
- (e_msg_composer_new, e_msg_composer_new_with_sig_file,
- e_msg_composer_new_with_message, e_msg_composer_new_from_url): Use
- create_composer, return if it fails, change return type to
- EMsgComposer *.
-
-2000-09-18 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-attachment.c (get_mime_type): Use
- gnome_vfs_get_file_info.
-
- * e-msg-composer-attachment-bar.c (update): Use gnome_vfs_mime
- functions, not old gnome_mime.
-
-2000-09-18 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and
- $(EXTRA_GNOME_LIBS). Removed unneeded libraries.
-
- * e-msg-composer-address-dialog.c, e-msg-composer-address-entry.c,
- e-msg-composer-attachment.c, e-msg-composer-hdrs.c,
- e-msg-composer.c: Fixed the #include lines to deal properly with
- gal.
-
-2000-09-12 Michael Meeks <michael@helixcode.com>
-
- * e-msg-composer.c: Update for new UI handler.
-
-2000-09-12 Larry Ewing <lewing@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (add_common): add a make sure
- the attachment isn't NULL. A more complete fix coming soon.
-
-2000-09-12 Ettore Perazzoli <ettore@helixcode.com>
-
- * Makefile.am ($(IDL_GENERATED)): Add space after `-I'.
-
-2000-09-05 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c (create_menubar_format): Accelerate the
- `Format' menu with an `o' instead of an `f' [the `f' is already
- taken by the "File" menu].
-
-2000-09-04 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_sig_file): Applied
- Jesse's patch that sets the composer's sig_file
-
-2000-09-02 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-msg-composer-address-dialog.c: Use e_utf8 wrappers
-
-2000-09-01 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_get_sig_file): This needs to
- return a const char * and not a char *, because we're not actually
- allocating memory here.
- (create_menubar_file): Changed "Send" to "Send Now" and added
- "Send Later"
- (menu_file_send_later_cb): New callback that emits the POSTPONE
- signal (equivalent to "Send Later"
-
-2000-08-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Always
- request to import the HTML version if at all possible so that we
- maintain formatting and other nifty stuff :-)
-
-2000-08-28 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_message): Set the
- "From" address in the CamelMimeMessage. Also updated to use
- get_subject to both make our lives easier and prepare for using UTF8
- (e_msg_composer_hdrs_get_subject): Updated to behave similarly to
- get_from and return allocated memory (it will have to return
- allocated memory once it's converted to use UTF8 anyways)
-
- * e-msg-composer.c (setup_save_draft): Always set
- composer->send_html = TRUE so that formatting is preserved.
-
-2000-08-24 Lauris Kaplinski <lauris@helixcode.com>
-
- * e-msg-composer-address-entry.c: Use e_utf8 wrappers
-
- * e-msg-composer-attachment.c: Use e_utf8 wrappers
-
- * e-msg-composer-hdrs.c: Use e_utf8 wrappers
-
-2000-08-24 Peter Williams <peterw@helixcode.com>
-
- * Makefile.am (INCLUDES): Add builddir/shell so we can
- get Evolution.h
-
-2000-08-12 Michael Meeks <michael@helixcode.com>
-
- * e-msg-composer.c (get_text): get_text not get_txt.
-
-2000-08-11 JP Rosevear <jpr@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Use
- new config accessors
-
-2000-08-10 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c: Remove unneeded e-setup.h include
-
-2000-08-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (exit_dialog_cb): Made async
-
-2000-08-10 Peter Williams <peterw@helixcode.com>
-
- * e-msg-composer.c (do_exit): Temporarily disable draft saving
- while we figure out how to work around Zucchi's new append_message.
-
-2000-08-10 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_from): Return the
- text in GtkCombo->entry
-
-2000-08-09 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (create_dropdown_entry): Fixed the GList
- identity stuff, should now display all configured identities.
-
-2000-08-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-msg-composer-address-dialog.c: Fixed some warnings.
-
- * e-msg-composer-hdrs.c: Switched the composer to use an EEntry
- for the subject field.
-
- * e-msg-composer.c: Changed the non scaling objects in this vbox
- to be FALSE, FALSE instead of FALSE, TRUE.
-
-2000-08-09 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-hdrs.c (add_header): Modified to allow dropdown
- entry-boxes as well (for headers like From:)
- (setup_headers): Modified to use the correct enum type.
- (create_dropdown_entry): New convenience function to add a
- drop-down combo box and fill it in with identities
- (init): Set from_entry to NULL
- (e_msg_composer_hdrs_get_from): New convenience function to get
- the text in the From widget in the composer
- (e_msg_composer_hdrs_set_from): New convenience function to set
- the From header in the composer
-
-2000-08-08 JP Rosevear <jpr@helixcode.com>
-
- * Makefile.am: Fix build by allowing includes for e-table dir
-
-2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart):
- s/strcasecmp/g_strcasecmp
-
- * e-msg-composer.c: s/strncasecmp/g_strncasecmp - this will help
- later with building on different platforms :-)
-
-2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Added code
- to set the body text based on the CamelMimeMessage.
- (set_editor_text): Use lowercase html tags...
-
-2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c (do_exit): Prompt the user to save their
- composition in Drafts.
- (set_editor_text): Uhm, use "-- \n" not "--\n" because the space
- is called for in the standard
- (e_msg_composer_new_with_message): New convenience function that
- takes a CamelMimeMessage as an argument. This will be useful when
- we code the ability to resume the editing of a message draft (like
- in the Drafts folder).
-
-2000-08-01 JP Rosevear <jpr@helixcode.com>
-
- * e-msg-composer.h: Constify param
-
- * e-msg-composer.c (get_signature): Constify param
- (set_editor_text): ditto
- (e_msg_composer_new_with_sig_file): ditto
-
-2000-08-01 Peter Williams <peterw@helixcode.com>
-
- * e-msg-composer.c (set_editor_text): sizeof("--\") !=
- strlen("--\n"), breaking the test for the signature prefix.
-
-2000-07-28 JP Rosevear <jpr@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_sig_file): New
- function to create composer with sig file set.
- (e_msg_composer_get_sig_file): New function to get sig file
- (e_msg_composer_set_sig_file): New function to set sig file
-
-2000-07-25 Michael Meeks <michael@helixcode.com>
-
- * e-msg-composer.c (get_text): add textual exception printout.
- (set_editor_text): close pre tags & check for pre-existing
- sig separator.
-
-2000-07-25 Peter Williams <peterw@helixcode.com>
-
- * e-msg-composer.c (menu_file_insert_file_cb): Mark this function
- as FIXME because we're waiting for the HTML Editor Control to
- support paste commands. Also some updates for when that happens.
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c: Remove GOAD support.
- (create_editor): Try to give a more helpful error message when
- failing to load the editor control.
-
-2000-07-23 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c (menu_format_html_cb): New callback for the
- "Send HTML" menu toggle item.
- (create_menubar_format): New.
- (create_menubar): Call it.
- (create_menubar_options): Removed.
- (init): Initialize `send_html' and `attachment_bar_visible' to
- FALSE.
- (get_signature): Add `void' to the declaration. This is C, not
- C++.
- (menu_file_close_cb): Renamed from `exit_cb'.
- (menu_file_send_cb): Renamed from `send_cb'.
- (menu_file_save_as_cb): Renamed from `save_as_cb'.
- (menu_file_save_cb): Renamed from `save_cb'.
- (menu_file_open_cb): Renamed from `open_cb'.
- (menu_file_add_attachment_cb): Renamed from `add_attachment_cb'.
- (menu_file_insert_file_cb): Renamed from `insert_file_cb'.
- (e_msg_composer_set_send_html): New.
- (build_message): Use the `send_html' flag instead of peeking the
- `msg_format' gnome-config value directly.
-
- * e-msg-composer.h: New member `send_html' in `EMsgComposer'.
-
-2000-07-23 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c: Changed to use BonoboUIHandler stuff directly
- instead of translating from GnomeUIInfo.
- (create_menubar_file): New.
- (create_menubar_edit): New.
- (create_menubar_view): New.
- (create_menubar_options): New.
- (create_menubar): Use these functions to set up the menu bar.
- (create_toolbar): Use BonoboUIHandler directly instead of
- converting from GnomeUIInfo.
- (toolbar_view_attachments_clicked_cb): Removed.
- (address_dialog_cb): Removed.
- (address_dialog_destroy_cb): Removed.
- (address_dialog_apply_cb): Removed.
- (setup_address_dialog): Removed.
-
-2000-07-12 Peter Williams <peterw@helixcode.com>
-
- * e-msg-composer.c: (view_tree) Make the "View Attachments" item
- a toggleitem ... so that it can be toggled...
- (menu_view_attachments_activate_cb): Treat the widget correctly
- and toggle correctly.
-
-2000-07-10 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c (exit_cb): Use it.
- (delete_event): New, handler for the "delete_event" signal.
-
-2000-07-09 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (set_editor_text): Don't load "" into the
- editor, because it will cause the editor component to g_warning.
-
-2000-07-09 Christopher James Lahey <clahey@helixcode.com>
-
- * e-msg-composer-hdrs.c: Removed the extra frame here.
-
-2000-07-08 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (create_menubar): Create an empty "Edit" menu
- for the editor control to insert itself into.
-
-2000-07-08 Jeffrey Stedfast <fejj@helixcode.com>
-
- * .cvsignore: Ignore dynamically created source files
-
-2000-07-08 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer-hdrs.c (set_entry): New.
- (e_msg_composer_hdrs_set_to): Use it.
- (e_msg_composer_hdrs_set_cc): Likewise
- (e_msg_composer_hdrs_set_bcc): Likewise.
- (e_msg_composer_hdrs_get_to): Replace implementation with a
- `g_assert_not_reached()'.
- (e_msg_composer_hdrs_get_cc): Likewise.
- (e_msg_composer_hdrs_get_bcc): Likewise.
-
- * e-msg-composer.c: Get rid of cut/copy/paste/undo as they
- duplicate the editor toolbar and cannot be made to work for all
- the widgets anyway.
-
-2000-07-08 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer-hdrs.c: New member `corba_select_names' in
- `EMsgComposerHdrsPrivate'.
- (destroy): If not `CORBA_OBJECT_NIL', release.
- (init): Init to `CORBA_OBJECT_NIL'.
- (setup_corba): New.
- (e_msg_composer_hdrs_new): Call it.
- (add_entry): Create the entries by using the ::SelectNames
- interface.
- (address_button_clicked_cb): Activate the dialog through the
- ::SelectNames interface.
-
-2000-06-29 Jeffrey Stedfast <fejj@helixcode.com>
-
- * e-msg-composer.c: Changed "Exit" to "Close" in the File menu.
- This is a little more intuitive as it does not suggest exiting
- the application, just says "close this window".
-
-2000-06-26 Christopher James Lahey <clahey@helixcode.com>
-
- * Makefile.am: Added e-msg-composer-select-file.h for make
- distcheck.
-
-2000-06-26 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c
- (load): New.
- (open_cb): Use it.
- (save): New function.
- (save_cb): Implemented by using it.
- (save_as_cb): Likewise.
-
-2000-06-17 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_construct): I18N the title bar.
-
- * Makefile.am (libcomposerinclude_HEADERS): Removed. Move all the
- `.h' files into `libcomposer_la_SOURCES' so that they get
- distributed, but not installed.
-
- * e-msg-composer.c (open_cb): New; implement the `Open' command.
- (save_as_cb): New; implement the `Save as' command.
- (init): Initialize the `persist_file_interface' and
- `persist_stream_interface' members to NULL.
- (destroy): Release the PersistStream and PersistFile interfaces.
- (e_msg_composer_construct): Query the PersistFile and
- PersistStream interfaces on the control and save them in the
- `persist_file_interface' and `persist_stream_interface' members.
- (get_text): Renamed from `get_editor_text'. Get a
- @persist_stream_interface instead of querying it a the control.
- (build_message): Return NULL if `persist_stream_interface' is nil.
-
- * e-msg-composer.h: New member `persist_file_interface' in
- `EMsgComposer'.
-
- * e-msg-composer-select-file.c: New.
- * e-msg-composer-select-file.h: New.
-
- * e-msg-composer.c (e_msg_composer_construct): Make the `To:'
- entry grab the keyboard focus.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_to_entry): New.
- (e_msg_composer_hdrs_get_cc_entry): New.
- (e_msg_composer_hdrs_get_bcc_entry): New.
- (e_msg_composer_hdrs_get_subject_entry): New.
-
- * e-msg-composer.c (e_msg_composer_construct): Set the scroll
- frame's shadow type to `GTK_SHADOW_IN'.
- (format_text): Initialize `tabbing' to zero to shut down the
- compiler.
-
-2000-06-14 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (add_from_user): keep the
- GtkFileSelection around between calls so we start up in the same
- directory we ended up in last time around. (Also fixes a big
- memory leak in that the code was already keeping the
- GtkFileSelection around, it just wasn't remembering to reuse it.)
-
- * e-msg-composer.c (format_text): Don't line-wrap lines that start
- with ">".
-
-2000-06-12 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (format_text): If a paragraph starts with TABs,
- indent the whole paragraph to that tab level.
-
-2000-06-12 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c: Make the `attachment_scroll_frame' an
- `EScrollFrame'.
- (exit_cb): I18N the quit message.
-
- * e-msg-composer.h: `attachment_scrolled_window' renamed to
- `attachment_scroll_frame'.
-
-2000-06-12 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (format_text): Don't break on non-breaking
- spaces, don't keep non-breaking spaces that fall after a line
- wrap, and translate non-breaking spaces to regular ones after
- wrapping.
-
-2000-06-05 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_attach): New convenience
- function.
-
- * e-msg-composer-attachment.c: Store a CamelMimePart rather than
- filename/description/mime_type info. Also record whether we were
- told or guessed the MIME type.
- (e_msg_composer_attachment_new_from_mime_part): New constructor.
- (e_msg_composer_attachment_edit): Remove the "browse" button. (If
- the user wants to change the actual file that the attachment is
- based on, he should delete the attachment and create a new one...)
- Remove the "Apply" button, because it's not all that useful. Make
- the MIME type only track the filename if it was guessed rather
- than being provided.
-
- * e-msg-composer-attachment.glade: Remove "browse" and "apply"
- buttons. Make filename editable.
-
- * e-msg-composer-attachment-bar.c (sort): Removed. Send the
- attachments in the order the user attached them in.
- (text_changed): Removed, since we weren't enabling the relevant
- GnomeIconList functionality that would have used this.
- (update): Don't print the size if it's 0.
- (attach_to_multipart, etc): adjust for EMsgComposerAttachment
- changes.
- (attach_to_multipart): Use 7bit encoding for message/ subparts.
- (e_msg_composer_attachment_bar_attach_mime_part): New convenience
- function.
-
-
-2000-06-02 Christopher James Lahey <clahey@helixcode.com>
-
- * e-msg-composer.c: Added the ability to save plain text mail.
-
-2000-05-29 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (get_editor_text): add a "format" argument so
- we can fetch different kinds of text.
- (format_text): New function to do line wrapping on plain text.
- (build_message): Build multipart/alternative messages rather than
- HTML-only ones. Yay. We don't suck (as much) any more!
-
-2000-05-28 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c: #include <errno.h>
-
-2000-05-26 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (get_editor_text, set_editor_text): Update for
- PersistStream changes
- (build_message): Update for CamelMultipart changes.
-
- * e-msg-composer.c (get_signature): routine to read the user's
- signature file.
- (set_editor_text): If the user has configured a signature, append
- it to the set text.
- (e_msg_composer_new): Call set_editor_text with "" to load the
- signature (if any).
-
-2000-05-25 Not Zed <NotZed@HelixCode.com>
-
- * e-msg-composer.c (build_message): Use camel_data_wrapper_new
- instead of camel_simple_data_wrapper_new.
-
-2000-05-17 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (build_message): Use
- camel_simple_data_wrapper_new rather than camel_data_wrapper_new.
-
-2000-05-13 Valek Filippov <frob@df.ru>
-
- * e-msg-composer-attachment.glade: save translatable strings
- * e-msg-composer-attachment.glade.h: file with strings
- * e-msg-composer-address-dialog.glade: save translatable strings
- * e-msg-composer-address-dialog.glade.h: file with strings
-
-2000-05-12 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (get_editor_text): NUL-terminate the data
- extracted from the BonoboStream.
-
-2000-05-10 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): deal with
- Content-Transfer-Encoding a little bit at least.
-
-2000-05-07 Mathieu Lacage <mathieu@gnu.org>
-
- * e-msg-composer.c (create_editor): remove FIXME and hardcoded
- string. You can write mails with OAF now.
-
-2000-05-07 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (build_message): unref content, etc. after
- attaching it to message.
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): unref
- part after attaching it.
-
-2000-05-06 Christopher James Lahey <clahey@helixcode.com>
-
- * e-msg-composer-hdrs.c: Turned off focus in the To, Cc, and Bcc
- buttons.
-
-2000-05-02 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: set G_LOG_DOMAIN.
-
-2000-04-28 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-hdrs.c (set_recipients): Update (minimally) for
- Camel recipient changes.
-
-2000-04-27 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new_from_url): New routine, to
- process mailto URLs.
-
-2000-04-26 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (build_message): Only generate a multipart
- message if there are attachments. Otherwise generate a single
- part.
-
- * Update for CamelMimeBodyPart -> CamelMimePart
-
-2000-04-26 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): add a
- s/SIMPLE_// that notzed missed. Update to use
- camel_mime_part_set_content.
- * e-msg-composer.c (build_message): remove a now-unused variable.
- Update for camel_mime_part_set_content.
-
-2000-04-26 NotZed <NotZed@HelixCode.com>
-
- * e-msg-composer.c (build_message): Use camel_mime_part_set_text()
- to set the text rather than messing with data wrappers.
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): Change
- for new camel-stream interfaces.
- (attach_to_multipart): Also set base64 encoding by default.
-
-2000-04-25 Radek Doulik <rodo@helixcode.com>
-
- * e-msg-composer.c (create_editor): use uih here
- (e_msg_composer_construct): create menubar/toolbar before creating
- editor control
-
-2000-04-23 Dan Winship <danw@helixcode.com>
-
- * Makefile.am: build libcomposer static and don't install it.
-
- * e-msg-composer-attachment-bar.c (attach_to_multipart): This was
- only half-implemented. Finish it, mostly.
-
-2000-04-22 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_add_header): new function to
- make the composer record additional headers it should output.
- (In-Reply-To), etc.
- (build_message): output them
-
-2000-04-21 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_set_headers):
- (e_msg_composer_set_body_text): new functions
- (exit_cb): Connect "Exit" menu item finally.
-
- * e-msg-composer-hdrs.c: const poisoning
- (e_msg_composer_hdrs_set_subject):
- (e_msg_composer_hdrs_get_subject): new functions
-
- * e-msg-composer-address-entry.c: const poisoning
-
-2000-04-20 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (get_editor_text, set_editor_text): new
- functions to get and set the contents of the HTML editor via
- Bonobo::PersistStream.
- (build_message): use get_editor_text. This works again.
-
-2000-04-17 Dan Winship <danw@helixcode.com>
-
- * e-msg-composer.c (build_message): Change
- camel_mime_message_new_with_session to camel_mime_message_new
-
-2000-03-17 bertrand <bertrand@helixcode.com>
-
- * e-msg-composer.c (create_menubar): Pass the composer as the data
- for the menubar callbacks.
-
-2000-03-12 Matt Loper <matt@helixcode.com>
-
- * Makefile.am: Modified to make the composer into a library, to be
- used by the mail component.
-
-2000-03-07 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c (create_toolbar): Pass the composer as the data
- for the toolbar callbacks.
- (e_msg_composer_construct): Connect the "changed" signal of the
- attachment bar to `attachment_bar_changed()'.
- (attachment_bar_changed): Renamed to `attachment_bar_changed_cb'.
-
-2000-03-02 Ettore Perazzoli <ettore@helixcode.com>
-
- * e-msg-composer.c (e_msg_composer_new): Precondition:
- gtk_main_level() greater than zero.
- (e_msg_composer_construct): Likewise.
- (create_menus): New function. Set up menus through
- BonoboUIHandler.
- (e_msg_composer_construct): Use it.
-
- * main.c (main): Initialize Bonobo.
-
- * e-msg-composer.c (init): Initialize `uih' and `editor' to NULL.
- Do not init `text' and `text_scrolled_window' anymore.
- (destroy): Unref `uih'.
- (e_msg_composer_construct): Create a new BonoboUIHandler and put
- it into `uih'.
- (create_editor): New helper function.
- (e_msg_composer_construct): Use it to set up the editor.
-
- * e-msg-composer.h: New member `uih' in `EMsgComposer'. Removed
- members `text', `text_scrolled_window'. New member `editor'.
-
- * Makefile.am (INCLUDES): Add `$(BONOBO_GNOME_CFLAGS)'.
- (evolution_msg_composer_LDADD): Add `$(BONOBO_GNOME_LIBS)'.
-
- * e-msg-composer.c (glade_connect): Removed.
- (setup_signals): Removed.
- (e_msg_composer_construct): Do not use libglade to set the toolbar
- and menubar up.
- (destroy): Removed libglade stuff.
- (init): Likewise.
-
- * e-msg-composer.h: Removed `menubar_gui', `toolbar_gui',
- `appbar_gui'.
-
- * e-msg-composer.glade: Removed.
-
-2000-01-12 bertrand <bertrand@helixcode.com>
-
- * Makefile.am (evolution_msg_composer_LDADD):
- use $(EXTRA_GNOME_LIBS_THREADS) to link with gthread
-
-1999-11-17 Ettore Perazzoli <ettore@gnu.org>
-
- * Makefile.am: New Makefile to compile the message composer
- executable.
-
- * main.c: New file.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_message): Use
- `CAMEL_RECIPIENT*' macros instead of the old `RECIPIENT*' ones
- that do not exist anymore.
-
- * e-msg-composer-address-dialog.c
- (e_msg_composer_address_dialog_construct): Use `E_GLADEDIR'
- instead of `E_GUIDIR'.
- * e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
- Likewise.
- * e-msg-composer.c (e_msg_composer_construct): Likewise.
-
-(See `$(top_srcdir)/widgets/ChangeLog' for previous changes to the
-message composer.)
diff --git a/composer/Composer.idl b/composer/Composer.idl
deleted file mode 100644
index a6cb35c037..0000000000
--- a/composer/Composer.idl
+++ /dev/null
@@ -1,4 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <Evolution-Addressbook-SelectNames.idl>
-#include <Evolution-Composer.idl>
diff --git a/composer/Evolution-Composer.idl b/composer/Evolution-Composer.idl
deleted file mode 100644
index 3fcda3873e..0000000000
--- a/composer/Evolution-Composer.idl
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Evolution-Composer.idl: Mail composer interfaces for Evolution
- *
- * Author:
- * Dan Winship <danw@helixcode.com>
- *
- * (C) 2000 Helix Code, Inc.
- */
-
-#include <Bonobo.idl>
-
-module GNOME {
-module Evolution {
-
- interface Composer : Bonobo::Unknown {
- struct Recipient {
- string name; /* UTF-8 */
- string address;
- };
- typedef sequence<Recipient> RecipientList;
-
- /**
- * setHeaders:
- * @to: the "To" recipients
- * @cc: the "CC" recipients
- * @bcc: the "Bcc" recipients
- * @subject: the subject of the message
- *
- * Sets the composer headers. Any of @to, @cc, and
- * @bcc may be an empty list, and @subject may be an
- * empty string.
- **/
- void setHeaders (in RecipientList to, in RecipientList cc,
- in RecipientList bcc, in string subject);
-
- /**
- * setBodyText:
- * @body: the body
- *
- * Sets the text in the body of the composer to
- * the given UTF-8 plain text.
- **/
- void setBodyText (in string body);
-
- /**
- * attachMIME:
- * @data: the attachment data
- *
- * This adds an attachment to the composer. @data
- * should be a fully-formed MIME body part.
- **/
- exception CouldNotParse {};
- void attachMIME (in string data)
- raises (CouldNotParse);
-
- /**
- * attachData:
- * @content_type: the Content-Type header
- * @filename: the suggested filename, or ""
- * @description: a description of the data, or ""
- * @show_inline: whether the attachment should be
- * displayed inline or not.
- * @data: the raw attachment data
- *
- * This adds @data as an attachment, using the provided
- * information to generate MIME headers. @content_type
- * may contain just a MIME content type, or it may
- * contain a complete Content-Type header. @filename
- * is a filename for the Content-Disposition header
- * @description (if not "") provides the
- * Content-Description, and @show_inline determines if the
- * Content-Disposition is "inline" or "attachment".
- *
- * If you need to specify headers or values other than
- * what this function can do, you will need to generate
- * all of the MIME headers yourself and use
- * add_attachment ().
- **/
- void attachData (in string content_type,
- in string filename,
- in string description,
- in boolean show_inline,
- in string data);
-
-
- /**
- * show:
- *
- * Shows the composer and lets the user edit things
- * and send the message.
- **/
- void show ();
- };
-};
-};
diff --git a/composer/Makefile.am b/composer/Makefile.am
deleted file mode 100644
index db5c56dc26..0000000000
--- a/composer/Makefile.am
+++ /dev/null
@@ -1,89 +0,0 @@
-## CORBA stuff
-
-IDLS = \
- Evolution-Composer.idl \
- Composer.idl
-
-IDL_GENERATED = \
- Composer.h \
- Composer-common.c \
- Composer-skels.c \
- Composer-stubs.c
-
-HTML_EDITOR_GENERATED = \
- Editor.h \
- Editor-common.c \
- Editor-skels.c \
- Editor-stubs.c
-
-selectnamesdir = $(top_srcdir)/addressbook/gui/component/select-names
-
-$(IDL_GENERATED): $(IDLS) $(selectnamesdir)/Evolution-Addressbook-SelectNames.idl
- $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
- -I $(selectnamesdir) $(srcdir)/Composer.idl
-
-Editor-commmon.c: $(GTK_HTML_EDITOR_IDL)
-
-$(HTML_EDITOR_GENERATED): $(GTK_HTML_EDITOR_IDL)
- $(ORBIT_IDL) -I $(srcdir) `$(GNOME_CONFIG) --cflags idl` $(GTK_HTML_EDITOR_IDL)
-
-##
-
-idldir = $(datadir)/idl
-idl_DATA = $(IDLS)
-
-gladedir = $(datadir)/evolution/glade
-
-glade_DATA = \
- e-msg-composer-attachment.glade
-
-libcomposerincludedir = $(includedir)/composer
-
-noinst_LIBRARIES = libcomposer.a
-
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_srcdir)/widgets \
- -I$(top_builddir)/widgets \
- -I$(top_srcdir)/camel \
- -I$(top_builddir)/camel \
- -I$(top_builddir)/addressbook/gui/component/select-names \
- -I$(top_builddir)/shell \
- -I$(top_srcdir)/shell \
- $(EXTRA_GNOME_CFLAGS) \
- $(GNOME_INCLUDEDIR) \
- $(BONOBO_GNOME_CFLAGS) \
- $(GTKHTML_CFLAGS) \
- $(UNICODE_CFLAGS) \
- -DEVOLUTION_DATADIR=\"$(datadir)\" \
- -DE_GLADEDIR=\"$(gladedir)\" \
- -DG_LOG_DOMAIN=\"composer\"
-
-libcomposer_a_SOURCES = \
- $(IDL_GENERATED) \
- $(HTML_EDITOR_GENERATED) \
- e-msg-composer-attachment-bar.c \
- e-msg-composer-attachment-bar.h \
- e-msg-composer-attachment.c \
- e-msg-composer-attachment.h \
- e-msg-composer-hdrs.c \
- e-msg-composer-hdrs.h \
- e-msg-composer-select-file.c \
- e-msg-composer-select-file.h \
- e-msg-composer.c \
- e-msg-composer.h \
- e-icon-list.c \
- e-icon-list.h \
- evolution-composer.c \
- evolution-composer.h \
- listener.c \
- listener.h
-
-EXTRA_DIST = \
- $(glade_DATA) \
- $(IDLS) \
- bad-icon.xpm
-
-BUILT_SOURCES = $(IDL_GENERATED)
-CLEANFILES += $(BUILT_SOURCES)
diff --git a/composer/bad-icon.xpm b/composer/bad-icon.xpm
deleted file mode 100644
index 0a9cac23cd..0000000000
--- a/composer/bad-icon.xpm
+++ /dev/null
@@ -1,53 +0,0 @@
-/* XPM */
-static char * bad_icon_xpm[] = {
-"48 48 2 1",
-" g None",
-". g #000000",
-"................................................",
-". .",
-". .",
-". .",
-". .",
-". .",
-". .",
-". .",
-". .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". .. .",
-". .. .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". . . .",
-". .",
-". .",
-". .",
-". .",
-". .",
-". .",
-"................................................"};
diff --git a/composer/e-icon-list.c b/composer/e-icon-list.c
deleted file mode 100644
index d71ecc262f..0000000000
--- a/composer/e-icon-list.c
+++ /dev/null
@@ -1,2667 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Copyright (C) 1998, 1999, 2000 Free Software Foundation
- * All rights reserved.
- *
- * This file is part of the Gnome Library.
- *
- * The Gnome Library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * The Gnome Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with the Gnome Library; see the file COPYING.LIB. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/*
- @NOTATION@
- */
-
-/*
- * GnomeIconList widget - scrollable icon list
- *
- * Authors:
- * Federico Mena <federico@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * Rewrote from scratch from the code written by Federico Mena
- * <federico@ximian.com> to be based on a GnomeCanvas, and
- * to support banding selection and allow inline icon renaming.
- *
- * Redone somewhat by Elliot to support gdk-pixbuf, and to use GArray instead of
- * GList for item storage.
- */
-
-#include <config.h>
-#include <string.h>
-#include <stdio.h>
-#include <gtk/gtk.h>
-#include "e-icon-list.h"
-#include <libgnomeui/gnome-icon-item.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
-
-#include "bad-icon.xpm"
-
-/* Aliases to minimize screen use in my laptop */
-#define EIL(x) E_ICON_LIST(x)
-#define EIL_CLASS(x) E_ICON_LIST_CLASS(x)
-#define IS_EIL(x) E_IS_ICON_LIST(x)
-
-typedef EIconList Eil;
-typedef EIconListClass EilClass;
-
-
-/* default spacings */
-#define DEFAULT_ROW_SPACING 4
-#define DEFAULT_COL_SPACING 2
-#define DEFAULT_TEXT_SPACING 2
-#define DEFAULT_ICON_BORDER 2
-
-/* Autoscroll timeout in milliseconds */
-#define SCROLL_TIMEOUT 30
-
-
-/* Signals */
-enum {
- SELECT_ICON,
- UNSELECT_ICON,
- TEXT_CHANGED,
- LAST_SIGNAL
-};
-
-typedef enum {
- SYNC_INSERT,
- SYNC_REMOVE
-} SyncType;
-
-enum {
- ARG_0,
-};
-
-static guint eil_signals[LAST_SIGNAL] = { 0 };
-
-
-static GnomeCanvasClass *parent_class;
-
-
-/* Icon structure */
-typedef struct {
- /* Icon image and text items */
- GnomeCanvasPixbuf *image;
- GnomeIconTextItem *text;
-
- /* Filename of the icon file. */
- gchar *icon_filename;
-
- /* User data and destroy notify function */
- gpointer data;
- GtkDestroyNotify destroy;
-
- /* ID for the text item's event signal handler */
- guint text_event_id;
-
- /* Whether the icon is selected, and temporary storage for rubberband
- * selections.
- */
- guint selected : 1;
- guint tmp_selected : 1;
-} Icon;
-
-/* A row of icons */
-typedef struct {
- GList *line_icons;
- gint16 y;
- gint16 icon_height, text_height;
-} IconLine;
-
-/* Private data of the EIconList structure */
-struct _EIconListPrivate {
- /* List of icons */
- GArray *icon_list;
-
- /* List of rows of icons */
- GList *lines;
-
- /* Separators used to wrap the text below icons */
- char *separators;
-
- Icon *last_selected_icon;
-
- /* Rubberband rectangle */
- GnomeCanvasItem *sel_rect;
-
- /* Saved event for a pending selection */
- GdkEvent select_pending_event;
-
- /* Max of the height of all the icon rows and window height */
- int total_height;
-
- /* Selection mode */
- GtkSelectionMode selection_mode;
-
- /* A list of integers with the indices of the currently selected icons */
- GList *selection;
-
- /* Number of icons in the list */
- int icons;
-
- /* Freeze count */
- int frozen;
-
- /* Width allocated for icons */
- int icon_width;
-
- /* Spacing values */
- int row_spacing;
- int col_spacing;
- int text_spacing;
- int icon_border;
-
- /* Index and pointer to last selected icon */
- int last_selected_idx;
-
- /* Timeout ID for autoscrolling */
- guint timer_tag;
-
- /* Change the adjustment value by this amount when autoscrolling */
- int value_diff;
-
- /* Mouse position for autoscrolling */
- int event_last_x;
- int event_last_y;
-
- /* Selection start position */
- int sel_start_x;
- int sel_start_y;
-
- /* Modifier state when the selection began */
- guint sel_state;
-
- /* Whether the icon texts are editable */
- guint is_editable : 1;
-
- /* Whether the icon texts need to be copied */
- guint static_text : 1;
-
- /* Whether the icons need to be laid out */
- guint dirty : 1;
-
- /* Whether the user is performing a rubberband selection */
- guint selecting : 1;
-
- /* Whether editing an icon is pending after a button press */
- guint edit_pending : 1;
-
- /* Whether selection is pending after a button press */
- guint select_pending : 1;
-
- /* Whether the icon that is pending selection was selected to begin with */
- guint select_pending_was_selected : 1;
-};
-
-
-static inline int
-icon_line_height (Eil *eil, IconLine *il)
-{
- EIconListPrivate *priv;
-
- priv = eil->_priv;
-
- return il->icon_height + il->text_height + priv->row_spacing + priv->text_spacing;
-}
-
-static void
-icon_get_height (Icon *icon, int *icon_height, int *text_height)
-{
- double d_icon_height;
- gtk_object_get(GTK_OBJECT(icon->image), "height", &d_icon_height, NULL);
- *icon_height = d_icon_height;
- *text_height = icon->text->ti->height;
-}
-
-static int
-eil_get_items_per_line (Eil *eil)
-{
- EIconListPrivate *priv;
- int items_per_line;
-
- priv = eil->_priv;
-
- items_per_line = GTK_WIDGET (eil)->allocation.width / (priv->icon_width + priv->col_spacing);
- if (items_per_line == 0)
- items_per_line = 1;
-
- return items_per_line;
-}
-
-/**
- * e_icon_list_get_items_per_line:
- * @eil: An icon list.
- *
- * Returns the number of icons that fit in a line or row.
- */
-int
-e_icon_list_get_items_per_line (EIconList *eil)
-{
- g_return_val_if_fail (eil != NULL, 1);
- g_return_val_if_fail (IS_EIL (eil), 1);
-
- return eil_get_items_per_line (eil);
-}
-
-static void
-eil_place_icon (Eil *eil, Icon *icon, int x, int y, int icon_height)
-{
- EIconListPrivate *priv;
- int x_offset, y_offset;
- double d_icon_image_height;
- double d_icon_image_width;
- int icon_image_height;
- int icon_image_width;
-
- priv = eil->_priv;
-
- gtk_object_get(GTK_OBJECT(icon->image), "height", &d_icon_image_height, NULL);
- icon_image_height = d_icon_image_height;
- g_assert(icon_image_height != 0);
- if (icon_height > icon_image_height)
- y_offset = (icon_height - icon_image_height) / 2;
- else
- y_offset = 0;
-
- gtk_object_get(GTK_OBJECT(icon->image), "width", &d_icon_image_width, NULL);
- icon_image_width = d_icon_image_width;
- g_assert(icon_image_width != 0);
- if (priv->icon_width > icon_image_width)
- x_offset = (priv->icon_width - icon_image_width) / 2;
- else
- x_offset = 0;
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (icon->image),
- "x", (double) (x + x_offset),
- "y", (double) (y + y_offset),
- NULL);
- gnome_icon_text_item_setxy (icon->text,
- x,
- y + icon_height + priv->text_spacing);
-}
-
-static void
-eil_layout_line (Eil *eil, IconLine *il)
-{
- EIconListPrivate *priv;
- GList *l;
- int x;
-
- priv = eil->_priv;
-
- x = 0;
- for (l = il->line_icons; l; l = l->next) {
- Icon *icon = l->data;
-
- eil_place_icon (eil, icon, x, il->y, il->icon_height);
- x += priv->icon_width + priv->col_spacing;
- }
-}
-
-static void
-eil_add_and_layout_line (Eil *eil, GList *line_icons, int y,
- int icon_height, int text_height)
-{
- EIconListPrivate *priv;
- IconLine *il;
-
- priv = eil->_priv;
-
- il = g_new (IconLine, 1);
- il->line_icons = line_icons;
- il->y = y;
- il->icon_height = icon_height;
- il->text_height = text_height;
-
- eil_layout_line (eil, il);
- priv->lines = g_list_append (priv->lines, il);
-}
-
-static void
-eil_relayout_icons_at (Eil *eil, int pos, int y)
-{
- EIconListPrivate *priv;
- int col, row, text_height, icon_height;
- int items_per_line, n;
- GList *line_icons;
-
- priv = eil->_priv;
- items_per_line = eil_get_items_per_line (eil);
-
- col = row = text_height = icon_height = 0;
- line_icons = NULL;
-
- for (n = pos; n < priv->icon_list->len; n++) {
- Icon *icon = g_array_index(priv->icon_list, Icon*, n);
- int ih, th;
-
- if (!(n % items_per_line)) {
- if (line_icons) {
- eil_add_and_layout_line (eil, line_icons, y,
- icon_height, text_height);
- line_icons = NULL;
-
- y += (icon_height + text_height
- + priv->row_spacing + priv->text_spacing);
- }
-
- icon_height = 0;
- text_height = 0;
- }
-
- icon_get_height (icon, &ih, &th);
-
- icon_height = MAX (ih, icon_height);
- text_height = MAX (th, text_height);
-
- line_icons = g_list_append (line_icons, icon);
- }
-
- if (line_icons)
- eil_add_and_layout_line (eil, line_icons, y, icon_height, text_height);
-}
-
-static void
-eil_free_line_info (Eil *eil)
-{
- EIconListPrivate *priv;
- GList *l;
-
- priv = eil->_priv;
-
- for (l = priv->lines; l; l = l->next) {
- IconLine *il = l->data;
-
- g_list_free (il->line_icons);
- g_free (il);
- }
-
- g_list_free (priv->lines);
- priv->lines = NULL;
- priv->total_height = 0;
-}
-
-static void
-eil_free_line_info_from (Eil *eil, int first_line)
-{
- EIconListPrivate *priv;
- GList *l, *ll;
-
- priv = eil->_priv;
- ll = g_list_nth (priv->lines, first_line);
-
- for (l = ll; l; l = l->next) {
- IconLine *il = l->data;
-
- g_list_free (il->line_icons);
- g_free (il);
- }
-
- if (priv->lines) {
- if (ll->prev)
- ll->prev->next = NULL;
- else
- priv->lines = NULL;
- }
-
- g_list_free (ll);
-}
-
-static void
-eil_layout_from_line (Eil *eil, int line)
-{
- EIconListPrivate *priv;
- GList *l;
- int height;
-
- priv = eil->_priv;
-
- eil_free_line_info_from (eil, line);
-
- height = 0;
- for (l = priv->lines; l; l = l->next) {
- IconLine *il = l->data;
-
- height += icon_line_height (eil, il);
- }
-
- eil_relayout_icons_at (eil, line * eil_get_items_per_line (eil), height);
-}
-
-static void
-eil_layout_all_icons (Eil *eil)
-{
- EIconListPrivate *priv;
-
- priv = eil->_priv;
-
- if (!GTK_WIDGET_REALIZED (eil))
- return;
-
- eil_free_line_info (eil);
- eil_relayout_icons_at (eil, 0, 0);
- priv->dirty = FALSE;
-}
-
-static void
-eil_scrollbar_adjust (Eil *eil)
-{
- EIconListPrivate *priv;
- GtkAdjustment *adj;
- GList *l;
- double wx, wy, wx1, wy1, wx2, wy2;
- int height, step_increment;
-
- priv = eil->_priv;
-
- if (!GTK_WIDGET_REALIZED (eil))
- return;
-
- height = 0;
- step_increment = 0;
- for (l = priv->lines; l; l = l->next) {
- IconLine *il = l->data;
-
- height += icon_line_height (eil, il);
-
- if (l == priv->lines)
- step_increment = height;
- }
-
- if (!step_increment)
- step_increment = 10;
-
- priv->total_height = MAX (height, GTK_WIDGET (eil)->allocation.height);
-
- gnome_canvas_c2w (GNOME_CANVAS (eil), 0, 0, &wx1, &wy1);
- gnome_canvas_c2w (GNOME_CANVAS (eil),
- GTK_WIDGET (eil)->allocation.width,
- priv->total_height,
- &wx2, &wy2);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (eil),
- wx1, wy1, wx2, wy2);
-
- wx = wy = 0;
- gnome_canvas_window_to_world (GNOME_CANVAS (eil), 0, 0, &wx, &wy);
-
- adj = gtk_layout_get_vadjustment (GTK_LAYOUT (eil));
-
- adj->upper = priv->total_height;
- adj->step_increment = step_increment;
- adj->page_increment = GTK_WIDGET (eil)->allocation.height;
- adj->page_size = GTK_WIDGET (eil)->allocation.height;
-
- if (wy > adj->upper - adj->page_size)
- wy = adj->upper - adj->page_size;
-
- adj->value = wy;
-
- gtk_adjustment_changed (adj);
-}
-
-/* Emits the select_icon or unselect_icon signals as appropriate */
-static void
-emit_select (Eil *eil, int sel, int i, GdkEvent *event)
-{
- gtk_signal_emit (GTK_OBJECT (eil),
- eil_signals[sel ? SELECT_ICON : UNSELECT_ICON],
- i,
- event);
-}
-
-static int
-eil_unselect_all (EIconList *eil, GdkEvent *event, gpointer keep)
-{
- EIconListPrivate *priv;
- Icon *icon;
- int i, idx = 0;
-
- g_return_val_if_fail (eil != NULL, 0);
- g_return_val_if_fail (IS_EIL (eil), 0);
-
- priv = eil->_priv;
-
- for (i = 0; i < priv->icon_list->len; i++) {
- icon = g_array_index(priv->icon_list, Icon*, i);
-
- if (icon == keep)
- idx = i;
- else if (icon->selected)
- emit_select (eil, FALSE, i, event);
- }
-
- return idx;
-}
-
-/**
- * e_icon_list_unselect_all:
- * @eil: An icon list.
- *
- * Returns: the number of icons in the icon list
- */
-int
-e_icon_list_unselect_all (EIconList *eil)
-{
- return eil_unselect_all (eil, NULL, NULL);
-}
-
-static void
-sync_selection (Eil *eil, int pos, SyncType type)
-{
- GList *list;
-
- for (list = eil->_priv->selection; list; list = list->next) {
- if (GPOINTER_TO_INT (list->data) >= pos) {
- int i = GPOINTER_TO_INT (list->data);
-
- switch (type) {
- case SYNC_INSERT:
- list->data = GINT_TO_POINTER (i + 1);
- break;
-
- case SYNC_REMOVE:
- list->data = GINT_TO_POINTER (i - 1);
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
- }
-}
-
-static int
-eil_icon_to_index (Eil *eil, Icon *icon)
-{
- EIconListPrivate *priv;
- int n;
-
- priv = eil->_priv;
-
- for (n = 0; n < priv->icon_list->len; n++)
- if (g_array_index(priv->icon_list, Icon*, n) == icon)
- return n;
-
- g_assert_not_reached ();
- return -1; /* Shut up the compiler */
-}
-
-/* Event handler for icons when we are in SINGLE or BROWSE mode */
-static gint
-selection_one_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent *event)
-{
- EIconListPrivate *priv;
- GnomeIconTextItem *text;
- int retval;
-
- priv = eil->_priv;
- retval = FALSE;
-
- /* We use a separate variable and ref the object because it may be
- * destroyed by one of the signal handlers.
- */
- text = icon->text;
- gtk_object_ref (GTK_OBJECT (text));
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- priv->edit_pending = FALSE;
- priv->select_pending = FALSE;
-
- /* Ignore wheel mouse clicks for now */
- if (event->button.button > 3)
- break;
-
- if (!icon->selected) {
- eil_unselect_all (eil, NULL, NULL);
- emit_select (eil, TRUE, idx, event);
- } else {
- if (priv->selection_mode == GTK_SELECTION_SINGLE
- && (event->button.state & GDK_CONTROL_MASK))
- emit_select (eil, FALSE, idx, event);
- else if (on_text && priv->is_editable && event->button.button == 1)
- priv->edit_pending = TRUE;
- else
- emit_select (eil, TRUE, idx, event);
- }
-
- retval = TRUE;
- break;
-
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- /* Ignore wheel mouse clicks for now */
- if (event->button.button > 3)
- break;
-
- emit_select (eil, TRUE, idx, event);
- retval = TRUE;
- break;
-
- case GDK_BUTTON_RELEASE:
- if (priv->edit_pending) {
- gnome_icon_text_item_start_editing (text);
- priv->edit_pending = FALSE;
- }
-
- retval = TRUE;
- break;
-
- default:
- break;
- }
-
- /* If the click was on the text and we actually did something, stop the
- * icon text item's own handler from executing.
- */
- if (on_text && retval)
- gtk_signal_emit_stop_by_name (GTK_OBJECT (text), "event");
-
- gtk_object_unref (GTK_OBJECT (text));
-
- return retval;
-}
-
-/* Handles range selections when clicking on an icon */
-static void
-select_range (Eil *eil, Icon *icon, int idx, GdkEvent *event)
-{
- EIconListPrivate *priv;
- int a, b;
- Icon *i;
-
- priv = eil->_priv;
-
- if (priv->last_selected_idx == -1) {
- priv->last_selected_idx = idx;
- priv->last_selected_icon = icon;
- }
-
- if (idx < priv->last_selected_idx) {
- a = idx;
- b = priv->last_selected_idx;
- } else {
- a = priv->last_selected_idx;
- b = idx;
- }
-
- for (; a <= b; a++) {
- i = g_array_index(priv->icon_list, Icon*, a);
-
- if (!i->selected)
- emit_select (eil, TRUE, a, NULL);
- }
-
- /* Actually notify the client of the event */
- emit_select (eil, TRUE, idx, event);
-}
-
-/* Handles icon selection for MULTIPLE or EXTENDED selection modes */
-static void
-do_select_many (Eil *eil, Icon *icon, int idx, GdkEvent *event, int use_event)
-{
- EIconListPrivate *priv;
- int range, additive;
-
- priv = eil->_priv;
-
- range = (event->button.state & GDK_SHIFT_MASK) != 0;
- additive = (event->button.state & GDK_CONTROL_MASK) != 0;
-
- if (!additive) {
- if (icon->selected)
- eil_unselect_all (eil, NULL, icon);
- else
- eil_unselect_all (eil, NULL, NULL);
- }
-
- if (!range) {
- if (additive)
- emit_select (eil, !icon->selected, idx, use_event ? event : NULL);
- else
- emit_select (eil, TRUE, idx, use_event ? event : NULL);
-
- priv->last_selected_idx = idx;
- priv->last_selected_icon = icon;
- } else
- select_range (eil, icon, idx, use_event ? event : NULL);
-}
-
-/* Event handler for icons when we are in MULTIPLE or EXTENDED mode */
-static gint
-selection_many_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent *event)
-{
- EIconListPrivate *priv;
- GnomeIconTextItem *text;
- int retval;
- int additive, range;
- int do_select;
-
- priv = eil->_priv;
- retval = FALSE;
-
- /* We use a separate variable and ref the object because it may be
- * destroyed by one of the signal handlers.
- */
- text = icon->text;
- gtk_object_ref (GTK_OBJECT (text));
-
- range = (event->button.state & GDK_SHIFT_MASK) != 0;
- additive = (event->button.state & GDK_CONTROL_MASK) != 0;
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- priv->edit_pending = FALSE;
- priv->select_pending = FALSE;
-
- /* Ignore wheel mouse clicks for now */
- if (event->button.button > 3)
- break;
-
- do_select = TRUE;
-
- if (additive || range) {
- if (additive && !range) {
- priv->select_pending = TRUE;
- priv->select_pending_event = *event;
- priv->select_pending_was_selected = icon->selected;
-
- /* We have to emit this so that the client will
- * know about the click.
- */
- emit_select (eil, TRUE, idx, event);
- do_select = FALSE;
- }
- } else if (icon->selected) {
- priv->select_pending = TRUE;
- priv->select_pending_event = *event;
- priv->select_pending_was_selected = icon->selected;
-
- if (on_text && priv->is_editable && event->button.button == 1)
- priv->edit_pending = TRUE;
-
- emit_select (eil, TRUE, idx, event);
- do_select = FALSE;
- }
-#if 0
- } else if (icon->selected && on_text && priv->is_editable
- && event->button.button == 1) {
- priv->edit_pending = TRUE;
- do_select = FALSE;
- }
-#endif
-
- if (do_select)
- do_select_many (eil, icon, idx, event, TRUE);
-
- retval = TRUE;
- break;
-
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- /* Ignore wheel mouse clicks for now */
- if (event->button.button > 3)
- break;
-
- emit_select (eil, TRUE, idx, event);
- retval = TRUE;
- break;
-
- case GDK_BUTTON_RELEASE:
- if (priv->select_pending) {
- icon->selected = priv->select_pending_was_selected;
- do_select_many (eil, icon, idx, &priv->select_pending_event, FALSE);
- priv->select_pending = FALSE;
- retval = TRUE;
- }
-
- if (priv->edit_pending) {
- gnome_icon_text_item_start_editing (text);
- priv->edit_pending = FALSE;
- retval = TRUE;
- }
-#if 0
- if (priv->select_pending) {
- icon->selected = priv->select_pending_was_selected;
- do_select_many (eil, icon, idx, &priv->select_pending_event);
- priv->select_pending = FALSE;
- retval = TRUE;
- } else if (priv->edit_pending) {
- gnome_icon_text_item_start_editing (text);
- priv->edit_pending = FALSE;
- retval = TRUE;
- }
-#endif
-
- break;
-
- default:
- break;
- }
-
- /* If the click was on the text and we actually did something, stop the
- * icon text item's own handler from executing.
- */
- if (on_text && retval)
- gtk_signal_emit_stop_by_name (GTK_OBJECT (text), "event");
-
- gtk_object_unref (GTK_OBJECT (text));
-
- return retval;
-}
-
-/* Event handler for icons in the icon list */
-static gint
-icon_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
-{
- Icon *icon;
- Eil *eil;
- EIconListPrivate *priv;
- int idx;
- int on_text;
-
- icon = data;
- eil = EIL (item->canvas);
- priv = eil->_priv;
- idx = eil_icon_to_index (eil, icon);
- on_text = item == GNOME_CANVAS_ITEM (icon->text);
-
- switch (priv->selection_mode) {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- return selection_one_icon_event (eil, icon, idx, on_text, event);
-
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_EXTENDED:
- return selection_many_icon_event (eil, icon, idx, on_text, event);
-
- default:
- g_assert_not_reached ();
- return FALSE; /* Shut up the compiler */
- }
-}
-
-/* Handler for the editing_started signal of an icon text item. We block the
- * event handler so that it will not be called while the text is being edited.
- */
-static void
-editing_started (GnomeIconTextItem *iti, gpointer data)
-{
- Icon *icon;
-
- icon = data;
- gtk_signal_handler_block (GTK_OBJECT (iti), icon->text_event_id);
- eil_unselect_all (EIL (GNOME_CANVAS_ITEM (iti)->canvas), NULL, icon);
-}
-
-/* Handler for the editing_stopped signal of an icon text item. We unblock the
- * event handler so that we can get events from it again.
- */
-static void
-editing_stopped (GnomeIconTextItem *iti, gpointer data)
-{
- Icon *icon;
-
- icon = data;
- gtk_signal_handler_unblock (GTK_OBJECT (iti), icon->text_event_id);
-}
-
-static gboolean
-text_changed (GnomeCanvasItem *item, Icon *icon)
-{
- Eil *eil;
- gboolean accept;
- int idx;
-
- eil = EIL (item->canvas);
- accept = TRUE;
-
- idx = eil_icon_to_index (eil, icon);
- gtk_signal_emit (GTK_OBJECT (eil),
- eil_signals[TEXT_CHANGED],
- idx, gnome_icon_text_item_get_text (icon->text),
- &accept);
-
- return accept;
-}
-
-static void
-height_changed (GnomeCanvasItem *item, Icon *icon)
-{
- Eil *eil;
- EIconListPrivate *priv;
- int n;
-
- eil = EIL (item->canvas);
- priv = eil->_priv;
-
- if (!GTK_WIDGET_REALIZED (eil))
- return;
-
- if (priv->frozen) {
- priv->dirty = TRUE;
- return;
- }
-
- n = eil_icon_to_index (eil, icon);
- eil_layout_from_line (eil, n / eil_get_items_per_line (eil));
- eil_scrollbar_adjust (eil);
-}
-
-static Icon *
-icon_new_from_pixbuf (EIconList *eil, GdkPixbuf *im,
- const char *icon_filename, const char *text)
-{
- EIconListPrivate *priv;
- GnomeCanvas *canvas;
- GnomeCanvasGroup *group;
- Icon *icon;
-
- priv = eil->_priv;
- canvas = GNOME_CANVAS (eil);
- group = GNOME_CANVAS_GROUP (canvas->root);
-
- icon = g_new0 (Icon, 1);
-
- if (icon_filename)
- icon->icon_filename = g_strdup (icon_filename);
- else
- icon->icon_filename = NULL;
-
- if (im == NULL)
- im = gdk_pixbuf_new_from_xpm_data ((const char**) bad_icon_xpm);
- else
- gdk_pixbuf_ref (im);
-
- icon->image = GNOME_CANVAS_PIXBUF (gnome_canvas_item_new (
- group,
- gnome_canvas_pixbuf_get_type (),
- "x", 0.0,
- "y", 0.0,
- "width", (double) gdk_pixbuf_get_width (im),
- "height", (double) gdk_pixbuf_get_height (im),
- "pixbuf", im,
- NULL));
- gdk_pixbuf_unref (im);
-
- icon->text = GNOME_ICON_TEXT_ITEM (gnome_canvas_item_new (
- group,
- gnome_icon_text_item_get_type (),
- NULL));
-
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (icon->text),
- "use_broken_event_handling", FALSE,
- NULL);
-
- gnome_icon_text_item_configure (icon->text,
- 0, 0, priv->icon_width,
- "-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso8859-1",
- text, priv->is_editable, priv->static_text);
-
- gtk_signal_connect (GTK_OBJECT (icon->image), "event",
- GTK_SIGNAL_FUNC (icon_event),
- icon);
- icon->text_event_id = gtk_signal_connect (GTK_OBJECT (icon->text), "event",
- GTK_SIGNAL_FUNC (icon_event),
- icon);
-
- gtk_signal_connect (GTK_OBJECT (icon->text), "editing_started",
- GTK_SIGNAL_FUNC (editing_started),
- icon);
- gtk_signal_connect (GTK_OBJECT (icon->text), "editing_stopped",
- GTK_SIGNAL_FUNC (editing_stopped),
- icon);
-
- gtk_signal_connect (GTK_OBJECT (icon->text), "text_changed",
- GTK_SIGNAL_FUNC (text_changed),
- icon);
- gtk_signal_connect (GTK_OBJECT (icon->text), "height_changed",
- GTK_SIGNAL_FUNC (height_changed),
- icon);
-
- return icon;
-}
-
-static Icon *
-icon_new (Eil *eil, const char *icon_filename, const char *text)
-{
- GdkPixbuf *im;
- Icon *retval;
-
- if (icon_filename) {
- im = gdk_pixbuf_new_from_file (icon_filename);
-
- /* Bad icon image
- Fixme. Need a better graphic. */
- if (im == NULL)
- im = gdk_pixbuf_new_from_xpm_data ((const char**) bad_icon_xpm);
- } else
- im = NULL;
-
- retval = icon_new_from_pixbuf (eil, im, icon_filename, text);
-
- if(im)
- gdk_pixbuf_unref(im);
-
- return retval;
-}
-
-static int
-icon_list_append (Eil *eil, Icon *icon)
-{
- EIconListPrivate *priv;
- int pos;
-
- priv = eil->_priv;
-
- pos = priv->icons++;
- g_array_append_val(priv->icon_list, icon);
-
- switch (priv->selection_mode) {
- case GTK_SELECTION_BROWSE:
- e_icon_list_select_icon (eil, 0);
- break;
-
- default:
- break;
- }
-
- if (!priv->frozen) {
- /* FIXME: this should only layout the last line */
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- } else
- priv->dirty = TRUE;
-
- return priv->icons - 1;
-}
-
-static void
-icon_list_insert (Eil *eil, int pos, Icon *icon)
-{
- EIconListPrivate *priv;
-
- priv = eil->_priv;
-
- if (pos == priv->icons) {
- icon_list_append (eil, icon);
- return;
- }
-
- g_array_insert_val(priv->icon_list, pos, icon);
- priv->icons++;
-
- switch (priv->selection_mode) {
- case GTK_SELECTION_BROWSE:
- e_icon_list_select_icon (eil, 0);
- break;
-
- default:
- break;
- }
-
- if (!priv->frozen) {
- /* FIXME: this should only layout the lines from then one
- * containing the Icon to the end.
- */
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- } else
- priv->dirty = TRUE;
-
- sync_selection (eil, pos, SYNC_INSERT);
-}
-
-/**
- * e_icon_list_insert_pixbuf:
- * @eil: An icon list.
- * @pos: Position at which the new icon should be inserted.
- * @im: Pixbuf image with the icon image.
- * @filename: Filename of the image file.
- * @text: Text to be used for the icon's caption.
- *
- * Inserts an icon in the specified icon list. The icon is created from the
- * specified Imlib image, and it is inserted at the @pos index.
- */
-void
-e_icon_list_insert_pixbuf (EIconList *eil, int pos, GdkPixbuf *im,
- const char *icon_filename, const char *text)
-{
- Icon *icon;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- icon = icon_new_from_pixbuf (eil, im, icon_filename, text);
- icon_list_insert (eil, pos, icon);
- return;
-}
-
-/**
- * e_icon_list_insert:
- * @eil: An icon list.
- * @pos: Position at which the new icon should be inserted.
- * @icon_filename: Name of the file that holds the icon's image.
- * @text: Text to be used for the icon's caption.
- *
- * Inserts an icon in the specified icon list. The icon's image is loaded
- * from the specified file, and it is inserted at the @pos index.
- */
-void
-e_icon_list_insert (EIconList *eil, int pos, const char *icon_filename, const char *text)
-{
- Icon *icon;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- icon = icon_new (eil, icon_filename, text);
- icon_list_insert (eil, pos, icon);
- return;
-}
-
-/**
- * e_icon_list_append_pixbuf:
- * @eil: An icon list.
- * @im: Pixbuf image with the icon image.
- * @filename: Filename of the image file.
- * @text: Text to be used for the icon's caption.
- *
- * Appends an icon to the specified icon list. The icon is created from
- * the specified Imlib image.
- */
-int
-e_icon_list_append_pixbuf (EIconList *eil, GdkPixbuf *im,
- const char *icon_filename, const char *text)
-{
- Icon *icon;
-
- g_return_val_if_fail (eil != NULL, -1);
- g_return_val_if_fail (IS_EIL (eil), -1);
-
- icon = icon_new_from_pixbuf (eil, im, icon_filename, text);
- return icon_list_append (eil, icon);
-}
-
-/**
- * e_icon_list_append:
- * @eil: An icon list.
- * @icon_filename: Name of the file that holds the icon's image.
- * @text: Text to be used for the icon's caption.
- *
- * Appends an icon to the specified icon list. The icon's image is loaded from
- * the specified file, and it is inserted at the @pos index.
- */
-int
-e_icon_list_append (EIconList *eil, const char *icon_filename,
- const char *text)
-{
- Icon *icon;
-
- g_return_val_if_fail (eil != NULL, -1);
- g_return_val_if_fail (IS_EIL (eil), -1);
-
- icon = icon_new (eil, icon_filename, text);
- return icon_list_append (eil, icon);
-}
-
-static void
-icon_destroy (Icon *icon)
-{
- if (icon->destroy)
- (* icon->destroy) (icon->data);
-
- g_free (icon->icon_filename);
-
- gtk_object_destroy (GTK_OBJECT (icon->image));
- gtk_object_destroy (GTK_OBJECT (icon->text));
- g_free (icon);
-}
-
-/**
- * e_icon_list_remove:
- * @eil: An icon list.
- * @pos: Index of the icon that should be removed.
- *
- * Removes the icon at index position @pos. If a destroy handler was specified
- * for that icon, it will be called with the appropriate data.
- */
-void
-e_icon_list_remove (EIconList *eil, int pos)
-{
- EIconListPrivate *priv;
- int was_selected;
- Icon *icon;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (pos >= 0 && pos < eil->_priv->icons);
-
- priv = eil->_priv;
-
- was_selected = FALSE;
-
- icon = g_array_index(priv->icon_list, Icon*, pos);
-
- if (icon->selected) {
- was_selected = TRUE;
-
- switch (priv->selection_mode) {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_EXTENDED:
- e_icon_list_unselect_icon (eil, pos);
- break;
-
- default:
- break;
- }
- }
-
- g_array_remove_index(priv->icon_list, pos);
- priv->icons--;
-
- sync_selection (eil, pos, SYNC_REMOVE);
-
- if (was_selected) {
- switch (priv->selection_mode) {
- case GTK_SELECTION_BROWSE:
- if (pos == priv->icons)
- e_icon_list_select_icon (eil, pos - 1);
- else
- e_icon_list_select_icon (eil, pos);
-
- break;
-
- default:
- break;
- }
- }
-
- if (priv->icons >= priv->last_selected_idx)
- priv->last_selected_idx = -1;
-
- if (priv->last_selected_icon == icon)
- priv->last_selected_icon = NULL;
-
- icon_destroy (icon);
-
- if (!priv->frozen) {
- /* FIXME: Optimize, only re-layout from pos to end */
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- } else
- priv->dirty = TRUE;
-}
-
-/**
- * e_icon_list_clear:
- * @eil: An icon list.
- *
- * Clears the contents for the icon list by removing all the icons. If destroy
- * handlers were specified for any of the icons, they will be called with the
- * appropriate data.
- */
-void
-e_icon_list_clear (EIconList *eil)
-{
- EIconListPrivate *priv;
- int i;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
-
- for (i = 0; i < priv->icon_list->len; i++)
- icon_destroy (g_array_index (priv->icon_list, Icon*, i));
-
- eil_free_line_info (eil);
-
- g_list_free (priv->selection);
- priv->selection = NULL;
- g_array_set_size(priv->icon_list, 0);
- priv->icons = 0;
- priv->last_selected_idx = -1;
- priv->last_selected_icon = NULL;
-
- if (!priv->frozen) {
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- } else
- priv->dirty = TRUE;
-}
-
-static void
-eil_destroy (GtkObject *object)
-{
- Eil *eil;
-
- /* remember, destroy can be run multiple times! */
-
- eil = EIL (object);
-
- g_free (eil->_priv->separators);
- eil->_priv->separators = NULL;
-
- eil->_priv->frozen = 1;
- eil->_priv->dirty = TRUE;
- if(eil->_priv->icon_list) {
- e_icon_list_clear (eil);
- g_array_free(eil->_priv->icon_list, TRUE);
- }
- eil->_priv->icon_list = NULL;
-
- if (eil->_priv->timer_tag != 0) {
- gtk_timeout_remove (eil->_priv->timer_tag);
- eil->_priv->timer_tag = 0;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (*GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-eil_finalize (GtkObject *object)
-{
- Eil *eil;
-
- eil = EIL (object);
-
- g_free (eil->_priv);
- eil->_priv = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->finalize)
- (*GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-
-static void
-select_icon (Eil *eil, int pos, GdkEvent *event)
-{
- EIconListPrivate *priv;
- gint i;
- Icon *icon;
-
- priv = eil->_priv;
-
- switch (priv->selection_mode) {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- i = 0;
-
- for (i = 0; i < priv->icon_list->len; i++) {
- icon = g_array_index (priv->icon_list, Icon*, i);
-
- if (i != pos && icon->selected)
- emit_select (eil, FALSE, i, event);
- }
-
- emit_select (eil, TRUE, pos, event);
- break;
-
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_EXTENDED:
- emit_select (eil, TRUE, pos, event);
- break;
-
- default:
- break;
- }
-}
-
-/**
- * e_icon_list_select_icon:
- * @eil: An icon list.
- * @pos: Index of the icon to be selected.
- *
- * Selects the icon at the index specified by @pos.
- */
-void
-e_icon_list_select_icon (EIconList *eil, int pos)
-{
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (pos >= 0 && pos < eil->_priv->icons);
-
- select_icon (eil, pos, NULL);
-}
-
-static void
-unselect_icon (Eil *eil, int pos, GdkEvent *event)
-{
- EIconListPrivate *priv;
-
- priv = eil->_priv;
-
- switch (priv->selection_mode) {
- case GTK_SELECTION_SINGLE:
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_EXTENDED:
- emit_select (eil, FALSE, pos, event);
- break;
-
- default:
- break;
- }
-}
-
-/**
- * e_icon_list_unselect_icon:
- * @eil: An icon list.
- * @pos: Index of the icon to be unselected.
- *
- * Unselects the icon at the index specified by @pos.
- */
-void
-e_icon_list_unselect_icon (EIconList *eil, int pos)
-{
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (pos >= 0 && pos < eil->_priv->icons);
-
- unselect_icon (eil, pos, NULL);
-}
-
-static void
-eil_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- requisition->width = 1;
- requisition->height = 1;
-}
-
-static void
-eil_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- Eil *eil;
- EIconListPrivate *priv;
-
- eil = EIL (widget);
- priv = eil->_priv;
-
- if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
- (* GTK_WIDGET_CLASS (parent_class)->size_allocate) (widget, allocation);
-
- if (priv->frozen)
- return;
-
- eil_layout_all_icons (eil);
-}
-
-static void
-eil_realize (GtkWidget *widget)
-{
- Eil *eil;
- EIconListPrivate *priv;
- GtkStyle *style;
-
- eil = EIL (widget);
- priv = eil->_priv;
-
- priv->frozen++;
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- priv->frozen--;
-
- /* Change the style to use the base color as the background */
-
- style = gtk_style_copy (gtk_widget_get_style (widget));
- style->bg[GTK_STATE_NORMAL] = style->base[GTK_STATE_NORMAL];
- gtk_widget_set_style (widget, style);
-
- gdk_window_set_background (GTK_LAYOUT (eil)->bin_window,
- &widget->style->bg[GTK_STATE_NORMAL]);
-
- if (priv->frozen)
- return;
-
- if (priv->dirty) {
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- }
-}
-
-static void
-real_select_icon (Eil *eil, gint num, GdkEvent *event)
-{
- EIconListPrivate *priv;
- Icon *icon;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (num >= 0 && num < eil->_priv->icons);
-
- priv = eil->_priv;
-
- icon = g_array_index (priv->icon_list, Icon*, num);
-
- if (icon->selected)
- return;
-
- icon->selected = TRUE;
- gnome_icon_text_item_select (icon->text, TRUE);
- priv->selection = g_list_append (priv->selection, GINT_TO_POINTER (num));
-}
-
-static void
-real_unselect_icon (Eil *eil, gint num, GdkEvent *event)
-{
- EIconListPrivate *priv;
- Icon *icon;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (num >= 0 && num < eil->_priv->icons);
-
- priv = eil->_priv;
-
- icon = g_array_index (priv->icon_list, Icon*, num);
-
- if (!icon->selected)
- return;
-
- icon->selected = FALSE;
- gnome_icon_text_item_select (icon->text, FALSE);
- priv->selection = g_list_remove (priv->selection, GINT_TO_POINTER (num));
-}
-
-/* Saves the selection of the icon list to temporary storage */
-static void
-store_temp_selection (Eil *eil)
-{
- EIconListPrivate *priv;
- int i;
- Icon *icon;
-
- priv = eil->_priv;
-
- for (i = 0; i < priv->icon_list->len; i++) {
- icon = g_array_index(priv->icon_list, Icon*, i);
-
- icon->tmp_selected = icon->selected;
- }
-}
-
-#define gray50_width 2
-#define gray50_height 2
-static const char gray50_bits[] = {
- 0x02, 0x01, };
-
-/* Button press handler for the icon list */
-static gint
-eil_button_press (GtkWidget *widget, GdkEventButton *event)
-{
- Eil *eil;
- EIconListPrivate *priv;
- int only_one;
- GdkBitmap *stipple;
- double tx, ty;
-
- eil = EIL (widget);
- priv = eil->_priv;
-
- /* Invoke the canvas event handler and see if an item picks up the event */
-
- if ((* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, event))
- return TRUE;
-
- if (!(event->type == GDK_BUTTON_PRESS
- && event->button == 1
- && priv->selection_mode != GTK_SELECTION_BROWSE))
- return FALSE;
-
- only_one = priv->selection_mode == GTK_SELECTION_SINGLE;
-
- if (only_one || (event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) == 0)
- eil_unselect_all (eil, NULL, NULL);
-
- if (only_one)
- return TRUE;
-
- if (priv->selecting)
- return FALSE;
-
- gnome_canvas_window_to_world (GNOME_CANVAS (eil), event->x, event->y, &tx, &ty);
- priv->sel_start_x = tx;
- priv->sel_start_y = ty;
- priv->sel_state = event->state;
- priv->selecting = TRUE;
-
- store_temp_selection (eil);
-
- stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
- priv->sel_rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (eil)),
- gnome_canvas_rect_get_type (),
- "x1", tx,
- "y1", ty,
- "x2", tx,
- "y2", ty,
- "outline_color", "black",
- "width_pixels", 1,
- "outline_stipple", stipple,
- NULL);
- gdk_bitmap_unref (stipple);
-
- gnome_canvas_item_grab (priv->sel_rect, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
- NULL, event->time);
-
- return TRUE;
-}
-
-/* Returns whether the specified icon is at least partially inside the specified
- * rectangle.
- */
-static int
-icon_is_in_area (Icon *icon, int x1, int y1, int x2, int y2)
-{
- double ix1, iy1, ix2, iy2;
-
- if (x1 == x2 && y1 == y2)
- return FALSE;
-
- gnome_canvas_item_get_bounds (GNOME_CANVAS_ITEM (icon->image), &ix1, &iy1, &ix2, &iy2);
-
- if (ix1 <= x2 && iy1 <= y2 && ix2 >= x1 && iy2 >= y1)
- return TRUE;
-
- gnome_canvas_item_get_bounds (GNOME_CANVAS_ITEM (icon->text), &ix1, &iy1, &ix2, &iy2);
-
- if (ix1 <= x2 && iy1 <= y2 && ix2 >= x1 && iy2 >= y1)
- return TRUE;
-
- return FALSE;
-}
-
-/* Updates the rubberband selection to the specified point */
-static void
-update_drag_selection (Eil *eil, int x, int y)
-{
- EIconListPrivate *priv;
- int x1, x2, y1, y2;
- int i;
- Icon *icon;
- int additive, invert;
-
- priv = eil->_priv;
-
- /* Update rubberband */
-
- if (priv->sel_start_x < x) {
- x1 = priv->sel_start_x;
- x2 = x;
- } else {
- x1 = x;
- x2 = priv->sel_start_x;
- }
-
- if (priv->sel_start_y < y) {
- y1 = priv->sel_start_y;
- y2 = y;
- } else {
- y1 = y;
- y2 = priv->sel_start_y;
- }
-
- if (x1 < 0)
- x1 = 0;
-
- if (y1 < 0)
- y1 = 0;
-
- if (x2 >= GTK_WIDGET (eil)->allocation.width)
- x2 = GTK_WIDGET (eil)->allocation.width - 1;
-
- if (y2 >= priv->total_height)
- y2 = priv->total_height - 1;
-
- gnome_canvas_item_set (priv->sel_rect,
- "x1", (double) x1,
- "y1", (double) y1,
- "x2", (double) x2,
- "y2", (double) y2,
- NULL);
-
- /* Select or unselect icons as appropriate */
-
- additive = priv->sel_state & GDK_SHIFT_MASK;
- invert = priv->sel_state & GDK_CONTROL_MASK;
-
- for (i = 0; i < priv->icon_list->len; i++) {
- icon = g_array_index(priv->icon_list, Icon*, i);
-
- if (icon_is_in_area (icon, x1, y1, x2, y2)) {
- if (invert) {
- if (icon->selected == icon->tmp_selected)
- emit_select (eil, !icon->selected, i, NULL);
- } else if (additive) {
- if (!icon->selected)
- emit_select (eil, TRUE, i, NULL);
- } else {
- if (!icon->selected)
- emit_select (eil, TRUE, i, NULL);
- }
- } else if (icon->selected != icon->tmp_selected)
- emit_select (eil, icon->tmp_selected, i, NULL);
- }
-}
-
-/* Button release handler for the icon list */
-static gint
-eil_button_release (GtkWidget *widget, GdkEventButton *event)
-{
- Eil *eil;
- EIconListPrivate *priv;
- double x, y;
-
- eil = EIL (widget);
- priv = eil->_priv;
-
- if (!priv->selecting)
- return (* GTK_WIDGET_CLASS (parent_class)->button_release_event) (widget, event);
-
- if (event->button != 1)
- return FALSE;
-
- gnome_canvas_window_to_world (GNOME_CANVAS (eil), event->x, event->y, &x, &y);
- update_drag_selection (eil, x, y);
- gnome_canvas_item_ungrab (priv->sel_rect, event->time);
-
- gtk_object_destroy (GTK_OBJECT (priv->sel_rect));
- priv->sel_rect = NULL;
- priv->selecting = FALSE;
-
- if (priv->timer_tag != 0) {
- gtk_timeout_remove (priv->timer_tag);
- priv->timer_tag = 0;
- }
-
- return TRUE;
-}
-
-/* Autoscroll timeout handler for the icon list */
-static gint
-scroll_timeout (gpointer data)
-{
- Eil *eil;
- EIconListPrivate *priv;
- GtkAdjustment *adj;
- double x, y;
- int value;
-
- eil = data;
- priv = eil->_priv;
-
- GDK_THREADS_ENTER ();
-
- adj = gtk_layout_get_vadjustment (GTK_LAYOUT (eil));
-
- value = adj->value + priv->value_diff;
- if (value > adj->upper - adj->page_size)
- value = adj->upper - adj->page_size;
-
- gtk_adjustment_set_value (adj, value);
-
- gnome_canvas_window_to_world (GNOME_CANVAS (eil),
- priv->event_last_x, priv->event_last_y,
- &x, &y);
- update_drag_selection (eil, x, y);
-
- GDK_THREADS_LEAVE();
-
- return TRUE;
-}
-
-/* Motion event handler for the icon list */
-static gint
-eil_motion_notify (GtkWidget *widget, GdkEventMotion *event)
-{
- Eil *eil;
- EIconListPrivate *priv;
- double x, y;
-
- eil = EIL (widget);
- priv = eil->_priv;
-
- if (!priv->selecting)
- return (* GTK_WIDGET_CLASS (parent_class)->motion_notify_event) (widget, event);
-
- gnome_canvas_window_to_world (GNOME_CANVAS (eil), event->x, event->y, &x, &y);
- update_drag_selection (eil, x, y);
-
- /* If we are out of bounds, schedule a timeout that will do the scrolling */
-
- if (event->y < 0 || event->y > widget->allocation.height) {
- if (priv->timer_tag == 0)
- priv->timer_tag = gtk_timeout_add (SCROLL_TIMEOUT, scroll_timeout, eil);
-
- if (event->y < 0)
- priv->value_diff = event->y;
- else
- priv->value_diff = event->y - widget->allocation.height;
-
- priv->event_last_x = event->x;
- priv->event_last_y = event->y;
-
- /* Make the steppings be relative to the mouse distance from the
- * canvas. Also notice the timeout above is small to give a
- * more smooth movement.
- */
- priv->value_diff /= 5;
- } else if (priv->timer_tag != 0) {
- gtk_timeout_remove (priv->timer_tag);
- priv->timer_tag = 0;
- }
-
- return TRUE;
-}
-
-typedef gboolean (*xGtkSignal_BOOL__INT_POINTER) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gpointer user_data);
-static void
-xgtk_marshal_BOOL__INT_POINTER (GtkObject *object, GtkSignalFunc func, gpointer func_data,
- GtkArg *args)
-{
- xGtkSignal_BOOL__INT_POINTER rfunc;
- gboolean *return_val;
-
- return_val = GTK_RETLOC_BOOL (args[2]);
- rfunc = (xGtkSignal_BOOL__INT_POINTER) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-static void
-eil_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EIconList *eil;
-
- eil = E_ICON_LIST (object);
-
- switch (arg_id) {
- default:
- break;
- }
-}
-
-static void
-eil_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EIconList *eil;
- EIconListPrivate *priv;
-
- eil = E_ICON_LIST (object);
- priv = eil->_priv;
-
- switch (arg_id) {
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-eil_class_init (EilClass *eil_class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkLayoutClass *layout_class;
- GnomeCanvasClass *canvas_class;
-
- object_class = (GtkObjectClass *) eil_class;
- widget_class = (GtkWidgetClass *) eil_class;
- layout_class = (GtkLayoutClass *) eil_class;
- canvas_class = (GnomeCanvasClass *) eil_class;
-
- parent_class = gtk_type_class (gnome_canvas_get_type ());
-
- eil_signals[SELECT_ICON] =
- gtk_signal_new (
- "select_icon",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconListClass, select_icon),
- gtk_marshal_NONE__INT_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_EVENT);
-
- eil_signals[UNSELECT_ICON] =
- gtk_signal_new (
- "unselect_icon",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconListClass, unselect_icon),
- gtk_marshal_NONE__INT_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_EVENT);
-
- eil_signals[TEXT_CHANGED] =
- gtk_signal_new (
- "text_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EIconListClass, text_changed),
- xgtk_marshal_BOOL__INT_POINTER,
- GTK_TYPE_BOOL, 2,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, eil_signals, LAST_SIGNAL);
-
- object_class->destroy = eil_destroy;
- object_class->finalize = eil_finalize;
- object_class->set_arg = eil_set_arg;
- object_class->get_arg = eil_get_arg;
-
- widget_class->size_request = eil_size_request;
- widget_class->size_allocate = eil_size_allocate;
- widget_class->realize = eil_realize;
- widget_class->button_press_event = eil_button_press;
- widget_class->button_release_event = eil_button_release;
- widget_class->motion_notify_event = eil_motion_notify;
-
- eil_class->select_icon = real_select_icon;
- eil_class->unselect_icon = real_unselect_icon;
-}
-
-static void
-eil_init (Eil *eil)
-{
- eil->_priv = g_new0 (EIconListPrivate, 1);
-
- eil->_priv->icon_list = g_array_new(FALSE, FALSE, sizeof(gpointer));
- eil->_priv->row_spacing = DEFAULT_ROW_SPACING;
- eil->_priv->col_spacing = DEFAULT_COL_SPACING;
- eil->_priv->text_spacing = DEFAULT_TEXT_SPACING;
- eil->_priv->icon_border = DEFAULT_ICON_BORDER;
- eil->_priv->separators = g_strdup (" ");
-
- eil->_priv->selection_mode = GTK_SELECTION_SINGLE;
- eil->_priv->dirty = TRUE;
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS (eil), 0.0, 0.0, 1000000.0, 1000000.0);
- gnome_canvas_scroll_to (GNOME_CANVAS (eil), 0, 0);
-}
-
-/**
- * e_icon_list_get_type:
- *
- * Registers the &EIconList class if necessary, and returns the type ID
- * associated to it.
- *
- * Returns: The type ID of the &EIconList class.
- */
-guint
-e_icon_list_get_type (void)
-{
- static guint eil_type = 0;
-
- if (!eil_type) {
- GtkTypeInfo eil_info = {
- "EIconList",
- sizeof (EIconList),
- sizeof (EIconListClass),
- (GtkClassInitFunc) eil_class_init,
- (GtkObjectInitFunc) eil_init,
- NULL,
- NULL,
- NULL
- };
-
- eil_type = gtk_type_unique (gnome_canvas_get_type (),
- &eil_info);
- }
-
- return eil_type;
-}
-
-/**
- * e_icon_list_set_icon_width:
- * @eil: An icon list.
- * @w: New width for the icon columns.
- *
- * Sets the amount of horizontal space allocated to the icons, i.e. the column
- * width of the icon list.
- */
-void
-e_icon_list_set_icon_width (EIconList *eil, int w)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
-
- priv->icon_width = w;
-
- if (priv->frozen) {
- priv->dirty = TRUE;
- return;
- }
-
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
-}
-
-
-/**
- * e_icon_list_construct:
- * @eil: An icon list.
- * @icon_width: Width for the icon columns.
- * @flags: A combination of %E_ICON_LIST_IS_EDITABLE and %E_ICON_LIST_STATIC_TEXT.
- *
- * Constructor for the icon list, to be used by derived classes.
- **/
-void
-e_icon_list_construct (EIconList *eil, guint icon_width, int flags)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
-
- e_icon_list_set_icon_width (eil, icon_width);
- priv->is_editable = (flags & E_ICON_LIST_IS_EDITABLE) != 0;
- priv->static_text = (flags & E_ICON_LIST_STATIC_TEXT) != 0;
-}
-
-
-/**
- * e_icon_list_new: [constructor]
- * @icon_width: Width for the icon columns.
- * @flags: A combination of %E_ICON_LIST_IS_EDITABLE and %E_ICON_LIST_STATIC_TEXT.
- *
- * Creates a new icon list widget. The icon columns are allocated a width of
- * @icon_width pixels. Icon captions will be word-wrapped to this width as
- * well.
- *
- * If @flags has the %E_ICON_LIST_IS_EDITABLE flag set, then the user will be
- * able to edit the text in the icon captions, and the "text_changed" signal
- * will be emitted when an icon's text is changed.
- *
- * If @flags has the %E_ICON_LIST_STATIC_TEXT flags set, then the text
- * for the icon captions will not be copied inside the icon list; it will only
- * store the pointers to the original text strings specified by the application.
- * This is intended to save memory. If this flag is not set, then the text
- * strings will be copied and managed internally.
- *
- * Returns: a newly-created icon list widget
- */
-GtkWidget *
-e_icon_list_new (guint icon_width, int flags)
-{
- Eil *eil;
-
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- eil = EIL (gtk_type_new (e_icon_list_get_type ()));
- gtk_widget_pop_colormap ();
-
- e_icon_list_construct (eil, icon_width, flags);
-
- return GTK_WIDGET (eil);
-}
-
-
-/**
- * e_icon_list_freeze:
- * @eil: An icon list.
- *
- * Freezes an icon list so that any changes made to it will not be
- * reflected on the screen until it is thawed with e_icon_list_thaw().
- * It is recommended to freeze the icon list before inserting or deleting
- * many icons, for example, so that the layout process will only be executed
- * once, when the icon list is finally thawed.
- *
- * You can call this function multiple times, but it must be balanced with the
- * same number of calls to e_icon_list_thaw() before the changes will take
- * effect.
- */
-void
-e_icon_list_freeze (EIconList *eil)
-{
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- eil->_priv->frozen++;
-
- /* We hide the root so that the user will not see any changes while the
- * icon list is doing stuff.
- */
-
- if (eil->_priv->frozen == 1)
- gnome_canvas_item_hide (GNOME_CANVAS (eil)->root);
-}
-
-/**
- * e_icon_list_thaw:
- * @eil: An icon list.
- *
- * Thaws the icon list and performs any pending layout operations. This
- * is to be used in conjunction with e_icon_list_freeze().
- */
-void
-e_icon_list_thaw (EIconList *eil)
-{
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (eil->_priv->frozen > 0);
-
- eil->_priv->frozen--;
-
- if (eil->_priv->dirty) {
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- }
-
- if (eil->_priv->frozen == 0)
- gnome_canvas_item_show (GNOME_CANVAS (eil)->root);
-}
-
-/**
- * e_icon_list_set_selection_mode
- * @eil: An icon list.
- * @mode: New selection mode.
- *
- * Sets the selection mode for an icon list. The %GTK_SELECTION_MULTIPLE and
- * %GTK_SELECTION_EXTENDED modes are considered equivalent.
- */
-void
-e_icon_list_set_selection_mode (EIconList *eil, GtkSelectionMode mode)
-{
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- eil->_priv->selection_mode = mode;
- eil->_priv->last_selected_idx = -1;
- eil->_priv->last_selected_icon = NULL;
-}
-
-/**
- * e_icon_list_set_icon_data_full:
- * @eil: An icon list.
- * @pos: Index of an icon.
- * @data: User data to set on the icon.
- * @destroy: Destroy notification handler for the icon.
- *
- * Associates the @data pointer to the icon at the index specified by @pos. The
- * @destroy argument points to a function that will be called when the icon is
- * destroyed, or NULL if no function is to be called when this happens.
- */
-void
-e_icon_list_set_icon_data_full (EIconList *eil,
- int pos, gpointer data,
- GtkDestroyNotify destroy)
-{
- Icon *icon;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (pos >= 0 && pos < eil->_priv->icons);
-
- icon = g_array_index (eil->_priv->icon_list, Icon*, pos);
- icon->data = data;
- icon->destroy = destroy;
-}
-
-/**
- * e_icon_list_get_icon_data:
- * @eil: An icon list.
- * @pos: Index of an icon.
- * @data: User data to set on the icon.
- *
- * Associates the @data pointer to the icon at the index specified by @pos.
- */
-void
-e_icon_list_set_icon_data (EIconList *eil, int pos, gpointer data)
-{
- e_icon_list_set_icon_data_full (eil, pos, data, NULL);
-}
-
-/**
- * e_icon_list_get_icon_data:
- * @eil: An icon list.
- * @pos: Index of an icon.
- *
- * Returns the user data pointer associated to the icon at the index specified
- * by @pos.
- */
-gpointer
-e_icon_list_get_icon_data (EIconList *eil, int pos)
-{
- Icon *icon;
-
- g_return_val_if_fail (eil != NULL, NULL);
- g_return_val_if_fail (IS_EIL (eil), NULL);
- g_return_val_if_fail (pos >= 0 && pos < eil->_priv->icons, NULL);
-
- icon = g_array_index (eil->_priv->icon_list, Icon*, pos);
- return icon->data;
-}
-
-/**
- * e_icon_list_find_icon_from_data:
- * @eil: An icon list.
- * @data: Data pointer associated to an icon.
- *
- * Returns the index of the icon whose user data has been set to @data,
- * or -1 if no icon has this data associated to it.
- */
-int
-e_icon_list_find_icon_from_data (EIconList *eil, gpointer data)
-{
- EIconListPrivate *priv;
- int n;
- Icon *icon;
-
- g_return_val_if_fail (eil != NULL, -1);
- g_return_val_if_fail (IS_EIL (eil), -1);
-
- priv = eil->_priv;
-
- for (n = 0; n < priv->icon_list->len; n++) {
- icon = g_array_index(priv->icon_list, Icon*, n);
- if (icon->data == data)
- return n;
- }
-
- return -1;
-}
-
-/* Sets an integer value in the private structure of the icon list, and updates it */
-static void
-set_value (EIconList *eil, EIconListPrivate *priv, int *dest, int val)
-{
- if (val == *dest)
- return;
-
- *dest = val;
-
- if (!priv->frozen) {
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
- } else
- priv->dirty = TRUE;
-}
-
-/**
- * e_icon_list_set_row_spacing:
- * @eil: An icon list.
- * @pixels: Number of pixels for inter-row spacing.
- *
- * Sets the spacing to be used between rows of icons.
- */
-void
-e_icon_list_set_row_spacing (EIconList *eil, int pixels)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
- set_value (eil, priv, &priv->row_spacing, pixels);
-}
-
-/**
- * e_icon_list_set_col_spacing:
- * @eil: An icon list.
- * @pixels: Number of pixels for inter-column spacing.
- *
- * Sets the spacing to be used between columns of icons.
- */
-void
-e_icon_list_set_col_spacing (EIconList *eil, int pixels)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
- set_value (eil, priv, &priv->col_spacing, pixels);
-}
-
-/**
- * e_icon_list_set_text_spacing:
- * @eil: An icon list.
- * @pixels: Number of pixels between an icon's image and its caption.
- *
- * Sets the spacing to be used between an icon's image and its text caption.
- */
-void
-e_icon_list_set_text_spacing (EIconList *eil, int pixels)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
- set_value (eil, priv, &priv->text_spacing, pixels);
-}
-
-/**
- * e_icon_list_set_icon_border:
- * @eil: An icon list.
- * @pixels: Number of border pixels to be used around an icon's image.
- *
- * Sets the width of the border to be displayed around an icon's image. This is
- * currently not implemented.
- */
-void
-e_icon_list_set_icon_border (EIconList *eil, int pixels)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
-
- priv = eil->_priv;
- set_value (eil, priv, &priv->icon_border, pixels);
-}
-
-/**
- * e_icon_list_set_separators:
- * @eil: An icon list.
- * @sep: String with characters to be used as word separators.
- *
- * Sets the characters that can be used as word separators when doing
- * word-wrapping in the icon text captions.
- */
-void
-e_icon_list_set_separators (EIconList *eil, const char *sep)
-{
- EIconListPrivate *priv;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (sep != NULL);
-
- priv = eil->_priv;
-
- if (priv->separators)
- g_free (priv->separators);
-
- priv->separators = g_strdup (sep);
-
- if (priv->frozen) {
- priv->dirty = TRUE;
- return;
- }
-
- eil_layout_all_icons (eil);
- eil_scrollbar_adjust (eil);
-}
-
-/**
- * e_icon_list_moveto:
- * @eil: An icon list.
- * @pos: Index of an icon.
- * @yalign: Vertical alignment of the icon.
- *
- * Makes the icon whose index is @pos be visible on the screen. The icon list
- * gets scrolled so that the icon is visible. An alignment of 0.0 represents
- * the top of the visible part of the icon list, and 1.0 represents the bottom.
- * An icon can be centered on the icon list.
- */
-void
-e_icon_list_moveto (EIconList *eil, int pos, double yalign)
-{
- EIconListPrivate *priv;
- GtkAdjustment *adj;
- IconLine *il;
- GList *l;
- int i, y, uh, line;
-
- g_return_if_fail (eil != NULL);
- g_return_if_fail (IS_EIL (eil));
- g_return_if_fail (pos >= 0 && pos < eil->_priv->icons);
- g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
-
- priv = eil->_priv;
-
- g_return_if_fail (priv->lines != NULL);
-
- line = pos / eil_get_items_per_line (eil);
-
- y = 0;
- for (i = 0, l = priv->lines; l && i < line; l = l->next, i++) {
- il = l->data;
- y += icon_line_height (eil, il);
- }
-
- il = l->data;
-
- uh = GTK_WIDGET (eil)->allocation.height - icon_line_height (eil,il);
- adj = gtk_layout_get_vadjustment (GTK_LAYOUT (eil));
- gtk_adjustment_set_value (adj, y - uh * yalign);
-}
-
-/**
- * e_icon_list_is_visible:
- * @eil: An icon list.
- * @pos: Index of an icon.
- *
- * Returns whether the icon at the index specified by @pos is visible. This
- * will be %GTK_VISIBILITY_NONE if the icon is not visible at all,
- * %GTK_VISIBILITY_PARTIAL if the icon is at least partially shown, and
- * %GTK_VISIBILITY_FULL if the icon is fully visible.
- */
-GtkVisibility
-e_icon_list_icon_is_visible (EIconList *eil, int pos)
-{
- EIconListPrivate *priv;
- GtkAdjustment *adj;
- IconLine *il;
- GList *l;
- int line, y1, y2, i;
-
- g_return_val_if_fail (eil != NULL, GTK_VISIBILITY_NONE);
- g_return_val_if_fail (IS_EIL (eil), GTK_VISIBILITY_NONE);
- g_return_val_if_fail (pos >= 0 && pos < eil->_priv->icons,
- GTK_VISIBILITY_NONE);
-
- priv = eil->_priv;
-
- if (priv->lines == NULL)
- return GTK_VISIBILITY_NONE;
-
- line = pos / eil_get_items_per_line (eil);
- y1 = 0;
- for (i = 0, l = priv->lines; l && i < line; l = l->next, i++) {
- il = l->data;
- y1 += icon_line_height (eil, il);
- }
-
- y2 = y1 + icon_line_height (eil, (IconLine *) l->data);
-
- adj = gtk_layout_get_vadjustment (GTK_LAYOUT (eil));
-
- if (y2 < adj->value)
- return GTK_VISIBILITY_NONE;
-
- if (y1 > adj->value + GTK_WIDGET (eil)->allocation.height)
- return GTK_VISIBILITY_NONE;
-
- if (y2 <= adj->value + GTK_WIDGET (eil)->allocation.height &&
- y1 >= adj->value)
- return GTK_VISIBILITY_FULL;
-
- return GTK_VISIBILITY_PARTIAL;
-}
-
-/**
- * e_icon_list_get_icon_at:
- * @eil: An icon list.
- * @x: X position in the icon list window.
- * @y: Y position in the icon list window.
- *
- * Returns the index of the icon that is under the specified coordinates, which
- * are relative to the icon list's window. If there is no icon in that
- * position, -1 is returned.
- */
-int
-e_icon_list_get_icon_at (EIconList *eil, int x, int y)
-{
- EIconListPrivate *priv;
- double wx, wy;
- double dx, dy;
- int cx, cy;
- int n;
- GnomeCanvasItem *item;
- double dist;
-
- g_return_val_if_fail (eil != NULL, -1);
- g_return_val_if_fail (IS_EIL (eil), -1);
-
- priv = eil->_priv;
-
- dx = x;
- dy = y;
-
- gnome_canvas_window_to_world (GNOME_CANVAS (eil), dx, dy, &wx, &wy);
- gnome_canvas_w2c (GNOME_CANVAS (eil), wx, wy, &cx, &cy);
-
- for (n = 0; n < priv->icon_list->len; n++) {
- Icon *icon = g_array_index(priv->icon_list, Icon*, n);
- GnomeCanvasItem *image = GNOME_CANVAS_ITEM (icon->image);
- GnomeCanvasItem *text = GNOME_CANVAS_ITEM (icon->text);
-
- if (wx >= image->x1 && wx <= image->x2 && wy >= image->y1 && wy <= image->y2) {
- dist = (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (image)->klass)->point) (
- image,
- wx, wy,
- cx, cy,
- &item);
-
- if ((int) (dist * GNOME_CANVAS (eil)->pixels_per_unit + 0.5)
- <= GNOME_CANVAS (eil)->close_enough)
- return n;
- }
-
- if (wx >= text->x1 && wx <= text->x2 && wy >= text->y1 && wy <= text->y2) {
- dist = (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (text)->klass)->point) (
- text,
- wx, wy,
- cx, cy,
- &item);
-
- if ((int) (dist * GNOME_CANVAS (eil)->pixels_per_unit + 0.5)
- <= GNOME_CANVAS (eil)->close_enough)
- return n;
- }
- }
-
- return -1;
-}
-
-
-/**
- * e_icon_list_get_num_icons:
- * @eil: An icon list.
- *
- * Returns the number of icons in the icon list.
- */
-guint
-e_icon_list_get_num_icons (EIconList *eil)
-{
- g_return_val_if_fail (E_IS_ICON_LIST (eil), 0);
-
- return eil->_priv->icons;
-}
-
-
-/**
- * e_icon_list_get_selection:
- * @eil: An icon list.
- *
- * Returns a list of integers with the indices of the currently selected icons.
- */
-GList *
-e_icon_list_get_selection (EIconList *eil)
-{
- g_return_val_if_fail (E_IS_ICON_LIST (eil), NULL);
-
- return eil->_priv->selection;
-}
-
-
-/**
- * e_icon_list_get_selection:
- * @eil: An icon list.
- * @idx: Index of an @icon.
- *
- * Returns the filename of the icon with index @idx.
- */
-gchar *
-e_icon_list_get_icon_filename (EIconList *eil, int idx)
-{
- Icon *icon;
-
- g_return_val_if_fail (eil != NULL, NULL);
- g_return_val_if_fail (IS_EIL (eil), NULL);
- g_return_val_if_fail (idx >= 0 && idx < eil->_priv->icons, NULL);
-
- icon = g_array_index (eil->_priv->icon_list, Icon*, idx);
- return icon->icon_filename;
-}
-
-
-/**
- * e_icon_list_find_icon_from_filename:
- * @eil: An icon list.
- * @filename: Filename of an icon.
- *
- * Returns the index of the icon whose filename is @filename or -1 if
- * there is no icon with this filename.
- */
-int
-e_icon_list_find_icon_from_filename (EIconList *eil,
- const gchar *filename)
-{
- EIconListPrivate *priv;
- int n;
- Icon *icon;
-
- g_return_val_if_fail (eil != NULL, -1);
- g_return_val_if_fail (IS_EIL (eil), -1);
- g_return_val_if_fail (filename != NULL, -1);
-
- priv = eil->_priv;
-
- for (n = 0; n < priv->icon_list->len; n++) {
- icon = g_array_index(priv->icon_list, Icon*, n);
- if (!strcmp (icon->icon_filename, filename))
- return n;
- }
-
- return -1;
-}
-
diff --git a/composer/e-icon-list.h b/composer/e-icon-list.h
deleted file mode 100644
index 7cdaf6e85f..0000000000
--- a/composer/e-icon-list.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 1998, 1999 Free Software Foundation
- * Copyright (C) 2000 Red Hat, Inc.
- * All rights reserved.
- *
- * This file is part of the Gnome Library.
- *
- * The Gnome Library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * The Gnome Library 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with the Gnome Library; see the file COPYING.LIB. If not,
- * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-/*
- @NOTATION@
- */
-
-/* GnomeIconList widget - scrollable icon list
- *
- *
- * Authors:
- * Federico Mena <federico@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- */
-
-#ifndef _E_ICON_LIST_H_
-#define _E_ICON_LIST_H_
-
-#include <libgnome/gnome-defs.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TYPE_ICON_LIST (e_icon_list_get_type ())
-#define E_ICON_LIST(obj) (GTK_CHECK_CAST ((obj), E_TYPE_ICON_LIST, EIconList))
-#define E_ICON_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_ICON_LIST, EIconListClass))
-#define E_IS_ICON_LIST(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_ICON_LIST))
-#define E_IS_ICON_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_ICON_LIST))
-#define E_ICON_LIST_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), E_TYPE_ICON_LIST, EIconListClass))
-
-typedef struct _EIconList EIconList;
-typedef struct _EIconListPrivate EIconListPrivate;
-typedef struct _EIconListClass EIconListClass;
-
-typedef enum {
- E_ICON_LIST_ICONS,
- E_ICON_LIST_TEXT_BELOW,
- E_ICON_LIST_TEXT_RIGHT
-} EIconListMode;
-
-/* This structure has been converted to use public and private parts. To avoid
- * breaking binary compatibility, the slots for private fields have been
- * replaced with padding. Please remove these fields when gnome-libs has
- * reached another major version and it is "fine" to break binary compatibility.
- */
-struct _EIconList {
- GnomeCanvas canvas;
-
- /*< private >*/
- EIconListPrivate * _priv;
-};
-
-struct _EIconListClass {
- GnomeCanvasClass parent_class;
-
- void (*select_icon) (EIconList *gil, gint num, GdkEvent *event);
- void (*unselect_icon) (EIconList *gil, gint num, GdkEvent *event);
- gboolean (*text_changed) (EIconList *gil, gint num, const char *new_text);
-};
-
-enum {
- E_ICON_LIST_IS_EDITABLE = 1 << 0,
- E_ICON_LIST_STATIC_TEXT = 1 << 1
-};
-
-guint e_icon_list_get_type (void) G_GNUC_CONST;
-
-GtkWidget *e_icon_list_new (guint icon_width,
- int flags);
-void e_icon_list_construct (EIconList *gil,
- guint icon_width,
- int flags);
-
-
-/* To avoid excesive recomputes during insertion/deletion */
-void e_icon_list_freeze (EIconList *gil);
-void e_icon_list_thaw (EIconList *gil);
-
-
-void e_icon_list_insert (EIconList *gil,
- int idx,
- const char *icon_filename,
- const char *text);
-void e_icon_list_insert_pixbuf (EIconList *gil,
- int idx,
- GdkPixbuf *im,
- const char *icon_filename,
- const char *text);
-
-int e_icon_list_append (EIconList *gil,
- const char *icon_filename,
- const char *text);
-int e_icon_list_append_pixbuf (EIconList *gil,
- GdkPixbuf *im,
- const char *icon_filename,
- const char *text);
-
-void e_icon_list_clear (EIconList *gil);
-void e_icon_list_remove (EIconList *gil,
- int idx);
-
-guint e_icon_list_get_num_icons (EIconList *gil);
-
-
-/* Managing the selection */
-void e_icon_list_set_selection_mode (EIconList *gil,
- GtkSelectionMode mode);
-void e_icon_list_select_icon (EIconList *gil,
- int idx);
-void e_icon_list_unselect_icon (EIconList *gil,
- int idx);
-int e_icon_list_unselect_all (EIconList *gil);
-GList * e_icon_list_get_selection (EIconList *gil);
-
-/* Setting the spacing values */
-void e_icon_list_set_icon_width (EIconList *gil,
- int w);
-void e_icon_list_set_row_spacing (EIconList *gil,
- int pixels);
-void e_icon_list_set_col_spacing (EIconList *gil,
- int pixels);
-void e_icon_list_set_text_spacing (EIconList *gil,
- int pixels);
-void e_icon_list_set_icon_border (EIconList *gil,
- int pixels);
-void e_icon_list_set_separators (EIconList *gil,
- const char *sep);
-/* Icon filename. */
-gchar * e_icon_list_get_icon_filename (EIconList *gil,
- int idx);
-int e_icon_list_find_icon_from_filename (EIconList *gil,
- const char *filename);
-
-/* Attaching information to the icons */
-void e_icon_list_set_icon_data (EIconList *gil,
- int idx, gpointer data);
-void e_icon_list_set_icon_data_full (EIconList *gil,
- int idx, gpointer data,
- GtkDestroyNotify destroy);
-int e_icon_list_find_icon_from_data (EIconList *gil,
- gpointer data);
-gpointer e_icon_list_get_icon_data (EIconList *gil,
- int idx);
-
-/* Visibility */
-void e_icon_list_moveto (EIconList *gil,
- int idx, double yalign);
-GtkVisibility e_icon_list_icon_is_visible (EIconList *gil,
- int idx);
-
-int e_icon_list_get_icon_at (EIconList *gil,
- int x, int y);
-
-int e_icon_list_get_items_per_line (EIconList *gil);
-
-END_GNOME_DECLS
-
-#endif /* _GNOME_ICON_LIST_H_ */
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
deleted file mode 100644
index 9c125e08b8..0000000000
--- a/composer/e-msg-composer-attachment-bar.c
+++ /dev/null
@@ -1,800 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-attachment-bar.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <glade/glade.h>
-#include <libgnomevfs/gnome-vfs-mime-info.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
-
-#include "e-msg-composer.h"
-#include "e-msg-composer-select-file.h"
-#include "e-msg-composer-attachment.h"
-#include "e-msg-composer-attachment-bar.h"
-
-#include "e-icon-list.h"
-
-#include "camel/camel-data-wrapper.h"
-#include "camel/camel-stream-fs.h"
-#include "camel/camel-stream-mem.h"
-#include "camel/camel-mime-part.h"
-
-
-#define ICON_WIDTH 64
-#define ICON_SEPARATORS " /-_"
-#define ICON_SPACING 2
-#define ICON_ROW_SPACING ICON_SPACING
-#define ICON_COL_SPACING ICON_SPACING
-#define ICON_BORDER 2
-#define ICON_TEXT_SPACING 2
-
-
-static EIconListClass *parent_class = NULL;
-
-struct _EMsgComposerAttachmentBarPrivate {
- GList *attachments;
- guint num_attachments;
-
- GtkWidget *context_menu;
- GtkWidget *icon_context_menu;
-};
-
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-
-static void update (EMsgComposerAttachmentBar *bar);
-
-
-static gchar *
-size_to_string (gulong size)
-{
- gchar *size_string;
-
- /* FIXME: The following should probably go into a separate module, as
- we might have to do the same thing in other places as well. Also,
- I am not sure this will be OK for all the languages. */
-
- if (size < 1e3L) {
- if (size == 1)
- size_string = g_strdup (_("1 byte"));
- else
- size_string = g_strdup_printf (_("%u bytes"),
- (guint) size);
- } else {
- gdouble displayed_size;
-
- if (size < 1e6L) {
- displayed_size = (gdouble) size / 1.0e3;
- size_string = g_strdup_printf (_("%.1fK"),
- displayed_size);
- } else if (size < 1e9L) {
- displayed_size = (gdouble) size / 1.0e6;
- size_string = g_strdup_printf (_("%.1fM"),
- displayed_size);
- } else {
- displayed_size = (gdouble) size / 1.0e9;
- size_string = g_strdup_printf (_("%.1fG"),
- displayed_size);
- }
- }
-
- return size_string;
-}
-
-/* Attachment handling functions. */
-
-static void
-free_attachment_list (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- GList *p;
-
- priv = bar->priv;
-
- for (p = priv->attachments; p != NULL; p = p->next)
- gtk_object_unref (GTK_OBJECT (p->data));
-}
-
-static void
-attachment_changed_cb (EMsgComposerAttachment *attachment,
- gpointer data)
-{
- update (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
-}
-
-static void
-add_common (EMsgComposerAttachmentBar *bar,
- EMsgComposerAttachment *attachment)
-{
- g_return_if_fail (attachment != NULL);
-
- gtk_signal_connect (GTK_OBJECT (attachment), "changed",
- GTK_SIGNAL_FUNC (attachment_changed_cb),
- bar);
-
- bar->priv->attachments = g_list_append (bar->priv->attachments,
- attachment);
- bar->priv->num_attachments++;
-
- update (bar);
-
- gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
-}
-
-static void
-add_from_mime_part (EMsgComposerAttachmentBar *bar,
- CamelMimePart *part)
-{
- add_common (bar, e_msg_composer_attachment_new_from_mime_part (part));
-}
-
-static void
-add_from_file (EMsgComposerAttachmentBar *bar,
- const gchar *file_name)
-{
- add_common (bar, e_msg_composer_attachment_new (file_name));
-}
-
-static void
-remove_attachment (EMsgComposerAttachmentBar *bar,
- EMsgComposerAttachment *attachment)
-{
- bar->priv->attachments = g_list_remove (bar->priv->attachments,
- attachment);
- bar->priv->num_attachments--;
-
- gtk_object_unref (GTK_OBJECT (attachment));
-
- gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
-}
-
-
-/* Icon list contents handling. */
-
-static GdkPixbuf *
-pixbuf_for_mime_type (const char *mime_type)
-{
- const char *icon_name;
- char *filename = NULL;
- GdkPixbuf *pixbuf;
-
- icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
- if (icon_name) {
- if (*icon_name == '/') {
- pixbuf = gdk_pixbuf_new_from_file (icon_name);
- if (pixbuf)
- return pixbuf;
- }
-
- filename = gnome_pixmap_file (icon_name);
- if (!filename) {
- char *fm_icon;
-
- fm_icon = g_strdup_printf ("nautilus/%s", icon_name);
- filename = gnome_pixmap_file (fm_icon);
- if (!filename) {
- fm_icon = g_strdup_printf ("mc/%s", icon_name);
- filename = gnome_pixmap_file (fm_icon);
- }
- g_free (fm_icon);
- }
- }
-
- if (!filename)
- filename = gnome_pixmap_file ("gnome-unknown.png");
-
- pixbuf = gdk_pixbuf_new_from_file (filename);
- g_free (filename);
-
- return pixbuf;
-}
-
-static void
-update (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- EIconList *icon_list;
- GList *p;
-
- priv = bar->priv;
- icon_list = E_ICON_LIST (bar);
-
- e_icon_list_freeze (icon_list);
-
- e_icon_list_clear (icon_list);
-
- /* FIXME could be faster, but we don't care. */
- for (p = priv->attachments; p != NULL; p = p->next) {
- EMsgComposerAttachment *attachment;
- const gchar *desc;
- gchar *size_string, *label;
- CamelContentType *content_type;
- GdkPixbuf *pixbuf;
- gboolean image;
-
- attachment = p->data;
- content_type = camel_mime_part_get_content_type (attachment->body);
- /* Get the image out of the attachment
- and create a thumbnail for it */
- image = header_content_type_is (content_type, "image", "*");
-
- if (image && attachment->pixbuf_cache == NULL) {
- CamelDataWrapper *wrapper;
- CamelStream *mstream;
- GdkPixbufLoader *loader;
- gboolean error = TRUE;
- char tmp[4096];
- int t;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body));
- mstream = camel_stream_mem_new ();
-
- camel_data_wrapper_write_to_stream (wrapper, mstream);
-
- camel_stream_reset (mstream);
-
- /* Stream image into pixbuf loader */
- loader = gdk_pixbuf_loader_new ();
- do {
- t = camel_stream_read (mstream, tmp, 4096);
- if (t > 0) {
- error = !gdk_pixbuf_loader_write (loader,
- tmp, t);
- if (error) {
- break;
- }
- } else {
- if (camel_stream_eos (mstream))
- break;
- error = TRUE;
- break;
- }
-
- } while (!camel_stream_eos (mstream));
-
- if (!error) {
- int ratio, width, height;
-
- /* Shrink pixbuf */
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- if (width >= height) {
- if (width > 48) {
- ratio = width / 48;
- width = 48;
- height = height / ratio;
- }
- } else {
- if (height > 48) {
- ratio = height / 48;
- height = 48;
- width = width / ratio;
- }
- }
-
- attachment->pixbuf_cache = gdk_pixbuf_scale_simple
- (pixbuf,
- width,
- height,
- GDK_INTERP_BILINEAR);
- } else {
- g_warning ("GdkPixbufLoader Error");
- image = FALSE;
- }
-
- /* Destroy everything */
- gdk_pixbuf_loader_close (loader);
- gtk_object_destroy (GTK_OBJECT (loader));
- camel_stream_close (mstream);
- }
-
- desc = camel_mime_part_get_description (attachment->body);
- if (!desc || *desc == '\0')
- desc = camel_mime_part_get_filename (attachment->body);
- if (!desc)
- desc = _("attachment");
-
- if (attachment->size) {
- size_string = size_to_string (attachment->size);
- label = g_strdup_printf ("%s (%s)", desc, size_string);
- g_free (size_string);
- } else
- label = g_strdup (desc);
-
- if (image) {
- e_icon_list_append_pixbuf (icon_list, attachment->pixbuf_cache, NULL, label);
- } else {
- char *mime_type;
-
- mime_type = header_content_type_simple (content_type);
- pixbuf = pixbuf_for_mime_type (mime_type);
- g_free (mime_type);
- e_icon_list_append_pixbuf (icon_list, pixbuf,
- NULL, label);
- if (pixbuf)
- gdk_pixbuf_unref (pixbuf);
- }
-
- g_free (label);
- }
-
- e_icon_list_thaw (icon_list);
-}
-
-static void
-remove_selected (EMsgComposerAttachmentBar *bar)
-{
- EIconList *icon_list;
- EMsgComposerAttachment *attachment;
- GList *attachment_list;
- GList *p;
- gint num;
-
- icon_list = E_ICON_LIST (bar);
-
- /* Weee! I am especially proud of this piece of cheesy code: it is
- truly awful. But unless one attaches a huge number of files, it
- will not be as greedy as intended. FIXME of course. */
-
- attachment_list = NULL;
- p = e_icon_list_get_selection (icon_list);
- for (; p != NULL; p = p->next) {
- num = GPOINTER_TO_INT (p->data);
- attachment = E_MSG_COMPOSER_ATTACHMENT
- (g_list_nth (bar->priv->attachments, num)->data);
- attachment_list = g_list_prepend (attachment_list, attachment);
- }
-
- for (p = attachment_list; p != NULL; p = p->next)
- remove_attachment (bar, E_MSG_COMPOSER_ATTACHMENT (p->data));
-
- g_list_free (attachment_list);
-
- update (bar);
-}
-
-static void
-edit_selected (EMsgComposerAttachmentBar *bar)
-{
- EIconList *icon_list;
- EMsgComposerAttachment *attachment;
- GList *selection;
- gint num;
-
- icon_list = E_ICON_LIST (bar);
-
- selection = e_icon_list_get_selection (icon_list);
- num = GPOINTER_TO_INT (selection->data);
- attachment = g_list_nth (bar->priv->attachments, num)->data;
-
- e_msg_composer_attachment_edit (attachment, GTK_WIDGET (bar));
-}
-
-
-/* "Attach" dialog. */
-
-static void
-add_from_user (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposer *composer;
- char *file_name;
-
- composer = E_MSG_COMPOSER (gtk_widget_get_toplevel (GTK_WIDGET (bar)));
-
- file_name = e_msg_composer_select_file (composer, _("Attach a file"));
-
- add_from_file (bar, file_name);
-
- g_free (file_name);
-}
-
-
-/* Callbacks. */
-
-static void
-add_cb (GtkWidget *widget,
- gpointer data)
-{
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
-
- add_from_user (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
-}
-
-static void
-properties_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachmentBar *bar;
-
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
- edit_selected (data);
-}
-
-static void
-remove_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachmentBar *bar;
-
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data));
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
- remove_selected (bar);
-}
-
-
-/* Popup menu handling. */
-
-static GnomeUIInfo icon_context_menu_info[] = {
- GNOMEUIINFO_ITEM (N_("Remove"),
- N_("Remove selected items from the attachment list"),
- remove_cb, NULL),
- GNOMEUIINFO_MENU_PROPERTIES_ITEM (properties_cb, NULL),
- GNOMEUIINFO_END
-};
-
-static GtkWidget *
-get_icon_context_menu (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
-
- priv = bar->priv;
- if (priv->icon_context_menu == NULL)
- priv->icon_context_menu = gnome_popup_menu_new
- (icon_context_menu_info);
-
- return priv->icon_context_menu;
-}
-
-static void
-popup_icon_context_menu (EMsgComposerAttachmentBar *bar,
- gint num,
- GdkEventButton *event)
-{
- GtkWidget *menu;
-
- menu = get_icon_context_menu (bar);
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
-}
-
-static GnomeUIInfo context_menu_info[] = {
- GNOMEUIINFO_ITEM (N_("Add attachment..."),
- N_("Attach a file to the message"),
- add_cb, NULL),
- GNOMEUIINFO_END
-};
-
-static GtkWidget *
-get_context_menu (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
-
- priv = bar->priv;
- if (priv->context_menu == NULL)
- priv->context_menu = gnome_popup_menu_new (context_menu_info);
-
- return priv->context_menu;
-}
-
-static void
-popup_context_menu (EMsgComposerAttachmentBar *bar,
- GdkEventButton *event)
-{
- GtkWidget *menu;
-
- menu = get_context_menu (bar);
- gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerAttachmentBar *bar;
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (object);
-
- free_attachment_list (bar);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* GtkWidget methods. */
-
-static gint
-button_press_event (GtkWidget *widget,
- GdkEventButton *event)
-{
- EMsgComposerAttachmentBar *bar;
- EIconList *icon_list;
- gint icon_number;
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (widget);
- icon_list = E_ICON_LIST (widget);
-
- if (event->button != 3)
- return GTK_WIDGET_CLASS (parent_class)->button_press_event
- (widget, event);
-
- icon_number = e_icon_list_get_icon_at (icon_list,
- event->x, event->y);
-
- if (icon_number >= 0) {
- e_icon_list_select_icon (icon_list, icon_number);
- popup_icon_context_menu (bar, icon_number, event);
- } else {
- popup_context_menu (bar, event);
- }
-
- return TRUE;
-}
-
-
-/* Initialization. */
-
-static void
-class_init (EMsgComposerAttachmentBarClass *class)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- EIconListClass *icon_list_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- widget_class = GTK_WIDGET_CLASS (class);
- icon_list_class = E_ICON_LIST_CLASS (class);
-
- parent_class = gtk_type_class (e_icon_list_get_type ());
-
- object_class->destroy = destroy;
-
- widget_class->button_press_event = button_press_event;
-
- /* Setup signals. */
-
- signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerAttachmentBarClass,
- changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposerAttachmentBar *bar)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- guint icon_size, icon_height;
- GdkFont *font;
-
- priv = g_new (EMsgComposerAttachmentBarPrivate, 1);
-
- priv->attachments = NULL;
- priv->context_menu = NULL;
- priv->icon_context_menu = NULL;
-
- priv->num_attachments = 0;
-
- bar->priv = priv;
-
- /* FIXME partly hardcoded. We should compute height from the font, and
- allow at least 2 lines for every item. */
- icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING;
-
- font = GTK_WIDGET (bar)->style->font;
- icon_height = icon_size + ((font->ascent + font->descent) * 2);
- icon_size += 24;
-
- gtk_widget_set_usize (GTK_WIDGET (bar), icon_size * 4, icon_height);
-}
-
-
-GtkType
-e_msg_composer_attachment_bar_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerAttachmentBar",
- sizeof (EMsgComposerAttachmentBar),
- sizeof (EMsgComposerAttachmentBarClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (e_icon_list_get_type (), &info);
- }
-
- return type;
-}
-
-GtkWidget *
-e_msg_composer_attachment_bar_new (GtkAdjustment *adj)
-{
- EMsgComposerAttachmentBar *new;
- EIconList *icon_list;
-
- gdk_rgb_init ();
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- new = gtk_type_new (e_msg_composer_attachment_bar_get_type ());
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- icon_list = E_ICON_LIST (new);
-
- e_icon_list_construct (icon_list, ICON_WIDTH, 0);
-
- e_icon_list_set_separators (icon_list, ICON_SEPARATORS);
- e_icon_list_set_row_spacing (icon_list, ICON_ROW_SPACING);
- e_icon_list_set_col_spacing (icon_list, ICON_COL_SPACING);
- e_icon_list_set_icon_border (icon_list, ICON_BORDER);
- e_icon_list_set_text_spacing (icon_list, ICON_TEXT_SPACING);
- e_icon_list_set_selection_mode (icon_list, GTK_SELECTION_MULTIPLE);
-
- return GTK_WIDGET (new);
-}
-
-/* FIXME: is_8bit() and best_encoding() should really be shared
- between e-msg-composer.c and this file. */
-static gboolean
-is_8bit (const guchar *text)
-{
- guchar *c;
-
- for (c = (guchar *) text; *c; c++)
- if (*c > (guchar) 127)
- return TRUE;
-
- return FALSE;
-}
-
-static int
-best_encoding (const guchar *text)
-{
- guchar *ch;
- int count = 0;
- int total;
-
- for (ch = (guchar *) text; *ch; ch++)
- if (*ch > (guchar) 127)
- count++;
-
- total = (int) (ch - text);
-
- if ((float) count <= total * 0.17)
- return CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
- else
- return CAMEL_MIME_PART_ENCODING_BASE64;
-}
-
-static void
-attach_to_multipart (CamelMultipart *multipart,
- EMsgComposerAttachment *attachment)
-{
- CamelContentType *content_type;
-
- content_type = camel_mime_part_get_content_type (attachment->body);
-
- if (!header_content_type_is (content_type, "multipart", "*")) {
- if (header_content_type_is (content_type, "text", "*")) {
- CamelStream *stream;
- GByteArray *array;
- guchar *text;
-
- array = g_byte_array_new ();
- stream = camel_stream_mem_new_with_byte_array (array);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (attachment->body), stream);
- g_byte_array_append (array, "", 1);
- text = array->data;
-
- if (is_8bit (text))
- camel_mime_part_set_encoding (attachment->body, best_encoding (text));
- else
- camel_mime_part_set_encoding (attachment->body, CAMEL_MIME_PART_ENCODING_7BIT);
-
- camel_object_unref (CAMEL_OBJECT (stream));
- } else if (!header_content_type_is (content_type, "message", "*")) {
- camel_mime_part_set_encoding (attachment->body,
- CAMEL_MIME_PART_ENCODING_BASE64);
- }
- }
-
- camel_multipart_add_part (multipart, attachment->body);
-}
-
-void
-e_msg_composer_attachment_bar_to_multipart (EMsgComposerAttachmentBar *bar,
- CamelMultipart *multipart)
-{
- EMsgComposerAttachmentBarPrivate *priv;
- GList *p;
-
- g_return_if_fail (bar != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
- g_return_if_fail (multipart != NULL);
- g_return_if_fail (CAMEL_IS_MULTIPART (multipart));
-
- priv = bar->priv;
-
- for (p = priv->attachments; p != NULL; p = p->next) {
- EMsgComposerAttachment *attachment;
-
- attachment = E_MSG_COMPOSER_ATTACHMENT (p->data);
- attach_to_multipart (multipart, attachment);
- }
-}
-
-
-guint
-e_msg_composer_attachment_bar_get_num_attachments (EMsgComposerAttachmentBar *bar)
-{
- g_return_val_if_fail (bar != NULL, 0);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar), 0);
-
- return bar->priv->num_attachments;
-}
-
-
-void
-e_msg_composer_attachment_bar_attach (EMsgComposerAttachmentBar *bar,
- const gchar *file_name)
-{
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
-
- if (file_name == NULL)
- add_from_user (bar);
- else
- add_from_file (bar, file_name);
-}
-
-void
-e_msg_composer_attachment_bar_attach_mime_part (EMsgComposerAttachmentBar *bar,
- CamelMimePart *part)
-{
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (bar));
-
- add_from_mime_part (bar, part);
-}
diff --git a/composer/e-msg-composer-attachment-bar.h b/composer/e-msg-composer-attachment-bar.h
deleted file mode 100644
index 17d717cc10..0000000000
--- a/composer/e-msg-composer-attachment-bar.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* msg-composer-attachment-bar.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __E_MSG_COMPOSER_ATTACHMENT_BAR_H__
-#define __E_MSG_COMPOSER_ATTACHMENT_BAR_H__
-
-#include <gnome.h>
-#include "e-icon-list.h"
-#include <camel/camel-multipart.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR \
- (e_msg_composer_attachment_bar_get_type ())
-#define E_MSG_COMPOSER_ATTACHMENT_BAR(obj) \
- (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR, EMsgComposerAttachmentBar))
-#define E_MSG_COMPOSER_ATTACHMENT_BAR_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR, EMsgComposerAttachmentBarClass))
-#define E_IS_MSG_COMPOSER_ATTACHMENT_BAR(obj) \
- (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR))
-#define E_IS_MSG_COMPOSER_ATTACHMENT_BAR_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR))
-
-
-typedef struct _EMsgComposerAttachmentBarPrivate EMsgComposerAttachmentBarPrivate;
-
-struct _EMsgComposerAttachmentBar {
- EIconList parent;
-
- EMsgComposerAttachmentBarPrivate *priv;
-};
-typedef struct _EMsgComposerAttachmentBar EMsgComposerAttachmentBar;
-
-struct _EMsgComposerAttachmentBarClass {
- EIconListClass parent_class;
-
- void (* changed) (EMsgComposerAttachmentBar *bar);
-};
-typedef struct _EMsgComposerAttachmentBarClass EMsgComposerAttachmentBarClass;
-
-
-GtkType e_msg_composer_attachment_bar_get_type (void);
-GtkWidget *e_msg_composer_attachment_bar_new (GtkAdjustment *adj);
-void e_msg_composer_attachment_bar_to_multipart (EMsgComposerAttachmentBar *bar, CamelMultipart *multipart);
-guint e_msg_composer_attachment_bar_get_num_attachments (EMsgComposerAttachmentBar *bar);
-void e_msg_composer_attachment_bar_attach (EMsgComposerAttachmentBar *bar, const gchar *file_name);
-void e_msg_composer_attachment_bar_attach_mime_part (EMsgComposerAttachmentBar *bar, CamelMimePart *part);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MSG_COMPOSER_ATTACHMENT_BAR_H__ */
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
deleted file mode 100644
index 223d118de5..0000000000
--- a/composer/e-msg-composer-attachment.c
+++ /dev/null
@@ -1,451 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-attachment.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-/* This is the object representing an email attachment. It is implemented as a
- GtkObject to make it easier for the application to handle it. For example,
- the "changed" signal is emitted whenever something changes in the
- attachment. Also, this contains the code to let users edit the
- attachment manually. */
-
-#include <sys/stat.h>
-
-#include <gnome.h>
-#include <camel/camel.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "e-msg-composer.h"
-#include "e-msg-composer-attachment.h"
-
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GtkObjectClass *parent_class = NULL;
-
-
-static void
-changed (EMsgComposerAttachment *attachment)
-{
- gtk_signal_emit (GTK_OBJECT (attachment), signals[CHANGED]);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerAttachment *attachment;
-
- attachment = E_MSG_COMPOSER_ATTACHMENT (object);
-
- camel_object_unref (CAMEL_OBJECT (attachment->body));
- if (attachment->pixbuf_cache != NULL)
- gdk_pixbuf_unref (attachment->pixbuf_cache);
-}
-
-
-/* Signals. */
-
-static void
-real_changed (EMsgComposerAttachment *msg_composer_attachment)
-{
- g_return_if_fail (msg_composer_attachment != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (msg_composer_attachment));
-}
-
-
-static void
-class_init (EMsgComposerAttachmentClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class->destroy = destroy;
-
- signals[CHANGED] = gtk_signal_new ("changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET
- (EMsgComposerAttachmentClass,
- changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-
- klass->changed = real_changed;
-}
-
-static void
-init (EMsgComposerAttachment *msg_composer_attachment)
-{
- msg_composer_attachment->editor_gui = NULL;
- msg_composer_attachment->body = NULL;
- msg_composer_attachment->size = 0;
- msg_composer_attachment->pixbuf_cache = NULL;
-}
-
-GtkType
-e_msg_composer_attachment_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerAttachment",
- sizeof (EMsgComposerAttachment),
- sizeof (EMsgComposerAttachmentClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-
-/**
- * e_msg_composer_attachment_new:
- * @file_name:
- *
- * Return value:
- **/
-EMsgComposerAttachment *
-e_msg_composer_attachment_new (const gchar *file_name)
-{
- EMsgComposerAttachment *new;
- CamelMimePart *part;
- CamelDataWrapper *wrapper;
- CamelStream *stream;
- struct stat statbuf;
- gchar *mime_type;
-
- g_return_val_if_fail (file_name != NULL, NULL);
-
- if (stat (file_name, &statbuf) < 0)
- return NULL;
-
- /* return if it's not a regular file */
- if (!S_ISREG (statbuf.st_mode))
- return NULL;
-
- stream = camel_stream_fs_new_with_name (file_name, O_RDONLY, 0);
- if (!stream)
- return NULL;
- wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
- camel_object_unref (CAMEL_OBJECT (stream));
- mime_type = e_msg_composer_guess_mime_type (file_name);
- if (mime_type) {
- camel_data_wrapper_set_mime_type (wrapper, mime_type);
- g_free (mime_type);
- } else
- camel_data_wrapper_set_mime_type (wrapper, "application/octet-stream");
-
- part = camel_mime_part_new ();
- camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper);
- camel_object_unref (CAMEL_OBJECT (wrapper));
-
- camel_mime_part_set_disposition (part, "attachment");
- if (strchr (file_name, '/'))
- camel_mime_part_set_filename (part, strrchr (file_name, '/') + 1);
- else
- camel_mime_part_set_filename (part, file_name);
-
- new = e_msg_composer_attachment_new_from_mime_part (part);
-
- new->size = statbuf.st_size;
- new->guessed_type = TRUE;
-
- return new;
-}
-
-
-/**
- * e_msg_composer_attachment_new_from_mime_part:
- * @part: a CamelMimePart
- *
- * Return value: a new EMsgComposerAttachment based on the mime part
- **/
-EMsgComposerAttachment *
-e_msg_composer_attachment_new_from_mime_part (CamelMimePart *part)
-{
- EMsgComposerAttachment *new;
-
- g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL);
-
- new = gtk_type_new (e_msg_composer_attachment_get_type ());
-
- new->editor_gui = NULL;
- new->body = part;
- camel_object_ref (CAMEL_OBJECT (part));
- new->guessed_type = FALSE;
- new->size = 0;
-
- return new;
-}
-
-
-/* The attachment property dialog. */
-
-struct _DialogData {
- GtkWidget *dialog;
- GtkEntry *file_name_entry;
- GtkEntry *description_entry;
- GtkEntry *mime_type_entry;
- GtkOptionMenu *disposition_option;
- EMsgComposerAttachment *attachment;
-};
-typedef struct _DialogData DialogData;
-
-static void
-destroy_dialog_data (DialogData *data)
-{
- g_free (data);
-}
-
-/*
- * fixme: I am converting EVERYTHING to/from UTF-8, although mime types
- * are in ASCII. This is not strictly necessary, but we want to be
- * consistent and possibly check for errors somewhere.
- */
-
-static void
-update_mime_type (DialogData *data)
-{
- const gchar *mime_type;
- gchar *file_name;
-
- if (!data->attachment->guessed_type)
- return;
-
- file_name = e_utf8_gtk_entry_get_text (data->file_name_entry);
- mime_type = e_msg_composer_guess_mime_type (file_name);
- g_free (file_name);
-
- e_utf8_gtk_entry_set_text (data->mime_type_entry, mime_type);
-}
-
-static void
-set_entry (GladeXML *xml,
- const gchar *widget_name,
- const gchar *value)
-{
- GtkEntry *entry;
-
- entry = GTK_ENTRY (glade_xml_get_widget (xml, widget_name));
- if (entry == NULL)
- g_warning ("Entry for `%s' not found.", widget_name);
- else
- e_utf8_gtk_entry_set_text (entry, value ? value : "");
-}
-
-static void
-connect_widget (GladeXML *gui,
- const gchar *name,
- const gchar *signal_name,
- GtkSignalFunc func,
- gpointer data)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
- gtk_signal_connect (GTK_OBJECT (widget), signal_name, func, data);
-}
-
-static void
-close_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachment *attachment;
- DialogData *dialog_data;
-
- dialog_data = (DialogData *) data;
- attachment = dialog_data->attachment;
-
- gtk_widget_destroy (glade_xml_get_widget (attachment->editor_gui,
- "dialog"));
- gtk_object_unref (GTK_OBJECT (attachment->editor_gui));
- attachment->editor_gui = NULL;
-
- destroy_dialog_data (dialog_data);
-}
-
-/* Why was this never part of GTK? */
-static int
-option_menu_get_history (GtkOptionMenu *menu)
-{
- GtkWidget *active;
-
- g_return_val_if_fail (menu != NULL, -1);
- g_return_val_if_fail (GTK_IS_OPTION_MENU (menu), -1);
-
- if (menu->menu) {
- active = gtk_menu_get_active (GTK_MENU (menu->menu));
-
- if (active)
- return g_list_index (GTK_MENU_SHELL (menu->menu)->children,
- active);
- else
- return -1;
- } else
- return -1;
-}
-
-static void
-ok_cb (GtkWidget *widget,
- gpointer data)
-{
- DialogData *dialog_data;
- EMsgComposerAttachment *attachment;
- gchar *str;
- int option;
-
- dialog_data = (DialogData *) data;
- attachment = dialog_data->attachment;
-
- str = e_utf8_gtk_entry_get_text (dialog_data->file_name_entry);
- camel_mime_part_set_filename (attachment->body, str);
- g_free (str);
-
- str = e_utf8_gtk_entry_get_text (dialog_data->description_entry);
- camel_mime_part_set_description (attachment->body, str);
- g_free (str);
-
- str = e_utf8_gtk_entry_get_text (dialog_data->mime_type_entry);
- camel_mime_part_set_content_type (attachment->body, str);
-
- camel_data_wrapper_set_mime_type (
- camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str);
- g_free (str);
-
- option = option_menu_get_history (dialog_data->disposition_option);
- switch (option) {
- case 0:
- camel_mime_part_set_disposition (attachment->body, "attachment");
- break;
- case 1:
- camel_mime_part_set_disposition (attachment->body, "inline");
- break;
- default:
- /* Hmmmm? */
- break;
- }
-
- changed (attachment);
- close_cb (widget, data);
-}
-
-static void
-file_name_focus_out_cb (GtkWidget *widget,
- GdkEventFocus *event,
- gpointer data)
-{
- DialogData *dialog_data;
-
- dialog_data = (DialogData *) data;
- update_mime_type (dialog_data);
-}
-
-
-void
-e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
- GtkWidget *parent)
-{
- DialogData *dialog_data;
- GladeXML *editor_gui;
-
- g_return_if_fail (attachment != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (attachment));
-
- if (attachment->editor_gui != NULL) {
- GtkWidget *window;
-
- window = glade_xml_get_widget (attachment->editor_gui,
- "dialog");
- gdk_window_show (window->window);
- return;
- }
-
- editor_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer-attachment.glade",
- NULL);
- if (editor_gui == NULL) {
- g_warning ("Cannot load `e-msg-composer-attachment.glade'");
- return;
- }
-
- attachment->editor_gui = editor_gui;
-
- gtk_window_set_transient_for
- (GTK_WINDOW (glade_xml_get_widget (editor_gui, "dialog")),
- GTK_WINDOW (gtk_widget_get_toplevel (parent)));
-
- dialog_data = g_new (DialogData, 1);
- dialog_data->attachment = attachment;
- dialog_data->dialog = glade_xml_get_widget (editor_gui, "dialog");
- dialog_data->file_name_entry = GTK_ENTRY (glade_xml_get_widget
- (editor_gui,
- "file_name_entry"));
- dialog_data->description_entry = GTK_ENTRY (glade_xml_get_widget
- (editor_gui,
- "description_entry"));
- dialog_data->mime_type_entry = GTK_ENTRY (glade_xml_get_widget
- (editor_gui,
- "mime_type_entry"));
- dialog_data->disposition_option = GTK_OPTION_MENU (glade_xml_get_widget
- (editor_gui,
- "disposition_option"));
-
- if (attachment != NULL) {
- CamelContentType *content_type;
- char *type;
-
- set_entry (editor_gui, "file_name_entry",
- camel_mime_part_get_filename (attachment->body));
- set_entry (editor_gui, "description_entry",
- camel_mime_part_get_description (attachment->body));
- content_type = camel_mime_part_get_content_type (attachment->body);
- type = header_content_type_simple (content_type);
- set_entry (editor_gui, "mime_type_entry", type);
- g_free (type);
- }
-
- connect_widget (editor_gui, "ok_button", "clicked", ok_cb, dialog_data);
- connect_widget (editor_gui, "close_button", "clicked", close_cb, dialog_data);
-
- connect_widget (editor_gui, "file_name_entry", "focus_out_event",
- file_name_focus_out_cb, dialog_data);
-}
diff --git a/composer/e-msg-composer-attachment.glade b/composer/e-msg-composer-attachment.glade
deleted file mode 100644
index 4679a0d8e0..0000000000
--- a/composer/e-msg-composer-attachment.glade
+++ /dev/null
@@ -1,332 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>e-msg-composer-attachment</name>
- <program_name>e-msg-composer-attachment</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>True</output_support_files>
- <output_build_files>True</output_build_files>
- <backup_source_files>True</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog</name>
- <cxx_use_heap>True</cxx_use_heap>
- <title>Attachment properties</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <rows>4</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>10</row_spacing>
- <column_spacing>5</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>description_entry</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox3</name>
- <cxx_use_heap>True</cxx_use_heap>
- <homogeneous>False</homogeneous>
- <spacing>10</spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>True</xshrink>
- <yshrink>True</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>file_name_entry</name>
- <width>290</width>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>mime_type_entry</name>
- <cxx_use_heap>True</cxx_use_heap>
- <sensitive>False</sensitive>
- <can_focus>True</can_focus>
- <editable>False</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>MIME type:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Description:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>File name:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <cxx_use_heap>True</cxx_use_heap>
- <label>Send as:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>disposition_option</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_focus>True</can_focus>
- <items>Attachment
-Inline attachment
-</items>
- <initial_choice>1</initial_choice>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <cxx_use_heap>True</cxx_use_heap>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>ok_button</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>close_button</name>
- <cxx_use_heap>True</cxx_use_heap>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/composer/e-msg-composer-attachment.h b/composer/e-msg-composer-attachment.h
deleted file mode 100644
index 47bc85ece0..0000000000
--- a/composer/e-msg-composer-attachment.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-attachment.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-#ifndef __E_MSG_COMPOSER_ATTACHMENT_H__
-#define __E_MSG_COMPOSER_ATTACHMENT_H__
-
-#include <gnome.h>
-#include <glade/glade-xml.h>
-#include <camel/camel-mime-part.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_ATTACHMENT (e_msg_composer_attachment_get_type ())
-#define E_MSG_COMPOSER_ATTACHMENT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT, EMsgComposerAttachment))
-#define E_MSG_COMPOSER_ATTACHMENT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ATTACHMENT, EMsgComposerAttachmentClass))
-#define E_IS_MSG_COMPOSER_ATTACHMENT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT))
-#define E_IS_MSG_COMPOSER_ATTACHMENT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ATTACHMENT))
-
-
-typedef struct _EMsgComposerAttachment EMsgComposerAttachment;
-typedef struct _EMsgComposerAttachmentClass EMsgComposerAttachmentClass;
-
-struct _EMsgComposerAttachment {
- GtkObject parent;
-
- GladeXML *editor_gui;
-
- CamelMimePart *body;
- gboolean guessed_type;
- gulong size;
-
- GdkPixbuf *pixbuf_cache;
-};
-
-struct _EMsgComposerAttachmentClass {
- GtkObjectClass parent_class;
-
- void (*changed) (EMsgComposerAttachment *msg_composer_attachment);
-};
-
-
-GtkType e_msg_composer_attachment_get_type (void);
-EMsgComposerAttachment *e_msg_composer_attachment_new (const gchar *file_name);
-EMsgComposerAttachment *e_msg_composer_attachment_new_from_mime_part (CamelMimePart *part);
-void e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
- GtkWidget *parent);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MSG_COMPOSER_ATTACHMENT_H__ */
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
deleted file mode 100644
index 3fa0634e52..0000000000
--- a/composer/e-msg-composer-hdrs.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* msg-composer-hdrs.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gnome.h>
-#include <camel/camel.h>
-
-#include <bonobo.h>
-
-#include <liboaf/liboaf.h>
-
-#include "Composer.h"
-
-#include "e-msg-composer-hdrs.h"
-#include <gal/e-text/e-entry.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "mail/mail-config.h"
-
-
-#define SELECT_NAMES_OAFID "OAFIID:GNOME_Evolution_Addressbook_SelectNames"
-
-struct _EMsgComposerHdrsPrivate {
- GNOME_Evolution_Addressbook_SelectNames corba_select_names;
-
- /* Total number of headers that we have. */
- guint num_hdrs;
-
- /* The tooltips. */
- GtkTooltips *tooltips;
-
- GSList *from_options;
-
- /* Standard headers. */
- GtkWidget *from_entry;
- GtkWidget *to_entry;
- GtkWidget *cc_entry;
- GtkWidget *bcc_entry;
- GtkWidget *subject_entry;
-};
-
-
-static GtkTableClass *parent_class = NULL;
-
-enum {
- SHOW_ADDRESS_DIALOG,
- SUBJECT_CHANGED,
- HDRS_CHANGED,
- LAST_SIGNAL
-};
-
-enum {
- HEADER_ADDRBOOK,
- HEADER_OPTIONMENU,
- HEADER_ENTRYBOX
-};
-
-static gint signals[LAST_SIGNAL];
-
-
-static gboolean
-setup_corba (EMsgComposerHdrs *hdrs)
-{
- EMsgComposerHdrsPrivate *priv;
- CORBA_Environment ev;
-
- priv = hdrs->priv;
-
- g_assert (priv->corba_select_names == CORBA_OBJECT_NIL);
-
- CORBA_exception_init (&ev);
-
- priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
-
- /* OAF seems to be broken -- it can return a CORBA_OBJECT_NIL without
- raising an exception in `ev'. */
- if (ev._major != CORBA_NO_EXCEPTION || priv->corba_select_names == CORBA_OBJECT_NIL) {
- g_warning ("Cannot activate -- %s", SELECT_NAMES_OAFID);
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
-
- return TRUE;
-}
-
-typedef struct {
- EMsgComposerHdrs *hdrs;
- char *string;
-} EMsgComposerHdrsAndString;
-
-static void
-e_msg_composer_hdrs_and_string_free(EMsgComposerHdrsAndString *emchas)
-{
- if (emchas->hdrs)
- gtk_object_unref(GTK_OBJECT(emchas->hdrs));
- g_free(emchas->string);
-}
-
-static EMsgComposerHdrsAndString *
-e_msg_composer_hdrs_and_string_create(EMsgComposerHdrs *hdrs, const char *string)
-{
- EMsgComposerHdrsAndString *emchas;
-
- emchas = g_new(EMsgComposerHdrsAndString, 1);
- emchas->hdrs = hdrs;
- emchas->string = g_strdup(string);
- if (emchas->hdrs)
- gtk_object_ref(GTK_OBJECT(emchas->hdrs));
-
- return emchas;
-}
-
-static void
-address_button_clicked_cb (GtkButton *button,
- gpointer data)
-{
- EMsgComposerHdrsAndString *emchas;
- EMsgComposerHdrs *hdrs;
- EMsgComposerHdrsPrivate *priv;
- CORBA_Environment ev;
-
- emchas = data;
- hdrs = emchas->hdrs;
- priv = hdrs->priv;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_SelectNames_activateDialog (priv->corba_select_names, emchas->string, &ev);
-
- CORBA_exception_free (&ev);
-}
-
-static void
-from_changed (GtkWidget *item, gpointer data)
-{
- EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (data);
-
- hdrs->account = gtk_object_get_data (GTK_OBJECT (item), "account");
-}
-
-static GtkWidget *
-create_optionmenu (EMsgComposerHdrs *hdrs,
- const char *name)
-{
- GtkWidget *omenu, *menu, *first = NULL;
- int i = 0, history = 0;
-
- omenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
-
- if (!strcmp (name, _("From:"))) {
- const GSList *accounts;
- GtkWidget *item;
-
- accounts = mail_config_get_accounts ();
- while (accounts) {
- const MailConfigAccount *account;
- char *label;
- char *native_label;
-
- account = accounts->data;
-
- /* this should never ever fail */
- if (!account || !account->name || !account->id) {
- g_assert_not_reached ();
- continue;
- }
-
- if (strcmp (account->name, account->id->address))
- label = g_strdup_printf ("%s <%s> (%s)", account->id->name,
- account->id->address, account->name);
- else
- label = g_strdup_printf ("%s <%s>", account->id->name, account->id->address);
-
-
- native_label = e_utf8_to_gtk_string (GTK_WIDGET (menu), label);
- item = gtk_menu_item_new_with_label (native_label);
- g_free (native_label);
- g_free (label);
-
- gtk_object_set_data (GTK_OBJECT (item), "account", account_copy (account));
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (from_changed), hdrs);
-
- if (account->default_account) {
- first = item;
- history = i;
- }
-
- /* this is so we can later set which one we want */
- hdrs->priv->from_options = g_slist_append (hdrs->priv->from_options, item);
-
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_widget_show (item);
-
- accounts = accounts->next;
- i++;
- }
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
- if (first) {
- gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), history);
- gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", hdrs);
- }
-
- return omenu;
-}
-
-static void
-addressbook_entry_changed (BonoboListener *listener,
- char *event_name,
- CORBA_any *arg,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (user_data);
-
- gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]);
-}
-
-static GtkWidget *
-create_addressbook_entry (EMsgComposerHdrs *hdrs,
- const char *name)
-{
- EMsgComposerHdrsPrivate *priv;
- GNOME_Evolution_Addressbook_SelectNames corba_select_names;
- Bonobo_Control corba_control;
- GtkWidget *control_widget;
- CORBA_Environment ev;
- BonoboControlFrame *cf;
- Bonobo_PropertyBag pb = CORBA_OBJECT_NIL;
-
- priv = hdrs->priv;
- corba_select_names = priv->corba_select_names;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_Addressbook_SelectNames_addSection (corba_select_names, name, name, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- corba_control = GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (corba_select_names, name, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
-
- cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_widget));
- pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
-
- bonobo_event_source_client_add_listener (pb, addressbook_entry_changed,
- "Bonobo/Property:change:entry_changed",
- NULL, hdrs);
-
- return control_widget;
-}
-
-static void
-entry_changed (GtkWidget *entry, EMsgComposerHdrs *hdrs)
-{
- gchar *tmp;
- gchar *subject;
-
- tmp = e_msg_composer_hdrs_get_subject (hdrs);
- subject = e_utf8_to_gtk_string (GTK_WIDGET (entry), tmp);
-
- gtk_signal_emit (GTK_OBJECT (hdrs), signals[SUBJECT_CHANGED], subject);
- g_free (tmp);
-
- gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]);
-}
-
-static GtkWidget *
-add_header (EMsgComposerHdrs *hdrs,
- const gchar *name,
- const gchar *tip,
- const gchar *tip_private,
- int type)
-{
- EMsgComposerHdrsPrivate *priv;
- GtkWidget *label;
- GtkWidget *entry;
- guint pad;
-
- priv = hdrs->priv;
-
- if (type == HEADER_ADDRBOOK) {
- label = gtk_button_new_with_label (name);
- GTK_OBJECT_UNSET_FLAGS (label, GTK_CAN_FOCUS);
- gtk_signal_connect_full (GTK_OBJECT (label), "clicked",
- GTK_SIGNAL_FUNC (address_button_clicked_cb), NULL,
- e_msg_composer_hdrs_and_string_create(hdrs, name),
- (GtkDestroyNotify) e_msg_composer_hdrs_and_string_free,
- FALSE, FALSE);
- pad = 2;
- gtk_tooltips_set_tip (hdrs->priv->tooltips, label,
- _("Click here for the address book"),
- NULL);
- } else {
- label = gtk_label_new (name);
- pad = GNOME_PAD;
- }
-
- gtk_table_attach (GTK_TABLE (hdrs), label,
- 0, 1, priv->num_hdrs, priv->num_hdrs + 1,
- GTK_FILL, GTK_FILL,
- pad, pad);
- gtk_widget_show (label);
-
- switch (type) {
- case HEADER_ADDRBOOK:
- entry = create_addressbook_entry (hdrs, name);
- break;
- case HEADER_OPTIONMENU:
- entry = create_optionmenu (hdrs, name);
- break;
- case HEADER_ENTRYBOX:
- default:
- entry = e_entry_new ();
- gtk_object_set (GTK_OBJECT(entry),
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
- gtk_signal_connect (GTK_OBJECT (entry), "changed",
- GTK_SIGNAL_FUNC (entry_changed), hdrs);
- }
-
- if (entry != NULL) {
- gtk_widget_show (entry);
-
- gtk_table_attach (GTK_TABLE (hdrs), entry,
- 1, 2, priv->num_hdrs, priv->num_hdrs + 1,
- GTK_FILL | GTK_EXPAND, 0,
- 2, 2);
-
- gtk_tooltips_set_tip (hdrs->priv->tooltips, entry, tip, tip_private);
- }
-
- priv->num_hdrs++;
-
- return entry;
-}
-
-static void
-setup_headers (EMsgComposerHdrs *hdrs)
-{
- EMsgComposerHdrsPrivate *priv;
-
- priv = hdrs->priv;
-
- priv->from_entry = add_header
- (hdrs, _("From:"),
- _("Enter the identity you wish to send this message from"),
- NULL,
- HEADER_OPTIONMENU);
- priv->to_entry = add_header
- (hdrs, _("To:"),
- _("Enter the recipients of the message"),
- NULL,
- HEADER_ADDRBOOK);
- priv->cc_entry = add_header
- (hdrs, _("Cc:"),
- _("Enter the addresses that will receive a carbon copy of "
- "the message"),
- NULL,
- HEADER_ADDRBOOK);
- priv->bcc_entry = add_header
- (hdrs, _("Bcc:"),
- _("Enter the addresses that will receive a carbon copy of "
- "the message without appearing in the recipient list of "
- "the message."),
- NULL,
- HEADER_ADDRBOOK);
- priv->subject_entry = add_header
- (hdrs, _("Subject:"),
- _("Enter the subject of the mail"),
- NULL,
- HEADER_ENTRYBOX);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposerHdrs *hdrs;
- EMsgComposerHdrsPrivate *priv;
- GSList *l;
-
- hdrs = E_MSG_COMPOSER_HDRS (object);
- priv = hdrs->priv;
-
- if (priv->corba_select_names != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
- CORBA_Object_release (priv->corba_select_names, &ev);
- CORBA_exception_free (&ev);
- }
-
- gtk_object_destroy (GTK_OBJECT (priv->tooltips));
-
- l = priv->from_options;
- while (l) {
- MailConfigAccount *account;
- GtkWidget *item = l->data;
-
- account = gtk_object_get_data (GTK_OBJECT (item), "account");
- account_destroy (account);
-
- l = l->next;
- }
- g_slist_free (priv->from_options);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-static void
-class_init (EMsgComposerHdrsClass *class)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (class);
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (gtk_table_get_type ());
-
- signals[SHOW_ADDRESS_DIALOG] =
- gtk_signal_new ("show_address_dialog",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass,
- show_address_dialog),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- signals[SUBJECT_CHANGED] =
- gtk_signal_new ("subject_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass,
- subject_changed),
- gtk_marshal_NONE__STRING,
- GTK_TYPE_NONE,
- 1, GTK_TYPE_STRING);
-
- signals[HDRS_CHANGED] =
- gtk_signal_new ("hdrs_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass,
- hdrs_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposerHdrs *hdrs)
-{
- EMsgComposerHdrsPrivate *priv;
-
- priv = g_new (EMsgComposerHdrsPrivate, 1);
-
- priv->corba_select_names = CORBA_OBJECT_NIL;
-
- priv->from_options = NULL;
-
- priv->from_entry = NULL;
- priv->to_entry = NULL;
- priv->cc_entry = NULL;
- priv->bcc_entry = NULL;
- priv->subject_entry = NULL;
-
- priv->tooltips = gtk_tooltips_new ();
-
- priv->num_hdrs = 0;
-
- hdrs->priv = priv;
-
- hdrs->account = NULL;
-}
-
-
-GtkType
-e_msg_composer_hdrs_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposerHdrs",
- sizeof (EMsgComposerHdrs),
- sizeof (EMsgComposerHdrsClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_table_get_type (), &info);
- }
-
- return type;
-}
-
-GtkWidget *
-e_msg_composer_hdrs_new (void)
-{
- EMsgComposerHdrs *new;
- EMsgComposerHdrsPrivate *priv;
-
- new = gtk_type_new (e_msg_composer_hdrs_get_type ());
- priv = new->priv;
-
- if (! setup_corba (new)) {
- gtk_widget_destroy (GTK_WIDGET (new));
- return NULL;
- }
-
- setup_headers (new);
-
- return GTK_WIDGET (new);
-}
-
-
-static void
-set_recipients (CamelMimeMessage *msg, GtkWidget *entry_widget, const gchar *type)
-{
- CamelInternetAddress *addr;
- char *string;
-
- bonobo_widget_get_property (BONOBO_WIDGET (entry_widget), "text", &string, NULL);
-
- addr = camel_internet_address_new ();
- camel_address_unformat (CAMEL_ADDRESS (addr), string);
-
- /* TODO: In here, we could cross-reference the names with an alias book
- or address book, it should be sufficient for unformat to do the parsing too */
-
- camel_mime_message_set_recipients (msg, type, addr);
-
- camel_object_unref (CAMEL_OBJECT (addr));
- g_free (string);
-}
-
-void
-e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg)
-{
- gchar *subject;
- CamelInternetAddress *from;
-
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- g_return_if_fail (msg != NULL);
- g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg));
-
- subject = e_msg_composer_hdrs_get_subject (hdrs);
- camel_mime_message_set_subject (msg, subject);
- g_free (subject);
-
- from = e_msg_composer_hdrs_get_from (hdrs);
- camel_mime_message_set_from (msg, from);
- camel_object_unref (CAMEL_OBJECT (from));
-
- set_recipients (msg, hdrs->priv->to_entry, CAMEL_RECIPIENT_TYPE_TO);
- set_recipients (msg, hdrs->priv->cc_entry, CAMEL_RECIPIENT_TYPE_CC);
- set_recipients (msg, hdrs->priv->bcc_entry, CAMEL_RECIPIENT_TYPE_BCC);
-}
-
-
-static void
-set_entry (BonoboWidget *bonobo_widget,
- const GList *list)
-{
- GString *string;
- const GList *p;
-
- string = g_string_new ("");
- for (p = list; p != NULL; p = p->next) {
- if (string->str[0] != '\0')
- g_string_append (string, ", ");
- g_string_append (string, p->data);
- }
-
- bonobo_widget_set_property (BONOBO_WIDGET (bonobo_widget), "text", string->str, NULL);
-
- g_string_free (string, TRUE);
-}
-
-
-/* FIXME: yea, this could be better... but it's doubtful it'll be used much */
-void
-e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
- const char *account_name)
-{
- GtkOptionMenu *omenu;
- GtkWidget *item;
- GSList *l;
- int i = 0;
-
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- omenu = GTK_OPTION_MENU (hdrs->priv->from_entry);
-
- /* find the item that represents the account and activate it */
- l = hdrs->priv->from_options;
- while (l) {
- MailConfigAccount *account;
- item = l->data;
-
- account = gtk_object_get_data (GTK_OBJECT (item), "account");
- if ((account_name && !strcmp (account_name, account->name)) ||
- (!account_name && account->default_account)) {
- gtk_option_menu_set_history (omenu, i);
- gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", hdrs);
- return;
- }
-
- l = l->next;
- i++;
- }
-}
-
-void
-e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
- const GList *to_list)
-{
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- set_entry (BONOBO_WIDGET (hdrs->priv->to_entry), to_list);
-}
-
-void
-e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
- const GList *cc_list)
-{
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- set_entry (BONOBO_WIDGET (hdrs->priv->cc_entry), cc_list);
-}
-
-void
-e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
- const GList *bcc_list)
-{
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
- set_entry (BONOBO_WIDGET (hdrs->priv->bcc_entry), bcc_list);
-}
-
-void
-e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
- const char *subject)
-{
- g_return_if_fail (hdrs != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- g_return_if_fail (subject != NULL);
-
- gtk_object_set (GTK_OBJECT (hdrs->priv->subject_entry),
- "text", subject,
- NULL);
-}
-
-
-CamelInternetAddress *
-e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs)
-{
- const MailConfigAccount *account;
- CamelInternetAddress *addr;
-
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- account = hdrs->account;
- if (!account || !account->id) {
- /* FIXME: perhaps we should try the default account? */
- return NULL;
- }
-
- addr = camel_internet_address_new ();
- camel_internet_address_add (addr, account->id->name, account->id->address);
-
- return addr;
-}
-
-/* FIXME this is currently unused and broken. */
-GList *
-e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- g_assert_not_reached ();
-
- return NULL;
-}
-
-/* FIXME this is currently unused and broken. */
-GList *
-e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- g_assert_not_reached ();
-
- return NULL;
-}
-
-/* FIXME this is currently unused and broken. */
-GList *
-e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- g_assert_not_reached ();
-
- return NULL;
-}
-
-char *
-e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs)
-{
- gchar *subject;
-
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- gtk_object_get (GTK_OBJECT (hdrs->priv->subject_entry),
- "text", &subject, NULL);
-
- return subject;
-}
-
-
-GtkWidget *
-e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return hdrs->priv->to_entry;
-}
-
-GtkWidget *
-e_msg_composer_hdrs_get_cc_entry (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return hdrs->priv->cc_entry;
-}
-
-GtkWidget *
-e_msg_composer_hdrs_get_bcc_entry (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return hdrs->priv->bcc_entry;
-}
-
-GtkWidget *
-e_msg_composer_hdrs_get_subject_entry (EMsgComposerHdrs *hdrs)
-{
- g_return_val_if_fail (hdrs != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
- return hdrs->priv->subject_entry;
-}
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
deleted file mode 100644
index 9b1c5c4c84..0000000000
--- a/composer/e-msg-composer-hdrs.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* msg-composer-hdrs.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef ___E_MSG_COMPOSER_HDRS_H__
-#define ___E_MSG_COMPOSER_HDRS_H__
-
-#include <gnome.h>
-#include <camel/camel-mime-message.h>
-#include <mail/mail-config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_MSG_COMPOSER_HDRS (e_msg_composer_hdrs_get_type ())
-#define E_MSG_COMPOSER_HDRS(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrs))
-#define E_MSG_COMPOSER_HDRS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_HDRS, EMsgComposerHdrsClass))
-#define E_IS_MSG_COMPOSER_HDRS(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_HDRS))
-#define E_IS_MSG_COMPOSER_HDRS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_HDRS))
-
-
-typedef struct _EMsgComposerHdrs EMsgComposerHdrs;
-typedef struct _EMsgComposerHdrsClass EMsgComposerHdrsClass;
-typedef struct _EMsgComposerHdrsPrivate EMsgComposerHdrsPrivate;
-
-struct _EMsgComposerHdrs {
- GtkTable parent;
-
- EMsgComposerHdrsPrivate *priv;
-
- const MailConfigAccount *account;
-
- gboolean has_changed;
-};
-
-struct _EMsgComposerHdrsClass {
- GtkTableClass parent_class;
-
- void (* show_address_dialog) (EMsgComposerHdrs *hdrs);
-
- void (* subject_changed) (EMsgComposerHdrs *hdrs, gchar *subject);
-
- void (* hdrs_changed) (EMsgComposerHdrs *hdrs);
-};
-
-
-GtkType e_msg_composer_hdrs_get_type (void);
-GtkWidget *e_msg_composer_hdrs_new (void);
-
-void e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg);
-
-void e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
- const char *account_name);
-void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
- const GList *to_list);
-void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
- const GList *cc_list);
-void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
- const GList *bcc_list);
-void e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
- const char *subject);
-
-CamelInternetAddress *e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs);
-GList *e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs);
-char *e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs);
-
-GtkWidget *e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs);
-GtkWidget *e_msg_composer_hdrs_get_cc_entry (EMsgComposerHdrs *hdrs);
-GtkWidget *e_msg_composer_hdrs_get_bcc_entry (EMsgComposerHdrs *hdrs);
-GtkWidget *e_msg_composer_hdrs_get_subject_entry (EMsgComposerHdrs *hdrs);
-
-#ifdef _cplusplus
-}
-#endif /* _cplusplus */
-
-
-#endif /* __E_MSG_COMPOSER_HDRS_H__ */
diff --git a/composer/e-msg-composer-select-file.c b/composer/e-msg-composer-select-file.c
deleted file mode 100644
index 36b53c8446..0000000000
--- a/composer/e-msg-composer-select-file.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-select-file.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#include <gtk/gtkfilesel.h>
-
-#include "e-msg-composer-select-file.h"
-
-
-struct _FileSelectionInfo {
- GtkWidget *widget;
- char *selected_file;
-};
-typedef struct _FileSelectionInfo FileSelectionInfo;
-
-
-static void
-confirm (FileSelectionInfo *info)
-{
- const char *filename;
-
- filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (info->widget));
- info->selected_file = g_strdup (filename);
-
- gtk_widget_hide (info->widget);
-
- gtk_main_quit ();
-}
-
-static void
-cancel (FileSelectionInfo *info)
-{
- g_assert (info->selected_file == NULL);
-
- gtk_widget_hide (info->widget);
-
- gtk_main_quit ();
-}
-
-
-/* Callbacks. */
-
-static void
-ok_clicked_cb (GtkWidget *widget,
- void *data)
-{
- FileSelectionInfo *info;
-
- info = (FileSelectionInfo *) data;
- confirm (info);
-}
-
-static void
-cancel_clicked_cb (GtkWidget *widget,
- void *data)
-{
- FileSelectionInfo *info;
-
- info = (FileSelectionInfo *) data;
- cancel (info);
-}
-
-static int
-delete_event_cb (GtkWidget *widget,
- GdkEventAny *event,
- void *data)
-{
- FileSelectionInfo *info;
-
- info = (FileSelectionInfo *) data;
- cancel (info);
-
- return TRUE;
-}
-
-
-/* Setup. */
-
-static FileSelectionInfo *
-create_file_selection (EMsgComposer *composer)
-{
- FileSelectionInfo *info;
- GtkWidget *widget;
- GtkWidget *ok_button;
- GtkWidget *cancel_button;
-
- info = g_new (FileSelectionInfo, 1);
-
- widget = gtk_file_selection_new (NULL);
- gtk_window_set_wmclass (GTK_WINDOW (widget), "fileselection",
- "Evolution:composer");
- ok_button = GTK_FILE_SELECTION (widget)->ok_button;
- cancel_button = GTK_FILE_SELECTION (widget)->cancel_button;
-
- gtk_signal_connect (GTK_OBJECT (ok_button),
- "clicked", GTK_SIGNAL_FUNC (ok_clicked_cb), info);
- gtk_signal_connect (GTK_OBJECT (cancel_button),
- "clicked", GTK_SIGNAL_FUNC (cancel_clicked_cb), info);
- gtk_signal_connect (GTK_OBJECT (widget), "delete_event",
- GTK_SIGNAL_FUNC (delete_event_cb), info);
-
- info->widget = widget;
- info->selected_file = NULL;
-
- return info;
-}
-
-static void
-file_selection_info_destroy_notify (void *data)
-{
- FileSelectionInfo *info;
-
- info = (FileSelectionInfo *) data;
-
- g_free (info->selected_file);
- g_free (info);
-}
-
-
-char *
-e_msg_composer_select_file (EMsgComposer *composer,
- const char *title)
-{
- FileSelectionInfo *info;
- char *retval;
-
- g_return_val_if_fail (composer != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
- info = gtk_object_get_data (GTK_OBJECT (composer),
- "e-msg-composer-file-selection-info");
-
- if (info == NULL) {
- info = create_file_selection (composer);
- gtk_object_set_data_full (GTK_OBJECT (composer),
- "e-msg-composer-file-selection-info", info,
- file_selection_info_destroy_notify);
- }
-
- if (GTK_WIDGET_VISIBLE (info->widget))
- return NULL; /* Busy! */
-
- gtk_window_set_title (GTK_WINDOW (info->widget), title);
- gtk_widget_show (info->widget);
-
- GDK_THREADS_ENTER();
- gtk_main ();
- GDK_THREADS_LEAVE();
-
- retval = info->selected_file;
- info->selected_file = NULL;
-
- return retval;
-}
diff --git a/composer/e-msg-composer-select-file.h b/composer/e-msg-composer-select-file.h
deleted file mode 100644
index 2f89bd58b4..0000000000
--- a/composer/e-msg-composer-select-file.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer-select-file.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef E_MSG_COMPOSER_SELECT_FILE_H
-#define E_MSG_COMPOSER_SELECT_FILE_H
-
-#include "e-msg-composer.h"
-
-char *e_msg_composer_select_file (EMsgComposer *composer,
- const char *title);
-
-#endif /* E_MSG_COMPOSER_SELECT_FILE_H */
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
deleted file mode 100644
index 03e747c481..0000000000
--- a/composer/e-msg-composer.c
+++ /dev/null
@@ -1,2369 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer.c
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Ettore Perazzoli, Jeffrey Stedfast
- */
-
-/*
-
- TODO
-
- - Somehow users should be able to see if any file(s) are attached even when
- the attachment bar is not shown.
-
-*/
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <errno.h>
-
-#include <bonobo.h>
-#include <bonobo/bonobo-stream-memory.h>
-#include <glade/glade.h>
-#include <gnome.h>
-#include <libgnorba/gnorba.h>
-#include <gtkhtml/gtkhtml.h>
-
-#include "camel/camel.h"
-#include "camel-charset-map.h"
-
-#include "mail/mail.h"
-#include "mail/mail-crypto.h"
-#include "mail/mail-tools.h"
-#include "mail/mail-ops.h"
-
-#include "e-util/e-html-utils.h"
-#include <gal/widgets/e-gui-utils.h>
-#include <gal/widgets/e-scroll-frame.h>
-
-#include "e-msg-composer.h"
-#include "e-msg-composer-attachment-bar.h"
-#include "e-msg-composer-hdrs.h"
-#include "e-msg-composer-select-file.h"
-
-#include "Editor.h"
-#include "listener.h"
-
-#include <libgnomevfs/gnome-vfs.h>
-
-#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor"
-
-
-#define DEFAULT_WIDTH 600
-#define DEFAULT_HEIGHT 500
-
-enum {
- SEND,
- POSTPONE,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL] = { 0 };
-
-static GnomeAppClass *parent_class = NULL;
-
-/* local prototypes */
-static GList *add_recipients (GList *list, const char *recips, gboolean decode);
-static void free_recipients (GList *list);
-static void handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth);
-
-
-static char *
-get_text (Bonobo_PersistStream persist, char *format)
-{
- BonoboStream *stream;
- BonoboStreamMem *stream_mem;
- CORBA_Environment ev;
- char *text;
-
- CORBA_exception_init (&ev);
-
- stream = bonobo_stream_mem_create (NULL, 0, FALSE, TRUE);
- Bonobo_PersistStream_save (persist, (Bonobo_Stream)bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
- format, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("Exception getting mail '%s'",
- bonobo_exception_get_text (&ev));
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- stream_mem = BONOBO_STREAM_MEM (stream);
- text = g_malloc (stream_mem->pos + 1);
- memcpy (text, stream_mem->buffer, stream_mem->pos);
- text[stream_mem->pos] = 0;
- bonobo_object_unref (BONOBO_OBJECT(stream));
-
- return text;
-}
-
-#define LINE_LEN 72
-
-typedef enum {
- MSG_FORMAT_PLAIN,
- MSG_FORMAT_ALTERNATIVE,
-} MsgFormat;
-
-static gboolean
-is_8bit (const guchar *text)
-{
- guchar *c;
-
- for (c = (guchar *) text; *c; c++)
- if (*c > (guchar) 127)
- return TRUE;
-
- return FALSE;
-}
-
-static int
-best_encoding (const guchar *text)
-{
- guchar *ch;
- int count = 0;
- int total;
-
- for (ch = (guchar *) text; *ch; ch++)
- if (*ch > (guchar) 127)
- count++;
-
- total = (int) (ch - text);
-
- if ((float) count <= total * 0.17)
- return CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE;
- else
- return CAMEL_MIME_PART_ENCODING_BASE64;
-}
-
-static char *
-best_content (gchar *plain)
-{
- char *result;
- const char *best;
-
- if ((best = camel_charset_best (plain, strlen (plain)))) {
- result = g_strdup_printf ("text/plain; charset=%s", best);
- } else {
- result = g_strdup ("text/plain");
- }
-
- return result;
-}
-
-static gboolean
-clear_inline_images (gpointer key, gpointer value, gpointer user_data)
-{
- g_free (key);
- g_free (value);
-
- return TRUE;
-}
-
-void
-e_msg_composer_clear_inlined_table (EMsgComposer *composer)
-{
- g_hash_table_foreach_remove (composer->inline_images, clear_inline_images, NULL);
-}
-
-static void
-add_inlined_image (gpointer key, gpointer value, gpointer data)
-{
- gchar *file_name = (gchar *) key;
- gchar *cid = (gchar *) value;
- gchar *id, *mime_type;
- CamelMultipart *multipart = (CamelMultipart *) data;
- CamelStream *stream;
- CamelDataWrapper *wrapper;
- CamelMimePart *part;
- struct stat statbuf;
-
- /* check for regular file */
- if (stat (file_name, &statbuf) < 0 || !S_ISREG (statbuf.st_mode))
- return;
-
- if (!(stream = camel_stream_fs_new_with_name (file_name, O_RDONLY, 0)))
- return;
-
- wrapper = camel_data_wrapper_new ();
- camel_data_wrapper_construct_from_stream (wrapper, stream);
- camel_object_unref (CAMEL_OBJECT (stream));
-
- mime_type = e_msg_composer_guess_mime_type (file_name);
- camel_data_wrapper_set_mime_type (wrapper, mime_type ? mime_type : "application/octet-stream");
- g_free (mime_type);
-
- part = camel_mime_part_new ();
- camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper);
- camel_object_unref (CAMEL_OBJECT (wrapper));
-
- id = g_strconcat ("<", cid, ">", NULL);
- camel_mime_part_set_content_id (part, id);
- g_free (id);
- /* FIXME: should this use g_basename (file_name)? */
- camel_mime_part_set_filename (part, strchr (file_name, '/') ? strrchr (file_name, '/') + 1 : file_name);
- camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_BASE64);
-
- camel_multipart_add_part (multipart, part);
- camel_object_unref (CAMEL_OBJECT (part));
-}
-
-static void
-add_inlined_images (EMsgComposer *composer, CamelMultipart *multipart)
-{
- g_hash_table_foreach (composer->inline_images, add_inlined_image, multipart);
-}
-
-/* This functions builds a CamelMimeMessage for the message that the user has
- composed in `composer'. */
-static CamelMimeMessage *
-build_message (EMsgComposer *composer)
-{
- EMsgComposerAttachmentBar *attachment_bar =
- E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar);
- MsgFormat type = MSG_FORMAT_ALTERNATIVE;
- CamelInternetAddress *from;
- CamelMimeMessage *new;
- CamelMultipart *body = NULL;
- CamelMimePart *part;
- gboolean plain_e8bit = FALSE, html_e8bit = FALSE;
- CamelException ex;
- char *html = NULL, *plain = NULL;
- char *content_type = NULL;
- int i;
-
- if (composer->persist_stream_interface == CORBA_OBJECT_NIL)
- return NULL;
-
- if (composer->send_html)
- type = MSG_FORMAT_ALTERNATIVE;
- else
- type = MSG_FORMAT_PLAIN;
-
- /* get and/or set the From field */
- from = e_msg_composer_hdrs_get_from (E_MSG_COMPOSER_HDRS (composer->hdrs));
- if (!from) {
- const MailConfigAccount *account = NULL;
-
- account = mail_config_get_default_account ();
-
- /* if !account then we have mucho problemos, amigo */
- if (!account)
- return NULL;
-
- e_msg_composer_hdrs_set_from_account (E_MSG_COMPOSER_HDRS (composer->hdrs), account->name);
- }
- camel_object_unref (CAMEL_OBJECT (from));
-
- new = camel_mime_message_new ();
-
- e_msg_composer_hdrs_to_message (E_MSG_COMPOSER_HDRS (composer->hdrs), new);
- for (i = 0; i < composer->extra_hdr_names->len; i++) {
- camel_medium_add_header (CAMEL_MEDIUM (new),
- composer->extra_hdr_names->pdata[i],
- composer->extra_hdr_values->pdata[i]);
- }
-
- plain = get_text (composer->persist_stream_interface, "text/plain");
-
- /* the component has probably died */
- if (plain == NULL)
- return NULL;
-
- plain_e8bit = is_8bit (plain);
-
- if (type != MSG_FORMAT_PLAIN) {
- e_msg_composer_clear_inlined_table (composer);
- html = get_text (composer->persist_stream_interface, "text/html");
-
- html_e8bit = is_8bit (html);
- /* the component has probably died */
- if (html == NULL) {
- g_free (plain);
- return NULL;
- }
- }
-
- if (type == MSG_FORMAT_ALTERNATIVE) {
- body = camel_multipart_new ();
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (body),
- "multipart/alternative");
- camel_multipart_set_boundary (body, NULL);
-
- part = camel_mime_part_new ();
-
- content_type = best_content (plain);
- camel_mime_part_set_content (part, plain, strlen (plain), content_type);
- g_free (content_type);
-
- if (plain_e8bit)
- camel_mime_part_set_encoding (part, best_encoding (plain));
-
- g_free (plain);
- camel_multipart_add_part (body, part);
- camel_object_unref (CAMEL_OBJECT (part));
-
- part = camel_mime_part_new ();
- if (g_hash_table_size (composer->inline_images)) {
- CamelMultipart *html_with_images;
- CamelMimePart *text_html;
-
- html_with_images = camel_multipart_new ();
- camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (html_with_images),
- "multipart/related");
- camel_multipart_set_boundary (html_with_images, NULL);
-
- text_html = camel_mime_part_new ();
- camel_mime_part_set_content (text_html, html, strlen (html), "text/html; charset=utf-8");
-
- if (html_e8bit)
- camel_mime_part_set_encoding (text_html, best_encoding (html));
-
- camel_multipart_add_part (html_with_images, text_html);
- camel_object_unref (CAMEL_OBJECT (text_html));
-
- add_inlined_images (composer, html_with_images);
- camel_medium_set_content_object (CAMEL_MEDIUM (part),
- CAMEL_DATA_WRAPPER (html_with_images));
- } else {
- camel_mime_part_set_content (part, html, strlen (html), "text/html; charset=utf-8");
-
- if (html_e8bit)
- camel_mime_part_set_encoding (part, best_encoding (html));
- }
-
- g_free (html);
-
- camel_multipart_add_part (body, part);
- camel_object_unref (CAMEL_OBJECT (part));
- }
-
- if (e_msg_composer_attachment_bar_get_num_attachments (attachment_bar)) {
- CamelMultipart *multipart = camel_multipart_new ();
-
- /* Generate a random boundary. */
- camel_multipart_set_boundary (multipart, NULL);
-
- part = camel_mime_part_new ();
- switch (type) {
- case MSG_FORMAT_ALTERNATIVE:
- camel_medium_set_content_object (CAMEL_MEDIUM (part),
- CAMEL_DATA_WRAPPER (body));
- camel_object_unref (CAMEL_OBJECT (body));
- break;
- case MSG_FORMAT_PLAIN:
- content_type = best_content (plain);
- camel_mime_part_set_content (part, plain, strlen (plain), content_type);
- g_free (content_type);
-
- if (plain_e8bit)
- camel_mime_part_set_encoding (part, best_encoding (plain));
-
- g_free (plain);
- break;
- }
- camel_multipart_add_part (multipart, part);
- camel_object_unref (CAMEL_OBJECT (part));
-
- e_msg_composer_attachment_bar_to_multipart (attachment_bar, multipart);
-
- part = camel_mime_part_new ();
- camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (multipart));
- camel_object_unref (CAMEL_OBJECT (multipart));
- } else {
- switch (type) {
- case MSG_FORMAT_ALTERNATIVE:
- part = camel_mime_part_new ();
-
- camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (body));
- camel_object_unref (CAMEL_OBJECT (body));
- break;
- case MSG_FORMAT_PLAIN:
- part = camel_mime_part_new ();
-
- content_type = best_content (plain);
- camel_mime_part_set_content (CAMEL_MIME_PART (part), plain, strlen (plain), content_type);
- g_free (content_type);
-
- if (plain_e8bit)
- camel_mime_part_set_encoding (part, best_encoding (plain));
-
- g_free (plain);
-
- break;
- }
- }
-
- camel_exception_init (&ex);
-
- if (composer->pgp_sign) {
- /* FIXME: should use the PGP key id rather than email address */
- const char *pgpid;
-
- camel_exception_init (&ex);
- from = e_msg_composer_hdrs_get_from (E_MSG_COMPOSER_HDRS (composer->hdrs));
- camel_internet_address_get (from, 0, NULL, &pgpid);
- pgp_mime_part_sign (&part, pgpid, PGP_HASH_TYPE_SHA1,
- &ex);
- camel_object_unref (CAMEL_OBJECT (from));
- if (camel_exception_is_set (&ex))
- goto exception;
- }
-
- if (composer->pgp_encrypt) {
- /* FIXME: recipients should be an array of key ids rather than email addresses */
- const CamelInternetAddress *addr;
- const char *address;
- GPtrArray *recipients;
- int i, len;
-
- camel_exception_init (&ex);
- recipients = g_ptr_array_new ();
-
- addr = camel_mime_message_get_recipients (new, CAMEL_RECIPIENT_TYPE_TO);
- len = camel_address_length (CAMEL_ADDRESS (addr));
- for (i = 0; i < len; i++) {
- camel_internet_address_get (addr, i, NULL, &address);
- g_ptr_array_add (recipients, g_strdup (address));
- }
-
- addr = camel_mime_message_get_recipients (new, CAMEL_RECIPIENT_TYPE_CC);
- len = camel_address_length (CAMEL_ADDRESS (addr));
- for (i = 0; i < len; i++) {
- camel_internet_address_get (addr, i, NULL, &address);
- g_ptr_array_add (recipients, g_strdup (address));
- }
-
- addr = camel_mime_message_get_recipients (new, CAMEL_RECIPIENT_TYPE_BCC);
- len = camel_address_length (CAMEL_ADDRESS (addr));
- for (i = 0; i < len; i++) {
- camel_internet_address_get (addr, i, NULL, &address);
- g_ptr_array_add (recipients, g_strdup (address));
- }
-
- pgp_mime_part_encrypt (&part, recipients, &ex);
- for (i = 0; i < recipients->len; i++)
- g_free (recipients->pdata[i]);
- g_ptr_array_free (recipients, TRUE);
- if (camel_exception_is_set (&ex))
- goto exception;
- }
-
- camel_medium_set_content_object (CAMEL_MEDIUM (new),
- camel_medium_get_content_object (CAMEL_MEDIUM (part)));
- camel_object_unref (CAMEL_OBJECT (part));
-
- return new;
-
- exception:
-
- camel_object_unref (CAMEL_OBJECT (part));
- camel_object_unref (CAMEL_OBJECT (new));
-
- if (camel_exception_is_set (&ex)) {
- GtkWidget *dialog;
-
- dialog = gnome_error_dialog_parented (camel_exception_get_description (&ex),
- GTK_WINDOW (composer));
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
- camel_exception_clear (&ex);
- }
-
- return NULL;
-}
-
-static char *
-get_signature (const char *sigfile, gboolean in_html)
-{
- GString *rawsig;
- gchar buf[1024];
- gchar *file_name;
- gchar *htmlsig = NULL;
- int fd, n;
-
- if (!sigfile || !*sigfile) {
- return NULL;
- }
-
- file_name = in_html ? g_strconcat (sigfile, ".html", NULL) : (gchar *) sigfile;
-
- fd = open (file_name, O_RDONLY);
- if (fd == -1) {
- char *msg;
-
- msg = g_strdup_printf (_("Could not open signature file %s:\n"
- "%s"), file_name, g_strerror (errno));
- gnome_error_dialog (msg);
- g_free (msg);
-
- htmlsig = NULL;
- } else {
- rawsig = g_string_new ("");
- while ((n = read (fd, buf, 1023)) > 0) {
- buf[n] = '\0';
- g_string_append (rawsig, buf);
- }
- close (fd);
-
- htmlsig = in_html ? rawsig->str : e_text_to_html (rawsig->str, 0);
- g_string_free (rawsig, !in_html);
- }
- if (in_html) g_free (file_name);
-
- return htmlsig;
-}
-
-static void
-prepare_engine (EMsgComposer *composer)
-{
- CORBA_Environment ev;
-
- g_assert (composer);
- g_assert (E_IS_MSG_COMPOSER (composer));
-
- /* printf ("prepare_engine\n"); */
-
- CORBA_exception_init (&ev);
- composer->editor_engine = (GNOME_GtkHTML_Editor_Engine) bonobo_object_client_query_interface
- (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev);
- if (composer->editor_engine != CORBA_OBJECT_NIL) {
-
- /* printf ("trying set listener\n"); */
- composer->editor_listener = BONOBO_OBJECT (listener_new (composer));
- if (composer->editor_listener != CORBA_OBJECT_NIL)
- GNOME_GtkHTML_Editor_Engine__set_listener (composer->editor_engine,
- (GNOME_GtkHTML_Editor_Listener)
- bonobo_object_dup_ref
- (bonobo_object_corba_objref (composer->editor_listener), &ev),
- &ev);
- else
- g_warning ("Can't establish Editor Listener\n");
- } else
- g_warning ("Can't get Editor Engine\n");
- CORBA_exception_free (&ev);
-}
-
-void
-e_msg_composer_mark_text_orig (EMsgComposer *composer)
-{
- g_assert (composer);
- g_assert (E_IS_MSG_COMPOSER (composer));
-
- if (composer->editor_engine != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
- CORBA_any *flag = bonobo_arg_new (TC_boolean);
- *((CORBA_boolean *) flag->_value) = CORBA_TRUE;
-
- CORBA_exception_init (&ev);
- GNOME_GtkHTML_Editor_Engine_setObjectDataByType (composer->editor_engine, "ClueFlow", "orig", flag, &ev);
- CORBA_free (flag);
- CORBA_exception_free (&ev);
- }
-}
-
-static void
-set_editor_text (EMsgComposer *composer, const char *sig_file, const char *text)
-{
- Bonobo_PersistStream persist;
- BonoboStream *stream;
- BonoboWidget *editor;
- CORBA_Environment ev;
- char *sig, *fulltext;
- gboolean html_sig = composer->send_html;
-
- editor = BONOBO_WIDGET (composer->editor);
- sig = get_signature (sig_file, html_sig);
- /* if we tried HTML sig and it's not available, try also non HTML signature */
- if (html_sig && !sig) {
- html_sig = FALSE;
- sig = get_signature (sig_file, html_sig);
- }
-
- if (sig) {
- if (html_sig)
- fulltext = g_strdup_printf ("%s<br>%s",
- text, sig);
- else if (!strncmp ("-- \n", sig, 3))
- fulltext = g_strdup_printf ("%s<br>\n<pre>\n%s</pre>",
- text, sig);
- else
- fulltext = g_strdup_printf ("%s<br>\n<pre>\n-- \n%s</pre>",
- text, sig);
- } else {
- if (!*text)
- return;
- fulltext = (char*)text;
- }
-
- CORBA_exception_init (&ev);
- persist = (Bonobo_PersistStream) bonobo_object_client_query_interface (
- bonobo_widget_get_server (editor), "IDL:Bonobo/PersistStream:1.0", &ev);
- g_assert (persist != CORBA_OBJECT_NIL);
-
- stream = bonobo_stream_mem_create (fulltext, strlen (fulltext),
- TRUE, FALSE);
- if (sig)
- g_free (fulltext);
- Bonobo_PersistStream_load (persist, (Bonobo_Stream)bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
- "text/html", &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- /* FIXME. Some error message. */
- return;
- }
- if (ev._major != CORBA_SYSTEM_EXCEPTION)
- CORBA_Object_release (persist, &ev);
-
- Bonobo_Unknown_unref (persist, &ev);
- CORBA_exception_free (&ev);
- bonobo_object_unref (BONOBO_OBJECT(stream));
-}
-
-
-/* Commands. */
-
-static void
-show_attachments (EMsgComposer *composer,
- gboolean show)
-{
- if (show) {
- gtk_widget_show (composer->attachment_scroll_frame);
- gtk_widget_show (composer->attachment_bar);
- } else {
- gtk_widget_hide (composer->attachment_scroll_frame);
- gtk_widget_hide (composer->attachment_bar);
- }
-
- composer->attachment_bar_visible = show;
-
- /* Update the GUI. */
-
-#if 0
- gtk_check_menu_item_set_active
- (GTK_CHECK_MENU_ITEM
- (glade_xml_get_widget (composer->menubar_gui,
- "menu_view_attachments")),
- show);
-#endif
-
- /* XXX we should update the toggle toolbar item as well. At
- this point, it is not a toggle because Glade is broken. */
-}
-
-static void
-save (EMsgComposer *composer,
- const char *file_name)
-{
- CORBA_Environment ev;
- char *my_file_name;
-
- if (file_name != NULL)
- my_file_name = g_strdup (file_name);
- else
- my_file_name = e_msg_composer_select_file (composer, _("Save as..."));
-
- if (my_file_name == NULL)
- return;
-
- CORBA_exception_init (&ev);
-
- Bonobo_PersistFile_save (composer->persist_file_interface, my_file_name, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
- _("Error saving file: %s"), g_basename (file_name));
- }
-
- CORBA_exception_free (&ev);
-
- g_free (my_file_name);
-}
-
-static void
-load (EMsgComposer *composer,
- const char *file_name)
-{
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- Bonobo_PersistFile_load (composer->persist_file_interface, file_name, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
- _("Error loading file: %s"), g_basename (file_name));
-
- CORBA_exception_free (&ev);
-}
-
-/* Exit dialog. (Displays a "Save composition to 'Drafts' before exiting?" warning before actually exiting.) */
-
-enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL };
-
-struct _save_info {
- EMsgComposer *composer;
- int quitok;
-};
-
-static void save_done(CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
-{
- struct _save_info *si = data;
-
- if (ok && si->quitok)
- gtk_widget_destroy((GtkWidget *)si->composer);
- else
- gtk_object_unref((GtkObject *)si->composer);
-
- g_free(info);
- g_free(si);
-}
-
-static void
-save_draft(EMsgComposer *composer, int quitok)
-{
- CamelMimeMessage *msg;
- CamelMessageInfo *info;
- extern CamelFolder *drafts_folder;
- struct _save_info *si;
-
- composer->send_html = TRUE; /* always save drafts as HTML to keep formatting */
- msg = e_msg_composer_get_message(composer);
-
- info = g_new0 (CamelMessageInfo, 1);
- info->flags = CAMEL_MESSAGE_DRAFT;
-
- si = g_malloc(sizeof(*si));
- si->composer = composer;
- gtk_object_ref((GtkObject *)composer);
- si->quitok = quitok;
-
- mail_append_mail(drafts_folder, msg, info, save_done, si);
- camel_object_unref((CamelObject *)msg);
-}
-
-static void
-menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
-{
- save_draft(E_MSG_COMPOSER(data), FALSE);
-}
-
-static void
-exit_dialog_cb (int reply, EMsgComposer *composer)
-{
- switch (reply) {
- case REPLY_YES:
- /* this has to be done async */
- save_draft(composer, TRUE);
- break;
- case REPLY_NO:
- gtk_widget_destroy (GTK_WIDGET (composer));
- break;
- case REPLY_CANCEL:
- default:
- }
-}
-
-static void
-do_exit (EMsgComposer *composer)
-{
- GtkWidget *dialog;
- GtkWidget *label;
- gint button;
-
- if (composer->has_changed) {
- dialog = gnome_dialog_new (_("Evolution"),
- GNOME_STOCK_BUTTON_YES, /* Save */
- GNOME_STOCK_BUTTON_NO, /* Don't save */
- GNOME_STOCK_BUTTON_CANCEL, /* Cancel */
- NULL);
-
- label = gtk_label_new (_("This message has not been sent.\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 (composer));
- gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
- button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- exit_dialog_cb (button, composer);
- } else {
- gtk_widget_destroy (GTK_WIDGET (composer));
- }
-}
-
-/* Menu callbacks. */
-
-static void
-menu_file_open_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EMsgComposer *composer;
- char *file_name;
-
- composer = E_MSG_COMPOSER (data);
-
- file_name = e_msg_composer_select_file (composer, _("Open file"));
- if (file_name == NULL)
- return;
-
- load (composer, file_name);
-
- g_free (file_name);
-}
-
-static void
-menu_file_save_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EMsgComposer *composer;
- CORBA_char *file_name;
- CORBA_Environment ev;
-
- composer = E_MSG_COMPOSER (data);
-
- CORBA_exception_init (&ev);
-
- file_name = Bonobo_PersistFile_getCurrentFile (composer->persist_file_interface, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- save (composer, NULL);
- } else {
- save (composer, file_name);
- CORBA_free (file_name);
- }
-
- CORBA_exception_free (&ev);
-}
-
-static void
-menu_file_save_as_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- save (composer, NULL);
-}
-
-static void
-menu_file_send_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- gtk_signal_emit (GTK_OBJECT (data), signals[SEND]);
-}
-
-static void
-menu_file_send_later_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- gtk_signal_emit (GTK_OBJECT (data), signals[POSTPONE]);
-}
-
-static void
-menu_file_close_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
- do_exit (composer);
-}
-
-static void
-menu_file_add_attachment_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- e_msg_composer_attachment_bar_attach
- (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
- NULL);
-}
-
-static void
-menu_view_attachments_activate_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-
-{
- gboolean new_state;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- new_state = atoi (state);
-
- e_msg_composer_show_attachments (E_MSG_COMPOSER (user_data), new_state);
-}
-
-#if 0
-static void
-insert_file_ok_cb (GtkWidget *widget, void *user_data)
-{
- GtkFileSelection *fs;
- GdkAtom selection_atom = GDK_NONE;
- char *name;
- EMsgComposer *composer;
- struct stat sb;
- int fd;
- guint8 *buffer;
- size_t bufsz, actual;
-
- fs = GTK_FILE_SELECTION (gtk_widget_get_ancestor (widget,
- GTK_TYPE_FILE_SELECTION));
- composer = E_MSG_COMPOSER (user_data);
- name = gtk_file_selection_get_filename (fs);
-
- if (stat (name, &sb) < 0) {
- GtkWidget *dlg;
-
- dlg = gnome_error_dialog_parented( _("That file does not exist."),
- GTK_WINDOW (fs));
- gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- gtk_widget_destroy (GTK_WIDGET (dlg));
- return;
- }
-
- if (!(S_ISREG (sb.st_mode))) {
- GtkWidget *dlg;
-
- dlg = gnome_error_dialog_parented (_("That is not a regular file."),
- GTK_WINDOW (fs));
- gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- gtk_widget_destroy (GTK_WIDGET (dlg));
- return;
- }
-
- if (access (name, R_OK) != 0) {
- GtkWidget *dlg;
-
- dlg = gnome_error_dialog_parented (_("That file exists but is not readable."),
- GTK_WINDOW (fs));
- gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- gtk_widget_destroy (GTK_WIDGET (dlg));
- return;
- }
-
- if ((fd = open (name, O_RDONLY)) < 0) {
- GtkWidget *dlg;
-
- dlg = gnome_error_dialog_parented (_("That file appeared accesible but open(2) failed."),
- GTK_WINDOW (fs));
- gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- gtk_widget_destroy (GTK_WIDGET (dlg));
- return;
- }
-
- buffer = NULL;
- bufsz = 0;
- actual = 0;
-#define CHUNK 5120
-
- while (TRUE) {
- ssize_t chunk;
-
- if (bufsz - actual < CHUNK) {
- bufsz += CHUNK;
-
- if (bufsz >= 102400) {
- GtkWidget *dlg;
- gint result;
-
- dlg = gnome_dialog_new (_("The file is very large (more than 100K).\n"
- "Are you sure you wish to insert it?"),
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
- gnome_dialog_set_parent (GNOME_DIALOG (dlg), GTK_WINDOW (fs));
- result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- gtk_widget_destroy (GTK_WIDGET (dlg));
-
- if (result == 1)
- goto cleanup;
- }
-
- buffer = g_realloc (buffer, bufsz * sizeof (guint8));
- }
-
- chunk = read (fd, &(buffer[actual]), CHUNK);
-
- if (chunk < 0) {
- GtkWidget *dlg;
-
- dlg = gnome_error_dialog_parented (_("An error occurred while reading the file."),
- GTK_WINDOW (fs));
- gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
- gtk_widget_destroy (GTK_WIDGET (dlg));
- goto cleanup;
- }
-
- if (chunk == 0)
- break;
-
- actual += chunk;
- }
-
- buffer[actual] = '\0';
-
- if (selection_atom == GDK_NONE)
- selection_atom = gdk_atom_intern ("TEMP_PASTE", FALSE);
- gtk_object_set_data (GTK_OBJECT (fs), "ev_file_buffer", buffer);
- gtk_selection_owner_set (GTK_WIDGET (fs), selection_atom, GDK_CURRENT_TIME);
- /*gtk_html_paste (composer->send_html);*/
-
- cleanup:
- close (fd);
- g_free (buffer);
- gtk_widget_destroy (GTK_WIDGET (fs));
-}
-
-static void
-fs_selection_get (GtkWidget *widget, GtkSelectionData *sdata,
- guint info, guint time)
-{
- gchar *buffer;
- GdkAtom encoding;
- gint format;
- guchar *ctext;
- gint length;
-
- buffer = gtk_object_get_data (GTK_OBJECT (widget), "ev_file_buffer");
- if (gdk_string_to_compound_text (buffer, &encoding, &format, &ctext,
- &length) == Success)
- gtk_selection_data_set (sdata, encoding, format, ctext, length);
- g_free (buffer);
- gtk_object_remove_data (GTK_OBJECT (widget), "ev_file_buffer");
-}
-
-#endif
-static void
-menu_file_insert_file_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
-{
-#if 0
- EMsgComposer *composer;
- GtkFileSelection *fs;
-
- composer = E_MSG_COMPOSER (data);
-
- fs = GTK_FILE_SELECTION (gtk_file_selection_new ("Choose File"));
- /* FIXME: remember the location or something */
- /*gtk_file_selection_set_filename( fs, g_get_home_dir() );*/
- gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
- GTK_SIGNAL_FUNC (insert_file_ok_cb), data);
- gtk_signal_connect_object (GTK_OBJECT (fs->cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (fs));
- gtk_widget_show (GTK_WIDGET(fs));
-#else
- g_message ("Insert file is unimplemented! oh no!");
-#endif
-}
-
-static void
-menu_format_html_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-
-{
- EMsgComposer *composer;
- gboolean new_state;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- composer = E_MSG_COMPOSER (user_data);
-
- new_state = atoi (state);
-
- if ((new_state && composer->send_html) ||
- (! new_state && ! composer->send_html))
- return;
-
- e_msg_composer_set_send_html (composer, new_state);
-}
-
-static void
-menu_security_pgp_sign_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-
-{
- EMsgComposer *composer;
- gboolean new_state;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- composer = E_MSG_COMPOSER (user_data);
-
- new_state = atoi (state);
-
- if ((new_state && composer->pgp_sign) ||
- (!new_state && ! composer->pgp_sign))
- return;
-
- e_msg_composer_set_pgp_sign (composer, new_state);
-}
-
-static void
-menu_security_pgp_encrypt_cb (BonoboUIComponent *component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- gpointer user_data)
-
-{
- EMsgComposer *composer;
- gboolean new_state;
-
- if (type != Bonobo_UIComponent_STATE_CHANGED)
- return;
-
- composer = E_MSG_COMPOSER (user_data);
-
- new_state = atoi (state);
-
- if ((new_state && composer->pgp_encrypt) ||
- (!new_state && ! composer->pgp_encrypt))
- return;
-
- e_msg_composer_set_pgp_encrypt (composer, new_state);
-}
-
-
-static BonoboUIVerb verbs [] = {
-
- BONOBO_UI_VERB ("FileOpen", menu_file_open_cb),
- BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
- BONOBO_UI_VERB ("FileSaveAs", menu_file_save_as_cb),
- BONOBO_UI_VERB ("FileSaveDraft", menu_file_save_draft_cb),
- BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
-
- BONOBO_UI_VERB ("FileInsertFile", menu_file_insert_file_cb),
- BONOBO_UI_VERB ("FileAttach", menu_file_add_attachment_cb),
-
- BONOBO_UI_VERB ("FileSend", menu_file_send_cb),
- BONOBO_UI_VERB ("FileSendLater", menu_file_send_later_cb),
-
- BONOBO_UI_VERB_END
-};
-
-static void
-setup_ui (EMsgComposer *composer)
-{
- BonoboUIContainer *container;
-
- container = bonobo_ui_container_new ();
- bonobo_ui_container_set_win (container, BONOBO_WINDOW (composer));
-
- composer->uic = bonobo_ui_component_new ("evolution-message-composer");
- bonobo_ui_component_set_container (
- composer->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)));
-
- bonobo_ui_component_add_verb_list_with_data (
- composer->uic, verbs, composer);
-
- bonobo_ui_util_set_ui (composer->uic, EVOLUTION_DATADIR,
- "evolution-message-composer.xml",
- "evolution-message-composer");
-
- /* Format -> HTML */
- bonobo_ui_component_set_prop (composer->uic, "/commands/FormatHtml",
- "state", composer->send_html ? "1" : "0", NULL);
-
- bonobo_ui_component_add_listener (composer->uic, "FormatHtml",
- menu_format_html_cb, composer);
-
- /* Security -> PGP Sign */
- bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityPGPSign",
- "state", composer->pgp_sign ? "1" : "0", NULL);
-
- bonobo_ui_component_add_listener (composer->uic, "SecurityPGPSign",
- menu_security_pgp_sign_cb, composer);
-
- /* Security -> PGP Encrypt */
- bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityPGPEncrypt",
- "state", composer->pgp_encrypt ? "1" : "0", NULL);
-
- bonobo_ui_component_add_listener (composer->uic, "SecurityPGPEncrypt",
- menu_security_pgp_encrypt_cb, composer);
-
- /* View -> Attachments */
- bonobo_ui_component_add_listener (composer->uic, "ViewAttach",
- menu_view_attachments_activate_cb, composer);
-}
-
-
-/* Miscellaneous callbacks. */
-
-static void
-attachment_bar_changed_cb (EMsgComposerAttachmentBar *bar,
- void *data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- if (e_msg_composer_attachment_bar_get_num_attachments (bar) > 0)
- e_msg_composer_show_attachments (composer, TRUE);
- else
- e_msg_composer_show_attachments (composer, FALSE);
-
- /* Mark the composer as changed so it prompts about unsaved changes on close */
- e_msg_composer_set_changed (composer);
-}
-
-static void
-subject_changed_cb (EMsgComposerHdrs *hdrs,
- gchar *subject,
- void *data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- if (strlen (subject))
- gtk_window_set_title (GTK_WINDOW (composer), subject);
- else
- gtk_window_set_title (GTK_WINDOW (composer),
- _("Compose a message"));
- g_free (subject);
-}
-
-static void
-hdrs_changed_cb (EMsgComposerHdrs *hdrs,
- void *data)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (data);
-
- /* Mark the composer as changed so it prompts about unsaved changes on close */
- e_msg_composer_set_changed (composer);
-}
-
-
-/* GtkObject methods. */
-
-static void
-destroy (GtkObject *object)
-{
- EMsgComposer *composer;
- CORBA_Environment ev;
-
- composer = E_MSG_COMPOSER (object);
-
- if (composer->uic)
- bonobo_object_unref (BONOBO_OBJECT (composer->uic));
- composer->uic = NULL;
-
- /* FIXME? I assume the Bonobo widget will get destroyed
- normally? */
-
- if (composer->address_dialog != NULL)
- gtk_widget_destroy (composer->address_dialog);
- if (composer->hdrs != NULL)
- gtk_widget_destroy (composer->hdrs);
-
- if (composer->extra_hdr_names) {
- int i;
-
- for (i = 0; i < composer->extra_hdr_names->len; i++) {
- g_free (composer->extra_hdr_names->pdata[i]);
- g_free (composer->extra_hdr_values->pdata[i]);
- }
- g_ptr_array_free (composer->extra_hdr_names, TRUE);
- g_ptr_array_free (composer->extra_hdr_values, TRUE);
- }
-
- e_msg_composer_clear_inlined_table (composer);
- g_hash_table_destroy (composer->inline_images);
-
- CORBA_exception_init (&ev);
-
- if (composer->persist_stream_interface != CORBA_OBJECT_NIL) {
- Bonobo_Unknown_unref (composer->persist_stream_interface, &ev);
- CORBA_Object_release (composer->persist_stream_interface, &ev);
- }
-
- if (composer->persist_file_interface != CORBA_OBJECT_NIL) {
- Bonobo_Unknown_unref (composer->persist_file_interface, &ev);
- CORBA_Object_release (composer->persist_file_interface, &ev);
- }
-
- if (composer->editor_engine != CORBA_OBJECT_NIL) {
- Bonobo_Unknown_unref (composer->editor_engine, &ev);
- CORBA_Object_release (composer->editor_engine, &ev);
- }
-
- CORBA_exception_free (&ev);
-
- if (composer->editor_listener)
- bonobo_object_unref (composer->editor_listener);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-/* GtkWidget methods. */
-
-static int
-delete_event (GtkWidget *widget,
- GdkEventAny *event)
-{
- do_exit (E_MSG_COMPOSER (widget));
-
- return TRUE;
-}
-
-static void
-drag_data_received (EMsgComposer *composer,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection,
- guint info,
- guint time)
-{
- gchar *temp, *filename;
-
- filename = g_strdup (selection->data);
- temp = strchr (filename, '\n');
- if (temp) {
- if (*(temp - 1) == '\r')
- *(temp - 1) = '\0';
- *temp = '\0';
- }
-
- /* Chop the file: part off */
- if (strncasecmp (filename, "file:", 5) == 0) {
- temp = g_strdup (filename + 5);
- g_free (filename);
- filename = temp;
- }
-
- e_msg_composer_attachment_bar_attach
- (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
- filename);
-
- g_free (filename);
-}
-
-
-static void
-class_init (EMsgComposerClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
-
- object_class->destroy = destroy;
-
- widget_class->delete_event = delete_event;
-
- parent_class = gtk_type_class (bonobo_window_get_type ());
-
- signals[SEND] =
- gtk_signal_new ("send",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerClass, send),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- signals[POSTPONE] =
- gtk_signal_new ("postpone",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerClass, postpone),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-init (EMsgComposer *composer)
-{
- composer->uic = NULL;
-
- composer->hdrs = NULL;
- composer->extra_hdr_names = g_ptr_array_new ();
- composer->extra_hdr_values = g_ptr_array_new ();
-
- composer->editor = NULL;
-
- composer->address_dialog = NULL;
-
- composer->attachment_bar = NULL;
- composer->attachment_scroll_frame = NULL;
-
- composer->persist_file_interface = CORBA_OBJECT_NIL;
- composer->persist_stream_interface = CORBA_OBJECT_NIL;
-
- composer->editor_engine = CORBA_OBJECT_NIL;
- composer->inline_images = g_hash_table_new (g_str_hash, g_str_equal);
-
- composer->attachment_bar_visible = FALSE;
- composer->send_html = FALSE;
- composer->pgp_sign = FALSE;
- composer->pgp_encrypt = FALSE;
-
- composer->has_changed = FALSE;
-}
-
-
-GtkType
-e_msg_composer_get_type (void)
-{
- static GtkType type = 0;
-
- if (type == 0) {
- static const GtkTypeInfo info = {
- "EMsgComposer",
- sizeof (EMsgComposer),
- sizeof (EMsgComposerClass),
- (GtkClassInitFunc) class_init,
- (GtkObjectInitFunc) init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (bonobo_window_get_type (), &info);
- }
-
- return type;
-}
-
-/**
- * e_msg_composer_construct:
- * @composer: A message composer widget
- *
- * Construct @composer.
- **/
-void
-e_msg_composer_construct (EMsgComposer *composer)
-{
- GtkWidget *vbox;
- BonoboObject *editor_server;
-
- static GtkTargetEntry drop_types[] = {
- {"text/uri-list", 0, 1}
- };
-
- g_return_if_fail (gtk_main_level () > 0);
-
- gtk_window_set_default_size (GTK_WINDOW (composer),
- DEFAULT_WIDTH, DEFAULT_HEIGHT);
-
- bonobo_window_construct (BONOBO_WINDOW (composer), "e-msg-composer",
- _("Compose a message"));
-
- /* DND support */
- gtk_drag_dest_set (GTK_WIDGET (composer), GTK_DEST_DEFAULT_ALL,
- drop_types, 1, GDK_ACTION_COPY);
- gtk_signal_connect (GTK_OBJECT (composer), "drag_data_received",
- GTK_SIGNAL_FUNC (drag_data_received), NULL);
-
- setup_ui (composer);
-
- vbox = gtk_vbox_new (FALSE, 0);
-
- composer->hdrs = e_msg_composer_hdrs_new ();
- gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (composer->hdrs), "subject_changed",
- GTK_SIGNAL_FUNC (subject_changed_cb), composer);
- gtk_signal_connect (GTK_OBJECT (composer->hdrs), "hdrs_changed",
- GTK_SIGNAL_FUNC (hdrs_changed_cb), composer);
- gtk_widget_show (composer->hdrs);
-
- /* Editor component. */
- composer->editor = bonobo_widget_new_control (
- GNOME_GTKHTML_EDITOR_CONTROL_ID,
- bonobo_ui_component_get_container (composer->uic));
-
- if (!composer->editor)
- return;
-
- editor_server = BONOBO_OBJECT (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)));
-
- composer->persist_file_interface
- = bonobo_object_query_interface (editor_server, "IDL:Bonobo/PersistFile:1.0");
- composer->persist_stream_interface
- = bonobo_object_query_interface (editor_server, "IDL:Bonobo/PersistStream:1.0");
-
- gtk_widget_show (composer->editor);
- gtk_box_pack_start (GTK_BOX (vbox), composer->editor, TRUE, TRUE, 0);
- gtk_widget_show (composer->editor);
-
- /* Attachment editor, wrapped into an EScrollFrame. We don't
- show it for now. */
-
- composer->attachment_scroll_frame = e_scroll_frame_new (NULL, NULL);
- e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (composer->attachment_scroll_frame),
- GTK_SHADOW_IN);
- e_scroll_frame_set_policy (E_SCROLL_FRAME (composer->attachment_scroll_frame),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- composer->attachment_bar = e_msg_composer_attachment_bar_new (NULL);
- GTK_WIDGET_SET_FLAGS (composer->attachment_bar, GTK_CAN_FOCUS);
- gtk_container_add (GTK_CONTAINER (composer->attachment_scroll_frame),
- composer->attachment_bar);
- gtk_box_pack_start (GTK_BOX (vbox),
- composer->attachment_scroll_frame,
- FALSE, FALSE, GNOME_PAD_SMALL);
-
- gtk_signal_connect (GTK_OBJECT (composer->attachment_bar), "changed",
- GTK_SIGNAL_FUNC (attachment_bar_changed_cb), composer);
-
- bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox);
- gtk_widget_show (vbox);
-
- e_msg_composer_show_attachments (composer, FALSE);
-
- /* Set focus on the `To:' field.
-
- gtk_widget_grab_focus (e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs)));
- GTK_WIDGET_SET_FLAGS (composer->editor, GTK_CAN_FOCUS);
- gtk_window_set_focus (GTK_WINDOW (composer), composer->editor); */
- gtk_widget_grab_focus (composer->editor);
-}
-
-static EMsgComposer *
-create_composer (void)
-{
- EMsgComposer *new;
-
- new = gtk_type_new (E_TYPE_MSG_COMPOSER);
- e_msg_composer_construct (new);
- if (!new->editor) {
- e_notice (GTK_WINDOW (new), GNOME_MESSAGE_BOX_ERROR,
- _("Could not create composer window."));
- gtk_object_unref (GTK_OBJECT (new));
- return NULL;
- }
- prepare_engine (new);
-
- return new;
-}
-
-/**
- * e_msg_composer_new:
- *
- * Create a new message composer widget.
- *
- * Return value: A pointer to the newly created widget
- **/
-EMsgComposer *
-e_msg_composer_new (void)
-{
- EMsgComposer *new;
-
- new = create_composer ();
- if (new) {
- /* Load the signature, if any. */
- set_editor_text (new, NULL, "");
- }
-
- return new;
-}
-
-/**
- * e_msg_composer_new_with_sig_file:
- *
- * Create a new message composer widget. Sets the signature file.
- *
- * Return value: A pointer to the newly created widget
- **/
-EMsgComposer *
-e_msg_composer_new_with_sig_file (const char *sig_file, gboolean send_html)
-{
- EMsgComposer *new;
-
- new = create_composer ();
- if (new) {
- e_msg_composer_set_send_html (new, send_html);
- /* Load the signature, if any. */
- set_editor_text (new, sig_file, "");
-
- e_msg_composer_set_sig_file (new, sig_file);
- }
-
- return new;
-}
-
-static void
-handle_multipart_alternative (EMsgComposer *composer, CamelMultipart *multipart)
-{
- /* Find the text/html part and set the composer body to it's contents */
- int i, nparts;
-
- nparts = camel_multipart_get_number (multipart);
-
- for (i = 0; i < nparts; i++) {
- CamelContentType *content_type;
- CamelMimePart *mime_part;
-
- mime_part = camel_multipart_get_part (multipart, i);
- content_type = camel_mime_part_get_content_type (mime_part);
-
- if (header_content_type_is (content_type, "text", "html")) {
- CamelDataWrapper *contents;
- char *text, *final_text;
- gboolean is_html;
-
- contents = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
- text = mail_get_message_body (contents, FALSE, &is_html);
- if (text) {
- if (is_html)
- final_text = g_strdup (text);
- else
- final_text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES);
- g_free (text);
-
- e_msg_composer_set_body_text (composer, final_text);
- }
-
- return;
- }
- }
-}
-
-static void
-handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth)
-{
- int i, nparts;
-
- nparts = camel_multipart_get_number (multipart);
-
- for (i = 0; i < nparts; i++) {
- CamelContentType *content_type;
- CamelMimePart *mime_part;
-
- mime_part = camel_multipart_get_part (multipart, i);
- content_type = camel_mime_part_get_content_type (mime_part);
-
- if (header_content_type_is (content_type, "multipart", "alternative")) {
- /* this structure contains the body */
- CamelDataWrapper *wrapper;
- CamelMultipart *mpart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
- mpart = CAMEL_MULTIPART (wrapper);
-
- handle_multipart_alternative (composer, mpart);
- } else if (header_content_type_is (content_type, "multipart", "*")) {
- /* another layer of multipartness... */
- CamelDataWrapper *wrapper;
- CamelMultipart *mpart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
- mpart = CAMEL_MULTIPART (wrapper);
-
- handle_multipart (composer, mpart, depth + 1);
- } else if (depth == 0 && i == 0) {
- /* Since the first part is not multipart/alternative, then this must be the body */
- CamelDataWrapper *contents;
- char *text, *final_text;
- gboolean is_html;
-
- contents = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part));
- text = mail_get_message_body (contents, FALSE, &is_html);
- if (text) {
- if (is_html)
- final_text = g_strdup (text);
- else
- final_text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES);
- g_free (text);
-
- e_msg_composer_set_body_text (composer, final_text);
- }
- } else {
- /* this is a leaf of the tree, so attach it */
- e_msg_composer_attach (composer, mime_part);
- }
- }
-}
-
-/**
- * e_msg_composer_new_with_message:
- *
- * Create a new message composer widget.
- *
- * Return value: A pointer to the newly created widget
- **/
-EMsgComposer *
-e_msg_composer_new_with_message (CamelMimeMessage *msg)
-{
- const CamelInternetAddress *to, *cc, *bcc;
- GList *To = NULL, *Cc = NULL, *Bcc = NULL;
- CamelContentType *content_type;
- const gchar *subject;
- EMsgComposer *new;
- guint len, i;
-
- g_return_val_if_fail (gtk_main_level () > 0, NULL);
-
- new = create_composer ();
- if (!new)
- return NULL;
-
- subject = camel_mime_message_get_subject (msg);
-
- to = camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_TO);
- cc = camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_CC);
- bcc = camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_BCC);
-
- len = CAMEL_ADDRESS (to)->addresses->len;
- for (i = 0; i < len; i++) {
- const char *name, *addr;
-
- if (camel_internet_address_get (to, i, &name, &addr)) {
- CamelInternetAddress *cia;
-
- cia = camel_internet_address_new ();
- camel_internet_address_add (cia, name, addr);
- To = g_list_append (To, camel_address_encode (CAMEL_ADDRESS (cia)));
- camel_object_unref (CAMEL_OBJECT (cia));
- }
- }
-
- len = CAMEL_ADDRESS (cc)->addresses->len;
- for (i = 0; i < len; i++) {
- const char *name, *addr;
-
- if (camel_internet_address_get (cc, i, &name, &addr)) {
- CamelInternetAddress *cia;
-
- cia = camel_internet_address_new ();
- camel_internet_address_add (cia, name, addr);
- Cc = g_list_append (Cc, camel_address_encode (CAMEL_ADDRESS (cia)));
- camel_object_unref (CAMEL_OBJECT (cia));
- }
- }
-
- len = CAMEL_ADDRESS (bcc)->addresses->len;
- for (i = 0; i < len; i++) {
- const char *name, *addr;
-
- if (camel_internet_address_get (bcc, i, &name, &addr)) {
- CamelInternetAddress *cia;
-
- cia = camel_internet_address_new ();
- camel_internet_address_add (cia, name, addr);
- Bcc = g_list_append (Bcc, camel_address_encode (CAMEL_ADDRESS (cia)));
- camel_object_unref (CAMEL_OBJECT (cia));
- }
- }
-
- e_msg_composer_set_headers (new, NULL, To, Cc, Bcc, subject);
-
- free_recipients (To);
- free_recipients (Cc);
- free_recipients (Bcc);
-
- content_type = camel_mime_part_get_content_type (CAMEL_MIME_PART (msg));
- if (header_content_type_is (content_type, "multipart", "alternative")) {
- /* multipart/alternative contains the text/plain and text/html versions of the message body */
- CamelDataWrapper *wrapper;
- CamelMultipart *multipart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (CAMEL_MIME_PART (msg)));
- multipart = CAMEL_MULTIPART (wrapper);
-
- handle_multipart_alternative (new, multipart);
- } else if (header_content_type_is (content_type, "multipart", "*")) {
- /* there must be attachments... */
- CamelDataWrapper *wrapper;
- CamelMultipart *multipart;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (CAMEL_MIME_PART (msg)));
- multipart = CAMEL_MULTIPART (wrapper);
-
- handle_multipart (new, multipart, 0);
- } else {
- /* We either have a text/plain or a text/html part */
- CamelDataWrapper *contents;
- char *text, *final_text;
- gboolean is_html;
-
- contents = camel_medium_get_content_object (CAMEL_MEDIUM (msg));
- text = mail_get_message_body (contents, FALSE, &is_html);
- if (text) {
- if (is_html)
- final_text = g_strdup (text);
- else
- final_text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES);
- g_free (text);
-
- e_msg_composer_set_body_text (new, final_text);
- }
- }
-
- return new;
-}
-
-#if 0
-static GList *
-add_recipients (GList *list, const char *recips, gboolean decode)
-{
- int len;
- char *addr;
-
- while (*recips) {
- len = strcspn (recips, ",");
- if (len) {
- addr = g_strndup (recips, len);
- if (decode)
- camel_url_decode (addr);
- list = g_list_append (list, addr);
- }
- recips += len;
- if (*recips == ',')
- recips++;
- }
-
- return list;
-}
-#endif
-
-static GList *
-add_recipients (GList *list, const char *recips, gboolean decode)
-{
- CamelInternetAddress *cia;
- const char *name, *addr;
- int num, i;
-
- cia = camel_internet_address_new ();
- if (decode)
- num = camel_address_decode (CAMEL_ADDRESS (cia), recips);
- else
- num = camel_address_unformat (CAMEL_ADDRESS (cia), recips);
-
- for (i = 0; i < num; i++) {
- if (camel_internet_address_get (cia, i, &name, &addr)) {
- char *str;
-
- str = camel_internet_address_format_address (name, addr);
- list = g_list_append (list, str);
- }
- }
-
- return list;
-}
-
-static void
-free_recipients (GList *list)
-{
- GList *l;
-
- for (l = list; l; l = l->next)
- g_free (l->data);
- g_list_free (list);
-}
-
-/**
- * e_msg_composer_new_from_url:
- * @url: a mailto URL
- *
- * Create a new message composer widget, and fill in fields as
- * defined by the provided URL.
- **/
-EMsgComposer *
-e_msg_composer_new_from_url (const char *url)
-{
- EMsgComposer *composer;
- EMsgComposerHdrs *hdrs;
- GList *to = NULL, *cc = NULL, *bcc = NULL;
- char *subject = NULL, *body = NULL;
- const char *p, *header;
- int len, clen;
- char *content;
-
- g_return_val_if_fail (g_strncasecmp (url, "mailto:", 7) == 0, NULL);
-
- composer = e_msg_composer_new ();
- if (!composer)
- return NULL;
-
- /* Parse recipients (everything after ':' until '?' or eos. */
- p = url + 7;
- len = strcspn (p, "?,");
- if (len) {
- content = g_strndup (p, len);
- to = add_recipients (to, content, TRUE);
- g_free (content);
- }
-
- p += len;
- if (*p == '?') {
- p++;
-
- while (*p) {
- len = strcspn (p, "=&");
-
- /* If it's malformed, give up. */
- if (p[len] != '=')
- break;
-
- header = p;
- p += len + 1;
-
- clen = strcspn (p, "&");
- content = g_strndup (p, clen);
- camel_url_decode (content);
-
- if (!g_strncasecmp (header, "to", len))
- to = add_recipients (to, content, FALSE);
- else if (!g_strncasecmp (header, "cc", len))
- cc = add_recipients (cc, content, FALSE);
- else if (!g_strncasecmp (header, "bcc", len))
- bcc = add_recipients (bcc, content, FALSE);
- else if (!g_strncasecmp (header, "subject", len))
- subject = g_strdup (content);
- else if (!g_strncasecmp (header, "body", len))
- body = g_strdup (content);
-
- g_free (content);
- p += clen;
- if (*p == '&') {
- p++;
- if (!strcmp (p, "amp;"))
- p += 4;
- }
- }
- }
-
- hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
- e_msg_composer_hdrs_set_to (hdrs, to);
- free_recipients (to);
- e_msg_composer_hdrs_set_cc (hdrs, cc);
- free_recipients (cc);
- e_msg_composer_hdrs_set_bcc (hdrs, bcc);
- free_recipients (bcc);
- if (subject) {
- e_msg_composer_hdrs_set_subject (hdrs, subject);
- g_free (subject);
- }
-
- if (body) {
- char *htmlbody = e_text_to_html (body, E_TEXT_TO_HTML_PRE);
- set_editor_text (composer, NULL, htmlbody);
- g_free (htmlbody);
- }
-
- return composer;
-}
-
-/**
- * e_msg_composer_show_attachments:
- * @composer: A message composer widget
- * @show: A boolean specifying whether the attachment bar should be shown or
- * not
- *
- * If @show is %FALSE, hide the attachment bar. Otherwise, show it.
- **/
-void
-e_msg_composer_show_attachments (EMsgComposer *composer,
- gboolean show)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- show_attachments (composer, show);
-}
-
-/**
- * e_msg_composer_set_headers:
- * @composer: a composer object
- * @from: the name of the account the user will send from,
- * or %NULL for the default account
- * @to: the values for the "To" header
- * @cc: the values for the "Cc" header
- * @bcc: the values for the "Bcc" header
- * @subject: the value for the "Subject" header
- *
- * Sets the headers in the composer to the given values.
- **/
-void
-e_msg_composer_set_headers (EMsgComposer *composer,
- const char *from,
- const GList *to,
- const GList *cc,
- const GList *bcc,
- const char *subject)
-{
- EMsgComposerHdrs *hdrs;
-
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
-
- e_msg_composer_hdrs_set_from_account (hdrs, from);
- e_msg_composer_hdrs_set_to (hdrs, to);
- e_msg_composer_hdrs_set_cc (hdrs, cc);
- e_msg_composer_hdrs_set_bcc (hdrs, bcc);
- e_msg_composer_hdrs_set_subject (hdrs, subject);
-}
-
-
-/**
- * e_msg_composer_set_body_text:
- * @composer: a composer object
- * @text: the HTML text to initialize the editor with
- *
- * Loads the given HTML text into the editor.
- **/
-void
-e_msg_composer_set_body_text (EMsgComposer *composer, const char *text)
-{
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- set_editor_text (composer, composer->sig_file, text);
-}
-
-
-/**
- * e_msg_composer_add_header:
- * @composer: a composer object
- * @name: the header name
- * @value: the header value
- *
- * Adds a header with @name and @value to the message. This header
- * may not be displayed by the composer, but will be included in
- * the message it outputs.
- **/
-void
-e_msg_composer_add_header (EMsgComposer *composer, const char *name,
- const char *value)
-{
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- g_return_if_fail (name != NULL);
- g_return_if_fail (value != NULL);
-
- g_ptr_array_add (composer->extra_hdr_names, g_strdup (name));
- g_ptr_array_add (composer->extra_hdr_values, g_strdup (value));
-}
-
-
-/**
- * e_msg_composer_attach:
- * @composer: a composer object
- * @attachment: the CamelMimePart to attach
- *
- * Attaches @attachment to the message being composed in the composer.
- **/
-void
-e_msg_composer_attach (EMsgComposer *composer, CamelMimePart *attachment)
-{
- EMsgComposerAttachmentBar *bar;
-
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- g_return_if_fail (CAMEL_IS_MIME_PART (attachment));
-
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar);
- e_msg_composer_attachment_bar_attach_mime_part (bar, attachment);
-}
-
-
-/**
- * e_msg_composer_get_message:
- * @composer: A message composer widget
- *
- * Retrieve the message edited by the user as a CamelMimeMessage. The
- * CamelMimeMessage object is created on the fly; subsequent calls to this
- * function will always create new objects from scratch.
- *
- * Return value: A pointer to the new CamelMimeMessage object
- **/
-CamelMimeMessage *
-e_msg_composer_get_message (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
- return build_message (composer);
-}
-
-
-
-/**
- * e_msg_composer_set_sig:
- * @composer: A message composer widget
- * @path: Signature file
- *
- * Set a signature
- **/
-void
-e_msg_composer_set_sig_file (EMsgComposer *composer, const char *sig_file)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- composer->sig_file = g_strdup (sig_file);
-}
-
-/**
- * e_msg_composer_get_sig_file:
- * @composer: A message composer widget
- *
- * Get the signature file
- *
- * Return value: The signature file.
- **/
-const char *
-e_msg_composer_get_sig_file (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
- return composer->sig_file;
-}
-
-
-/**
- * e_msg_composer_set_send_html:
- * @composer: A message composer widget
- * @send_html: Whether the composer should have the "Send HTML" flag set
- *
- * Set the status of the "Send HTML" toggle item. The user can override it.
- **/
-void
-e_msg_composer_set_send_html (EMsgComposer *composer,
- gboolean send_html)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- if (composer->send_html && send_html)
- return;
- if (! composer->send_html && ! send_html)
- return;
-
- composer->send_html = send_html;
-
- bonobo_ui_component_set_prop (composer->uic, "/commands/FormatHtml",
- "state", composer->send_html ? "1" : "0", NULL);
-}
-
-/**
- * e_msg_composer_get_send_html:
- * @composer: A message composer widget
- *
- * Get the status of the "Send HTML mail" flag.
- *
- * Return value: The status of the "Send HTML mail" flag.
- **/
-gboolean
-e_msg_composer_get_send_html (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, FALSE);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
-
- return composer->send_html;
-}
-
-
-/**
- * e_msg_composer_get_preferred_account:
- * @composer: composer
- *
- * Returns the user-specified account (from field).
- */
-const MailConfigAccount *
-e_msg_composer_get_preferred_account (EMsgComposer *composer)
-{
- EMsgComposerHdrs *hdrs;
-
- g_return_val_if_fail (composer != NULL, NULL);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), NULL);
-
- hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
-
- return hdrs->account;
-}
-
-
-/**
- * e_msg_composer_set_pgp_sign:
- * @composer: A message composer widget
- * @send_html: Whether the composer should have the "PGP Sign" flag set
- *
- * Set the status of the "PGP Sign" toggle item. The user can override it.
- **/
-void
-e_msg_composer_set_pgp_sign (EMsgComposer *composer, gboolean pgp_sign)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- if (composer->pgp_sign && pgp_sign)
- return;
- if (!composer->pgp_sign && !pgp_sign)
- return;
-
- composer->pgp_sign = pgp_sign;
-
- bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityPGPSign",
- "state", composer->pgp_sign ? "1" : "0", NULL);
-}
-
-
-/**
- * e_msg_composer_get_pgp_sign:
- * @composer: A message composer widget
- *
- * Get the status of the "PGP Sign" flag.
- *
- * Return value: The status of the "PGP Sign" flag.
- **/
-gboolean
-e_msg_composer_get_pgp_sign (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, FALSE);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
-
- return composer->pgp_sign;
-}
-
-
-/**
- * e_msg_composer_set_pgp_encrypt:
- * @composer: A message composer widget
- * @send_html: Whether the composer should have the "PGP Encrypt" flag set
- *
- * Set the status of the "PGP Encrypt" toggle item. The user can override it.
- **/
-void
-e_msg_composer_set_pgp_encrypt (EMsgComposer *composer, gboolean pgp_encrypt)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- if (composer->pgp_encrypt && pgp_encrypt)
- return;
- if (!composer->pgp_encrypt && !pgp_encrypt)
- return;
-
- composer->pgp_encrypt = pgp_encrypt;
-
- bonobo_ui_component_set_prop (composer->uic, "/commands/SecurityPGPEncrypt",
- "state", composer->pgp_encrypt ? "1" : "0", NULL);
-}
-
-
-/**
- * e_msg_composer_get_pgp_encrypt:
- * @composer: A message composer widget
- *
- * Get the status of the "PGP Encrypt" flag.
- *
- * Return value: The status of the "PGP Encrypt" flag.
- **/
-gboolean
-e_msg_composer_get_pgp_encrypt (EMsgComposer *composer)
-{
- g_return_val_if_fail (composer != NULL, FALSE);
- g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
-
- return composer->pgp_encrypt;
-}
-
-
-/**
- * e_msg_composer_guess_mime_type:
- * @file_name: filename
- *
- * Returns the guessed mime type of the file given by #file_name.
- **/
-gchar *
-e_msg_composer_guess_mime_type (const gchar *file_name)
-{
- GnomeVFSFileInfo info;
- GnomeVFSResult result;
-
- result = gnome_vfs_get_file_info (file_name, &info,
- GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
- if (result == GNOME_VFS_OK) {
- gchar *type;
-
- type = g_strdup (gnome_vfs_file_info_get_mime_type (&info));
- gnome_vfs_file_info_unref (&info);
- return type;
- } else
- return NULL;
-}
-
-/**
- * e_msg_composer_set_changed:
- * @composer: An EMsgComposer object.
- *
- * Mark the composer as changed, so before the composer gets destroyed
- * the user will be prompted about unsaved changes.
- **/
-void
-e_msg_composer_set_changed (EMsgComposer *composer)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- composer->has_changed = TRUE;
-}
-
-/**
- * e_msg_composer_unset_changed:
- * @composer: An EMsgComposer object.
- *
- * Mark the composer as unchanged, so no prompt about unsaved changes
- * will appear before destroying the composer.
- **/
-void
-e_msg_composer_unset_changed (EMsgComposer *composer)
-{
- g_return_if_fail (composer != NULL);
- g_return_if_fail (E_IS_MSG_COMPOSER (composer));
-
- composer->has_changed = FALSE;
-}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
deleted file mode 100644
index 485ca6f9f1..0000000000
--- a/composer/e-msg-composer.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-msg-composer.h
- *
- * Copyright (C) 1999 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef ___E_MSG_COMPOSER_H__
-#define ___E_MSG_COMPOSER_H__
-
-typedef struct _EMsgComposer EMsgComposer;
-typedef struct _EMsgComposerClass EMsgComposerClass;
-
-#include <gnome.h>
-#include <bonobo.h>
-
-#include "e-msg-composer-attachment-bar.h"
-#include "e-msg-composer-hdrs.h"
-#include "Editor.h"
-
-#include <mail/mail-config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-
-#define E_TYPE_MSG_COMPOSER (e_msg_composer_get_type ())
-#define E_MSG_COMPOSER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER, EMsgComposer))
-#define E_MSG_COMPOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER, EMsgComposerClass))
-#define E_IS_MSG_COMPOSER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER))
-#define E_IS_MSG_COMPOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER))
-
-
-
-struct _EMsgComposer {
- BonoboWindow parent;
-
- BonoboUIComponent *uic;
-
- GtkWidget *hdrs;
- GPtrArray *extra_hdr_names, *extra_hdr_values;
-
- GtkWidget *editor;
-
- GtkWidget *attachment_bar;
- GtkWidget *attachment_scroll_frame;
-
- GtkWidget *address_dialog;
-
- Bonobo_PersistFile persist_file_interface;
- Bonobo_PersistStream persist_stream_interface;
- GNOME_GtkHTML_Editor_Engine editor_engine;
- BonoboObject *editor_listener;
- GHashTable *inline_images;
-
- char *sig_file;
-
- gboolean attachment_bar_visible : 1;
- gboolean send_html : 1;
- gboolean pgp_sign : 1;
- gboolean pgp_encrypt : 1;
-
- gboolean has_changed : 1;
-};
-
-struct _EMsgComposerClass {
- BonoboWindowClass parent_class;
-
- void (* send) (EMsgComposer *composer);
- void (* postpone) (EMsgComposer *composer);
-};
-
-
-GtkType e_msg_composer_get_type (void);
-void e_msg_composer_construct (EMsgComposer *composer);
-EMsgComposer *e_msg_composer_new (void);
-EMsgComposer *e_msg_composer_new_with_sig_file (const char *sig_file,
- gboolean send_html);
-EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg);
-EMsgComposer *e_msg_composer_new_from_url (const char *url);
-void e_msg_composer_show_attachments (EMsgComposer *composer,
- gboolean show);
-void e_msg_composer_set_headers (EMsgComposer *composer,
- const char *from,
- const GList *to,
- const GList *cc,
- const GList *bcc,
- const char *subject);
-void e_msg_composer_set_body_text (EMsgComposer *composer,
- const char *text);
-void e_msg_composer_mark_text_orig (EMsgComposer *composer);
-void e_msg_composer_add_header (EMsgComposer *composer,
- const char *name,
- const char *value);
-void e_msg_composer_attach (EMsgComposer *composer,
- CamelMimePart *attachment);
-CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer);
-void e_msg_composer_set_sig_file (EMsgComposer *composer,
- const char *sig_file);
-const char *e_msg_composer_get_sig_file (EMsgComposer *composer);
-void e_msg_composer_set_send_html (EMsgComposer *composer,
- gboolean send_html);
-gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
-void e_msg_composer_set_pgp_sign (EMsgComposer *composer,
- gboolean pgp_sign);
-
-const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
-
-gboolean e_msg_composer_get_pgp_sign (EMsgComposer *composer);
-void e_msg_composer_set_pgp_encrypt (EMsgComposer *composer,
- gboolean pgp_encrypt);
-gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *composer);
-void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
-gchar * e_msg_composer_guess_mime_type (const gchar *file_name);
-
-void e_msg_composer_set_changed (EMsgComposer *composer);
-void e_msg_composer_unset_changed (EMsgComposer *composer);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* ___E_MSG_COMPOSER_H__ */
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
deleted file mode 100644
index 2ea7949462..0000000000
--- a/composer/evolution-composer.c
+++ /dev/null
@@ -1,373 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* evolution-composer.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Dan Winship <danw@helixcode.com>
- */
-
-#include <config.h>
-
-#include <bonobo.h>
-#include <camel/camel.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-gui-utils.h>
-#include <bonobo/bonobo-item-handler.h>
-#include "evolution-composer.h"
-#include "mail/mail-config.h"
-
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-static BonoboObjectClass *parent_class = NULL;
-
-static void (*send_cb) (EMsgComposer *, gpointer);
-static void (*postpone_cb) (EMsgComposer *, gpointer);
-
-/* CORBA interface implementation. */
-
-static POA_GNOME_Evolution_Composer__vepv Composer_vepv;
-
-static GList *
-corba_recipientlist_to_glist (const GNOME_Evolution_Composer_RecipientList *cl)
-{
- GNOME_Evolution_Composer_Recipient *recip;
- GList *gl = NULL;
- char *str;
- int i;
-
- for (i = cl->_length - 1; i >= 0; i--) {
- recip = &(cl->_buffer[i]);
-
- /* Let's copy this code into yet another place! */
- if (*recip->name) {
- str = camel_internet_address_format_address (recip->name, recip->address);
- } else
- str = g_strdup (recip->address);
-
- gl = g_list_prepend (gl, str);
- }
-
- return gl;
-}
-
-static void
-free_recipient_glist (GList *gl)
-{
- GList *tmp;
-
- while (gl) {
- tmp = gl->next;
- g_free (gl->data);
- g_list_free_1 (gl);
- gl = tmp;
- }
-}
-
-static void
-impl_Composer_set_headers (PortableServer_Servant servant,
- const GNOME_Evolution_Composer_RecipientList *to,
- const GNOME_Evolution_Composer_RecipientList *cc,
- const GNOME_Evolution_Composer_RecipientList *bcc,
- const CORBA_char *subject,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
- GList *gto, *gcc, *gbcc;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- gto = corba_recipientlist_to_glist (to);
- gcc = corba_recipientlist_to_glist (cc);
- gbcc = corba_recipientlist_to_glist (bcc);
-
- e_msg_composer_set_headers (composer->composer, NULL, gto, gcc, gbcc,
- subject);
-
- free_recipient_glist (gto);
- free_recipient_glist (gcc);
- free_recipient_glist (gbcc);
-}
-
-static void
-impl_Composer_set_body_text (PortableServer_Servant servant,
- const CORBA_char *text,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- e_msg_composer_set_body_text (composer->composer, text);
-}
-
-static void
-impl_Composer_attach_MIME (PortableServer_Servant servant,
- const CORBA_char *data,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
- CamelMimePart *attachment;
- CamelStream *mem_stream;
- int status;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- mem_stream = camel_stream_mem_new_with_buffer (data, strlen (data));
- attachment = camel_mime_part_new ();
- status = camel_data_wrapper_construct_from_stream (
- CAMEL_DATA_WRAPPER (attachment), mem_stream);
- camel_object_unref (CAMEL_OBJECT (mem_stream));
-
- if (status == -1) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Composer_CouldNotParse,
- NULL);
- return;
- }
-
- e_msg_composer_attach (composer->composer, attachment);
- camel_object_unref (CAMEL_OBJECT (attachment));
-}
-
-static void
-impl_Composer_attach_data (PortableServer_Servant servant,
- const CORBA_char *content_type,
- const CORBA_char *filename,
- const CORBA_char *description,
- const CORBA_boolean show_inline,
- const CORBA_char *data,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
- CamelMimePart *attachment;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- attachment = camel_mime_part_new ();
- camel_mime_part_set_content (attachment, data, strlen (data),
- content_type);
-
- if (*filename)
- camel_mime_part_set_filename (attachment, filename);
- if (*description)
- camel_mime_part_set_description (attachment, description);
- camel_mime_part_set_disposition (attachment, show_inline ?
- "inline" : "attachment");
-
- e_msg_composer_attach (composer->composer, attachment);
- camel_object_unref (CAMEL_OBJECT (attachment));
-}
-
-static void
-impl_Composer_show (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- gtk_widget_show (GTK_WIDGET (composer->composer));
-}
-
-POA_GNOME_Evolution_Composer__epv *
-evolution_composer_get_epv (void)
-{
- POA_GNOME_Evolution_Composer__epv *epv;
-
- epv = g_new0 (POA_GNOME_Evolution_Composer__epv, 1);
- epv->setHeaders = impl_Composer_set_headers;
- epv->setBodyText = impl_Composer_set_body_text;
- epv->attachMIME = impl_Composer_attach_MIME;
- epv->attachData = impl_Composer_attach_data;
- epv->show = impl_Composer_show;
-
- return epv;
-}
-
-
-/* GtkObject stuff */
-
-static void
-destroy (GtkObject *object)
-{
- EvolutionComposer *composer = EVOLUTION_COMPOSER (object);
-
- if (composer->composer)
- gtk_object_unref (GTK_OBJECT (composer->composer));
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-class_init (EvolutionComposerClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- object_class->destroy = destroy;
-
- parent_class = gtk_type_class (bonobo_object_get_type ());
-
- Composer_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- Composer_vepv.GNOME_Evolution_Composer_epv = evolution_composer_get_epv ();
-}
-
-static void
-init (EvolutionComposer *composer)
-{
- const MailConfigAccount *account;
- gboolean send_html;
- gchar *sig_file = NULL;
-
- account = mail_config_get_default_account ();
- send_html = mail_config_get_send_html ();
-
- if (account->id)
- sig_file = account->id->signature;
-
- if (sig_file)
- composer->composer = e_msg_composer_new_with_sig_file (sig_file, send_html);
- else
- composer->composer = e_msg_composer_new ();
-
- gtk_signal_connect (GTK_OBJECT (composer->composer), "send",
- GTK_SIGNAL_FUNC (send_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer->composer), "postpone",
- GTK_SIGNAL_FUNC (postpone_cb), NULL);
-}
-
-#if 0
-static Bonobo_ItemContainer_ObjectNames *
-enum_objects (BonoboItemHandler *handler, gpointer data, CORBA_Environment *ev)
-{
-}
-#endif
-
-static Bonobo_Unknown
-get_object (BonoboItemHandler *h, const char *item_name, gboolean only_if_exists,
- gpointer data, CORBA_Environment *ev)
-{
- EvolutionComposer *composer = data;
- GSList *options, *l;
-
- options = bonobo_item_option_parse (item_name);
- for (l = options; l; l = l->next){
- BonoboItemOption *option = l->data;
-
- if (strcmp (option->key, "visible") == 0){
- gboolean show = 1;
-
- if (option->value)
- show = atoi (option->value);
-
- if (show)
- gtk_widget_show (GTK_WIDGET (composer->composer));
- else
- gtk_widget_hide (GTK_WIDGET (composer->composer));
- }
- }
- return bonobo_object_dup_ref (
- BONOBO_OBJECT (composer)->corba_objref, ev);
-}
-
-void
-evolution_composer_construct (EvolutionComposer *composer,
- GNOME_Evolution_Composer corba_object)
-{
- BonoboObject *item_handler;
-
- g_return_if_fail (composer != NULL);
- g_return_if_fail (EVOLUTION_IS_COMPOSER (composer));
- g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
-
- bonobo_object_construct (BONOBO_OBJECT (composer), corba_object);
-
- item_handler = BONOBO_OBJECT (
- bonobo_item_handler_new (NULL, get_object, composer));
- bonobo_object_add_interface (BONOBO_OBJECT (composer), BONOBO_OBJECT (item_handler));
-}
-
-EvolutionComposer *
-evolution_composer_new (void)
-{
- EvolutionComposer *new;
- POA_GNOME_Evolution_Composer *servant;
- CORBA_Environment ev;
- GNOME_Evolution_Composer corba_object;
-
- servant = (POA_GNOME_Evolution_Composer *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &Composer_vepv;
-
- CORBA_exception_init (&ev);
- POA_GNOME_Evolution_Composer__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_free (servant);
- CORBA_exception_free (&ev);
- return NULL;
- }
- CORBA_exception_free (&ev);
-
- new = gtk_type_new (evolution_composer_get_type ());
- corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new),
- servant);
- evolution_composer_construct (new, corba_object);
-
- return new;
-}
-
-E_MAKE_TYPE (evolution_composer, "EvolutionComposer", EvolutionComposer, class_init, init, PARENT_TYPE)
-
-
-#define GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ComposerFactory"
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *factory, void *closure)
-{
- if (!mail_config_is_configured ()) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Could not create composer window, because you "
- "have not yet\nconfigured any identities in the "
- "mail component."));
- return NULL;
- }
- return BONOBO_OBJECT (evolution_composer_new ());
-}
-
-void
-evolution_composer_factory_init (void (*send) (EMsgComposer *, gpointer),
- void (*postpone) (EMsgComposer *, gpointer))
-{
- if (bonobo_generic_factory_new (GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID,
- factory_fn, NULL) == NULL) {
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Cannot initialize Evolution's composer."));
- exit (1);
- }
-
- send_cb = send;
- postpone_cb = postpone;
-}
diff --git a/composer/evolution-composer.h b/composer/evolution-composer.h
deleted file mode 100644
index 65f3f246d2..0000000000
--- a/composer/evolution-composer.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* evolution-composer.h
- *
- * Copyright (C) 2000 Helix Code, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Dan Winship
- */
-
-#ifndef __EVOLUTION_COMPOSER_H__
-#define __EVOLUTION_COMPOSER_H__
-
-#include <bonobo/bonobo-object.h>
-
-#include "Composer.h"
-#include "e-msg-composer.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define EVOLUTION_TYPE_COMPOSER (evolution_composer_get_type ())
-#define EVOLUTION_COMPOSER(obj) (GTK_CHECK_CAST ((obj), EVOLUTION_TYPE_COMPOSER, EvolutionComposer))
-#define EVOLUTION_COMPOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), EVOLUTION_TYPE_COMPOSER, EvolutionComposerClass))
-#define EVOLUTION_IS_COMPOSER(obj) (GTK_CHECK_TYPE ((obj), EVOLUTION_TYPE_COMPOSER))
-#define EVOLUTION_IS_COMPOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), EVOLUTION_TYPE_COMPOSER))
-
-typedef struct _EvolutionComposer EvolutionComposer;
-typedef struct _EvolutionComposerClass EvolutionComposerClass;
-
-struct _EvolutionComposer {
- BonoboObject parent;
-
- EMsgComposer *composer;
-};
-
-struct _EvolutionComposerClass {
- BonoboObjectClass parent_class;
-};
-
-POA_GNOME_Evolution_Composer__epv *evolution_composer_get_epv (void);
-
-GtkType evolution_composer_get_type (void);
-void evolution_composer_construct (EvolutionComposer *,
- GNOME_Evolution_Composer);
-EvolutionComposer *evolution_composer_new (void);
-
-void evolution_composer_factory_init (void (*send) (EMsgComposer *, gpointer),
- void (*postpone) (EMsgComposer *, gpointer));
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EVOLUTION_COMPOSER_H__ */
diff --git a/composer/listener.c b/composer/listener.c
deleted file mode 100644
index 938122a480..0000000000
--- a/composer/listener.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* This file is part of gnome-spell bonobo component
-
- Copyright (C) 2000 Helix Code, Inc.
- Authors: Radek Doulik <rodo@helixcode.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#include <config.h>
-#include <bonobo.h>
-
-#include "listener.h"
-
-static BonoboObjectClass *listener_parent_class;
-static POA_GNOME_GtkHTML_Editor_Listener__vepv listener_vepv;
-
-inline static EditorListener *
-listener_from_servant (PortableServer_Servant servant)
-{
- return EDITOR_LISTENER (bonobo_object_from_servant (servant));
-}
-
-static CORBA_any *
-get_any_null ()
-{
- CORBA_any *rv;
-
- rv = CORBA_any__alloc ();
- rv->_type = TC_null;
-
- return rv;
-}
-
-static gchar *
-resolve_image_url (EditorListener *l, gchar *url)
-{
- gchar *cid = NULL;
-
- printf ("resolve_image_url %s\n", url);
-
- if (!strncmp (url, "file:", 5)) {
- gchar *id;
-
- id = (gchar *) g_hash_table_lookup (l->composer->inline_images, url + 5);
- if (!id) {
- id = header_msgid_generate ();
- g_hash_table_insert (l->composer->inline_images, g_strdup (url + 5), id);
- }
- cid = g_strconcat ("cid:", id, NULL);
- printf ("resolved to %s\n", cid);
- }
-
- return cid;
-}
-
-static void
-reply_indent (EditorListener *l, CORBA_Environment * ev)
-{
- if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (l->composer->editor_engine, ev)) {
- if (GNOME_GtkHTML_Editor_Engine_isPreviousParagraphEmpty (l->composer->editor_engine, ev))
- GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "cursor-backward", ev);
- else {
- GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "insert-paragraph", ev);
- return;
- }
-
- }
- GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "style-normal", ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "indent-zero", ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (l->composer->editor_engine, "italic-off", ev);
-}
-
-static CORBA_any *
-impl_event (PortableServer_Servant _servant,
- const CORBA_char * name, const CORBA_any * arg,
- CORBA_Environment * ev)
-{
- EditorListener *l = listener_from_servant (_servant);
- BonoboArg *data;
- CORBA_any *rv = NULL;
-
- /* printf ("impl_event\n"); */
-
- if (!strcmp (name, "command")) {
- /* FIXME check for insert-paragraph command */
- data = GNOME_GtkHTML_Editor_Engine_getParagraphData (l->composer->editor_engine, "orig", ev);
- if (ev->_major == CORBA_NO_EXCEPTION && data) {
- if (CORBA_TypeCode_equal (data->_type, TC_boolean, ev) && BONOBO_ARG_GET_BOOLEAN (data))
- reply_indent (l, ev);
- BONOBO_ARG_SET_BOOLEAN (data, CORBA_FALSE);
- GNOME_GtkHTML_Editor_Engine_setParagraphData (l->composer->editor_engine, "orig", data, ev);
- }
- } else if (!strcmp (name, "image_url")) {
- gchar *url;
-
- if ((url = resolve_image_url (l, BONOBO_ARG_GET_STRING (arg)))) {
- rv = bonobo_arg_new (TC_string);
- BONOBO_ARG_SET_STRING (rv, url);
- printf ("new url: %s\n", url);
- g_free (url);
- }
- }
-
- return rv ? rv : get_any_null ();
-}
-
-POA_GNOME_GtkHTML_Editor_Listener__epv *
-listener_get_epv (void)
-{
- POA_GNOME_GtkHTML_Editor_Listener__epv *epv;
-
- epv = g_new0 (POA_GNOME_GtkHTML_Editor_Listener__epv, 1);
-
- epv->event = impl_event;
-
- return epv;
-}
-
-static void
-init_listener_corba_class (void)
-{
- listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
- listener_vepv.GNOME_GtkHTML_Editor_Listener_epv = listener_get_epv ();
-}
-
-static void
-listener_class_init (EditorListenerClass *klass)
-{
- listener_parent_class = gtk_type_class (bonobo_object_get_type ());
-
- init_listener_corba_class ();
-}
-
-GtkType
-listener_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "EditorListener",
- sizeof (EditorListener),
- sizeof (EditorListenerClass),
- (GtkClassInitFunc) listener_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (bonobo_object_get_type (), &info);
- }
-
- return type;
-}
-
-EditorListener *
-listener_construct (EditorListener *listener, GNOME_GtkHTML_Editor_Listener corba_listener)
-{
- g_return_val_if_fail (listener != NULL, NULL);
- g_return_val_if_fail (IS_EDITOR_LISTENER (listener), NULL);
- g_return_val_if_fail (corba_listener != CORBA_OBJECT_NIL, NULL);
-
- if (!bonobo_object_construct (BONOBO_OBJECT (listener), (CORBA_Object) corba_listener))
- return NULL;
-
- return listener;
-}
-
-static GNOME_GtkHTML_Editor_Listener
-create_listener (BonoboObject *listener)
-{
- POA_GNOME_GtkHTML_Editor_Listener *servant;
- CORBA_Environment ev;
-
- servant = (POA_GNOME_GtkHTML_Editor_Listener *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &listener_vepv;
-
- CORBA_exception_init (&ev);
- POA_GNOME_GtkHTML_Editor_Listener__init ((PortableServer_Servant) servant, &ev);
- ORBIT_OBJECT_KEY(servant->_private)->object = NULL;
-
- if (ev._major != CORBA_NO_EXCEPTION){
- g_free (servant);
- CORBA_exception_free (&ev);
- return CORBA_OBJECT_NIL;
- }
-
- CORBA_exception_free (&ev);
-
- return (GNOME_GtkHTML_Editor_Listener) bonobo_object_activate_servant (listener, servant);
-}
-
-EditorListener *
-listener_new (EMsgComposer *composer)
-{
- EditorListener *listener;
- GNOME_GtkHTML_Editor_Listener corba_listener;
-
- listener = gtk_type_new (EDITOR_LISTENER_TYPE);
- listener->composer = composer;
-
- corba_listener = create_listener (BONOBO_OBJECT (listener));
-
- if (corba_listener == CORBA_OBJECT_NIL) {
- bonobo_object_unref (BONOBO_OBJECT (listener));
- return NULL;
- }
-
- return listener_construct (listener, corba_listener);
-}
diff --git a/composer/listener.h b/composer/listener.h
deleted file mode 100644
index 0c50ef2111..0000000000
--- a/composer/listener.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* This file is part of gnome-spell bonobo component
-
- Copyright (C) 2000 Helix Code, Inc.
- Authors: Radek Doulik <rodo@helixcode.com>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-*/
-
-#ifndef LISTENER_H_
-#define LISTENER_H_
-
-#include <libgnome/gnome-defs.h>
-#include <bonobo/bonobo-object.h>
-#include "Editor.h"
-#include "e-msg-composer.h"
-
-BEGIN_GNOME_DECLS
-
-#define EDITOR_LISTENER_TYPE (listener_get_type ())
-#define EDITOR_LISTENER(o) (GTK_CHECK_CAST ((o), EDITOR_LISTENER_TYPE, EditorListener))
-#define EDITOR_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), EDITOR_LISTENER_TYPE, EditorListenerClass))
-#define IS_EDITOR_LISTENER(o) (GTK_CHECK_TYPE ((o), EDITOR_LISTENER_TYPE))
-#define IS_EDITOR_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), EDITOR_LISTENER_TYPE))
-
-typedef struct {
- BonoboObject parent;
- EMsgComposer *composer;
-} EditorListener;
-
-typedef struct {
- BonoboObjectClass parent_class;
-} EditorListenerClass;
-
-GtkType listener_get_type (void);
-EditorListener *listener_construct (EditorListener *listener,
- GNOME_GtkHTML_Editor_Listener corba_listener);
-EditorListener *listener_new (EMsgComposer *composer);
-POA_GNOME_GtkHTML_Editor_Listener__epv *listener_get_epv (void);
-
-END_GNOME_DECLS
-
-#endif /* LISTENER_H_ */