widget-factory: Use the new application resource support
This commit is contained in:
@ -60,6 +60,7 @@ uninstall-update-icon-cache:
|
|||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
widget-factory.ui \
|
widget-factory.ui \
|
||||||
|
menus.ui \
|
||||||
widget-factory.gresource.xml
|
widget-factory.gresource.xml
|
||||||
|
|
||||||
-include $(top_srcdir)/git.mk
|
-include $(top_srcdir)/git.mk
|
||||||
|
|||||||
19
demos/widget-factory/menus.ui
Normal file
19
demos/widget-factory/menus.ui
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
|
<menu id="app-menu">
|
||||||
|
<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>
|
||||||
@ -230,22 +230,6 @@ on_entry_icon_release (GtkEntry *entry,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
startup (GApplication *app)
|
|
||||||
{
|
|
||||||
GtkBuilder *builder;
|
|
||||||
GMenuModel *appmenu;
|
|
||||||
|
|
||||||
builder = gtk_builder_new ();
|
|
||||||
gtk_builder_add_from_resource (builder, "/ui/widget-factory.ui", NULL);
|
|
||||||
|
|
||||||
appmenu = (GMenuModel *)gtk_builder_get_object (builder, "appmenu");
|
|
||||||
|
|
||||||
gtk_application_set_app_menu (GTK_APPLICATION (app), appmenu);
|
|
||||||
|
|
||||||
g_object_unref (builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_header (GtkListBoxRow *row,
|
update_header (GtkListBoxRow *row,
|
||||||
GtkListBoxRow *before,
|
GtkListBoxRow *before,
|
||||||
@ -437,7 +421,6 @@ main (int argc, char *argv[])
|
|||||||
app_entries, G_N_ELEMENTS (app_entries),
|
app_entries, G_N_ELEMENTS (app_entries),
|
||||||
app);
|
app);
|
||||||
|
|
||||||
g_signal_connect (app, "startup", G_CALLBACK (startup), NULL);
|
|
||||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||||
|
|
||||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||||
|
|||||||
@ -3,4 +3,7 @@
|
|||||||
<gresource prefix="/ui">
|
<gresource prefix="/ui">
|
||||||
<file preprocess="xml-stripblanks">widget-factory.ui</file>
|
<file preprocess="xml-stripblanks">widget-factory.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
|
<gresource prefix="/org/gtk/WidgetFactory/gtk">
|
||||||
|
<file preprocess="xml-stripblanks">menus.ui</file>
|
||||||
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|||||||
@ -1,21 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<interface>
|
<interface>
|
||||||
<!-- interface-requires gtk+ 3.0 -->
|
<!-- interface-requires gtk+ 3.0 -->
|
||||||
<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>
|
|
||||||
<menu id="gear_menu">
|
<menu id="gear_menu">
|
||||||
<section>
|
<section>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user