Dynamic completions for GtkEntryCompletion



[I intended to send the following about a month ago, but then realized
that ::insert_text is pretty much what I want, but not quite.  I don't
know if the issue is just bugginess in GtkEntryCompletion, or the file
chooser, or what.]

GtkEntryCompletion seems to operate under the model that you stuff
strings in a list, feed that to the GtkEntryCompletion, and let it
handle things from there.  This does not seem to play very well with
cases where completions change as the user types.

For example, say you start typing "/etc/p" in the file chooser's entry
line.  The completions at that point are something like {passwd, ppp,
printcap}.  If you go on typing, "/etc/ppp/i", then the completions
become {ioptions, ip-up, ip-down}.

I think it would be useful to have a
GtkEntryCompletion::build_completions signal that would be emitted when
it is necessary/safe to change the completions tree-model.  This is
basically when the user has typed a character in the corresponding
GtkEntry.  [Are there other occasions when this is valid?]  At that
point, the app would regenerate the list of completions.

What do people think of a signal like this:

gboolean GtkEntryCompletion::build_completions (GtkEntryCompletion *ec);

The handler would return FALSE if it didn't modify the list, and TRUE
otherwise.  Or perhaps the signal would return void and
GtkEntryCompletion would a) ignore model changes while the signal is
being emitted, and b) update itself internally if the model changed.

  Federico




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