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:
19
demos/gtk-demo/appmenu.ui
Normal file
19
demos/gtk-demo/appmenu.ui
Normal 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"><Primary>q</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
|
</menu>
|
||||||
|
</interface>
|
||||||
@ -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>
|
||||||
|
|||||||
@ -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");
|
||||||
|
|
||||||
|
|||||||
@ -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"><Primary>q</attribute>
|
|
||||||
</item>
|
|
||||||
</section>
|
|
||||||
</menu>
|
|
||||||
<object class="GtkTreeStore" id="treestore">
|
<object class="GtkTreeStore" id="treestore">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name NAME -->
|
<!-- column-name NAME -->
|
||||||
|
|||||||
Reference in New Issue
Block a user