Re: Bugs in To: entry
- From: Emmanuel <e allaud wanadoo fr>
- To: balsa-list gnome org
- Subject: Re: Bugs in To: entry
- Date: Thu, 11 Oct 2001 18:33:35 +0200
On 2001.10.11 14:07 Emmanuel wrote:
> Hi all,
> here is a little bug but still annoying. When you compose a new message,
> type something in the to: address field, select it and erase it with
> backspace or del, as you want, then open your address book, select one
> person, you'll see the correct address in the to: field. But now press
> send
> button, this will erase the To: field, causing the message not to be sent
> (because Balsa does not send message with empty address).
> It's related with libbalsa_..._clear_to_send function, but I was not able
> to really find it. So if someone who knows this code better than me.
> Moreover look at this function in libbalsa/address-entry.c :
>
> /*************************************************************
> * libbalsa_address_entry_show:
> * Shows the widget. This will work out the aliases,
> * and set the widget text to that, and then call
> * libbalsa_address_entry_draw_text() to draw the
> * widget.
> *
> * arguments:
> * address_entry: the widget.
> *
> * results:
> * modifies address_entry
> *
> * FIXME:
> * - Adding the lists together should be easier.
> * - It should make more use of helper functions
> * that got written after this function got written,
> * like libbalsa_make_address_string()
> *************************************************************/
> void
> libbalsa_address_entry_show(LibBalsaAddressEntry *address_entry)
> {
> GtkEditable *editable;
> GString *show;
> GList *list;
> emailData *addy;
> gchar *out;
> gint cursor, start, end;
> gboolean found;
> inputData *input;
> gint tmp_pos;
>
> g_return_if_fail(address_entry != NULL);
> g_return_if_fail(LIBBALSA_IS_ADDRESS_ENTRY(address_entry));
> g_return_if_fail(address_entry->input != NULL);
>
> if (!GTK_WIDGET_DRAWABLE(address_entry)) return;
>
> editable = GTK_EDITABLE(address_entry);
>
> input = address_entry->input;
> show = g_string_new("");
> cursor = start = end = 0;
> found = FALSE;
> for (list = g_list_first(input->list);
> list != NULL;
> list = g_list_next(list)) {
> /*
> * Is it a normal string, or is it a match that requires ()
> */
> addy = (emailData *)list->data;
> g_assert(addy != NULL);
> if (addy->match != NULL) {
> out = g_strconcat("", addy->user, " (", addy->match, ")",
> NULL);
> } else {
> out = g_strdup(addy->user);
> }
> /*
> * Copy the string, adding a delimiter if need be.
> */
> show = g_string_append(show, out);
> if (g_list_next(list) != NULL)
> show = g_string_append(show, ", ");
>
> /*
> * Check for the cursor position.
> */
> if (!found) {
> if (list != input->active) {
> cursor += strlen(out);
> if (g_list_next(list) != NULL) cursor += 2;
> } else {
> ---> found = TRUE;
> cursor += addy->cursor;
> if (addy->match) {
> start = cursor - addy->cursor;
> start += strlen(addy->user) + 1;
> end = start + strlen(addy->match) + 2;
> }
> }
> }
> g_free(out);
> }
> ...
>
> You see that in the line pointed by the arrow, you are in the else case,
> meaning that found is already TRUE, so you don't have to assign the TRUE
> value to it. Moreover found is always FALSE, because it is first
> initialized to FALSE.
>
Damn I think I should have thought a bit more about this :-(
This is not a bug, it's correct, just forget that thing. Still the
remainder of the patch is correct (anyway it's really only one-liners).
Sorry
Bye
Manu
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]