summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2008-11-27 21:35:19 +0000
committerjoncruz <joncruz@users.sourceforge.net>2008-11-27 21:35:19 +0000
commit414de3cc7a9446a22b87e6215bc1570f03823aa7 (patch)
tree37ddf4d047eb275c0ce12a7703ebf365aac01f99 /src
parentFix compile with lcms disabled. (diff)
downloadinkscape-414de3cc7a9446a22b87e6215bc1570f03823aa7.tar.gz
inkscape-414de3cc7a9446a22b87e6215bc1570f03823aa7.zip
Rearrange to enable code that does not directly rely on lcms.
(bzr r6910)
Diffstat (limited to 'src')
-rw-r--r--src/color-profile.cpp21
-rw-r--r--src/color-profile.h3
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp11
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<gchar *> ColorProfile::getProfileDirs() {
- std::list<gchar *> sources;
+std::list<Glib::ustring> ColorProfile::getProfileDirs() {
+ std::list<Glib::ustring> sources;
gchar* base = profile_path("XXX");
{
@@ -587,20 +586,18 @@ std::list<gchar *> ColorProfile::getProfileDirs() {
return sources;
}
-#endif // ENABLE_LCMS
static void findThings() {
- std::list<gchar *> sources = ColorProfile::getProfileDirs();
+ std::list<Glib::ustring> 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<Glib::ustring>::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 <glib/gtypes.h>
#include <sp-object.h>
+#include <glibmm/ustring.h>
#if ENABLE_LCMS
#include <lcms.h>
#endif // ENABLE_LCMS
@@ -32,9 +33,9 @@ struct ColorProfile : public SPObject {
static GType getType();
static void classInit( ColorProfileClass *klass );
+ static std::list<Glib::ustring> getProfileDirs();
#if ENABLE_LCMS
static cmsHPROFILE getSRGBProfile();
- static std::list<gchar *> 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<gchar *> sources = ColorProfile::getProfileDirs();
- while (!sources.empty()) {
- gchar* dirname = sources.front();
- gchar* part = g_strdup_printf("\n%s", dirname);
+ std::list<Glib::ustring> sources = ColorProfile::getProfileDirs();
+ for ( std::list<Glib::ustring>::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, "",