Re: gtk accelerator problems



On Sun, Sep 22, 2002 at 03:16:22PM +0200, Filip Van Raemdonck wrote:

      item = gtk_menu_item_new_with_mnemonic ("_Entry");
      g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (activate_cb), NULL);
      gtk_menu_item_set_accel_path (GTK_MENU_ITEM (item), "<MyApp>/menu/entry");
      gtk_accel_map_add_entry ("<MyApp>/menu/entry", 'E', GDK_CONTROL_MASK);
      gtk_widget_show (item);
      gtk_menu_shell_append (GTK_MENU_SHELL (item_holder), item);

etc.

When running the application, neither the accelerator label is shown in the
menu, nor does the accelerator (ctrl+E) actually work.

I can't find anything in the API reference or in the tutorial which I might
have missed.
I tried using gtk_window_add_accel_group () on the top level window, using a
freshly created GtkAccelGroup but it doesn't change anything. Not that I
expected it to, since I'm not passing on the accelgroup anywhere to the menu
item related accel calls.

I figured this out myself by browsing the API until I found more on
accelerators. I had to call gtk_menu_set_accel_group(), too, before it
worked. It would be nice if there would be a comment on that in the
gtk_menu_item_set_accel_path() documentation; gtk_menu_set_accel_group isn't
mentioned anywhere now AFAICT.
I'll file a bug when I get time for it.


Regards,

Filip

-- 
"Those who don't understand Unix are condemned to reinvent it, poorly."
        -- Peter Cech



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