Re: A model/buffer for GtkEntry



On Thu, Mar 26, 2009 at 12:41 AM, Stef Walter <stef-list memberwebs com> wrote:
> A while back [1] I tackled the possibility of having GtkEntry store it's
> text in a application configurable memory buffer. This makes GtkEntry
> very useful for use with gnome-keyring and seahorse passwords/secrets [2].
>
> I've given it another shot, and come up with what I think is a much
> better approach. I've implemented a GtkEntryBuffer class (or
> GtkEntryModel) which segregates all the text storage and conversion to
> displayable text.
>
[...]

>  * gtk_entry_buffer_get_visibility
>  * gtk_entry_buffer_set_visibility
>  * gtk_entry_buffer_get_invisible_char
>  * gtk_entry_buffer_set_invisible_char
>  * gtk_entry_buffer_unset_invisible_char
>  * gtk_entry_buffer_have_invisible_char

    I have a feeling these apis should be handled by
the view (multiple entries on the same buffer
should be able to control these attributes independently).

Rather than creating a whole new class, is there any reasons
why a GtkTextBuffer doesnt satisfy the needs of a GtkEntry ?

Interesting work by the way.

Cheers,
               -Tristan


>
> Some questions/points I'd love to have advice on:
>
> 1. I think that abstracting out the text storage of GtkEntry is the
> right way forward. Does that seem right?
>
> 2. Naming: GtkEntryModel or GtkEntryBuffer?
>
> 3. As hinted at by the above functions, this moves the conversion to
> displayable text into the GtkEntryBuffer class. This helps remove tons
> of 'entry->visible' cases in GtkEntry and cleans up the code a whole lot.
>
> 4. Interface vs. Subclass: I found that a subclass is far more useful
> in this case.
>
> 5. GtkEntryBuffer can be used directly, or can be derived from. The
> default implementation of the virtual methods acts exactly as one would
> expect from GtkEntry.



>
> 6. Various properties that were on GtkEntry are now on GtkEntryModel.
> Leaving temporary wrappers in GtkEntry is pretty easy. Would we mark
> them deprecated? That includes:
>
> gtk_entry_set_visibility
> gtk_entry_get_visibility
> gtk_entry_set_invisible_char
> gtk_entry_get_invisible_char
> gtk_entry_unset_invisible_char
> gtk_entry_set_max_length
> gtk_entry_get_max_length
>
> I imagine these would live on as convenience functions (and maybe some
> of the above):
>
> gtk_entry_set_text
> gtk_entry_get_text_length
> gtk_entry_get_text
>
> Bug report filed here with some initial rough patches:
>
> http://bugzilla.gnome.org/show_bug.cgi?id=576801
>
>
> Anything else I'm missing?
>
> Cheers,
>
> Stef
>
>
>
> [1] http://mail.gnome.org/archives/gtk-devel-list/2009-March/msg00000.html
>
> [2]
> http://mail.gnome.org/archives/gnome-keyring-list/2009-January/msg00003.html
>
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
>


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