Hi all,

I am trying to add three items to a toolbar submenu, that when clicked should 
open the default browser with a particular url.

Based on https://wiki.gnome.org/HowDoI/GAction 
<https://wiki.gnome.org/HowDoI/GAction> and 
https://developer.gnome.org/gio/stable/GActionMap.html 
<https://developer.gnome.org/gio/stable/GActionMap.html>

I came up with something like:


<?xml version="1.0"?>
<interface>
        <menu id="menubar">
                <section>
                        <submenu>
                                <attribute name="label">_Help</attribute>
                                <section>
                                        <attribute 
name="id">help-section</attribute>
                                        <item>
                                                <attribute name="label">Visit 
site a</attribute>
                                                <attribute 
name="action">app.help-url('https://a.com')</attribute>
                                        </item>
                                        <item>
                                                <attribute name="label">Visit 
site b</attribute>
                                                <attribute 
name="action">app.help-url('https://b.com')</attribute>
                                        </item>
                                        <item>
                                                <attribute name="label">Visit 
site c</attribute>
                                                <attribute 
name="action">app.help-url('https://c.com')</attribute>
                                        </item>
                                </section>
                        </submenu>
                </section>
        </menu>
</interface>


In my GtkApplication derived class:

static GActionEntry app_entries[] = {
        {"help-url", help_url_activated, "s", NULL, NULL},
};


This causes the items to be shown in the menu, but they are not sensitive 
(cannot be activated).

The real example is considerably more complicated and also contains menu items 
with actions that do not require a parameter: these all work fine.

I am using the latest versions of Gtk+3 and Glib, in case it matters...

No errors or warnings are being shown in the terminal.

Many thanks for your comments in advance,

Tom
_______________________________________________
gtk-list mailing list
gtk-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to