Re: [gedit-list] GtkSourceView Popup



On Sat, 2007-03-17 at 21:26 +0100, Steve Fr�naux wrote:
> On Sat, 2007-03-17 at 11:20 +0100, Paolo Maggi wrote:
> > I think we need an interface "AutocompletionSource" that the various
> > autocompletion sources must implement.
> 
> Maybe I'm a bit old school, or just like simplicity and coherency with
> existing stuff, but what about a simple "autocompletion-populate"
> signal ? It would be damn simple to extend an object to listen to it (no
> need for inheritance), and the interface you describe is mostly an
> observer anyway.

Let me extend:

You have a list model for completion (containing cols like an icon, a
text, a weight, eventually something else as needed). You can then
manipulate this model using add, remove, etc.

Now your gtktextview has a "populate-completion-popup" signal, with a
textiter as the argument. An object that wants to add entries in the
completion popup just adds or modifies the model as needed. Eventually,
the model can be kept from time to time and the object can do something
more clever than adding the same entries again and again.

As an analogy, you can look at the "populate-popup" signal for GtkEntry
or GtkTextView. An object connects to it and then add menuitems to the
menu as needed.

This looks a very simple and pragmatic way of doing things. I can't
think of any case where this wouldn't be sufficient. What do you think
about it ?




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