Extra menu accelerator




I'm trying to attach an extra keyboard accelerators to a menu item,
in addition to the normal one. I define the file_menu as:

static GnomeUIInfo file_menu [] = {

    { GNOME_APP_UI_ITEM, 
      N_("_Login..."), 
      N_("Login to server"), 
      MainWindow::login_cb, NULL, NULL, 
      GNOME_APP_PIXMAP_NONE, 0, 
      'l', GDK_CONTROL_MASK, NULL 
    }
<...>
}

And the menu as:

static GnomeUIInfo menu [] = {
  GNOMEUIINFO_MENU_FILE_TREE(file_menu),
<...>
};

Then I create the menus with

    gnome_app_create_menus (GNOME_APP(app), menu);

Then I add an extra accelerator: (Is it correct to create a new
accel_group when I wan't to have two accelerators to the same menuitem?)

    GtkAccelGroup *accel_group; 

    accel_group = gtk_accel_group_new (); 
    gtk_widget_add_accelerator (file_menu[0].widget, "activate", accel_group,
				GDK_z, 0, GTK_ACCEL_VISIBLE);
    gtk_window_add_accel_group (GTK_WINDOW (app), accel_group);

This works great, but only the first time I run the application! The file
menu lists the accelerators for "Login..." as Z / Ctl+L. But the second
time, the extra accelerator is loaded from the file .gnome/accels/myapp,
and the menu reads Z / Z. How can I prevent the extra accelerator to be
saved in .gnome/accels/myapp? What is the purpose of .gnome/accels/myapp?

(Are there any documentation/tutorials/examples on gtk_accel_* ?)

/Peter Åstrand <peter@student.liu.se>




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