GtkEntryCompletion from the internet?



Hi,

I'm writing a GTK3 dictionary app in Vala. It has a GtkEntry with a
GtkEntryCompletion, that it uses to provide word suggestions based on what
you've typed. Think Google's search box.
The way I've implemented this is by connection to the "changed" signal, and
dispatching a new async libsoup request to grab the word suggestions with a
callback that parses them and inserts them into the GtkListStore that is the
model of the GtkEntryCompletion.

I understand it, the GtkEntryCompletion was designed on the assumption that
it would have access to the entire pool of possible suggestions. Obviously,
this is not the case with my application as it only knows about the few
suggestions it returns from the net.  Because of this I believe the API is
slightly awkward (or at least, the way I'm using it, hence my writing this).
My implementation works fine when typing "forward" (i.e going from "fo" to
"foo" -- adding letters, not deleting them), but seems to flash and stutter
when pressing backspace. Whereas in forward typing the pop-up box
suggestions instantly visually change to their updated forms based on the
new letters being typed, when hitting backspace the entire pop-up box goes
blank, then repopulates entirely, making the experience look jittery and
somewhat annoying. I actually cache old results in RAM, so it's not even
going over the wire when typing backwards -- just reading from a datatype in
RAM, so I know there isn't some issue with it being slow because of the
internet connection.

Is this behavior normal? Why should it only happen when hitting backspace,
but not when typing? What, if anything, can I do to fix it?

*tl;dr* GtkEntryCompletion popup visually clears and repopulates when
hitting backspace.

Thanks,
Avi



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