GtkImageMenuItem replacement

Simon Steinbeiß simon at xfce.org
Sat Jun 6 10:23:40 CEST 2015


On Fri, 05 Jun 2015 16:12:30 +0000
Eric <eric.koegel at gmail.com> wrote:

> On Thu, Jun 4, 2015 at 4:11 AM Matthew Brush <mbrush at codebrainz.ca> wrote:
> 
> > On 2015-06-03 11:00 AM, flo.xfce at gmx-topmail.de wrote:
> > > Hey everyone,
> > > another mail regarding the GTK3 port.
> > > One really big issue is the deprecation of GtkImageMenuItem. There was a
> > > discussion on this list in February on this topic, but as I see it,
> > > without a final statement.
> > > So now I ask: How do we replace it?
> > > Just drop it?
> > > Use GMenu which still has icon support (but with different semantics)?
> > > Or write a wrapper in libxfceui4 which packs a GtkGrid with an icon and
> > > a label into the GtkMenuItem (which is derived from GtkBin)?
> > >
> > > Hopefully, these are the only three options but I fear there are more.
> > > For the sake of consistency I would greatly appreciate if a core
> > > developer would make a final statement so that individual patches from
> > > possibly a lot of different contributors follow the same "port rules".
> > >
> >
> > When stuff is deprecated in GTK+, it will still be available until at
> > least the next major version.
> >
> > IMO, it would be more useful to focus on porting the stuff that won't
> > work at all on GTK+3 (ex. sealed members, dropped APIs, etc) first,
> > rather than spending time porting all the loads of deprecated stuff,
> > much of which has no suitable replacements yet, and will likely be still
> > working fine and supported for the next decade or more.
> >
> > My 2 cents, as a pragmatic application developer.
> >
> > Cheers,
> > Matthew Brush
> >
> 
> Hey,
> 
>   For most menu items you can just make a box, image, and label then pack
> the image and label inside the box. That works with both Gtk 2 and 3. You
> can see the Garcon patch as an example:
> http://git.xfce.org/xfce/garcon/diff/garcon-gtk/garcon-gtk-menu.c?id=4f746d15a648984bfe7fffe81a988a4c834b59d8
> 
>   If you have a more complex menu setup like xfpm, then yeah, just wait for
> Gtk4 to become an issue.

+1 to what Eric said :)

Let me just add one detail: the main difference between using GtkMenuItem with a GtkBox holding a GtkLabel and GtkImage versus a GtkImageMenuItem is the space on the left, which is reserved for things like Checks and Radioitems in the menu and which gets used by GtkImageMenuItem but is always kept free with GtkMenuItem (unless you brutally override it, but it feels more like a hack).

Cheers
Simon


More information about the Xfce4-dev mailing list