Re: About GtkBuilder, GMenu, and GAction (was Re: Deprecation of GtkImageMenuItem)

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

 



hi;

you can set an id attribute on any section, and then retrieve the
GMenu associated with that section, at which point you can add any
further item there, e.g.:

  <section>
    <attribute name="id">view-placeholder</attribute>
    <item>
      ...
    </item>
  </section>

then use the GMenuModel API to iterate over the menu until you hit the
section with the "view-placeholder" id attribute. at that point, you
can use the GMenu API to add items at that section. gedit has some
simple code that handles their extension mechanism for menus:

https://git.gnome.org/browse/gedit/tree/gedit/gedit-app.c#n1613

and a class that handles appending/prepending/removing menus by using
a "merge-id" attribute on the GMenuItem added by an extension.

ciao,
 Emmanuele.

On 23 October 2014 10:58, Jean Brefort <jean.brefort@xxxxxxxxxxxxxx> wrote:
> Le jeudi 23 octobre 2014 à 10:31 +0100, Emmanuele Bassi a écrit :
>> another recommendation is to *not* use GtkMenu and friends directly,
>> but to use GtkBuilder, GAction, and GMenu — follow the "How Do I"
>> document here: https://developer.gnome.org/GMenu/ — to describe your
>> menus with XML, which also lets you specify icons for specific menu
>> items.
>
> Hi Emmanuele,
>
> I read that documentation, but I'm unsure about how I might use
> placeholders with this (not so) new API, as I could do when using
> GtkUIManager. Is it possible? or not?
>
> Best regards,
> Jean
>



-- 
http://www.bassi.io
[@] ebassi [@gmail.com]
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux