summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/help.cpp20
-rw-r--r--src/help.h2
-rw-r--r--src/verbs.cpp39
3 files changed, 25 insertions, 36 deletions
diff --git a/src/help.cpp b/src/help.cpp
index 3c76797c0..fd935e8c2 100644
--- a/src/help.cpp
+++ b/src/help.cpp
@@ -17,28 +17,36 @@
#include "file.h"
#include "help.h"
+#include "io/resource.h"
#include "io/sys.h"
#include "path-prefix.h"
#include "ui/dialog/aboutbox.h"
#include "ui/interface.h"
+
+using namespace Inkscape::IO::Resource;
+
+
void sp_help_about()
{
Inkscape::UI::Dialog::AboutBox::show_about();
}
-void sp_help_open_tutorial(GtkMenuItem *, void* data)
+void sp_help_open_tutorial(Glib::ustring name)
{
- gchar const *name = static_cast<gchar const *>(data);
- gchar *c = g_build_filename(INKSCAPE_TUTORIALSDIR, name, NULL);
- if (Inkscape::IO::file_test(c, G_FILE_TEST_EXISTS)) {
- sp_file_open(c, nullptr, false, false);
+ Glib::ustring filename = name + ".svg";
+ // TRANSLATORS: 'en' is a ISO 639-1 language code.
+ // Replace with language code for your language (i.e. the name of your .po file)
+ Glib::ustring filename_localized = name + "." + _("en") + ".svg";
+
+ filename = get_filename(TUTORIALS, filename.c_str(), filename_localized.c_str());
+ if (!filename.empty()) {
+ sp_file_open(filename.c_str(), nullptr, false, false);
} else {
sp_ui_error_dialog(_("The tutorial files are not installed.\nFor Linux, you may need to install "
"'inkscape-tutorials'; for Windows, please re-run the setup and select 'Tutorials'.\nThe "
"tutorials can also be found online at https://inkscape.org/learn/tutorials/"));
}
- g_free(c);
}
/*
diff --git a/src/help.h b/src/help.h
index 810cec4e6..efdbe5349 100644
--- a/src/help.h
+++ b/src/help.h
@@ -18,7 +18,7 @@ typedef struct _GtkMenuItem GtkMenuItem;
* Help/About window.
*/
void sp_help_about();
-void sp_help_open_tutorial(GtkMenuItem * /*unused*/, void* data);
+void sp_help_open_tutorial(Glib::ustring name);
#endif // !SEEN_HELP_H
diff --git a/src/verbs.cpp b/src/verbs.cpp
index deedecf75..ad8f21787 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -2305,20 +2305,11 @@ void HelpVerb::perform(SPAction *action, void *data)
case SP_VERB_HELP_ABOUT:
sp_help_about();
break;
- case SP_VERB_HELP_ABOUT_EXTENSIONS: {
+ case SP_VERB_HELP_ABOUT_EXTENSIONS:
// Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
// panel->set_full(true);
// show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
break;
- }
-
- /*
- case SP_VERB_SHOW_LICENSE:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
- break;
- */
-
case SP_VERB_HELP_MEMORY:
INKSCAPE.dialogs_unhide();
dt->_dlg_mgr->showDialog("Memory");
@@ -2336,45 +2327,35 @@ void TutorialVerb::perform(SPAction *action, void *data)
g_return_if_fail(ensure_desktop_valid(action));
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_TUTORIAL_BASIC:
- // TRANSLATORS: If you have translated the tutorial-basic.en.svgz file to your language,
- // then translate this string as "tutorial-basic.LANG.svgz" (where LANG is your language
- // code); otherwise leave as "tutorial-basic.svg".
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-basic.svg"));
+ sp_help_open_tutorial("tutorial-basic");
break;
case SP_VERB_TUTORIAL_SHAPES:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-shapes.svg"));
+ sp_help_open_tutorial("tutorial-shapes");
break;
case SP_VERB_TUTORIAL_ADVANCED:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-advanced.svg"));
+ sp_help_open_tutorial("tutorial-advanced");
break;
#if HAVE_POTRACE
case SP_VERB_TUTORIAL_TRACING:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-tracing.svg"));
+ sp_help_open_tutorial("tutorial-tracing");
break;
#endif
case SP_VERB_TUTORIAL_TRACING_PIXELART:
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-tracing-pixelart.svg"));
+ sp_help_open_tutorial("tutorial-tracing-pixelart");
break;
case SP_VERB_TUTORIAL_CALLIGRAPHY:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-calligraphy.svg"));
+ sp_help_open_tutorial("tutorial-calligraphy");
break;
case SP_VERB_TUTORIAL_INTERPOLATE:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-interpolate.svg"));
+ sp_help_open_tutorial("tutorial-interpolate");
break;
case SP_VERB_TUTORIAL_DESIGN:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-elements.svg"));
+ sp_help_open_tutorial("tutorial-elements");
break;
case SP_VERB_TUTORIAL_TIPS:
- // TRANSLATORS: See "tutorial-basic.svg" comment.
- sp_help_open_tutorial(nullptr, (gpointer)_("tutorial-tips.svg"));
+ sp_help_open_tutorial("tutorial-tips");
break;
default:
break;