Re: MenuItem activate signal



On Fri, Feb 6, 2009 at 6:56 PM, dhk <dhkuhl optonline net> wrote:
[...]
I have a callback that is called when a MenuItem is selected, but in the
callback the paramenter is which is suppose to be the MenuItem is NULL.
 The callback signature is "void user_function (GtkMenuItem *menuitem,
gpointer user_data)".

What I want to do is set menuitem to be insensitive when sellected and
then sensitive when the task it calls is done.

Any ideas?

Sure, the best solution for you will be GTK+ 2.16/Glade 3.6 (comming soon
with the GNOME 2.26 release) - this will allow you to use a GtkAction for your
user operation, then when its activated - set it insensitive
(gtk_action_set_sensitive),
do your thing and set it sensitive again.

You could accomplish the same with Libglade and Glade 3.4, but directly
on the menu items (no action abstraction), the new GtkAction support will
allow you to place your menu item, add buttons or toolbuttons that all can
reflect the same user action without changing your code.

Note also that for the duration of your "operation", you must return to the
mainloop regularly (i.e. your operation cant be while (1) { compute stuff }, it
should be itterations in idle handlers or timeouts until the operation
is finished).

Cheers,
                   -Tristan



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