dynamic accelerators



Hi list,
I'm trying to get runtime-settable accelerators to work with my app.
I'm fairly new to GTK, so I'm still trying to wrap my head around the
terminology and structure of things.

Currently, I'm generating the menu procedurally in code and have a
basic File menu with Open and Quit commands.  I'd like to attach an
accelerator triggered by the Control key and "q" to File->Quit.

Here's my current code

const char *accel_path = "<LuaAV>/file/quit";
gtk_accel_map_add_entry(accel_path, gdk_keyval_from_name("q"),
GDK_CONTROL_MASK);
gtk_menu_item_set_accel_path(GTK_MENU_ITEM(quit_item), accel_path);

(I've also tried with const char *accel_path = "<LuaAV>/File/Quit"; to no avail)

So, how do I do this???  First, what's the deal with accel paths?
They seem a bit archaic.  Any good comprehensive reference on these?
What defines my window name?  In this case, I use <LuaAV> but I never
registered any such string with GTK so how would it ever know what
that meant?  Is there some registration step I missed?  Or, is the
string just some unique identifier that isn't actually parsed and
simply used as a hash?  That would make more sense to me.  If this is
the case, then I would expect the above code to work, but I don't see
the accelerator showing up in the menu.

any ideas?

thanks,
wes


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