gtk-demo: Put hte app menu in a separate file

No need to cram it in the same file as the main window.
This commit is contained in:
Matthias Clasen
2016-02-27 23:43:06 -05:00
parent 9d5ad67c91
commit 492fec6294
4 changed files with 21 additions and 16 deletions

19
demos/gtk-demo/appmenu.ui Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.10 -->
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<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>
</interface>

View File

@ -2,6 +2,7 @@
<gresources> <gresources>
<gresource prefix="/ui"> <gresource prefix="/ui">
<file preprocess="xml-stripblanks">main.ui</file> <file preprocess="xml-stripblanks">main.ui</file>
<file preprocess="xml-stripblanks">appmenu.ui</file>
</gresource> </gresource>
<gresource prefix="/application_demo"> <gresource prefix="/application_demo">
<file>application.c</file> <file>application.c</file>

View File

@ -920,7 +920,7 @@ startup (GApplication *app)
gchar *ids[] = { "appmenu", NULL }; gchar *ids[] = { "appmenu", NULL };
builder = gtk_builder_new (); builder = gtk_builder_new ();
gtk_builder_add_objects_from_resource (builder, "/ui/main.ui", ids, NULL); gtk_builder_add_objects_from_resource (builder, "/ui/appmenu.ui", ids, NULL);
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu"); appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");

View File

@ -1,21 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<!-- interface-requires gtk+ 3.10 --> <!-- interface-requires gtk+ 3.10 -->
<menu id="appmenu">
<section>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
<section>
<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>
<object class="GtkTreeStore" id="treestore"> <object class="GtkTreeStore" id="treestore">
<columns> <columns>
<!-- column-name NAME --> <!-- column-name NAME -->