binary toggle design question


I have a design question about Gnome programs.  A program I am writing
uses a custom widget (built with gob) to display its data (images with
overlayed additional information).  This widget has boolean gobject
property which controls the display of some kind of cursor.  This
flag should be easily controllable by the user.

Optimally the user would be able to toggle the flag using a key press
and there should be a toggle button to control it with the mouse and
to display the current setting.

My question: how should I implement this?

Possibilities I could think about:

1) The GObject controls the checkbox: Setting the gobjects flag emits
a signal to which I could bind a function which udpates the checkbox.
I could bind the key to a function which also manipulates the GObject
and thus, indirectly, the checkbox.  But clicking the checkbox would
then probably leed to some weird kind of feedback loop.

2) The checkbox controls the custom widget: I would bind to the
checkbox's signal a function which updates the flag and make sure that
whoever updates the object's property does so through the checkbox.
Is there a canonical way to make a key toggle the checkbox?

All the best,

Attachment: signature.asc
Description: Digital signature

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