GtkBuilder: change format of menus

Change the format of GtkBuilder <menu> to be more in-line with the style
of the rest of GtkBuilder so that we can do translation in a consistent
way.

The format is now substantially more difficult to hand-write, but tools
should be along soon.

There is an xslt program attached to the bug to help you convert your
existing .ui files from the old format to the new one.

https://bugzilla.gnome.org/show_bug.cgi?id=668696
This commit is contained in:
Ryan Lortie
2012-01-25 18:23:25 -05:00
parent c76cccd437
commit eed307713b
7 changed files with 526 additions and 76 deletions

View File

@ -18,8 +18,7 @@
</object>
</child>
<child>
<object class="GtkSeparatorToolItem" id="sep">
</object>
<object class="GtkSeparatorToolItem" id="sep"/>
</child>
<child>
<object class="GtkToolButton" id="logo">
@ -97,6 +96,9 @@
</child>
</object>
<menu id="toolmenu">
<item label='File1' action='win.file1'/>
<item>
<attribute name="label">File1</attribute>
<attribute name="action">win.file1</attribute>
</item>
</menu>
</interface>

View File

@ -2,39 +2,106 @@
<interface>
<menu id="appmenu">
<section>
<item label="_New" action="app.new" accel="&lt;Primary&gt;n"/>
<item label="_Open" action="app.open"/>
<item label="_Save" action="app.save" accel="&lt;Primary&gt;s"/>
<item label="Save _As..." action="app.save-as" accel="&lt;Primary&gt;s"/>
<item>
<attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">app.new</attribute>
<attribute name="accel">&lt;Primary&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open</attribute>
<attribute name="action">app.open</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">app.save</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _As...</attribute>
<attribute name="action">app.save-as</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
</section>
<section>
<item label="_Quit" action="app.quit" accel="&lt;Primary&gt;q"/>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">app.quit</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
</menu>
<menu id="menubar">
<submenu label="_Preferences">
<submenu>
<attribute name="label" translatable="yes">_Preferences</attribute>
<section>
<item label="_Prefer Dark Theme" action="app.dark"/>
<item label="_Hide Titlebar when maximized" action="win.titlebar"/>
<submenu label="_Color">
<item>
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>
<attribute name="action">app.dark</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Hide Titlebar when maximized</attribute>
<attribute name="action">win.titlebar</attribute>
</item>
<submenu>
<attribute name="label" translatable="yes">_Color</attribute>
<section>
<item label="_Red" action="app.color" target="red" accel="&lt;Primary&gt;r"/>
<item label="_Green" action="app.color" target="green" accel="&lt;Primary&gt;g"/>
<item label="_Blue" action="app.color" target="blue" accel="&lt;Primary&gt;b"/>
<item>
<attribute name="label" translatable="yes">_Red</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">red</attribute>
<attribute name="accel">&lt;Primary&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Green</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">green</attribute>
<attribute name="accel">&lt;Primary&gt;g</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Blue</attribute>
<attribute name="action">app.color</attribute>
<attribute name="target">blue</attribute>
<attribute name="accel">&lt;Primary&gt;b</attribute>
</item>
</section>
</submenu>
<submenu label="_Shape">
<submenu>
<attribute name="label" translatable="yes">_Shape</attribute>
<section>
<item label="_Square" action="win.shape" target="square" accel="&lt;Primary&gt;s"/>
<item label="_Rectangle" action="win.shape" target="rectangle" accel="&lt;Primary&gt;r"/>
<item label="_Oval" action="win.shape" target="oval" accel="&lt;Primary&gt;o"/>
<item>
<attribute name="label" translatable="yes">_Square</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">square</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Rectangle</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">rectangle</attribute>
<attribute name="accel">&lt;Primary&gt;r</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Oval</attribute>
<attribute name="action">win.shape</attribute>
<attribute name="target">oval</attribute>
<attribute name="accel">&lt;Primary&gt;o</attribute>
</item>
</section>
</submenu>
<item label="_Bold" action="win.bold" accel="&lt;Primary&gt;b"/>
<item>
<attribute name="label" translatable="yes">_Bold</attribute>
<attribute name="action">win.bold</attribute>
<attribute name="accel">&lt;Primary&gt;b</attribute>
</item>
</section>
</submenu>
<submenu label="_Help">
<item label="_About" action="win.about" accel="&lt;Primary&gt;a"/>
<submenu>
<attribute name="label" translatable="yes">_Help</attribute>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute>
<attribute name="accel">&lt;Primary&gt;a</attribute>
</item>
</submenu>
</menu>
</interface>