ifs: move menu to XML

See: https://gitlab.gnome.org/GNOME/gimp/-/issues/9776
This commit is contained in:
Zander Brown 2023-08-05 18:21:22 +01:00 committed by Alx Sa
parent 37220c5dab
commit 7d1eac18ca
5 changed files with 67 additions and 55 deletions

View file

@ -475,61 +475,7 @@ ifs_run (GimpProcedure *procedure,
ifs->app = gtk_application_new (NULL, G_APPLICATION_FLAGS_NONE);
#endif
ifs->builder = gtk_builder_new_from_string (
"<interface>"
"<menu id=\"ifs-compose-menu\">"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Move</attribute>"
"<attribute name=\"action\">app.transform</attribute>"
"<attribute name=\"target\">move</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Rotate</attribute>"
"<attribute name=\"action\">app.transform</attribute>"
"<attribute name=\"target\">rotate</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Stretch</attribute>"
"<attribute name=\"action\">app.transform</attribute>"
"<attribute name=\"target\">stretch</attribute>"
"</item>"
"</section>"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">New</attribute>"
"<attribute name=\"action\">app.new</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Delete</attribute>"
"<attribute name=\"action\">app.delete</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Undo</attribute>"
"<attribute name=\"action\">app.undo</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Redo</attribute>"
"<attribute name=\"action\">app.redo</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Select All</attribute>"
"<attribute name=\"action\">app.select-all</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Recompute Center</attribute>"
"<attribute name=\"action\">app.center</attribute>"
"</item>"
"</section>"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Render Options</attribute>"
"<attribute name=\"action\">app.options</attribute>"
"</item>"
"</section>"
"</menu>"
"</interface>",
-1);
ifs->builder = gtk_builder_new_from_resource ("/org/gimp/ifs/ifs-menus.ui");
gegl_init (NULL, NULL);

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gimp/ifs/">
<file preprocess="xml-stripblanks">ifs-menus.ui</file>
</gresource>
</gresources>

View file

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="ifs-compose-menu">
<section>
<item>
<attribute name="label" translatable="yes">Move</attribute>
<attribute name="action">app.transform</attribute>
<attribute name="target">move</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Rotate</attribute>
<attribute name="action">app.transform</attribute>
<attribute name="target">rotate</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Stretch</attribute>
<attribute name="action">app.transform</attribute>
<attribute name="target">stretch</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">New</attribute>
<attribute name="action">app.new</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Delete</attribute>
<attribute name="action">app.delete</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Undo</attribute>
<attribute name="action">app.undo</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Redo</attribute>
<attribute name="action">app.redo</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Select All</attribute>
<attribute name="action">app.select-all</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Recompute Center</attribute>
<attribute name="action">app.center</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Render Options</attribute>
<attribute name="action">app.options</attribute>
</item>
</section>
</menu>
</interface>

View file

@ -6,6 +6,11 @@ plugin_sources = [
'ifs-compose.c',
]
plugin_sources += gnome.compile_resources(
'ifs-menus',
'ifs-menus.gresource.xml',
)
if platform_windows
plugin_sources += windows.compile_resources(
gimp_plugins_rc,

View file

@ -162,6 +162,7 @@ plug-ins/help-browser/help-browser.c
plug-ins/help/gimphelpdomain.c
plug-ins/help/gimphelplocale.c
plug-ins/ifs-compose/ifs-compose.c
plug-ins/ifs-compose/ifs-menus.ui
plug-ins/imagemap/imap_about.c
plug-ins/imagemap/imap_browse.c
plug-ins/imagemap/imap_circle.c