aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-01-18 07:32:07 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-01-18 07:32:07 +0800
commitf4a030d2fa7f74ff382996c15d15b5e2b6f2fb29 (patch)
tree07cd469fcbfacc6a4a282dfa00307afaf801bca9
parent99df61da47d51dcad35ec965be2b9acae491c8fa (diff)
downloadgsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.tar
gsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.tar.gz
gsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.tar.bz2
gsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.tar.lz
gsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.tar.xz
gsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.tar.zst
gsoc2013-evolution-f4a030d2fa7f74ff382996c15d15b5e2b6f2fb29.zip
Updated to use EAccountList and iterators. (evolution_composer_init):
2003-01-17 Jeffrey Stedfast <fejj@ximian.com> * evolution-composer.c (impl_Composer_set_headers): Updated to use EAccountList and iterators. (evolution_composer_init): Updated to use EAccount. * e-msg-composer.c (from_changed_cb): Updated to use the EAccount object. (e_msg_composer_new_with_message): Same. (e_msg_composer_get_preferred_account): Updated to return an EAccount object. (set_editor_signature): Updated to use an EAccountIdentity pointer. (get_signature_html): Same. * e-msg-composer-hdrs.c (create_from_optionmenu): Updated to use EAccount and EAccountList foo. (destroy): Same here. (e_msg_composer_hdrs_set_from_account): Here too. (e_msg_composer_hdrs_get_from): Updated. svn path=/trunk/; revision=19511
-rw-r--r--composer/ChangeLog20
-rw-r--r--composer/e-msg-composer-hdrs.c54
-rw-r--r--composer/e-msg-composer-hdrs.h6
-rw-r--r--composer/e-msg-composer.c19
-rw-r--r--composer/e-msg-composer.h2
-rw-r--r--composer/evolution-composer.c40
6 files changed, 92 insertions, 49 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 670bd82651..3fa2714345 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,23 @@
+2003-01-17 Jeffrey Stedfast <fejj@ximian.com>
+
+ * evolution-composer.c (impl_Composer_set_headers): Updated to use
+ EAccountList and iterators.
+ (evolution_composer_init): Updated to use EAccount.
+
+ * e-msg-composer.c (from_changed_cb): Updated to use the EAccount
+ object.
+ (e_msg_composer_new_with_message): Same.
+ (e_msg_composer_get_preferred_account): Updated to return an
+ EAccount object.
+ (set_editor_signature): Updated to use an EAccountIdentity pointer.
+ (get_signature_html): Same.
+
+ * e-msg-composer-hdrs.c (create_from_optionmenu): Updated to use
+ EAccount and EAccountList foo.
+ (destroy): Same here.
+ (e_msg_composer_hdrs_set_from_account): Here too.
+ (e_msg_composer_hdrs_get_from): Updated.
+
2003-01-16 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (signature_cb): mail_config_get_signature_list
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index ddb392e11d..251687eb9b 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -193,8 +193,9 @@ static GtkWidget *
create_from_optionmenu (EMsgComposerHdrs *hdrs)
{
GtkWidget *omenu, *menu, *first = NULL;
- const GSList *accounts, *a;
- const MailConfigAccount *account;
+ EAccountList *accounts;
+ EAccount *account;
+ EIterator *iter;
GPtrArray *addresses;
GtkWidget *item, *hbox;
int i = 0, history = 0, m, matches;
@@ -210,16 +211,22 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
/* Make list of account email addresses */
addresses = g_ptr_array_new ();
accounts = mail_config_get_accounts ();
- for (a = accounts; a; a = a->next) {
- account = a->data;
+ iter = e_list_get_iterator ((EList *) accounts);
+ while (e_iterator_is_valid (iter)) {
+ account = (EAccount *) e_iterator_get (iter);
+
if (account->id->address)
g_ptr_array_add (addresses, account->id->address);
+
+ e_iterator_next (iter);
}
- while (accounts) {
+ e_iterator_reset (iter);
+
+ while (e_iterator_is_valid (iter)) {
char *label;
- account = accounts->data;
+ account = (EAccount *) e_iterator_get (iter);
/* this should never ever fail */
if (!account || !account->name || !account->id) {
@@ -245,7 +252,8 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
item = gtk_menu_item_new_with_label (label);
g_free (label);
- g_object_set_data ((GObject *) item, "account", account_copy (account));
+ g_object_ref (account);
+ g_object_set_data ((GObject *) item, "account", account);
g_signal_connect (item, "activate", G_CALLBACK (from_changed), hdrs);
if (i == index) {
@@ -261,9 +269,11 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
i++;
}
- accounts = accounts->next;
+ e_iterator_next (iter);
}
+ g_object_unref (iter);
+
g_ptr_array_free (addresses, TRUE);
gtk_option_menu_set_menu (GTK_OPTION_MENU (omenu), menu);
@@ -292,7 +302,7 @@ addressbook_entry_changed (BonoboListener *listener,
{
EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (user_data);
- g_signal_emit(hdrs, signals[HDRS_CHANGED], 0);
+ g_signal_emit (hdrs, signals[HDRS_CHANGED], 0);
}
static GtkWidget *
@@ -570,7 +580,7 @@ destroy (GtkObject *object)
{
EMsgComposerHdrs *hdrs;
EMsgComposerHdrsPrivate *priv;
- GSList *l;
+ GSList *l, *n;
hdrs = E_MSG_COMPOSER_HDRS (object);
priv = hdrs->priv;
@@ -583,7 +593,7 @@ destroy (GtkObject *object)
CORBA_exception_free (&ev);
priv->corba_select_names = CORBA_OBJECT_NIL;
}
-
+
if (priv->tooltips) {
gtk_object_destroy (GTK_OBJECT (priv->tooltips));
g_object_unref (priv->tooltips);
@@ -592,15 +602,17 @@ destroy (GtkObject *object)
l = priv->from_options;
while (l) {
- MailConfigAccount *account;
+ EAccount *account;
GtkWidget *item = l->data;
account = g_object_get_data ((GObject *) item, "account");
- account_destroy (account);
+ g_object_unref (account);
- l = l->next;
+ n = l->next;
+ g_slist_free_1 (l);
+ l = n;
}
- g_slist_free (priv->from_options);
+
priv->from_options = NULL;
g_free (priv);
@@ -901,7 +913,7 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs,
/* find the item that represents the account and activate it */
l = hdrs->priv->from_options;
while (l) {
- MailConfigAccount *account;
+ EAccount *account;
item = l->data;
account = g_object_get_data ((GObject *) item, "account");
@@ -998,22 +1010,20 @@ e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs,
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
g_return_if_fail (subject != NULL);
- g_object_set((hdrs->priv->subject.entry),
- "text", subject,
- NULL);
+ g_object_set ((GObject *) hdrs->priv->subject.entry,
+ "text", subject, NULL);
}
CamelInternetAddress *
e_msg_composer_hdrs_get_from (EMsgComposerHdrs *hdrs)
{
- const MailConfigAccount *account;
CamelInternetAddress *addr;
+ EAccount *account;
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
- account = hdrs->account;
- if (!account || !account->id) {
+ if (!(account = hdrs->account)) {
/* FIXME: perhaps we should try the default account? */
return NULL;
}
diff --git a/composer/e-msg-composer-hdrs.h b/composer/e-msg-composer-hdrs.h
index 0baffea562..7ba370140c 100644
--- a/composer/e-msg-composer-hdrs.h
+++ b/composer/e-msg-composer-hdrs.h
@@ -29,9 +29,9 @@
#include <bonobo/bonobo-ui-component.h>
+#include <e-util/e-account.h>
#include <camel/camel-mime-message.h>
#include <addressbook/backend/ebook/e-destination.h>
-#include <mail/mail-config.h>
#ifdef __cplusplus
extern "C" {
@@ -53,10 +53,10 @@ typedef struct _EMsgComposerHdrsPrivate EMsgComposerHdrsPrivate;
struct _EMsgComposerHdrs {
GtkTable parent;
-
+
EMsgComposerHdrsPrivate *priv;
- const MailConfigAccount *account;
+ EAccount *account;
guint32 visible_mask;
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 422abc406a..5abda1e209 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1008,7 +1008,7 @@ decode_signature_name (const gchar *name)
#define CONVERT_SPACES CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
-static gchar *
+static char *
get_signature_html (EMsgComposer *composer)
{
gboolean format_html = FALSE;
@@ -1019,7 +1019,7 @@ get_signature_html (EMsgComposer *composer)
format_html = composer->signature->html;
script = composer->signature->script;
} else if (composer->auto_signature) {
- MailConfigIdentity *id;
+ EAccountIdentity *id;
char *organization;
char *address;
char *name;
@@ -2303,7 +2303,7 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data)
composer = E_MSG_COMPOSER (data);
if (hdrs->account) {
- const MailConfigAccount *account = hdrs->account;
+ EAccount *account = hdrs->account;
e_msg_composer_set_pgp_sign (composer,
account->pgp_always_sign &&
@@ -2931,11 +2931,14 @@ set_editor_signature (EMsgComposer *composer)
{
/* printf ("set_editor_signature\n"); */
if (E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id) {
- MailConfigIdentity *id;
+ EAccountIdentity *id;
+ GSList *signatures;
id = E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id;
- composer->signature = id->def_signature;
+ signatures = mail_config_get_signature_list ();
+
+ composer->signature = g_slist_nth_data (signatures, id->def_signature);
composer->auto_signature = id->auto_signature;
/* printf ("auto: %d\n", id->auto_signature); */
@@ -3404,13 +3407,13 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
{
const CamelInternetAddress *to, *cc, *bcc;
GList *To = NULL, *Cc = NULL, *Bcc = NULL;
- const MailConfigAccount *account = NULL;
const char *format, *subject, *postto;
EDestination **Tov, **Ccv, **Bccv;
GHashTable *auto_cc, *auto_bcc;
CamelContentType *content_type;
struct _header_raw *headers;
CamelDataWrapper *content;
+ EAccount *account = NULL;
char *account_name;
EMsgComposer *new;
XEvolution *xev;
@@ -4070,7 +4073,7 @@ CamelMimeMessage *
e_msg_composer_get_message_draft (EMsgComposer *composer)
{
CamelMimeMessage *msg;
- const MailConfigAccount *account;
+ EAccount *account;
gboolean old_send_html;
gboolean old_pgp_sign;
gboolean old_pgp_encrypt;
@@ -4244,7 +4247,7 @@ e_msg_composer_get_send_html (EMsgComposer *composer)
*
* Returns the user-specified account (from field).
*/
-const MailConfigAccount *
+EAccount *
e_msg_composer_get_preferred_account (EMsgComposer *composer)
{
EMsgComposerHdrs *hdrs;
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index d60aa91a7e..1617bf2983 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -174,7 +174,7 @@ EDestination **e_msg_composer_get_cc (EMsgCo
EDestination **e_msg_composer_get_bcc (EMsgComposer *composer);
char *e_msg_composer_get_subject (EMsgComposer *composer);
-const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
+EAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
char *e_msg_composer_guess_mime_type (const char *file_name);
void e_msg_composer_set_changed (EMsgComposer *composer);
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index cef0110413..851bf3c853 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -83,32 +83,42 @@ impl_Composer_set_headers (PortableServer_Servant servant,
BonoboObject *bonobo_object;
EvolutionComposer *composer;
EDestination **tov, **ccv, **bccv;
- const MailConfigAccount *account;
- const GSList *accounts;
-
+ 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 ();
- while (accounts) {
- account = accounts->data;
- if (!strcasecmp (account->id->address, from))
+ iter = e_list_get_iterator ((EList *) accounts);
+ while (e_iterator_is_valid (iter)) {
+ account = (EAccount *) e_iterator_get (iter);
+
+ if (!strcasecmp (account->id->address, from)) {
+ found = TRUE;
break;
- accounts = accounts->next;
+ }
+
+ e_iterator_next (iter);
}
- if (!accounts)
+
+ 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);
@@ -300,12 +310,12 @@ evolution_composer_class_init (EvolutionComposerClass *klass)
static void
evolution_composer_init (EvolutionComposer *composer)
{
- const MailConfigAccount *account;
BonoboObject *item_handler;
-
- account = mail_config_get_default_account ();
+ EAccount *account;
+
+ account = mail_config_get_default_account ();
composer->composer = e_msg_composer_new ();
-
+
g_signal_connect (composer->composer, "send",
G_CALLBACK (send_cb), NULL);
g_signal_connect (composer->composer, "save-draft",