node-editor: Add a menu items for auto reloading

Expose the auto-reload property as a toggle action, and add
a menu item for it.
This commit is contained in:
Matthias Clasen 2024-01-14 13:29:24 -05:00
parent 911730493d
commit 2771befdd9
2 changed files with 14 additions and 0 deletions

View File

@ -1892,6 +1892,8 @@ initiate_autosave (NodeEditorWindow *self)
static void
node_editor_window_init (NodeEditorWindow *self)
{
GAction *action;
gtk_widget_init_template (GTK_WIDGET (self));
self->auto_reload = TRUE;
@ -1908,6 +1910,10 @@ node_editor_window_init (NodeEditorWindow *self)
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
action = G_ACTION (g_property_action_new ("auto-reload", self, "auto-reload"));
g_action_map_add_action (G_ACTION_MAP (self), action);
g_object_unref (action);
self->tag_table = gtk_text_tag_table_new ();
gtk_text_tag_table_add (self->tag_table,
g_object_new (GTK_TYPE_TEXT_TAG,

View File

@ -2,6 +2,14 @@
<interface>
<menu id="gear_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Reload automatically</attribute>
<attribute name="action">win.auto-reload</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>