help-browser: move menu to XML

This commit is contained in:
Zander Brown 2023-08-09 22:43:55 +01:00 committed by Alx Sa
parent 7d1eac18ca
commit efabebd0bb
5 changed files with 84 additions and 72 deletions

View File

@ -299,78 +299,7 @@ gimp_help_browser_dialog_init (GimpHelpBrowserDialog *self)
gtk_widget_show (toolbar);
/* Context menu */
builder = gtk_builder_new_from_string (
"<interface>"
"<menu id=\"help_browser_popup_menu\">"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">_Back</attribute>"
"<attribute name=\"action\">win.back</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">_Previous</attribute>"
"<attribute name=\"action\">win.forward</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">_Reload</attribute>"
"<attribute name=\"action\">win.reload</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">_Stop</attribute>"
"<attribute name=\"action\">win.stop</attribute>"
"</item>"
"</section>"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">_Home</attribute>"
"<attribute name=\"action\">win.home</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">C_opy location</attribute>"
"<attribute name=\"action\">win.copy-location</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">S_how index</attribute>"
"<attribute name=\"action\">win.show-index</attribute>"
"</item>"
"</section>"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Find</attribute>"
"<attribute name=\"action\">win.find</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Find _Again</attribute>"
"<attribute name=\"action\">win.find-again</attribute>"
"</item>"
"</section>"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Zoom in</attribute>"
"<attribute name=\"action\">win.zoom-in</attribute>"
"</item>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Zoom out</attribute>"
"<attribute name=\"action\">win.zoom-out</attribute>"
"</item>"
"</section>"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Close</attribute>"
"<attribute name=\"action\">win.close</attribute>"
"</item>"
"</section>"
"</menu>"
"<menu id=\"help_browser_copy_popup_menu\">"
"<section>"
"<item>"
"<attribute name=\"label\" translatable=\"yes\">Copy selection</attribute>"
"<attribute name=\"action\">win.copy-selection</attribute>"
"</item>"
"</section>"
"</menu>"
"</interface>",
-1);
builder = gtk_builder_new_from_resource ("/org/gimp/help/help-menu.ui");
self->popup_menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "help_browser_popup_menu"));
g_object_ref (self->popup_menu_model);
self->copy_popup_menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "help_browser_copy_popup_menu"));

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="help_browser_popup_menu">
<section>
<item>
<attribute name="label" translatable="yes">_Back</attribute>
<attribute name="action">win.back</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Previous</attribute>
<attribute name="action">win.forward</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Reload</attribute>
<attribute name="action">win.reload</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Stop</attribute>
<attribute name="action">win.stop</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Home</attribute>
<attribute name="action">win.home</attribute>
</item>
<item>
<attribute name="label" translatable="yes">C_opy location</attribute>
<attribute name="action">win.copy-location</attribute>
</item>
<item>
<attribute name="label" translatable="yes">S_how index</attribute>
<attribute name="action">win.show-index</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Find</attribute>
<attribute name="action">win.find</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Find _Again</attribute>
<attribute name="action">win.find-again</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Zoom in</attribute>
<attribute name="action">win.zoom-in</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Zoom out</attribute>
<attribute name="action">win.zoom-out</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Close</attribute>
<attribute name="action">win.close</attribute>
</item>
</section>
</menu>
<menu id="help_browser_copy_popup_menu">
<section>
<item>
<attribute name="label" translatable="yes">Copy selection</attribute>
<attribute name="action">win.copy-selection</attribute>
</item>
</section>
</menu>
</interface>

View File

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

View File

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

View File

@ -159,6 +159,7 @@ plug-ins/gimpressionist/utils.c
plug-ins/gradient-flare/gradient-flare.c
plug-ins/help-browser/dialog.c
plug-ins/help-browser/help-browser.c
plug-ins/help-browser/help-menu.ui
plug-ins/help/gimphelpdomain.c
plug-ins/help/gimphelplocale.c
plug-ins/ifs-compose/ifs-compose.c