Message-ID: <40050BBD.20106 at cea.fr> Date: Wed, 14 Jan 2004 10:28:29 +0100 From: Benjamin Monate Organization: CRIT/CEA MIME-Version: 1.0 To: Artem Prisyznuk Cc: "lablgtk at kaba.or.jp" Subject: Re: Question about ~accel_path parameter from GMenu.item_factory References: In-Reply-To: Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit Artem Prisyznuk wrote: > Hello, > > I try found info about ~accel_path, but info which I found > don't approach me for understand meaning of this parameter. > I found only small piece of info in gtk2+ API reference. > > I shall be very grateful if who that can explain to me value > of the given parameter. And as it to use in practice. > An accel_path is a string describing a name for an accelerator. Accelerators are keys combinations that emit signals corresponding to menus entries. The global accel_path map can be saved and loaded. This enable user customization for the accelerators. Here is a part of the accel_path file foo.keys generated by a call to GtkData.AccelMap.save "foo.keys" in one of my lablgtk2 programs : ============== ; coqide GtkAccelMap rc-file -*- scheme -*- ; this file is an automated accelerator map dump ; ; (gtk_accel_path "/V_ariables/" "") ; (gtk_accel_path "/R_eset Initial/" "") ; (gtk_accel_path "/B_egin Silent/" "") ; (gtk_accel_path "/D_erive Inversion_clear/" "") ; (gtk_accel_path "/T_actic Definition/" "") ; (gtk_accel_path "/Tactics/_EAuto with */" "ampersand") ; (gtk_accel_path "/File/_Print/" "") ============== All lines are commented by char ';'. A user may remove this ';' to define a custom accelerator. The first argument of gtk_accel_path is the accel_path. If you do not give an explicit accel_path for the factory of the menu, it defaults to "/menu/path/menu_name/". This default is specific to lablgtk2, not to Gtk2. The second argument is the accelerator itself. Only one is defined by the application in the example : "ampersand". To uses this accelerator map, use GtkData.AccelMap.load "foo.keys" To define an accelpath use : let factory = new GMenu.factory ~accel_path:"/" (* this is the root for this factory *) menubar let load_m = factory#add_item "_Open" ~key:GdkKeysyms._O in Generates the line : ; (gtk_accel_path "/_Open/" "o") I hope this helps Cheers Benjamin -- | Benjamin Monate | mailto:benjamin.monate@cea.fr | | Inge'nieur-Chercheur | CEA/DRT/DTSI/SLA/LSL |