Re: Yet another alias-expand update.



On Mon, 11 Dec 2000 22:34:48 Ian Campbell wrote:
> 
> > Concerning the patch, I haven't really tried it yet but have comments
> > from the structure stand point:
> 
> I have one from a quick glance.
> 
> I notice there is still quite some code in src/expand-alias.c.

Yes.  I am slowly moving it out.  First on the cards are the
gtk_object_get/set_data() calls, as they are no longer necessary.

It should be finished in a few days, if nothing major happens.

> I wonder if much of this could become internal to the new widget,
> and the API expanded to include a set_address_book_list (or something)
> method.

That isn't hard, but the only function that currently uses the address
books directly is expand_alias_find_match().

> I think having it internal to the widget will remove the need
> to use the emailData and inputData to keep track of the state (from what
> I can tell they are used to allow swapping from CC, To: etc??)

I don't quite follow, so I'll add what I use them for.  I don't
see how to get rid of them entirely, but there are places where
they are not necessary.

inputData  is a GList split of the user's input.  There is one per
           entry, and there will have to remain one per entry,
           although its now in the widget. (as in entry->input).
           Its state is which entry in the GList is active, and
           exists purely for performance reasons.
emailData  is an entry in the above GList.  It has two states:
           * The current match (or NULL)
           * How many tabs were pressed, to cycle through possible
             matches.
focus_c    is a flag to determine if its necessary to re-generate
           inputData.  This can be moved internally or deprecated.
next_entry Needs to figure out where to go if the user presses
           enter or Tab.  This should be deprecated.

The problem was thus:  When a user swapped between widgets, and the
widgets lost focus, the user could use the mouse to put the text
cursor in the widget /wherever he wanted/.  Including in the
alias (data he did not type).  This caused problems.  For this
reason there was a "focus_c" variable stored as gtk_object_data,
which was supposed to reload inputData when the user clicked anywhere.
I didn't want to reload inputData all the time since it could be
slow.

Furthermore, care had to be taken to not attach the wrong inputData
to the wrong entry box.

Since I rewrote expand-alias.c to put the alias inside () brackets,
its much less important, since its much "nicer" when the cursor ends
up in a wrong place.  Further, the code now removes the expanded
aliases if the widget loses focus, which makes it even less important.

Now that the code is a subclass of the entry(), the focus_c is an
internal variable (it is in my testing code).  Later, as code moves
across, keeping track of focus will be a lot more manageable.  There
are quite a few places where the code can be simplified.

> In the long run I reckon there should be pretty much nothing left in
> src/expand-alias.c. Perhaps this is your plan too?

Yes.  Every few days, I move functions across.  I want to move
the ones that depend on dirty hacks first, and the others later.

> Anyway, I think we should commit what exists now, since it is much
> better than the current stuff. It'll also help keep the patches more
> managable..
>
> -- 
> Ian Campbell
> Churchill College, Cambridge.
> 

Kind regards,				  
Berend                                  

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Berend De Schouwer, +27-11-712-1435, UCS





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]