diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2008-04-03 02:37:22 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2008-04-03 02:37:22 +0800 |
commit | 16068d9b4191ea142a9e75a50eb8d260ed2bb406 (patch) | |
tree | 835a7909cd8b352d8c414986f1f5e27697b4de98 /addressbook/gui | |
parent | ee50e5d68e4f1a793541f1ee4979818ed4940173 (diff) | |
download | gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.tar gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.tar.gz gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.tar.bz2 gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.tar.lz gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.tar.xz gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.tar.zst gsoc2013-evolution-16068d9b4191ea142a9e75a50eb8d260ed2bb406.zip |
** Merge the mbarnes-composer branch
2008-04-02 Matthew Barnes <mbarnes@redhat.com>
** Merge the mbarnes-composer branch
* configure.in:
Bump libgtkhtml requirement to 3.19.1.
Add gtkhtml-editor dependency for addressbook, calendar and mail.
Remove print-message plugin; new composer implements this natively.
* tools/Makefile.am:
Remove CORBA rules for the old composer.
* addressbook/gui/widgets/Makefile.am:
Remove CORBA rules for the old composer.
* addressbook/gui/widgets/eab-gui-util.c
(eab_send_to_contact_and_email_num_list),
(eab_send_contact_list_as_attachment):
Adapt to new Bonobo-less composer widget.
* calendar/gui/Makefile.am:
Remove CORBA rules for the old composer.
* calendar/gui/itip-utils.c (comp_from), (comp_to_list),
(comp_subject), (comp_content_type), (comp_filename),
(comp_description), (append_cal_attachments), (itip_send_comp),
(reply_to_calendar_comp):
Adapt to new Bonobo-less composer widget.
* composer/Makefile.am:
Remove CORBA rules for the old composer.
* composer/e-msg-composer.c:
* composer/e-msg-composer.h:
EMsgComposer is now a subclass of GtkhtmlEditor.
Extensive refactoring and cleanup, too much to list in detail.
* composer/e-composer-header.c:
* composer/e-composer-header.h:
Add "sensitive" property along with get/set functions.
* composer/e-composer-from-header.c:
* composer/e-composer-from-header.h:
Propagate "refreshed" signal from EAccountComboBox.
Add function e_composer_from_header_get_account_list().
* composer/e-composer-private.c:
* composer/e-composer-private.h:
New files manage composer's private data.
Allows other composer files to manipulate private data.
* composer/e-msg-composer-hdrs.c:
* composer/e-msg-composer-hdrs.h:
Remove these files; replaced by EComposerHeaderTable widget.
* composer/evolution-composer.c:
* composer/evolution-composer.h:
Remove these files; composer is now a subclass of GtkhtmlEditor.
* composer/e-msg-composer-select-file.c:
* composer/e-msg-composer-select-file.h:
Remove these files; logic moved to e-msg-composer.c.
* composer/listener.c:
* composer/listener.h:
Remove these files; event handlers moved to e-msg-composer.c.
* composer/Composer.idl:
* composer/Evolution-Composer.idl:
Remove these files; composer is no longer a Bonobo object.
* mail/em-composer-prefs (sig_edit_cb),
(em_composer_prefs_new_signature):
Adapt to new Bonobo-less signature editor.
* mail/mail-signature-editor.c:
* mail/mail-signature-editor.h:
Rewrite the signature editor as a subclass of GtkhtmlEditor.
Eliminates Bonobo from the equation.
* mail/em-composer-utils.c (composer_get_message),
(em_utils_composer_send_cb), (save_draft_done),
(em_utils_composer_save_draft_cb), (create_new_composer),
(em_utils_compose_new_message),
(em_utils_compose_new_message_with_mailto), (em_utils_post_to_folder),
(em_utils_post_to_url), (edit_message), (forward_attached),
(forward_non_attached), (reply_get_composer), (composer_set_body),
(em_utils_reply_to_message), (post_reply_to_message):
Adapt to new Bonobo-less composer.
* mail/mail-component-factory.c:
Composer is no longer needs a Bonobo factory.
* mail/mail-config.c:
Fix style pattern for EMsgComposer widgets.
* plugins/groupwise/mail-send-options.c
(org_gnome_composer_send_options):
Adapt to streamlined EMsgComposer API.
* plugins/exchange-operations/Makefile.am:
Add EVOLUTION_MAIL_CFLAGS and EVOLUTION_MAIL_LIBS.
* plugins/exchange-operations/exchange-mail-send-options.c
(append_to_header), (org_gnome_exchange_send_options):
Adapt to streamlined EMsgComposer API.
* plugins/mailing-list-actions/mailing-list-actions.c
(emla_list_action_do):
Adapt to streamlined EMsgComposer API.
* po/POTFILES.in: Update file list for new composer.
* ui/evolution-composer-entries.xml:
Remove this file; obsoleted by new composer.
* widgets/misc/Makefile.am:
Add EVOLUTION_MAIL_LIBS.
* widgets/misc/e-account-combo-box.c:
* widgets/misc/e-account-combo-box.h:
New function e_account_combo_box_get_account_list().
Emit a "refreshed" signal when the EAccountList changes.
Add an internal reverse-lookup index.
* widgets/misc/e-charset-picker.c (e_charser_add_radio_actions):
New function adds radio actions to an action group.
Will eventually replace e_charset_picker_bonobo_ui_populate().
* widgets/misc/e-signature-combo-box.c:
* widgets/misc/e-signature-combo-box.h:
New function e_signature_combo_box_get_signature_list().
... separate issue ...
* configure.in:
Bump eds_minimum_version to 2.23.1 for
CAMEL_FOLDER_JUNKED_NOT_DELETED symbol.
svn path=/trunk/; revision=35313
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/widgets/Makefile.am | 20 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-gui-util.c | 309 |
2 files changed, 87 insertions, 242 deletions
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am index 640f2add01..88c7f07011 100644 --- a/addressbook/gui/widgets/Makefile.am +++ b/addressbook/gui/widgets/Makefile.am @@ -16,23 +16,6 @@ INCLUDES = \ -I$(top_builddir)/shell \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) -CORBA_COMPOSER_SOURCE_H = \ - Evolution-Composer.h -CORBA_COMPOSER_SOURCE_C = \ - Evolution-Composer-common.c \ - Evolution-Composer-skels.c \ - Evolution-Composer-stubs.c -CORBA_COMPOSER_IDL = $(srcdir)/../../../composer/Evolution-Composer.idl - -$(CORBA_COMPOSER_SOURCE_H): $(CORBA_COMPOSER_IDL) - $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(CORBA_COMPOSER_IDL) - -$(CORBA_COMPOSER_SOURCE_C): $(CORBA_COMPOSER_SOURCE_H) - -CORBA_SOURCE_H = $(CORBA_COMPOSER_SOURCE_H) -CORBA_SOURCE_C = $(CORBA_COMPOSER_SOURCE_C) -CORBA_SOURCE = $(CORBA_SOURCE_H) $(CORBA_SOURCE_C) - noinst_LTLIBRARIES = \ libeabwidgets.la @@ -44,7 +27,6 @@ eabinclude_HEADERS = \ eab-popup.h libeabwidgets_la_SOURCES = \ - $(CORBA_SOURCE) \ $(MARSHAL_GENERATED) \ eab-config.c \ eab-contact-display.c \ @@ -82,7 +64,7 @@ libeabwidgets_la_SOURCES = \ MARSHAL_GENERATED = eab-marshal.c eab-marshal.h @EVO_MARSHAL_RULE@ -BUILT_SOURCES = $(CORBA_SOURCE) $(MARSHAL_GENERATED) +BUILT_SOURCES = $(MARSHAL_GENERATED) CLEANFILES = $(BUILT_SOURCES) dist-hook: diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c index 842e954f20..27b81e7110 100644 --- a/addressbook/gui/widgets/eab-gui-util.c +++ b/addressbook/gui/widgets/eab-gui-util.c @@ -39,6 +39,7 @@ #include <e-util/e-icon-factory.h> #include "eab-contact-merging.h" #include <gnome.h> +#include <composer/e-msg-composer.h> /* we link to camel for decoding quoted printable email addresses */ #include <camel/camel-mime-utils.h> @@ -766,174 +767,76 @@ eab_transfer_contacts (EBook *source, GList *contacts /* adopted */, gboolean de addressbook_load (dest, got_book_cb, process); } -#include <Evolution-Composer.h> - -#define COMPOSER_OAFID "OAFIID:GNOME_Evolution_Mail_Composer:" BASE_VERSION - typedef struct { EContact *contact; int email_num; /* if the contact is a person (not a list), the email address to use */ } ContactAndEmailNum; static void -eab_send_to_contact_and_email_num_list (GList *c) +eab_send_to_contact_and_email_num_list (GList *contact_list) { - GNOME_Evolution_Composer composer_server; - CORBA_Environment ev; - GNOME_Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list; - CORBA_char *subject; - int to_i, bcc_i; - GList *iter; - gint to_length = 0, bcc_length = 0; - - if (c == NULL) - return; + EMsgComposer *composer; + EComposerHeaderTable *table; + GPtrArray *to_array; + GPtrArray *bcc_array; - CORBA_exception_init (&ev); + union { + gpointer *pdata; + EDestination **destinations; + } convert; - composer_server = bonobo_activation_activate_from_id (COMPOSER_OAFID, 0, NULL, &ev); - - /* Figure out how many addresses of each kind we have. */ - for (iter = c; iter != NULL; iter = g_list_next (iter)) { - ContactAndEmailNum *ce = iter->data; - EContact *contact = ce->contact; - GList *emails = e_contact_get (contact, E_CONTACT_EMAIL); - if (e_contact_get (contact, E_CONTACT_IS_LIST)) { - gint len = g_list_length (emails); - if (e_contact_get (contact, E_CONTACT_LIST_SHOW_ADDRESSES)) - to_length += len; - else - bcc_length += len; - } else { - if (emails != NULL) - ++to_length; - } - g_list_foreach (emails, (GFunc)g_free, NULL); - g_list_free (emails); - } + if (contact_list == NULL) + return; - /* Now I have to make a CORBA sequences that represents a recipient list with - the right number of entries, for the contacts. */ - to_list = GNOME_Evolution_Composer_RecipientList__alloc (); - to_list->_maximum = to_length; - to_list->_length = to_length; - if (to_length > 0) { - to_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (to_length); - } + composer = e_msg_composer_new (); + table = e_msg_composer_get_header_table (composer); - cc_list = GNOME_Evolution_Composer_RecipientList__alloc (); - cc_list->_maximum = cc_list->_length = 0; + to_array = g_ptr_array_new (); + bcc_array = g_ptr_array_new (); - bcc_list = GNOME_Evolution_Composer_RecipientList__alloc (); - bcc_list->_maximum = bcc_length; - bcc_list->_length = bcc_length; - if (bcc_length > 0) { - bcc_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (bcc_length); - } - - to_i = 0; - bcc_i = 0; - while (c != NULL) { - ContactAndEmailNum *ce = c->data; + /* Sort contacts into "To" and "Bcc" destinations. */ + while (contact_list != NULL) { + ContactAndEmailNum *ce = contact_list->data; EContact *contact = ce->contact; - int nth = ce->email_num; - char *name, *addr; - gboolean is_list, is_hidden; - GNOME_Evolution_Composer_Recipient *recipient; - GList *emails = e_contact_get (contact, E_CONTACT_EMAIL); - GList *iterator; - - if (emails != NULL) { - is_list = e_contact_get (contact, E_CONTACT_IS_LIST) != NULL; - is_hidden = is_list && !e_contact_get (contact, E_CONTACT_LIST_SHOW_ADDRESSES); - - if (is_list) { - for (iterator = emails; iterator; iterator = iterator->next) { - - if (is_hidden) { - recipient = &(bcc_list->_buffer[bcc_i]); - ++bcc_i; - } else { - recipient = &(to_list->_buffer[to_i]); - ++to_i; - } - - name = NULL; - addr = NULL; - if (iterator && iterator->data) { - /* XXX we should probably try to get the name from the attribute parameter here.. */ - addr = g_strdup ((char*)iterator->data); - } - - recipient->name = CORBA_string_dup (name ? name : ""); - recipient->address = CORBA_string_dup (addr ? addr : ""); - - g_free (name); - g_free (addr); - } - } - else { - EContactName *contact_name = e_contact_get (contact, E_CONTACT_NAME); - int length = g_list_length (emails); - - if (is_hidden) { - recipient = &(bcc_list->_buffer[bcc_i]); - ++bcc_i; - } else { - recipient = &(to_list->_buffer[to_i]); - ++to_i; - } - - if (nth >= length) - nth = 0; - - if (contact_name) { - name = e_contact_name_to_string (contact_name); - e_contact_name_free (contact_name); - } - else - name = NULL; - - addr = g_strdup (g_list_nth_data (emails, nth)); - - - recipient->name = CORBA_string_dup (name ? name : ""); - recipient->address = CORBA_string_dup (addr ? addr : ""); - - g_free (name); - g_free (addr); - } - - g_list_foreach (emails, (GFunc)g_free, NULL); - g_list_free (emails); - } - - c = c->next; - } + EDestination *destination; - subject = CORBA_string_dup (""); + destination = e_destination_new (); + e_destination_set_contact (destination, contact, 0); - GNOME_Evolution_Composer_setHeaders (composer_server, "", to_list, cc_list, bcc_list, subject, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_printerr ("gui/e-meeting-edit.c: I couldn't set the composer headers via CORBA! Aagh.\n"); - CORBA_exception_free (&ev); - return; - } - - CORBA_free (to_list); - CORBA_free (cc_list); - CORBA_free (bcc_list); - CORBA_free (subject); - - GNOME_Evolution_Composer_show (composer_server, &ev); + if (e_destination_is_evolution_list (destination)) { + if (e_destination_list_show_addresses (destination)) + g_ptr_array_add (to_array, destination); + else + g_ptr_array_add (bcc_array, destination); + } else + g_ptr_array_add (to_array, destination); - if (ev._major != CORBA_NO_EXCEPTION) { - g_printerr ("gui/e-meeting-edit.c: I couldn't show the composer via CORBA! Aagh.\n"); - CORBA_exception_free (&ev); - return; + contact_list = g_list_next (contact_list); } - CORBA_exception_free (&ev); + /* Add sentinels to each array. */ + g_ptr_array_add (to_array, NULL); + g_ptr_array_add (bcc_array, NULL); + + /* XXX Acrobatics like this make me question whether NULL-terminated + * arrays are really the best argument type for passing a list of + * destinations to the header table. */ + + /* Add "To" destinations. */ + convert.pdata = to_array->pdata; + e_composer_header_table_set_destinations_to ( + table, convert.destinations); + g_ptr_array_free (to_array, FALSE); + e_destination_freev (convert.destinations); + + /* Add "Bcc" destinations. */ + convert.pdata = bcc_array->pdata; + e_composer_header_table_set_destinations_bcc ( + table, convert.destinations); + g_ptr_array_free (bcc_array, FALSE); + e_destination_freev (convert.destinations); + + gtk_widget_show (GTK_WIDGET (composer)); } static const char * @@ -958,75 +861,48 @@ get_email (EContact *contact, EContactField field_id, gchar **to_free) static void eab_send_contact_list_as_attachment (GList *contacts) { - GNOME_Evolution_Composer composer_server; - CORBA_Environment ev; - CORBA_char *content_type, *filename, *description; - GNOME_Evolution_Composer_AttachmentData *attach_data; - CORBA_boolean show_inline; - char *tempstr; - GNOME_Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list; - CORBA_char *subject; + EMsgComposer *composer; + EComposerHeaderTable *table; + CamelMimePart *attachment; + gchar *data; if (contacts == NULL) return; - CORBA_exception_init (&ev); - - composer_server = bonobo_activation_activate_from_id (COMPOSER_OAFID, 0, NULL, &ev); + composer = e_msg_composer_new (); + table = e_msg_composer_get_header_table (composer); + attachment = camel_mime_part_new (); + data = eab_contact_list_to_string (contacts); + camel_mime_part_set_content ( + attachment, data, strlen (data), "text/x-vcard"); - content_type = CORBA_string_dup ("text/x-vcard"); - filename = CORBA_string_dup (""); - - if (contacts->next) { - description = CORBA_string_dup (_("Multiple vCards")); - } else { - char *file_as = e_contact_get (E_CONTACT (contacts->data), E_CONTACT_FILE_AS); - tempstr = g_strdup_printf (_("vCard for %s"), file_as); - description = CORBA_string_dup (tempstr); - g_free (tempstr); - g_free (file_as); - } - - show_inline = FALSE; - - tempstr = eab_contact_list_to_string (contacts); - attach_data = GNOME_Evolution_Composer_AttachmentData__alloc(); - attach_data->_maximum = attach_data->_length = strlen (tempstr); - attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length); - memcpy (attach_data->_buffer, tempstr, attach_data->_length); - g_free (tempstr); - - GNOME_Evolution_Composer_attachData (composer_server, - content_type, filename, description, - show_inline, attach_data, - &ev); + if (contacts->next != NULL) + camel_mime_part_set_description ( + attachment, _("Multiple vCards")); + else { + EContact *contact = contacts->data; + const gchar *file_as; + gchar *description; - if (ev._major != CORBA_NO_EXCEPTION) { - g_printerr ("gui/e-meeting-edit.c: I couldn't attach data to the composer via CORBA! Aagh.\n"); - CORBA_exception_free (&ev); - return; + file_as = e_contact_get_const (contact, E_CONTACT_FILE_AS); + description = g_strdup_printf (_("vCard for %s"), file_as); + camel_mime_part_set_description (attachment, description); + g_free (description); } - CORBA_free (content_type); - CORBA_free (filename); - CORBA_free (description); - CORBA_free (attach_data); - - to_list = GNOME_Evolution_Composer_RecipientList__alloc (); - to_list->_maximum = to_list->_length = 0; + camel_mime_part_set_disposition (attachment, "attachment"); - cc_list = GNOME_Evolution_Composer_RecipientList__alloc (); - cc_list->_maximum = cc_list->_length = 0; + e_msg_composer_attach (composer, attachment); + camel_object_unref (attachment); - bcc_list = GNOME_Evolution_Composer_RecipientList__alloc (); - bcc_list->_maximum = bcc_list->_length = 0; - - if (!contacts || contacts->next) { - subject = CORBA_string_dup (_("Contact information")); - } else { + if (contacts->next != NULL) + e_composer_header_table_set_subject ( + table, _("Contact information")); + else { EContact *contact = contacts->data; + gchar *tempstr; const gchar *tempstr2; gchar *tempfree = NULL; @@ -1052,27 +928,14 @@ eab_send_contact_list_as_attachment (GList *contacts) tempstr = g_strdup_printf (_("Contact information")); else tempstr = g_strdup_printf (_("Contact information for %s"), tempstr2); - subject = CORBA_string_dup (tempstr); - g_free (tempstr); - g_free (tempfree); - } - GNOME_Evolution_Composer_setHeaders (composer_server, "", to_list, cc_list, bcc_list, subject, &ev); + e_composer_header_table_set_subject (table, tempstr); - CORBA_free (to_list); - CORBA_free (cc_list); - CORBA_free (bcc_list); - CORBA_free (subject); - - GNOME_Evolution_Composer_show (composer_server, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_printerr ("gui/e-meeting-edit.c: I couldn't show the composer via CORBA! Aagh.\n"); - CORBA_exception_free (&ev); - return; + g_free (tempstr); + g_free (tempfree); } - CORBA_exception_free (&ev); + gtk_widget_show (GTK_WIDGET (composer)); } void |