conformal / gotk3

Go bindings for GTK3
ISC License
470 stars 81 forks source link

Support for GtkMenuItem sub-types #51

Closed Avinash-Bhat closed 10 years ago

Avinash-Bhat commented 10 years ago

the subtypes of GtkImageMenuItem, GtkCheckMenuItem GtkSeparatorMenuItem, GtkTearoffMenuItem are missing and trying to access them throws errors like

unrecognized class name 'GtkImageMenuItem'

This is quite unfortunate as there is no way to connect the activate signal on them.

jrick commented 10 years ago

GtkImageMenuItem and GtkTearoffMenuItem are deprecated (since GTK 3.10 and 3.4 respectively) so I won't add support for those. GtkSeparatorMenuItem is already implemented. I'll work on adding support for GtkCheckMenuItem.

jrick commented 10 years ago

It hasn't been mentioned yet, but GtkRadioMenuItem needs to be implemented as well.

Avinash-Bhat commented 10 years ago

GtkImageMenuItem and GtkTearoffMenuItem are deprecated (since GTK 3.10 and 3.4 respectively)

That's a shame :-) I am using Glade (gtk2) and was trying to convert a python project (hobby project) to Go. Everything but this is working out so well.

BTW, Although it's true that GtkImageMenuItem is deprecated, the release notes itself mentions that it will be available until gtk+ 4. (see: https://mail.gnome.org/archives/gtk-list/2013-September/msg00021.html)

  • We've started deprecating stock APIs, including GtkIconFactory, GtkIconSet, GtkIconSource, GtkImageMenuItem, GtkAction, GtkUIManager. These APIs will continue to work until GTK+ 4, so there is no need to rush to replace them.

So will it be supported or ignored as others?

jrick commented 10 years ago

I'd rather not. The reasons being:

  1. Go treats all build warnings as errors. Disabling the deprecated warnings is possible, but I like this strictness and removing it can hide bugs later.
  2. In general, I'd like to see applications be updated to support the latest GTK, and for more users to run the latest release, than for developers to keep targeting aging libraries. Personally, I consider 3.10 to be a major improvement over earlier releases and there are many features I'd love to use, but am realistically unable to since almost every Linux distro out there likes to keep their GTK version as ancient as possible. When developers target newer stable releases, it encourges distributions to support these new releases as well. This is how open source software improves.

Since GtkImageMenuItem isn't deprecated in <=3.8, I'd be willing to take a patch for it that is only included when built with the gtk_3_6 and gtk_3_8 build tags. There are other projects that need my attention more, however, so I won't do it.

Another option that may be possible in your situation may be to wrap both the Image and AccelLabel in a Box or Grid and Add() it to a MenuItem (since the MenuItem is a Bin). Untested, but it might achieve your goal. You could also search for posts on the gtk mailing list about menu images (or make a new post if none) and see what plans upstream has for them.

jrick commented 10 years ago

Here's a short example of creating a custom menuicon widget: http://sprunge.us/iDDg

Looks like it could use some spacing love to make it look like old GTK, but it's a start.