[solang] ContentTypeRepo::is_gdk_supported should take a content-type
- From: Debarshi Ray <debarshir src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [solang] ContentTypeRepo::is_gdk_supported should take a content-type
- Date: Fri, 25 Dec 2009 10:36:11 +0000 (UTC)
commit 3ba0bc4c1b68333ed38cfd49eeb6b67444ceccf8
Author: Debarshi Ray <rishi gnu org>
Date: Sat Dec 5 21:44:09 2009 +0200
ContentTypeRepo::is_gdk_supported should take a content-type
Since the content-type is stored in the photo we do not need to read
the file again.
src/attribute/thumbnail.cpp | 6 +++---
src/common/content-type-repo.cpp | 12 +++++-------
src/common/content-type-repo.h | 3 ++-
3 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/attribute/thumbnail.cpp b/src/attribute/thumbnail.cpp
index 2835ff1..4a57885 100644
--- a/src/attribute/thumbnail.cpp
+++ b/src/attribute/thumbnail.cpp
@@ -161,7 +161,7 @@ Thumbnail::generate(Exiv2::ExifData & exifData,
}
if (!ContentTypeRepo::instance()->is_gdk_supported(
- photo.get_disk_file_path())
+ photo.get_content_type())
&& !exifData.empty() )
{
// Extract from exif if present.
@@ -207,8 +207,8 @@ Thumbnail::generate(Exiv2::ExifData & exifData,
}
if (false == thumbnail_generated
- && ContentTypeRepo::instance()->is_gdk_supported(
- photo.get_disk_file_path()))
+ && ContentTypeRepo::instance()->is_gdk_supported(
+ photo.get_content_type()))
{
set_path( get_path() + ".jpg" );
generate_using_gdkpixbuf(photo.get_disk_file_path(),
diff --git a/src/common/content-type-repo.cpp b/src/common/content-type-repo.cpp
index b89358a..c7c52f6 100644
--- a/src/common/content-type-repo.cpp
+++ b/src/common/content-type-repo.cpp
@@ -79,14 +79,12 @@ ContentTypeRepo::get_content_type(const std::string &filename ) const throw()
}
bool
-ContentTypeRepo::is_gdk_supported(
- const std::string &filename ) const throw()
+ContentTypeRepo::is_gdk_supported(const Glib::ustring & content_type)
+ const throw()
{
- Glib::ustring contentType = get_content_type( filename );
- return std::binary_search(
- supportedTypes_.begin(), supportedTypes_.end(),
- contentType );
-
+ return std::binary_search(supportedTypes_.begin(),
+ supportedTypes_.end(),
+ content_type);
}
const ContentTypeRepoPtr
diff --git a/src/common/content-type-repo.h b/src/common/content-type-repo.h
index fd99ff4..ba26759 100644
--- a/src/common/content-type-repo.h
+++ b/src/common/content-type-repo.h
@@ -52,7 +52,8 @@ class ContentTypeRepo
get_content_type(const std::string & filename) const throw();
bool
- is_gdk_supported(const std::string & filename) const throw();
+ is_gdk_supported(const Glib::ustring & content_type) const
+ throw();
//Static
static const ContentTypeRepoPtr
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]