tags:

views:

194

answers:

3

I am building an application which has GtkMenu widget. I am using Glade RAD tool to develop UI and while creating project in Glade I have specified version of GTK as 2.16 which supports GtkMenu and GtkMenuItems.

So I used GtkMenu everywhere in app (for File Menu and for Right Click Menu).

But I tried this application on my target platform, which has GTK+ 2.14 installed
Does not recognize GtkMenu or GtkMenuItem.

What should I do now? I need to use GtkMenu with GtkMenuItems but I can't upgrade target platform to use GTK+ 2.16.

So questions are:

  1. Does GTK+ 2.14 support GtkMenu and GtkImageMenuItem/GtkMenuItems?
  2. If not what should we use instead?
A: 

GtkMenu is a core GTK+ class. It's been in there since the first (2.0) version of the current series, and was even in GTK+ 1.x.

I think the same holds true for GtkMenuItem; there are things (like the submenu property) that are noted as having been added in 2.12, for instance.

Not sure what that says about your problem; perhaps you're mis-interpreting some error message?

UPDATE: It does seem GtkImageMenuItem is new; perhaps you can emulate it using a plain menu item?

unwind
When i run my app i am not able to see file menu... i am getting Error Unknow Gtk Widget: GtkImageMenuItem... Plus GtkMenu Widget is disabled in Glade when i select Gtk version as Gtk+-2.14. Glade don't have separate GtkMenu widget or GtkMenuItem widget it has Menu Bar which comes with file menu only, so we can't JUST use GtkMenu or GtkMenuItem separately.
PP
Okay ... I don't work with Glade myself, I do all my GTK+ interface development by using the API "manually", directly from the code. :|
unwind
Is It that Gtk-2.14.0 Does not support GtkMenu/GtkMenuItem ? Can't I add it Manually with Coding without using Glade Rad tool?
PP
A: 

The issue isn't that GTK+ 2.14 doesn't support GtkMenu and friends. It's that the UI building infrastructure, GtkBuilder, doesn't support creating them from XML specifications. Unfortunately I'm not sure what the recommended solution is/was; I'm dealing with the same problem myself.

Peter Williams
A: 

Gtk 2.14 definitly support menuitem, menubar etc.. You are most likely saving your user interface as a gtkbuilder UI.

GtkBuilder is taking over libglade. Unfortunatly, GtkBuilder in gtk2.14 doesn't yet support the construction of menubar and menuitem, even though gtk2.14 totally support menubar and menuitem.

What are your options?

  1. Stay as you are, your project is fully operational on gtk >= 2.16 (gtkbuilder can create menuitem in gtk >=2.16)

  2. Save your user interface as a glade user interface and then your project will work fine on gtk 2.14. You will need to use libglade instead of gtkbuilder to load the interface, connect the signals etc. However it is a bad option since libglade will slowly diseapear.

  3. If building your app on gtk2.14 is really important, then you will want to build your menu without gtkbuilder, but directly write the code. (you will need to see the 2.14 documentation, go to http://library.gnome.org/devel/gtk/2.14/GtkMenuBar.html ).

I'll go for option 3. Good luck.

Christophe

Christophe