diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-07-01 02:03:38 +0000 |
| commit | 0d5bb885dee83f041830dc950d3be6f21a37f08b (patch) | |
| tree | 88a0ae7a15ed496ddad1f83f43547783b88843ac /src/extension | |
| parent | Bug fixes (diff) | |
| parent | Add Mac CI build config (diff) | |
| download | inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.tar.gz inkscape-0d5bb885dee83f041830dc950d3be6f21a37f08b.zip | |
update to trunk
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/error-file.cpp | 3 | ||||
| -rw-r--r-- | src/extension/extension.cpp | 3 | ||||
| -rw-r--r-- | src/extension/init.cpp | 31 | ||||
| -rw-r--r-- | src/extension/internal/filter/filter-file.cpp | 21 | ||||
| -rw-r--r-- | src/extension/internal/filter/filter.h | 1 |
5 files changed, 30 insertions, 29 deletions
diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp index 342511ec9..063e43f42 100644 --- a/src/extension/error-file.cpp +++ b/src/extension/error-file.cpp @@ -18,6 +18,7 @@ #include "inkscape.h" #include "preferences.h" #include "extension/extension.h" +#include "io/resource.h" #include "error-file.h" @@ -51,7 +52,7 @@ ErrorFileNotice::ErrorFileNotice (void) : // \FIXME change this /* This is some filler text, needs to change before relase */ Glib::ustring dialog_text(_("<span weight=\"bold\" size=\"larger\">One or more extensions failed to load</span>\n\nThe failed extensions have been skipped. Inkscape will continue to run normally but those extensions will be unavailable. For details to troubleshoot this problem, please refer to the error log located at: ")); - gchar * ext_error_file = Inkscape::Application::profile_path(EXTENSION_ERROR_LOG_FILENAME); + gchar * ext_error_file = Inkscape::IO::Resource::log_path(EXTENSION_ERROR_LOG_FILENAME); dialog_text += ext_error_file; g_free(ext_error_file); set_message(dialog_text, true); diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 497f98431..9c0221521 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -33,6 +33,7 @@ #include "dependency.h" #include "timer.h" #include "param/parameter.h" +#include "io/resource.h" namespace Inkscape { namespace Extension { @@ -658,7 +659,7 @@ Extension::set_param_color (const gchar * name, guint32 color, SPDocument * doc, void Extension::error_file_open (void) { - gchar * ext_error_file = Inkscape::Application::profile_path(EXTENSION_ERROR_LOG_FILENAME); + gchar * ext_error_file = Inkscape::IO::Resource::log_path(EXTENSION_ERROR_LOG_FILENAME); gchar * filename = g_filename_from_utf8( ext_error_file, -1, NULL, NULL, NULL ); error_file.open(filename); if (!error_file.is_open()) { diff --git a/src/extension/init.cpp b/src/extension/init.cpp index af7af2cb1..a40196a74 100644 --- a/src/extension/init.cpp +++ b/src/extension/init.cpp @@ -60,11 +60,13 @@ #endif #include "preferences.h" #include "io/sys.h" +#include "io/resource.h" #ifdef WITH_DBUS #include "dbus/dbus-init.h" #endif #ifdef WITH_IMAGE_MAGICK +#include <Magick++.h> #include "internal/bitmap/adaptiveThreshold.h" #include "internal/bitmap/addNoise.h" #include "internal/bitmap/blur.h" @@ -106,6 +108,8 @@ #include "init.h" +using namespace Inkscape::IO::Resource; + namespace Inkscape { namespace Extension { @@ -113,7 +117,7 @@ namespace Extension { the extension directory and parsed */ #define SP_MODULE_EXTENSION "inx" -static void build_module_from_dir(gchar const *dirname); +static void build_module_from_domain(Domain domain); static void check_extensions(); /** @@ -150,7 +154,7 @@ update_pref(Glib::ustring const &pref_path, * Invokes the init routines for internal modules. * * This should be a list of all the internal modules that need to initialized. This is just a - * convinent place to put them. Also, this function calls build_module_from_dir to parse the + * convinent place to put them. Also, this function calls build_module_from_domain to parse the * Inkscape extensions directory. */ void @@ -201,6 +205,8 @@ init() /* Raster Effects */ #ifdef WITH_IMAGE_MAGICK + Magick::InitializeMagick(NULL); + Internal::Bitmap::AdaptiveThreshold::init(); Internal::Bitmap::AddNoise::init(); Internal::Bitmap::Blur::init(); @@ -240,18 +246,8 @@ init() Internal::Filter::Filter::filters_all(); - /* Load search path for extensions */ - if (Inkscape::Extension::Extension::search_path.size() == 0) - { - Inkscape::Extension::Extension::search_path.push_back(Inkscape::Application::profile_path("extensions")); - - Inkscape::Extension::Extension::search_path.push_back(g_strdup(INKSCAPE_EXTENSIONDIR)); - - } - - for (unsigned int i=0; i<Inkscape::Extension::Extension::search_path.size(); i++) { - build_module_from_dir(Inkscape::Extension::Extension::search_path[i]); - } + build_module_from_domain(USER); + build_module_from_domain(SYSTEM); /* this is at the very end because it has several catch-alls * that are possibly over-ridden by other extensions (such as @@ -282,8 +278,10 @@ init() * with their filenames. */ static void -build_module_from_dir(gchar const *dirname) +build_module_from_domain(Domain domain) { + char const *dirname = get_path(domain, EXTENSIONS); + if (!dirname) { g_warning("%s", _("Null external module directory name. Modules will not be loaded.")); return; @@ -293,7 +291,8 @@ build_module_from_dir(gchar const *dirname) return; } - //# Hopefully doing this the Glib way is portable + // TODO: We may have to get to why this is needed, since it seems redundent. + Inkscape::Extension::Extension::search_path.push_back(dirname); GError *err; GDir *directory = g_dir_open(dirname, 0, &err); diff --git a/src/extension/internal/filter/filter-file.cpp b/src/extension/internal/filter/filter-file.cpp index b1993057d..dfe889ddf 100644 --- a/src/extension/internal/filter/filter-file.cpp +++ b/src/extension/internal/filter/filter-file.cpp @@ -8,6 +8,7 @@ #include "filter.h" #include "io/sys.h" +#include "io/resource.h" #include "io/inkscapestream.h" /* Directory includes */ @@ -22,27 +23,27 @@ #include <glibmm/i18n.h> #include <glibmm/fileutils.h> +using namespace Inkscape::IO::Resource; + namespace Inkscape { namespace Extension { namespace Internal { namespace Filter { +void filters_load_domain(Domain domain, gchar *menuname); + void Filter::filters_all_files(void) { - gchar *filtersProfilePath = Inkscape::Application::profile_path("filters"); - - filters_load_dir(INKSCAPE_FILTERDIR, _("Bundled")); - filters_load_dir(filtersProfilePath, _("Personal")); - - g_free(filtersProfilePath); - filtersProfilePath = 0; + filters_load_domain(SYSTEM, _("Bundled")); + filters_load_domain(USER, _("Personal")); } #define INKSCAPE_FILTER_FILE ".svg" -void -Filter::filters_load_dir (gchar const * dirname, gchar * menuname) +void filters_load_domain(Domain domain, gchar *menuname) { + char const *dirname = get_path(domain, FILTERS); + if (!dirname) { g_warning("%s", _("Null external module directory name. Filters will not be loaded.")); return; @@ -72,7 +73,7 @@ Filter::filters_load_dir (gchar const * dirname, gchar * menuname) } gchar *pathname = g_build_filename(dirname, filename, NULL); - filters_load_file(pathname, menuname); + Filter::filters_load_file(pathname, menuname); g_free(pathname); } diff --git a/src/extension/internal/filter/filter.h b/src/extension/internal/filter/filter.h index 9aaa84aec..d4728b69c 100644 --- a/src/extension/internal/filter/filter.h +++ b/src/extension/internal/filter/filter.h @@ -53,7 +53,6 @@ public: /* File loader related */ static void filters_all_files(void); - static void filters_load_dir(gchar const * filename, gchar * menuname); static void filters_load_file(gchar * filename, gchar * menuname); static void filters_load_node(Inkscape::XML::Node * node, gchar * menuname); |
