diff -u -r1.25 address-entry.c
--- libbalsa/address-entry.c	2002/02/15 09:01:56	1.25
+++ libbalsa/address-entry.c	2002/02/15 18:26:37
@@ -40,6 +40,27 @@
 #include "libbalsa.h"
 #include "address-entry.h"
 
+
+/* LibBalsaAddressEntry is typedef'd in address-entry.h, but the
+ * structure is declared here to keep it opaque */
+struct _LibBalsaAddressEntry {
+    GtkEntry parent;
+
+    GList *active;              /* A GList of email addresses.
+                                 * Caution! active may not
+                                 * point to the start of the list. */
+    gint focus;			/* Used to keep track of the validity of
+				   the 'input' variable. */
+    gchar *domain;		/* The domain to add if the user omits one. */
+    gint alias_start_pos,       /* Used with selection_start/stop_pos to */
+         alias_end_pos;         /* colorise text */
+
+    /*
+     * Function to find matches.  User defined.
+     */
+    void (* find_match)  (emailData *addy, gboolean fast_check);
+};
+
 /*
  * Global variable.  We need this for access to parent methods.
  */
@@ -262,11 +283,15 @@
     entry = GTK_ENTRY(object);
     address_entry = LIBBALSA_ADDRESS_ENTRY(object);
 
+    /* FIXME: I don't see any code that sets this data--is it deadwood?
+     */
     /*
      * Remove known data references set by gtk_object_set_data()
      */
     gtk_object_remove_data(GTK_OBJECT(object), "next_in_line");
 
+    /* FIXME: the timer is removed by gtk_entry's finalize method--do we
+     * need to do it as well? */
     /*
      * Remove timers.
      */
@@ -702,18 +727,26 @@
      * Delete the current entry.
      */
     } else {
+        /* except as noted below, cursor will be in the entry to the
+         * left of the current one, so we'll put the cursor at the
+         * end */
+        gboolean cursor_at_start = FALSE;
         GList *prev;
 
 	list = address_entry->active;
         if ((prev = g_list_previous(list)))
             address_entry->active = prev;
+        else
+            /* cursor will be in the entry to the right of the
+             * current one, so we'll put the cursor at the start */
+            cursor_at_start = TRUE;
 	libbalsa_emailData_free(list->data);
         address_entry->active =
             libbalsa_delete_link(address_entry->active, list);
 	if (address_entry->active) {
 	    addy = address_entry->active->data;
 	    g_assert(addy != NULL);
-	    addy->cursor = 0;
+	    addy->cursor = cursor_at_start ? 0 : strlen(addy->user);
 	} else {
 	    gtk_entry_set_text(GTK_ENTRY(address_entry), "");
 	    libbalsa_fill_input(address_entry);
@@ -763,16 +796,25 @@
      * Delete the current entry.
      */
     } else {
+        /* except as noted below, cursor will be in the entry to the
+         * right of the current one, so we'll put the cursor at the
+         * start */
+        gboolean cursor_at_end = FALSE;
+
 	list = address_entry->active;
-	if (!g_list_next(list))
+	if (!g_list_next(list)) {
+            /* cursor will be in the entry to the left of the
+             * current one, so we'll put the cursor at the end */
 	    address_entry->active = g_list_previous(list);
+            cursor_at_end = TRUE;
+        }
 	libbalsa_emailData_free(list->data);
         address_entry->active =
             libbalsa_delete_link(address_entry->active, list);
 	if (address_entry->active) {
 	    addy = address_entry->active->data;
 	    g_assert(addy != NULL);
-	    addy->cursor = strlen(addy->user);
+	    addy->cursor = cursor_at_end ? strlen(addy->user) : 0;
 	} else {
 	    gtk_entry_set_text(GTK_ENTRY(address_entry), "");
 	    libbalsa_fill_input(address_entry);
@@ -840,7 +882,6 @@
  *   results:
  *     None?  Changes the appearance of the widget.
  *************************************************************/
-#define INNER_BORDER     2
 static void
 libbalsa_address_entry_draw(GtkWidget * widget, GdkRectangle * area)
 {
@@ -2064,18 +2105,13 @@
  *     Modifies the text in the widget.
  *************************************************************/
 void
-libbalsa_address_entry_clear_to_send(GtkWidget *widget)
+libbalsa_address_entry_clear_to_send(LibBalsaAddressEntry * address_entry)
 {
-    LibBalsaAddressEntry *address_entry;
     emailData *addy;
 
-    g_return_if_fail(widget != NULL);
-    g_return_if_fail(LIBBALSA_IS_ADDRESS_ENTRY(widget));
-
     /*
      * Grab the input.
      */
-    address_entry = LIBBALSA_ADDRESS_ENTRY(widget);
     if (!address_entry->active)
         return;
 
@@ -2088,6 +2124,53 @@
     /*
      * Show the input, so that we fill the GtkEntry box.
      */
-    libbalsa_address_entry_show(LIBBALSA_ADDRESS_ENTRY(widget));
+    libbalsa_address_entry_show(address_entry);
+}
+
+/*************************************************************
+ * libbalsa_address_entry_get_chars_all:
+ *     Wrapper for GtkEditable method.
+ *************************************************************/
+gchar *
+libbalsa_address_entry_get_chars_all(LibBalsaAddressEntry * address_entry)
+{
+    return gtk_editable_get_chars(GTK_EDITABLE(address_entry), 0, -1);
 }
 
+/*************************************************************
+ * libbalsa_address_entry_set_text:
+ *     Wrapper for GtkEntry method.
+ *************************************************************/
+void
+libbalsa_address_entry_set_text(LibBalsaAddressEntry * address_entry,
+                                const gchar *text)
+{
+    gtk_entry_set_text(GTK_ENTRY(address_entry), text);
+}
+
+/*************************************************************
+ * libbalsa_address_entry_append_text:
+ *     Wrapper for GtkEntry method.
+ *************************************************************/
+void
+libbalsa_address_entry_append_text(LibBalsaAddressEntry * address_entry,
+                                const gchar *text)
+{
+    gtk_entry_append_text(GTK_ENTRY(address_entry), text);
+}
+
+/*************************************************************
+ * libbalsa_address_entry_matching:
+ *     Is the widget showing a match? 
+ *************************************************************/
+gboolean 
+libbalsa_address_entry_matching(LibBalsaAddressEntry * address_entry)
+{
+    if (address_entry->active) {
+        emailData *addy = address_entry->active->data;
+
+        if (addy->match)
+            return TRUE;
+    }
+    return FALSE;
+}
Index: libbalsa/address-entry.h
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/address-entry.h,v
retrieving revision 1.7
diff -u -r1.7 address-entry.h
--- libbalsa/address-entry.h	2002/02/11 08:24:27	1.7
+++ libbalsa/address-entry.h	2002/02/15 18:26:37
@@ -74,28 +74,12 @@
 #define LIBBALSA_IS_ADDRESS_ENTRY(obj)		(GTK_CHECK_TYPE (obj, LIBBALSA_TYPE_ADDRESS_ENTRY))
 #define LIBBALSA_IS_ADDRESS_ENTRY_CLASS(klass)	(GTK_CHECK_CLASS_TYPE (klass, LIBBALSA_TYPE_ADDRESS_ENTRY))
 
+/* LibBalsaAddressEntry is typedef'd here, but the structure is declared
+ * in address-entry.c to keep it opaque */
 typedef struct _LibBalsaAddressEntry LibBalsaAddressEntry;
 typedef struct _LibBalsaAddressEntryClass LibBalsaAddressEntryClass;
 
-struct _LibBalsaAddressEntry {
-    GtkEntry parent;
 
-    GList *active;              /* A GList of email addresses.
-                                 * Caution! active may not
-                                 * point to the start of the list. */
-    gint focus;			/* Used to keep track of the validity of
-				   the 'input' variable. */
-    gchar *domain;		/* The domain to add if the user omits one. */
-    gint alias_start_pos,       /* Used with selection_start/stop_pos to */
-         alias_end_pos;         /* colorise text */
-
-    /*
-     * Function to find matches.  User defined.
-     */
-    void (* find_match)  (emailData *addy, gboolean fast_check);
-};
-
-
 struct _LibBalsaAddressEntryClass {
     GtkEntryClass parent_class;
 };
@@ -112,6 +96,15 @@
 GtkWidget *libbalsa_address_entry_new(void);
 void libbalsa_address_entry_set_find_match(LibBalsaAddressEntry *, void *);
 void libbalsa_address_entry_set_domain(LibBalsaAddressEntry *, void *);
-void libbalsa_address_entry_clear_to_send(GtkWidget *);
+void libbalsa_address_entry_clear_to_send(LibBalsaAddressEntry *
+                                          address_entry);
+gchar *libbalsa_address_entry_get_chars_all(LibBalsaAddressEntry *
+                                            address_entry);
+void libbalsa_address_entry_set_text(LibBalsaAddressEntry * address_entry,
+                                     const gchar * text);
+void libbalsa_address_entry_append_text(LibBalsaAddressEntry *
+                                        address_entry, const gchar * text);
+gboolean libbalsa_address_entry_matching(LibBalsaAddressEntry *
+                                         address_entry);
 
 #endif
Index: src/sendmsg-window.c
===================================================================
RCS file: /cvs/gnome/balsa/src/sendmsg-window.c,v
retrieving revision 1.338
diff -u -r1.338 sendmsg-window.c
--- src/sendmsg-window.c	2002/02/08 09:30:58	1.338
+++ src/sendmsg-window.c	2002/02/15 18:26:38
@@ -134,8 +134,10 @@
 static void set_list_post_address(BalsaSendmsg * msg);
 static gboolean set_list_post_rfc2369(BalsaSendmsg * msg, GList * p);
 static gchar *rfc2822_skip_comments(gchar * str);
-static void address_changed_cb(GtkEditable * w, BalsaSendmsgAddress *sma);
-static void set_ready(GtkEditable * w, BalsaSendmsgAddress *sma);
+static void address_changed_cb(LibBalsaAddressEntry * address_entry,
+                               BalsaSendmsgAddress *sma);
+static void set_ready(LibBalsaAddressEntry * address_entry,
+                      BalsaSendmsgAddress *sma);
 
 /* Standard DnD types */
 enum {
@@ -509,10 +511,13 @@
 address_book_cb(GtkWidget *widget, BalsaSendmsg *snd_msg_wind)
 {
     GtkWidget *ab;
-    GtkEntry *entry;
+    LibBalsaAddressEntry *address_entry;
     gint button;
 
-    entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(widget), "address-entry-widget"));
+    address_entry =
+        LIBBALSA_ADDRESS_ENTRY(gtk_object_get_data
+                               (GTK_OBJECT(widget),
+                                "address-entry-widget"));
 
     ab = balsa_address_book_new(TRUE);
     gnome_dialog_set_parent(GNOME_DIALOG(ab), 
@@ -524,7 +529,7 @@
 	gchar *t;
 	t = balsa_address_book_get_recipients(BALSA_ADDRESS_BOOK(ab));
 	if ( t ) 
-	    gtk_entry_set_text(GTK_ENTRY(entry), t);
+	    libbalsa_address_entry_set_text(address_entry, t);
 	g_free(t);
     }
     gnome_dialog_close(GNOME_DIALOG(ab));
@@ -536,10 +541,13 @@
     gint reply;
     if(balsa_app.debug) printf("delete_event_cb\n");
     if(bsmsg->modified) {
+        gchar *tmp =
+            libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                                 (bsmsg->to[1]));
 	gchar* str = 
 	    g_strdup_printf(_("The message to '%s' is modified.\n"
 			      "Save message to Draftbox?"),
-			    gtk_entry_get_text(GTK_ENTRY(bsmsg->to[1])));
+                              tmp);
 	GtkWidget* l = gtk_label_new(str);
 	GnomeDialog* d =
 	    GNOME_DIALOG(gnome_dialog_new(_("Closing the Compose Window"),
@@ -550,6 +558,7 @@
 	gnome_dialog_set_accelerator(GNOME_DIALOG(d), 0, 'Y', 0);
 	gnome_dialog_set_accelerator(GNOME_DIALOG(d), 1, 'N', 0);
 
+	g_free(tmp);
 	g_free(str);
 	gnome_dialog_set_parent(d, GTK_WINDOW(bsmsg->window));
 	gtk_widget_show(l);
@@ -695,16 +704,25 @@
 	while(fgets(line, sizeof(line), tmp)) {
             if(line[strlen(line)-1] == '\n')line[strlen(line)-1] = '\0';
             if(!strncmp(line, "To: ", 4))
-                gtk_entry_set_text(GTK_ENTRY(data_real->msg->to[1]), line+4);
+                libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                                (data_real->msg->to[1]),
+                                                line + 4);
             else if(!strncmp(line, "From: ", 6))
-                gtk_entry_set_text(GTK_ENTRY(data_real->msg->from[1]), line+6);
+                libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                                (data_real->msg->from[1]), 
+                                                line+6);
             else if(!strncmp(line, "Reply-To: ", 10))
-                gtk_entry_set_text(GTK_ENTRY(data_real->msg->reply_to[1]), 
-                                   line+10);
+                libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                                (data_real->msg->reply_to[1]), 
+                                                line+10);
             else if(!strncmp(line, "Bcc: ", 5))
-                gtk_entry_set_text(GTK_ENTRY(data_real->msg->bcc[1]), line+5);
+                libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                                (data_real->msg->bcc[1]), 
+                                                line+5);
             else if(!strncmp(line, "Cc: ", 4))
-                gtk_entry_set_text(GTK_ENTRY(data_real->msg->cc[1]), line+4);
+                libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                                (data_real->msg->cc[1]), 
+                                                line+4);
             else if(!strncmp(line, "Comments: ", 10))
                 gtk_entry_set_text(GTK_ENTRY(data_real->msg->comments[1]), 
                                    line+10);
@@ -755,14 +773,23 @@
     tmp   = fdopen(tmpfd, "w+");
     
     if(balsa_app.edit_headers) {
-	gchar *from = gtk_entry_get_text(GTK_ENTRY(msg->from[1])),
-            *to = gtk_entry_get_text(GTK_ENTRY(msg->to[1])),
+        gchar *from =
+            libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                                 (msg->from[1])),
+            *to =
+            libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                                 (msg->to[1])),
             *reply_to =
-            gtk_entry_get_text(GTK_ENTRY(msg->reply_to[1])), *cc =
-            gtk_entry_get_text(GTK_ENTRY(msg->cc[1])),
-            *bcc = gtk_entry_get_text(GTK_ENTRY(msg->bcc[1])),
-            *subject = gtk_entry_get_text(GTK_ENTRY(msg->subject[1])),
-            *comments = gtk_entry_get_text(GTK_ENTRY(msg->comments[1]));
+            libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                                 (msg->reply_to[1])),
+            *cc =
+            libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                                 (msg->cc[1])),
+            *bcc =
+            libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                                 (msg->bcc[1])),
+	    *subject = gtk_entry_get_text(GTK_ENTRY(msg->subject[1])),
+	    *comments = gtk_entry_get_text(GTK_ENTRY(msg->comments[1]));
 	
 	/* Write all the headers */
 	fprintf(tmp, 
@@ -774,7 +801,13 @@
                 "Reply-To: %s\n"
                 "Comments: %s\n\n\n",
                 from, to, cc, bcc, subject, reply_to, comments);
+        g_free(from);
+        g_free(to);
+        g_free(cc);
+        g_free(bcc);
+        g_free(reply_to);
     }
+
     gtk_widget_set_sensitive(msg->text, FALSE);
     fputs(gtk_editable_get_chars(GTK_EDITABLE(msg->text), 0,
                                  gtk_text_get_length(GTK_TEXT
@@ -822,11 +855,14 @@
     gchar* tmpstr=libbalsa_address_to_gchar(ident->address, 0);
     
     /* change entries to reflect new identity */
-    gtk_entry_set_text(GTK_ENTRY(msg->from[1]), tmpstr);
+    libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                    (msg->from[1]), tmpstr);
     g_free(tmpstr);
 
-    gtk_entry_set_text(GTK_ENTRY(msg->reply_to[1]), ident->replyto);
-    gtk_entry_set_text(GTK_ENTRY(msg->bcc[1]), ident->bcc);
+    libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                    (msg->reply_to[1]), ident->replyto);
+    libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                    (msg->bcc[1]), ident->bcc);
     
     /* change the subject to use the reply/forward strings */
 
@@ -1452,13 +1488,19 @@
        GtkSelectionData * selection_data,
        guint info, guint32 time, GnomeIconList * iconlist)
 {
-
-    if (!*gtk_entry_get_text(GTK_ENTRY(widget))) {
-	gtk_entry_set_text(GTK_ENTRY(widget), selection_data->data);
+    LibBalsaAddressEntry *address_entry = LIBBALSA_ADDRESS_ENTRY(widget);
+    gchar *tmp =
+        libbalsa_address_entry_get_chars_all(address_entry);
+
+    if (!*tmp) {
+        libbalsa_address_entry_set_text(address_entry,
+                                        selection_data->data);
     } else {
-	gtk_entry_append_text(GTK_ENTRY(widget), ",");
-	gtk_entry_append_text(GTK_ENTRY(widget), selection_data->data);
+        libbalsa_address_entry_append_text(address_entry, ",");
+        libbalsa_address_entry_append_text(address_entry,
+                                           selection_data->data);
     }
+    g_free(tmp);
 }
 
 
@@ -1595,7 +1637,7 @@
     sma->ready = TRUE;
 
     /* set initial label style: */
-    set_ready(GTK_EDITABLE(arr[1]), sma);
+    set_ready(LIBBALSA_ADDRESS_ENTRY(arr[1]), sma);
 }
 
 
@@ -2193,11 +2235,12 @@
 }
 
 static void
-set_entry_from_address_list(GtkEntry* field, GList* list)
+set_entry_from_address_list(LibBalsaAddressEntry * address_entry,
+                            GList * list)
 {
     if (list) {
 	gchar* tmp = libbalsa_make_string_from_list(list);
-	gtk_entry_set_text(field, tmp);
+        libbalsa_address_entry_set_text(address_entry, tmp);
 	g_free(tmp);
     }
 }
@@ -2205,9 +2248,12 @@
 static void
 setup_headers_from_message(BalsaSendmsg* cw, LibBalsaMessage *message)
 {
-    set_entry_from_address_list(GTK_ENTRY(cw->to[1]),  message->to_list);
-    set_entry_from_address_list(GTK_ENTRY(cw->cc[1]),  message->cc_list);
-    set_entry_from_address_list(GTK_ENTRY(cw->bcc[1]), message->bcc_list);
+    set_entry_from_address_list(LIBBALSA_ADDRESS_ENTRY(cw->to[1]),
+                                message->to_list);
+    set_entry_from_address_list(LIBBALSA_ADDRESS_ENTRY(cw->cc[1]),
+                                message->cc_list);
+    set_entry_from_address_list(LIBBALSA_ADDRESS_ENTRY(cw->bcc[1]),
+                                message->bcc_list);
 }
 
 
@@ -2252,12 +2298,15 @@
 setup_headers_from_identity(BalsaSendmsg* cw, LibBalsaIdentity *ident)    
 {
     gchar* str = libbalsa_address_to_gchar(ident->address, 0);
-    gtk_entry_set_text(GTK_ENTRY(cw->from[1]), str); 
+    libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                    (cw->from[1]), str);
     g_free(str); 
     if(ident->replyto)
-	gtk_entry_set_text(GTK_ENTRY(cw->reply_to[1]), ident->replyto);
+        libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                        (cw->reply_to[1]), ident->replyto);
     if(ident->bcc)
-	gtk_entry_set_text(GTK_ENTRY(cw->bcc[1]), ident->bcc);
+	libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                        (cw->bcc[1]), ident->bcc);
 }
 
 BalsaSendmsg *
@@ -2402,7 +2451,8 @@
 	addr = (message->reply_to) ? message->reply_to : message->from;
 
 	tmp = libbalsa_address_to_gchar(addr, 0);
-	gtk_entry_set_text(GTK_ENTRY(msg->to[1]), tmp);
+	libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                        (msg->to[1]), tmp);
 	g_free(tmp);
     } else if ( type == SEND_REPLY_GROUP ) {
         set_list_post_address(msg);
@@ -2428,14 +2478,17 @@
     if (type == SEND_REPLY_ALL) {
 	tmp = libbalsa_make_string_from_list(message->to_list);
 
-	gtk_entry_set_text(GTK_ENTRY(msg->cc[1]), tmp);
+	libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                        (msg->cc[1]), tmp);
 	g_free(tmp);
 
 	if (message->cc_list) {
-	    gtk_entry_append_text(GTK_ENTRY(msg->cc[1]), ", ");
+	    libbalsa_address_entry_append_text(LIBBALSA_ADDRESS_ENTRY
+                                               (msg->cc[1]), ", ");
 
 	    tmp = libbalsa_make_string_from_list(message->cc_list);
-	    gtk_entry_append_text(GTK_ENTRY(msg->cc[1]), tmp);
+	    libbalsa_address_entry_append_text(LIBBALSA_ADDRESS_ENTRY
+                                               (msg->cc[1]), tmp);
 	    g_free(tmp);
 	}
     }
@@ -2706,17 +2759,20 @@
 }
 
 static void
-address_changed_cb(GtkEditable * w, BalsaSendmsgAddress *sma)
+address_changed_cb(LibBalsaAddressEntry * address_entry,
+                   BalsaSendmsgAddress * sma)
 {
-    set_ready(w, sma);
-    check_readiness(sma->msg);
+    if (!libbalsa_address_entry_matching(address_entry)) {
+        set_ready(address_entry, sma);
+        check_readiness(sma->msg);
+    }
 }
 
 static void
-set_ready(GtkEditable * w, BalsaSendmsgAddress *sma)
+set_ready(LibBalsaAddressEntry * address_entry, BalsaSendmsgAddress *sma)
 {
     gint len = 0;
-    gchar *tmp = gtk_editable_get_chars(w, 0, -1);
+    gchar *tmp = libbalsa_address_entry_get_chars_all(address_entry);
 
     if (tmp && *tmp) {
         GList *list = libbalsa_address_new_list_from_string(tmp);
@@ -2779,27 +2835,41 @@
     g_assert(bsmsg != NULL);
     message = libbalsa_message_new();
 
-    message->from = 
-        libbalsa_address_new_from_string(gtk_entry_get_text
-                                         (GTK_ENTRY(bsmsg->from[1])));
+    tmp =
+        libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                             (bsmsg->from[1]));
+    message->from = libbalsa_address_new_from_string(tmp);
+    g_free(tmp);
 
-    tmp = g_strdup(gtk_entry_get_text(GTK_ENTRY(bsmsg->subject[1])));
+    tmp = gtk_editable_get_chars(GTK_EDITABLE(bsmsg->subject[1]), 0, -1);
     strip_chars(tmp, "\r\n");
     LIBBALSA_MESSAGE_SET_SUBJECT(message, tmp);
+
+    tmp =
+        libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                             (bsmsg->to[1]));
+    message->to_list = libbalsa_address_new_list_from_string(tmp);
+    g_free(tmp);
 
-    message->to_list =
-	libbalsa_address_new_list_from_string(gtk_entry_get_text
-					      (GTK_ENTRY(bsmsg->to[1])));
-    message->cc_list =
-	libbalsa_address_new_list_from_string(gtk_entry_get_text
-					      (GTK_ENTRY(bsmsg->cc[1])));
-    message->bcc_list =
-	libbalsa_address_new_list_from_string(gtk_entry_get_text
-					      (GTK_ENTRY(bsmsg->bcc[1])));
+    tmp =
+        libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                             (bsmsg->cc[1]));
+    message->cc_list = libbalsa_address_new_list_from_string(tmp);
+    g_free(tmp);
 
-    if ((tmp = gtk_entry_get_text(GTK_ENTRY(bsmsg->reply_to[1]))) != NULL
+    tmp =
+        libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                             (bsmsg->bcc[1]));
+    message->bcc_list = libbalsa_address_new_list_from_string(tmp);
+    g_free(tmp);
+
+    if ((tmp =
+         libbalsa_address_entry_get_chars_all(LIBBALSA_ADDRESS_ENTRY
+                                              (bsmsg->reply_to[1])))
+        != NULL
 	&& *tmp)
 	message->reply_to = libbalsa_address_new_from_string(tmp);
+    g_free(tmp);
 
     if (balsa_app.req_dispnotify)
 	libbalsa_message_set_dispnotify(message, balsa_app.current_ident->address);
@@ -2938,9 +3008,12 @@
 static void
 send_message_toolbar_cb(GtkWidget * widget, BalsaSendmsg * bsmsg)
 {
-    libbalsa_address_entry_clear_to_send(bsmsg->to[1]);
-    libbalsa_address_entry_clear_to_send(bsmsg->cc[1]);
-    libbalsa_address_entry_clear_to_send(bsmsg->bcc[1]);
+    libbalsa_address_entry_clear_to_send(LIBBALSA_ADDRESS_ENTRY
+                                         (bsmsg->to[1]));
+    libbalsa_address_entry_clear_to_send(LIBBALSA_ADDRESS_ENTRY
+                                         (bsmsg->cc[1]));
+    libbalsa_address_entry_clear_to_send(LIBBALSA_ADDRESS_ENTRY
+                                         (bsmsg->bcc[1]));
     send_message_handler(bsmsg, balsa_app.always_queue_sent_mail);
 }
 
@@ -2953,9 +3026,12 @@
      * First, check if aliasing is on, and get it to nullify the
      * match.  Otherwise we send mail to "John (John Doe <jdoe@public.com>)"
      */
-    libbalsa_address_entry_clear_to_send(bsmsg->to[1]);
-    libbalsa_address_entry_clear_to_send(bsmsg->cc[1]);
-    libbalsa_address_entry_clear_to_send(bsmsg->bcc[1]);
+    libbalsa_address_entry_clear_to_send(LIBBALSA_ADDRESS_ENTRY
+                                         (bsmsg->to[1]));
+    libbalsa_address_entry_clear_to_send(LIBBALSA_ADDRESS_ENTRY
+                                         (bsmsg->cc[1]));
+    libbalsa_address_entry_clear_to_send(LIBBALSA_ADDRESS_ENTRY
+                                         (bsmsg->bcc[1]));
     return send_message_handler(bsmsg, FALSE);
 }
 
@@ -3615,7 +3691,8 @@
         gchar *tmp =
             libbalsa_address_to_gchar(message->mailbox->
                                       mailing_list_address, 0);
-        gtk_entry_set_text(GTK_ENTRY(msg->to[1]), tmp);
+        libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY(msg->to[1]),
+                                        tmp);
         g_free(tmp);
     } else {
         GList *lst = libbalsa_message_user_hdrs(message);
@@ -3627,7 +3704,8 @@
                 gchar **pair = p->data;
                 if (libbalsa_find_word(pair[0],
                                        "x-beenthere x-mailing-list")) {
-                    gtk_entry_set_text(GTK_ENTRY(msg->to[1]), pair[1]);
+                    libbalsa_address_entry_set_text(LIBBALSA_ADDRESS_ENTRY
+                                                    (msg->to[1]), pair[1]);
                     break;
                 }
             }
