♻️ Move main menu to separate file

This commit is contained in:
Simon Schneegans
2022-01-08 13:34:28 +01:00
parent 91daabd791
commit c154115192
4 changed files with 33 additions and 60 deletions
+1
View File
@@ -37,6 +37,7 @@ var PreferencesDialog = class PreferencesDialog {
// Load the user interface file. // Load the user interface file.
this._builder = new Gtk.Builder(); this._builder = new Gtk.Builder();
this._builder.add_from_resource(`/ui/common/main-menu.ui`);
this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/prefs.ui`);
this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/fire.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/fire.ui`);
this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/matrix.ui`); this._builder.add_from_resource(`/ui/${utils.isGTK4() ? 'gtk4' : 'gtk3'}/matrix.ui`);
+32
View File
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="main-menu">
<section>
<item>
<attribute name="label" translatable="yes">Visit Homepage</attribute>
<attribute name="action">prefs.homepage</attribute>
</item>
<item>
<attribute name="label" translatable="yes">View Changelog</attribute>
<attribute name="action">prefs.changelog</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Report a Bug</attribute>
<attribute name="action">prefs.bugs</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Donate</attribute>
<item>
<attribute name="label" translatable="yes">Via PayPal</attribute>
<attribute name="action">prefs.donate-paypal</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Via GitHub</attribute>
<attribute name="action">prefs.donate-github</attribute>
</item>
</submenu>
</section>
</menu>
</interface>
-30
View File
@@ -19,36 +19,6 @@
</data> </data>
</object> </object>
<menu id="main-menu">
<section>
<item>
<attribute name="label" translatable="yes">Visit Homepage</attribute>
<attribute name="action">prefs.homepage</attribute>
</item>
<item>
<attribute name="label" translatable="yes">View Changelog</attribute>
<attribute name="action">prefs.changelog</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Report a Bug</attribute>
<attribute name="action">prefs.bugs</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Donate</attribute>
<item>
<attribute name="label" translatable="yes">Via PayPal</attribute>
<attribute name="action">prefs.donate-paypal</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Via GitHub</attribute>
<attribute name="action">prefs.donate-github</attribute>
</item>
</submenu>
</section>
</menu>
<object class="GtkMenuButton" id="menu-button"> <object class="GtkMenuButton" id="menu-button">
<property name="menu-model">main-menu</property> <property name="menu-model">main-menu</property>
<property name="visible">1</property> <property name="visible">1</property>
-30
View File
@@ -27,36 +27,6 @@
</data> </data>
</object> </object>
<menu id="main-menu">
<section>
<item>
<attribute name="label" translatable="yes">Visit Homepage</attribute>
<attribute name="action">prefs.homepage</attribute>
</item>
<item>
<attribute name="label" translatable="yes">View Changelog</attribute>
<attribute name="action">prefs.changelog</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Report a Bug</attribute>
<attribute name="action">prefs.bugs</attribute>
</item>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Donate</attribute>
<item>
<attribute name="label" translatable="yes">Via PayPal</attribute>
<attribute name="action">prefs.donate-paypal</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Via GitHub</attribute>
<attribute name="action">prefs.donate-github</attribute>
</item>
</submenu>
</section>
</menu>
<object class="GtkMenuButton" id="menu-button"> <object class="GtkMenuButton" id="menu-button">
<property name="menu-model">main-menu</property> <property name="menu-model">main-menu</property>
<property name="icon-name">open-menu-symbolic</property> <property name="icon-name">open-menu-symbolic</property>