GTK3 menu bar

I am still not really sure how to create a FINE pulldown menu bar.

Currently I am still using this Ruby code, which originates from the
initial GTK2 version and still works with GTK 3.14 -- I may have done
some modifications for GTK3, can not really remember.

class PetedMenuItemStock < Gtk::ImageMenuItem
  def initialize(menu, item, id)
    super(:label => nil, :mnemonic => nil, :stock_id => id, :accel_group => nil)
    self.accel_path = MenuWindowName + '/' + menu + '/' + item
    self.always_show_image = true
    modifier, keyval = Gtk::Stock.lookup(id)[2, 2]
    Gtk::AccelMap.add_entry(self.accel_path, keyval, modifier)

class PetedMenuItemText < Gtk::ImageMenuItem
  def initialize(menu, itemtext, keyval = nil, modifier = nil)
    super(:label => itemtext, :mnemonic => nil, :stock_id => nil, :accel_group => nil)
    self.accel_path = MenuWindowName + '/' + menu + '/' + itemtext
    if keyval and modifier
      Gtk::AccelMap.add_entry(self.accel_path, keyval, modifier)

But I guess I should fix it for latest GTK3: On the fly modifying
keyboard shortcuts is not supported in GTK3, and icons are deprecated,
same for gtk_stock_lockup().

OK, plain text menu is easy with gtk_menu_item_new_with_label()
described in

But have I really to use gtk_accel_map_add_entry() to manually set
keyboard accelerators for menu items? Currently I get these values with
gtk_stock_lookup(). And now? Where can I find the correct values for
"save", "load", "quit" menu text?  Or are accelerators deprecated too

I have done some Google search for a fine GTK3 example, but was not
really successful. The menu example is still GTK2, inkscape
too, and tools like gedit have the new app layout style.  

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