Re: Using Gtk.Builder to create a menubar.



Yes, actions get a prefix depending on where you put them. Every "action
container" has a prefix. In your case you add_action() to
GtkApplicationWindow and its prefix is "win"

I used your code to create an answer to my StackOverflow question
https://stackoverflow.com/a/50051155/4865723


great!

Luca

2018-04-27 12:24 GMT+02:00 Marius Gedminas <marius gedmin as>:

On Thu, Apr 26, 2018 at 09:46:57PM +0200, c buhtz posteo jp wrote:
Thank you very much. Your example works for me but I don't understand
why. ;)

                <attribute name='action'>win.bar</attribute>

        action_bar = Gio.SimpleAction.new('bar', None)

The name of the action in the XML and the code is different. Why? What
is the system behind it?

"bar" is the name of the action.  "win" describes the action's scope.

Check out the "Action scopes" section in https://developer.gnome.org/
GAction/
and a brief discussion on "quit" vs "app.quit" in the GActionMap
section.

Marius Gedminas
--
My own take on it as a writer is that I am passing my story across to Ms.
Average Reader, who works all day (or night) as a nurse in a children's
cancer
hospice. She doesn't need some writer lecturing her about the human
condition.
She needs someone to hand her a drink.
                -- Lois McMaster Bujold's take on grimdark fiction

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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