From 7b51296159813ffbc382e4decef735f222ee23f8 Mon Sep 17 00:00:00 2001 From: joncruz Date: Thu, 27 Nov 2008 21:35:19 +0000 Subject: [PATCH] Rearrange to enable code that does not directly rely on lcms. --- src/color-profile.cpp | 21 +++++++-------------- src/color-profile.h | 3 ++- src/ui/dialog/inkscape-preferences.cpp | 11 +++-------- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 5a2a1efc9..9ac1f6414 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -562,9 +562,8 @@ Glib::ustring Inkscape::get_path_for_profile(Glib::ustring const& name) return result; } -#if ENABLE_LCMS -std::list ColorProfile::getProfileDirs() { - std::list sources; +std::list ColorProfile::getProfileDirs() { + std::list sources; gchar* base = profile_path("XXX"); { @@ -587,20 +586,18 @@ std::list ColorProfile::getProfileDirs() { return sources; } -#endif // ENABLE_LCMS static void findThings() { - std::list sources = ColorProfile::getProfileDirs(); + std::list sources = ColorProfile::getProfileDirs(); - while (!sources.empty()) { - gchar *dirname = sources.front(); - if ( g_file_test( dirname, G_FILE_TEST_EXISTS ) && g_file_test( dirname, G_FILE_TEST_IS_DIR ) ) { + for ( std::list::const_iterator it = sources.begin(); it != sources.end(); ++it ) { + if ( g_file_test( it->c_str(), G_FILE_TEST_EXISTS ) && g_file_test( it->c_str(), G_FILE_TEST_IS_DIR ) ) { GError *err = 0; - GDir *dir = g_dir_open(dirname, 0, &err); + GDir *dir = g_dir_open(it->c_str(), 0, &err); if (dir) { for (gchar const *file = g_dir_read_name(dir); file != NULL; file = g_dir_read_name(dir)) { - gchar *filepath = g_build_filename(dirname, file, NULL); + gchar *filepath = g_build_filename(it->c_str(), file, NULL); if ( g_file_test( filepath, G_FILE_TEST_IS_DIR ) ) { @@ -654,10 +651,6 @@ static void findThings() { } } } - - // toss the dirname - g_free(dirname); - sources.pop_front(); } } diff --git a/src/color-profile.h b/src/color-profile.h index 0c4ec8e09..2e57e7ef0 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -7,6 +7,7 @@ #include #include +#include #if ENABLE_LCMS #include #endif // ENABLE_LCMS @@ -32,9 +33,9 @@ struct ColorProfile : public SPObject { static GType getType(); static void classInit( ColorProfileClass *klass ); + static std::list getProfileDirs(); #if ENABLE_LCMS static cmsHPROFILE getSRGBProfile(); - static std::list getProfileDirs(); icColorSpaceSignature getColorSpace() const {return _profileSpace;} icProfileClassSignature getProfileClass() const {return _profileClass;} diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 43d1ea88c..b1a14e781 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -816,16 +816,12 @@ void InkscapePreferences::initPageCMS() _page_cms.add_group_header( _("Display adjustment")); -#if ENABLE_LCMS Glib::ustring tmpStr; - std::list sources = ColorProfile::getProfileDirs(); - while (!sources.empty()) { - gchar* dirname = sources.front(); - gchar* part = g_strdup_printf("\n%s", dirname); + std::list sources = ColorProfile::getProfileDirs(); + for ( std::list::const_iterator it = sources.begin(); it != sources.end(); ++it ) { + gchar* part = g_strdup_printf( "\n%s", it->c_str() ); tmpStr += part; g_free(part); - g_free(dirname); - sources.pop_front(); } gchar* profileTip = g_strdup_printf(_("The ICC profile to use to calibrate display output.\nSearched directories:%s"), tmpStr.c_str()); @@ -833,7 +829,6 @@ void InkscapePreferences::initPageCMS() profileTip, false); g_free(profileTip); profileTip = 0; -#endif // ENABLE_LCMS _cms_from_display.init( _("Retrieve profile from display"), "/options/displayprofile/from_display", false); _page_cms.add_line( false, "", _cms_from_display, "", -- 2.30.2