GTK+ 2 and prelight

2016-11-15 Thread Gabriele Greco
... still trying to build from a graphics designer mockup :)

There is a way to override the .gtkrc-2.0 file to avoid button prelight
state?

I want the some widgets (mostly toggle buttons) to keep their actual state
(normal or active) also if the cursor is on them.

It's a functional behaviour, not only aesthetics since a toggle button in
prelight state can be both active or not, but you can't see its state until
you move the mouse pointer...

Thanks in advance!

-- 
*Bye,*
* Gabry*
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Editable SpinButton on a TreeView: detect *every* changes

2016-11-15 Thread Pozz Pozz
2016-11-15 6:27 GMT+01:00 Tristan Van Berkom :

> Hi,
>
> On Tue, 2016-11-15 at 02:09 +0100, pozzugno wrote:
> [...]
> > I have tried to catch "editing_started", "editing_canceled" and
> > "edited"
> > signals of CellRenderer. In "editing_started" callback, I retrieve
> > and
> > save the row and column of the cell the user is going to edit. I
> > also
> > connect a callback to "value_changed" signal of the GtkAdjustment
> > associated to the GtkCellRendererSpin. Moreover I save the starting
> > value so I can restore it if the user will cancel the editing.
> >
> > When the user clicks on +/- buttons, "value_changed" is called (so I
> > can
> > send the request to the remote device).
> >
> > With some tricks, I'm able to restore the original value if the user
> > cancels the editing and to avoid a duplicate request to the remote
> > device when the user confirm the value changed by +/- buttons
> > (actually
> > when the user moves the focus away from the spinbutton, thus
> > terminated
> > the editing).
> >
> > As you know, I'm very new to Gtk programming, so I'm wondering
> > wethere
> > there's a better approach.
>
> Without reading your python code, your approach sounds correct.
>
> If you want to get notifications (callbacks) for live editing of
> editable widgets, you need to handle the editing started signal and
> then handle signals on the editable widget which is created for that
> edit session.
>

>From your words, I can use editable parameter in "editing-started"
callback. It should be a real GtkSpinButton, so I can connect to
"value-changed" signal to know when the user changes the value, through +/-
buttons or associated entry.

It works quite well, but I have two problems yet.

The first: you wrote the editable widget is *created* for that session. So
I suppose it will be destroyed automatically when the edit session ends.
Should I care to disconnect my callbacks before the widget is destroyed? I
think it's not important: when the widget is destroyed, all the connections
are freed without memory leaks.

Second and more important problem. During editing, the table/GtkTreeView
should be in a particular state (I have to avoid refreshing associated
GtkListStore to prevent ending prematurely from editing).
So I have to make some actions when the user is changing the value, but I
can't update GtkListStore otherwise the edit session is ended. My idea is
to use a global editing_in_progress flag that is asserted when the user
starts editing and deasserted when the edit session is ended.
I tried to assert the flag in "editing-started" callback, and to deassert
the flag in "edited" and "editing-canceled" callbacks and it works most of
the time... but not always.

For example, if the user clicks on another application during cell editing,
the "edited" signal is fired (so the flag is deasserted), but the editable
widget (the SpinButton) isn't destroyed. In this state, the ListStore could
be updated because the flag is deasserted, ending prematurely the active
edit session.

I couldn't find a "editing-finished" signal.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Sharing Gtk.Adjustment objects among several Gtk.SpinButton widgets

2016-11-15 Thread Damien Caliste
Hello,

Le 14/11/2016, Pozz Pozz  a écrit :
> Of course, I'm supponsing the case of several parameters that have
> different values but the same range properties (min, max, page
> step, ...)
You may implement your use case using bindings. You have a master
GtkAdjusment, or even better a derived GObject with range properties.
Then you can use g_object_bind_property() on every slave GtkAdjusments,
so that their range properties are always in sync.

Damien.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list