gui: make the app menu translatable
Fixes #216 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
f01651bf5e
commit
cb72111910
|
@ -9,5 +9,6 @@
|
||||||
<file preprocess="xml-stripblanks">ui/SetupPerspective.ui</file>
|
<file preprocess="xml-stripblanks">ui/SetupPerspective.ui</file>
|
||||||
<file preprocess="xml-stripblanks">ui/ErrorPerspective.ui</file>
|
<file preprocess="xml-stripblanks">ui/ErrorPerspective.ui</file>
|
||||||
<file preprocess="xml-stripblanks">input-tablet-missing-symbolic.svg</file>
|
<file preprocess="xml-stripblanks">input-tablet-missing-symbolic.svg</file>
|
||||||
|
<file preprocess="xml-stripblanks">ui/AppMenu.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
<interface>
|
||||||
|
<menu id="primary-menu">
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Portrait</attribute>
|
||||||
|
<attribute name="action">win.orientation</attribute>
|
||||||
|
<attribute name="target">portrait</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Landscape</attribute>
|
||||||
|
<attribute name="action">win.orientation</attribute>
|
||||||
|
<attribute name="target">landscape</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Help</attribute>
|
||||||
|
<attribute name="action">app.help</attribute>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">About</attribute>
|
||||||
|
<attribute name="action">app.about</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
</menu>
|
||||||
|
</interface>
|
|
@ -2,6 +2,7 @@ data/org.freedesktop.Tuhi.appdata.xml.in.in
|
||||||
data/org.freedesktop.Tuhi.desktop.in
|
data/org.freedesktop.Tuhi.desktop.in
|
||||||
|
|
||||||
data/ui/AboutDialog.ui.in
|
data/ui/AboutDialog.ui.in
|
||||||
|
data/ui/AppMenu.ui
|
||||||
data/ui/Drawing.ui
|
data/ui/Drawing.ui
|
||||||
data/ui/DrawingPerspective.ui
|
data/ui/DrawingPerspective.ui
|
||||||
data/ui/ErrorPerspective.ui
|
data/ui/ErrorPerspective.ui
|
||||||
|
|
|
@ -24,36 +24,6 @@ from gi.repository import Gtk, Gio, GLib, GObject # NOQA
|
||||||
|
|
||||||
logger = logging.getLogger('tuhi.gui.window')
|
logger = logging.getLogger('tuhi.gui.window')
|
||||||
|
|
||||||
MENU_XML = """
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<interface>
|
|
||||||
<menu id="primary-menu">
|
|
||||||
<section>
|
|
||||||
<item>
|
|
||||||
<attribute name="label" translatable="yes">Portrait</attribute>
|
|
||||||
<attribute name="action">win.orientation</attribute>
|
|
||||||
<attribute name="target">portrait</attribute>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<attribute name="label" translatable="yes">Landscape</attribute>
|
|
||||||
<attribute name="action">win.orientation</attribute>
|
|
||||||
<attribute name="target">landscape</attribute>
|
|
||||||
</item>
|
|
||||||
</section>
|
|
||||||
<section>
|
|
||||||
<item>
|
|
||||||
<attribute name="label" translatable="yes">Help</attribute>
|
|
||||||
<attribute name="action">app.help</attribute>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<attribute name="label" translatable="yes">About</attribute>
|
|
||||||
<attribute name="action">app.about</attribute>
|
|
||||||
</item>
|
|
||||||
</section>
|
|
||||||
</menu>
|
|
||||||
</interface>
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
@Gtk.Template(resource_path="/org/freedesktop/Tuhi/ui/ErrorPerspective.ui")
|
@Gtk.Template(resource_path="/org/freedesktop/Tuhi/ui/ErrorPerspective.ui")
|
||||||
class ErrorPerspective(Gtk.Box):
|
class ErrorPerspective(Gtk.Box):
|
||||||
|
@ -140,7 +110,7 @@ class MainWindow(Gtk.ApplicationWindow):
|
||||||
action.set_state(GLib.Variant.new_string(Config().orientation))
|
action.set_state(GLib.Variant.new_string(Config().orientation))
|
||||||
self.add_action(action)
|
self.add_action(action)
|
||||||
|
|
||||||
builder = Gtk.Builder.new_from_string(MENU_XML, -1)
|
builder = Gtk.Builder.new_from_resource('/org/freedesktop/Tuhi/ui/AppMenu.ui')
|
||||||
menu = builder.get_object("primary-menu")
|
menu = builder.get_object("primary-menu")
|
||||||
self.menubutton1.set_menu_model(menu)
|
self.menubutton1.set_menu_model(menu)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue