From 8709e919997a8188d9e13cdfcd3bc65eda3cf9a2 Mon Sep 17 00:00:00 2001 From: Alx Sa Date: Wed, 9 Aug 2023 14:48:21 +0000 Subject: [PATCH] plug-ins: Make GFig menus translatable Based on the IMAP port in !1031, this moves the menu code to a separate file so that gettext can access it for translation. --- plug-ins/gfig/gfig-menu.ui | 147 ++++++++++++++++++++++++ plug-ins/gfig/gfig-menus.gresource.xml | 6 + plug-ins/gfig/gfig.c | 149 +------------------------ plug-ins/gfig/meson.build | 5 + po-plug-ins/POTFILES.in | 1 + 5 files changed, 160 insertions(+), 148 deletions(-) create mode 100644 plug-ins/gfig/gfig-menu.ui create mode 100644 plug-ins/gfig/gfig-menus.gresource.xml diff --git a/plug-ins/gfig/gfig-menu.ui b/plug-ins/gfig/gfig-menu.ui new file mode 100644 index 0000000000..d6238b46f5 --- /dev/null +++ b/plug-ins/gfig/gfig-menu.ui @@ -0,0 +1,147 @@ + + + +
+ + File + + Open + app.open + + + Save + app.save + + + Close + app.close + + + + Edit + + Undo + app.undo + + + Clear + app.clear + + + Grid + app.grid + + + Preferences + app.preferences + + +
+
+ +
+ + Line + app.shape + line + + + Rectangle + app.shape + rectangle + + + Circle + app.shape + circle + + + Ellipse + app.shape + ellipse + + + Arc + app.shape + arc + + + Polygon + app.shape + polygon + + + Star + app.shape + star + + + Spiral + app.shape + spiral + + + Bezier + app.shape + bezier + + + Move Object + app.shape + move-obj + + + Move Point + app.shape + move-point + + + Copy + app.shape + copy + + + Delete + app.shape + delete + + + Select + app.shape + select + +
+
+ + Raise + app.raise + + + Lower + app.lower + + + Top + app.top + + + Bottom + app.bottom + +
+
+ + Show Previous + app.show-prev + + + Show Next + app.show-next + + + Show All + app.show-all + +
+
+
\ No newline at end of file diff --git a/plug-ins/gfig/gfig-menus.gresource.xml b/plug-ins/gfig/gfig-menus.gresource.xml new file mode 100644 index 0000000000..c6fb8ae8b3 --- /dev/null +++ b/plug-ins/gfig/gfig-menus.gresource.xml @@ -0,0 +1,6 @@ + + + + gfig-menu.ui + + \ No newline at end of file diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index d58060024f..78107e8eb5 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -232,154 +232,7 @@ gfig_run (GimpProcedure *procedure, #endif gfig->success = FALSE; - gfig->builder = gtk_builder_new_from_string ( - "" - "" - "
" - "" - "File" - "" - "Open" - "app.open" - "" - "" - "Save" - "app.save" - "" - "" - "Close" - "app.close" - "" - "" - "" - "Edit" - "" - "Undo" - "app.undo" - "" - "" - "Clear" - "app.clear" - "" - "" - "Grid" - "app.grid" - "" - "" - "Preferences" - "app.preferences" - "" - "" - "
" - "
" - "" - "
" - "" - "Line" - "app.shape" - "line" - "" - "" - "Rectangle" - "app.shape" - "rectangle" - "" - "" - "Circle" - "app.shape" - "circle" - "" - "" - "Ellipse" - "app.shape" - "ellipse" - "" - "" - "Arc" - "app.shape" - "arc" - "" - "" - "Polygon" - "app.shape" - "polygon" - "" - "" - "Star" - "app.shape" - "star" - "" - "" - "Spiral" - "app.shape" - "spiral" - "" - "" - "Bezier" - "app.shape" - "bezier" - "" - "" - "Move Object" - "app.shape" - "move-obj" - "" - "" - "Move Point" - "app.shape" - "move-point" - "" - "" - "Copy" - "app.shape" - "copy" - "" - "" - "Delete" - "app.shape" - "delete" - "" - "" - "Select" - "app.shape" - "select" - "" - "
" - "
" - "" - "Raise" - "app.raise" - "" - "" - "Lower" - "app.lower" - "" - "" - "Top" - "app.top" - "" - "" - "Bottom" - "app.bottom" - "" - "
" - "
" - "" - "Show Previous" - "app.show-prev" - "" - "" - "Show Next" - "app.show-next" - "" - "" - "Show All" - "app.show-all" - "" - "
" - "
" - "
", - -1); + gfig->builder = gtk_builder_new_from_resource ("/org/gimp/gfig/gfig-menu.ui"); gfig_context = g_new0 (GFigContext, 1); diff --git a/plug-ins/gfig/meson.build b/plug-ins/gfig/meson.build index 30f5c1d4b5..d05740f327 100644 --- a/plug-ins/gfig/meson.build +++ b/plug-ins/gfig/meson.build @@ -23,6 +23,11 @@ plugin_sources = [ gfig_icon_sources, ] +plugin_sources += gnome.compile_resources( + 'gfig-menus', + 'gfig-menus.gresource.xml', +) + if platform_windows plugin_sources += windows.compile_resources( gimp_plugins_rc, diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in index 838e4b4ec1..e61fe25af3 100644 --- a/po-plug-ins/POTFILES.in +++ b/po-plug-ins/POTFILES.in @@ -139,6 +139,7 @@ plug-ins/gfig/gfig-preview.c plug-ins/gfig/gfig-spiral.c plug-ins/gfig/gfig-star.c plug-ins/gfig/gfig.c +plug-ins/gfig/gfig-menu.ui plug-ins/gimpressionist/brush.c plug-ins/gimpressionist/color.c plug-ins/gimpressionist/general.c