[Glade-users] Working with GtkAction and GtkActionGroup
John Delaney
johndelaney at gmail.com
Tue Jul 14 11:58:15 EDT 2009
On Tue, Jul 14, 2009 at 3:37 PM, Tristan Van
Berkom<tristan.van.berkom at gmail.com> wrote:
>> * Specify a widget to connect to an action object as a proxy.
>
> Yes.
How?
>> * Add action objects to an action group.
>
> No.
>
> This part could be very easy to implement, but maybe
> you clarify something for me...
>
> I can see the GtkActionGroup you have a way to add
> a bunch of actions, and some convenience functions
> to set a logical group as sensitive or visible or stuff.
>
> Could you explain how the GtkActionGroup is useful
> at all to you outside the context of a GtkUIManager ?
I have a GtkTable containing several dozen GtkLabel and GtkEntry
widgets, which I want to be able to categorise into two distinct
groups so that I can selectively toggle sensitive on and off, without
having to explicitly name each widget in my code. There are 3 possible
states:
1. All widgets are sensitive.
2. Widgets in group A are not sensitive.
3. Widgets in group B are not sensitive.
Groups A and B are mutually exclusive, and a few widgets in the table
are in neither group and thus always sensitive. The way that I'd
envisaged implementing it was as follows:
* For each widget in groups A and B, create an action object and
connect the widget to it.
* Create two action groups and add the respective action objects to
each action group, so that I can just set each action group as
sensitive or not sensitive.
I am able to do it like that programmatically, but it involves writing
even more code than calling gtk_widget_set_sensitive() for each
widget, so there seems little point. I'm a relative newcomer to Gtk
programming, so it may make no sense whatsoever to do it like that
anyway ;-)
Cheers,
John
More information about the Glade-users
mailing list