summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es>2018-07-24 17:28:19 +0000
committerJabiertxo Arraiza Cenoz <jtx@jtx.markerlab.es>2018-07-24 17:28:19 +0000
commit2984959869ff341299e12f6b2ada2aba49fef2e4 (patch)
tree1a0af64b915b7952f270c4e1f464913722c90085 /src
parentToggle symbolic icons staff depending the theme has it or not (diff)
downloadinkscape-2984959869ff341299e12f6b2ada2aba49fef2e4.tar.gz
inkscape-2984959869ff341299e12f6b2ada2aba49fef2e4.zip
Add themes inkscape folder abailable by the app
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp30
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp7
2 files changed, 35 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index fb73eb810..108e5b0b2 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -80,6 +80,7 @@
#include "xml/repr.h"
+#include "io/resource.h"
#include "io/sys.h"
#include "debug/logger.h"
@@ -646,6 +647,34 @@ static void set_extensions_env()
//printf("PYTHONPATH = %s\n", g_getenv("PYTHONPATH"));
}
+static void set_datadir_env()
+{
+ using namespace Inkscape::IO::Resource;
+ gchar *datadir;
+
+#ifdef WIN32
+ datadir = g_win32_locale_filename_from_utf8(profile_path(""));
+#else
+ datadir = profile_path("");
+#endif
+
+ // On some platforms, INKSCAPE_EXTENSIONDIR is not absolute,
+ // but relative to the directory that contains the Inkscape executable.
+ // Since we spawn Python chdir'ed into the script's directory,
+ // we need to obtain the absolute path here.
+ if (!g_path_is_absolute(datadir)) {
+ gchar *curdir = g_get_current_dir();
+ gchar *datadir_new = g_build_filename(curdir, datadir, NULL);
+ g_free(datadir);
+ g_free(curdir);
+ datadir = datadir_new;
+ }
+
+ g_setenv("XDG_DATA_HOME", datadir, TRUE);
+ g_free(datadir);
+ //printf("XDG_DATA_HOME = %s\n", g_getenv("XDG_DATA_HOME"));
+}
+
/**
* This is the classic main() entry point of the program, though on some
* architectures it might be called by something else.
@@ -676,6 +705,7 @@ main(int argc, char **argv)
rt.setPathInfo();
}
#endif
+ set_datadir_env();
set_extensions_env();
// Prevents errors like "Unable to wrap GdkPixbuf..." (in nr-filter-image.cpp for example)
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 0a040f87d..bc940bbe2 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -624,8 +624,11 @@ void InkscapePreferences::symbolicThemeCheck()
folder.erase(0, last_slash_idx + 1);
}
if (folder == prefs->getString("/theme/iconTheme")) {
- //TODO: check this on WIN
- path += "/scalable/actions";
+#ifdef WIN32
+ path += g_win32_locale_filename_from_utf8("/scalable/actions");
+#else
+ path += "/scalable/actions";
+#endif
Glib::ustring ret = Glib::build_filename(path, "3dbox_four_handles-symbolic.svg");
if (Glib::file_test(ret, Glib::FILE_TEST_EXISTS)) {
symbolic = true;