From cf457eea72b81850da5503d0091952871135c1fd Mon Sep 17 00:00:00 2001 From: Martin Owens Date: Wed, 28 Jun 2017 09:04:16 +0200 Subject: Refactor profile directory use and promote IO::Resource get_path and get_filename methods --- src/widgets/icon.cpp | 10 ++++++---- src/widgets/toolbox.cpp | 14 +++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 885deaab7..730fe3e31 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -34,6 +34,7 @@ #include "display/drawing-item.h" #include "display/drawing.h" #include "io/sys.h" +#include "io/resource.h" #include "sp-root.h" #include "sp-namedview.h" #include "util/units.h" @@ -1237,14 +1238,15 @@ GdkPixbuf *get_cached_pixbuf(Glib::ustring const &key) { std::list &IconImpl::icons_svg_paths() { + using namespace Inkscape::IO::Resource; static std::list sources; static bool initialized = false; if (!initialized) { // Fall back from user prefs dir into system locations. - gchar *userdir = Inkscape::Application::profile_path("icons"); - sources.push_back(g_build_filename(userdir,"icons.svg", NULL)); - sources.push_back(g_build_filename(INKSCAPE_PIXMAPDIR, "icons.svg", NULL)); - g_free(userdir); + // doctormo 2017 hackfest - I've left this modification very light + // because there is a refactoring of the icons underway. + sources.push_back(g_strdup(get_path(USER, ICONS, "icons.svg"))); + sources.push_back(g_strdup(get_path(SYSTEM, ICONS, "icons.svg"))); initialized = true; } return sources; diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 65c54f0ce..672cb708b 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -102,7 +102,7 @@ using Inkscape::UI::ToolboxFactory; using Inkscape::UI::Tools::ToolBase; using Inkscape::IO::Resource::get_filename; -using Inkscape::IO::Resource::UI; +using Inkscape::IO::Resource::UIS; typedef void (*SetupFunction)(GtkWidget *toolbox, SPDesktop *desktop); typedef void (*UpdateFunction)(SPDesktop *desktop, ToolBase *eventcontext, GtkWidget *toolbox); @@ -840,10 +840,10 @@ static void setupToolboxCommon( GtkWidget *toolbox, gtk_ui_manager_insert_action_group( mgr, mainActions->gobj(), 0 ); - char const *filename = get_filename(UI, ui_file); - gtk_ui_manager_add_ui_from_file( mgr, filename, &err ); + Glib::ustring filename = get_filename(UIS, ui_file); + gtk_ui_manager_add_ui_from_file( mgr, filename.c_str(), &err ); if(err) { - g_warning("Failed to load %s: %s", filename, err->message); + g_warning("Failed to load %s: %s", filename.c_str(), err->message); g_error_free(err); return; } @@ -984,10 +984,10 @@ void setup_aux_toolbox(GtkWidget *toolbox, SPDesktop *desktop) GError *err = 0; gtk_ui_manager_insert_action_group( mgr, mainActions->gobj(), 0 ); - char const *filename = get_filename(UI, "select-toolbar.ui"); - guint ret = gtk_ui_manager_add_ui_from_file(mgr, filename, &err); + Glib::ustring filename = get_filename(UIS, "select-toolbar.ui"); + guint ret = gtk_ui_manager_add_ui_from_file(mgr, filename.c_str(), &err); if(err) { - g_warning("Failed to load aux toolbar %s: %s", filename, err->message); + g_warning("Failed to load aux toolbar %s: %s", filename.c_str(), err->message); g_error_free(err); return; } -- cgit v1.2.3