aboutsummaryrefslogtreecommitdiffstats
path: root/composer/evolution-composer.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-04-03 02:37:22 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-04-03 02:37:22 +0800
commit16068d9b4191ea142a9e75a50eb8d260ed2bb406 (patch)
tree835a7909cd8b352d8c414986f1f5e27697b4de98 /composer/evolution-composer.c
parentee50e5d68e4f1a793541f1ee4979818ed4940173 (diff)
downloadgsoc2013-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 'composer/evolution-composer.c')
-rw-r--r--composer/evolution-composer.c395
1 files changed, 0 insertions, 395 deletions
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
deleted file mode 100644
index 5c20c3a6aa..0000000000
--- a/composer/evolution-composer.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* evolution-composer.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * published by the Free Software Foundation; either version 2 of the
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * 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., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * Author: Dan Winship <danw@ximian.com>
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <bonobo/bonobo-item-handler.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <e-util/e-util.h>
-#include <misc/e-gui-utils.h>
-#include "evolution-composer.h"
-#include "mail/mail-config.h"
-#include "libedataserver/e-account-list.h"
-#include <camel/camel-mime-filter-tohtml.h>
-#include <camel/camel-stream-mem.h>
-
-#define PARENT_TYPE BONOBO_OBJECT_TYPE
-static BonoboObjectClass *parent_class = NULL;
-
-struct _EvolutionComposerPrivate {
- int send_id;
- int save_draft_id;
-
- void (*send_cb) (EMsgComposer *, gpointer);
- void (*save_draft_cb) (EMsgComposer *, int, gpointer);
-};
-
-/* CORBA interface implementation. */
-static EDestination **
-corba_recipientlist_to_destv (const GNOME_Evolution_Composer_RecipientList *cl)
-{
- GNOME_Evolution_Composer_Recipient *recip;
- EDestination **destv;
- int i;
-
- if (cl->_length == 0)
- return NULL;
-
- destv = g_new (EDestination *, cl->_length+1);
-
- for (i = 0; i < cl->_length; ++i) {
- recip = &(cl->_buffer[i]);
-
- destv[i] = e_destination_new ();
-
- if (*recip->name)
- e_destination_set_name (destv[i], recip->name);
- e_destination_set_email (destv[i], recip->address);
-
- }
- destv[cl->_length] = NULL;
-
- return destv;
-}
-
-static void
-impl_Composer_set_headers (PortableServer_Servant servant,
- const CORBA_char *from,
- 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;
- EDestination **tov, **ccv, **bccv;
- EAccountList *accounts;
- EAccount *account;
- EIterator *iter;
- int found = 0;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- account = mail_config_get_account_by_name (from);
- if (!account) {
- accounts = mail_config_get_accounts ();
- iter = e_list_get_iterator ((EList *) accounts);
- while (e_iterator_is_valid (iter)) {
- account = (EAccount *) e_iterator_get (iter);
-
- if (!g_ascii_strcasecmp (account->id->address, from)) {
- found = TRUE;
- break;
- }
-
- e_iterator_next (iter);
- }
-
- g_object_unref (iter);
-
- if (!found)
- account = mail_config_get_default_account ();
- }
-
- tov = corba_recipientlist_to_destv (to);
- ccv = corba_recipientlist_to_destv (cc);
- bccv = corba_recipientlist_to_destv (bcc);
-
- e_msg_composer_set_headers (composer->composer, account->name,
- tov, ccv, bccv, subject);
-
- e_destination_freev (tov);
- e_destination_freev (ccv);
- e_destination_freev (bccv);
-}
-
-static void
-impl_Composer_set_multipart_type (PortableServer_Servant servant,
- GNOME_Evolution_Composer_MultipartType type,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- if (type == GNOME_Evolution_Composer_ALTERNATIVE) {
- e_msg_composer_set_alternative (composer->composer, TRUE);
- }
-}
-
-static void
-impl_Composer_set_body (PortableServer_Servant servant,
- const CORBA_char *body,
- const CORBA_char *mime_type,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- if (!g_ascii_strcasecmp (mime_type, "text/plain")) {
- char *htmlbody = camel_text_to_html (body, CAMEL_MIME_FILTER_TOHTML_PRE, 0);
-
- e_msg_composer_set_body_text (composer->composer, htmlbody, -1);
- g_free (htmlbody);
- } else if (!g_ascii_strcasecmp (mime_type, "text/html"))
- e_msg_composer_set_body_text (composer->composer, body, -1);
- else
- e_msg_composer_set_body (composer->composer, body, mime_type);
-}
-
-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 (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 GNOME_Evolution_Composer_AttachmentData *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->_buffer, data->_length,
- 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 (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));
-}
-
-static void
-impl_Composer_send (PortableServer_Servant servant,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EvolutionComposer *composer;
-
- bonobo_object = bonobo_object_from_servant (servant);
- composer = EVOLUTION_COMPOSER (bonobo_object);
-
- composer->priv->send_cb (composer->composer, NULL);
-}
-
-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->setMultipartType = impl_Composer_set_multipart_type;
- epv->setBody = impl_Composer_set_body;
- epv->attachMIME = impl_Composer_attach_MIME;
- epv->attachData = impl_Composer_attach_data;
- epv->show = impl_Composer_show;
- epv->send = impl_Composer_send;
-
- return epv;
-}
-
-
-/* GObject stuff */
-
-static void
-finalise (GObject *object)
-{
- EvolutionComposer *composer = EVOLUTION_COMPOSER (object);
- struct _EvolutionComposerPrivate *p = composer->priv;
-
- g_signal_handler_disconnect(composer->composer, p->send_id);
- g_signal_handler_disconnect(composer->composer, p->save_draft_id);
- g_free(p);
-
- if (composer->composer) {
- g_object_unref(composer->composer);
- composer->composer = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-evolution_composer_class_init (EvolutionComposerClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_Composer__epv *epv;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = finalise;
-
- parent_class = g_type_class_ref(bonobo_object_get_type ());
-
- epv = &klass->epv;
-
- epv->setHeaders = impl_Composer_set_headers;
- epv->setMultipartType = impl_Composer_set_multipart_type;
- epv->setBody = impl_Composer_set_body;
- epv->attachMIME = impl_Composer_attach_MIME;
- epv->attachData = impl_Composer_attach_data;
- epv->show = impl_Composer_show;
- epv->send = impl_Composer_send;
-}
-
-static void
-evolution_composer_init (EvolutionComposer *composer)
-{
- composer->composer = e_msg_composer_new ();
- composer->priv = g_malloc0(sizeof(*composer->priv));
-}
-
-#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 (*send) (EMsgComposer *, gpointer),
- void (*save_draft) (EMsgComposer *, int, gpointer))
-{
- EvolutionComposer *new;
- struct _EvolutionComposerPrivate *p;
-
- new = g_object_new(EVOLUTION_TYPE_COMPOSER, NULL);
- evolution_composer_construct (new, bonobo_object_corba_objref((BonoboObject *)new));
- p = new->priv;
- p->send_cb = send;
- p->save_draft_cb = save_draft;
- p->send_id = g_signal_connect (new->composer, "send", G_CALLBACK (send), NULL);
- p->save_draft_id = g_signal_connect (new->composer, "save-draft", G_CALLBACK (save_draft), NULL);
-
- return new;
-}
-
-BONOBO_TYPE_FUNC_FULL(EvolutionComposer, GNOME_Evolution_Composer, BONOBO_TYPE_OBJECT, evolution_composer)