[niepce] * Get rid of gnomevfs.



commit d720c144f6d370dd7fd94641fbaaad575c4efb3a
Author: Hubert Figuiere <hub figuiere net>
Date:   Sat May 2 19:32:51 2009 -0400

    	* Get rid of gnomevfs.
---
 ChangeLog                                   |    2 +
 README                                      |    6 +--
 configure.ac                                |   17 ++--------
 src/engine/db/Makefile.am                   |    2 +-
 src/engine/db/filebundle.cpp                |    2 +-
 src/engine/db/library.cpp                   |    2 +-
 src/engine/library/Makefile.am              |    3 +-
 src/fwk/toolkit/Makefile.am                 |    2 +-
 src/fwk/toolkit/imageloader.cpp             |    2 +-
 src/fwk/toolkit/mimetype.cpp                |   48 +++++++++------------------
 src/fwk/toolkit/mimetype.hpp                |   10 +++--
 src/niepce/Makefile.am                      |    2 +-
 src/niepce/modules/darkroom/Makefile.am     |    2 +-
 src/niepce/ui/Makefile.am                   |    2 +-
 src/niepce/ui/thumb-view/eog-thumb-view.cpp |    2 -
 15 files changed, 39 insertions(+), 65 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1e04930..7df0675 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2009-05-02  Hubert Figuiere  <hub figuiere net>
 
+	* Get rid of gnomevfs.
+
 	* Rename all C++ .h to .hpp
 
 	* Remove boost::array and use tr1 instead.
diff --git a/README b/README
index a2796db..498d649 100644
--- a/README
+++ b/README
@@ -25,9 +25,9 @@ A C++ compiler
 gtk+ 2.8
 cairo 1.1
 gtkmm 2.12
+giomm
 gconf 2.x
 cairomm
-gnome-vfs >= 2.14
 sqlite3
 libxml > 2.5.0
 boost 1.34
@@ -47,7 +47,7 @@ UNIX systems.
 Working on Debian
 ~~~~~~~~~~~~~~~~~
 In order to get Niepce working on Debian you should have to install:
-aptitude install gconf2-dev libgnomevfs2-dev \
+aptitude install gconf2-dev \
 > libexempi-dev libopenraw-dev libopenrawgnome-dev libgtkmm-2.4-dev \
 > libgoocanvas-dev
 
@@ -61,8 +61,6 @@ Working on SUSE
 To install the up to date dependencies, add the following repostitory to
 zypper using "zypper ar"
 
-For openSUSE 10.3
-http://download.opensuse.org/repositories/home:/hfiguiere/openSUSE_10.3/
 For openSUSE 11.0
 http://download.opensuse.org/repositories/home:/hfiguiere/openSUSE_11.0/
 For openSUSE 11.1
diff --git a/configure.ac b/configure.ac
index 76f3343..f648079 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,8 @@ AC_SUBST(NIEPCE_VERSION)
 
 dnl all the library version.
 dnl if one is harcoded elsewhere, it is a bug
-LIBGLIBMM_VERSION=2.0
+LIBGIOMM_VERSION=2.16
+LIBGLIBMM_VERSION=2.4
 LIBGTKMM_VERSION=2.12.0
 LIBGCONF_VERSION=2.0.0
 LIBGNOMEUI_VERSION=2.0.0
@@ -63,13 +64,10 @@ AC_PROG_LIBTOOL
 AC_LANG_CPLUSPLUS
 AC_LANG_COMPILER_REQUIRE
 
-PKG_CHECK_MODULES(LIBGLIBMM, [glibmm-2.4])
+PKG_CHECK_MODULES(LIBGLIBMM, [glibmm-2.4 >= $LIBGLIBMM_VERSION giomm-2.4 >= $LIBGIOMM_VERSION])
 PKG_CHECK_MODULES(LIBGTKMM, [gtkmm-2.4 >= $LIBGTKMM_VERSION])
 dnl PKG_CHECK_MODULES(LIBGCONFMM, [gconfmm-2.6 >= $LIBGCONFMM_VERSION])
 PKG_CHECK_MODULES(GCONF, [gconf-2.0 >= $LIBGCONF_VERSION])
-PKG_CHECK_MODULES(GNOMEVFS, [gnome-vfs-2.0 >= 2.12])
-PKG_CHECK_EXISTS([gnome-vfs-2.0 >= 2.14], [HAVE_GNOME_VFS_2_14=1], [HAVE_GNOME_VFS_2_14=0])
-dnl AC_SUBST(GNOMEVFS_VER)
 PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= $SQLITE_VERSION])
 PKG_CHECK_MODULES(EXEMPI, [exempi-2.0 >= $EXEMPI_VERSION])
 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= $LIBXML2_VERSION])
@@ -90,15 +88,6 @@ AC_SUBST(GEGLMM_LIBS)
 PKG_CHECK_MODULES(GOOCANVASMM, [goocanvasmm-1.0 >= $LIBGOOCANVASMM_VERSION])
 
 
-if test $HAVE_GNOME_VFS_2_14 = 1
-then
-	NIEPCE_BUILD_CONFIG="$NIEPCE_BUILD_CONFIG Gnome-VFS>=2.14"
-else
-	NIEPCE_BUILD_CONFIG="$NIEPCE_BUILD_CONFIG Gnome-VFS=2.12"	
-fi
-
-AC_DEFINE_UNQUOTED([HAVE_GNOME_VFS_2_14], [$HAVE_GNOME_VFS_2_14], [If gnome-vfs is at least 2.14])
-
 BOOST_REQUIRE([$BOOST_VERSION])
 BOOST_BIND
 BOOST_CONVERSION
diff --git a/src/engine/db/Makefile.am b/src/engine/db/Makefile.am
index 2789656..64bca47 100644
--- a/src/engine/db/Makefile.am
+++ b/src/engine/db/Makefile.am
@@ -11,7 +11,7 @@ TEST_LIBS =  \
 	$(top_builddir)/src/fwk/utils/libniepceutils.a \
 	$(top_builddir)/src/fwk/toolkit/libniepceframework.a \
 	$(top_builddir)/src/fwk/libfwk.a \
-	@LIBGTKMM_LIBS@ @GNOMEVFS_LIBS@ \
+	@LIBGTKMM_LIBS@ \
 	@BOOST_UNIT_TEST_FRAMEWORK_LIBS@ \
 	@BOOST_FILESYSTEM_LIBS@ \
 	@LIBGLIBMM_LIBS@ \
diff --git a/src/engine/db/filebundle.cpp b/src/engine/db/filebundle.cpp
index f5915f7..4982a94 100644
--- a/src/engine/db/filebundle.cpp
+++ b/src/engine/db/filebundle.cpp
@@ -32,7 +32,7 @@ void
 FileBundle::add(const boost::filesystem::path & path)
 {
     // TODO make it more reliable with more tests.
-    fwk::MimeType type(path);
+    fwk::MimeType type(path.string());
     
     if(type.isImage()) {
         if(type.isDigicamRaw()) {
diff --git a/src/engine/db/library.cpp b/src/engine/db/library.cpp
index dc7a6c9..ffc2822 100644
--- a/src/engine/db/library.cpp
+++ b/src/engine/db/library.cpp
@@ -263,7 +263,7 @@ int Library::addFile(int folder_id, const bfs::path & file, bool manage)
     try {
         int32_t rating, label_id, orientation;
         std::string label;  
-        fwk::MimeType mime = fwk::MimeType(file);
+        fwk::MimeType mime = fwk::MimeType(file.string());
         db::LibFile::FileType file_type = db::LibFile::mimetype_to_filetype(mime);
         utils::XmpMeta meta(file, file_type == db::LibFile::FILE_TYPE_RAW);
         label_id = 0;
diff --git a/src/engine/library/Makefile.am b/src/engine/library/Makefile.am
index b28bab7..c6119c7 100644
--- a/src/engine/library/Makefile.am
+++ b/src/engine/library/Makefile.am
@@ -1,7 +1,8 @@
 
 
 INCLUDES = -I$(top_srcdir)/src/ \
-	@LIBGTKMM_CFLAGS@ @OPENRAW_CFLAGS@ @EXEMPI_CFLAGS@
+	@LIBGLIBMM_CFLAGS@ @LIBGTKMM_CFLAGS@ \
+	@OPENRAW_CFLAGS@ @EXEMPI_CFLAGS@
 
 check_PROGRAMS = test_opqueue
 TESTS = test_opqueue
diff --git a/src/fwk/toolkit/Makefile.am b/src/fwk/toolkit/Makefile.am
index 7601bac..33546dd 100644
--- a/src/fwk/toolkit/Makefile.am
+++ b/src/fwk/toolkit/Makefile.am
@@ -4,7 +4,7 @@
 INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/ext \
 	@LIBGLIBMM_CFLAGS@ \
 	@LIBGTKMM_CFLAGS@ \
-	@GCONF_CFLAGS@  @GNOMEVFS_CFLAGS@ @EXEMPI_CFLAGS@ \
+	@GCONF_CFLAGS@  @EXEMPI_CFLAGS@ \
 	$(NULL)
 
 noinst_LIBRARIES = libniepceframework.a
diff --git a/src/fwk/toolkit/imageloader.cpp b/src/fwk/toolkit/imageloader.cpp
index 81a2072..1ca7bda 100644
--- a/src/fwk/toolkit/imageloader.cpp
+++ b/src/fwk/toolkit/imageloader.cpp
@@ -34,7 +34,7 @@ ImageLoader::ImageLoader(const boost::filesystem::path & file)
 Glib::RefPtr<Gdk::Pixbuf> ImageLoader::get_pixbuf()
 {
 	// TODO split get_pixbuf and the real load.
-	fwk::MimeType mime_type(m_file);
+	fwk::MimeType mime_type(m_file.string());
 	
 	Glib::RefPtr<Gdk::PixbufLoader> loader =  
 		Gdk::PixbufLoader::create(mime_type.string(), true);
diff --git a/src/fwk/toolkit/mimetype.cpp b/src/fwk/toolkit/mimetype.cpp
index 3ce9c17..220005e 100644
--- a/src/fwk/toolkit/mimetype.cpp
+++ b/src/fwk/toolkit/mimetype.cpp
@@ -18,71 +18,55 @@
  */
 
 #include <string>
-
-#include <boost/version.hpp>
+#include <boost/filesystem/path.hpp>
 #include <boost/filesystem/convenience.hpp>
-
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
+#include <giomm/contenttype.h>
 
 #include "config.h"
 
 #include "mimetype.hpp"
 
-namespace bfs = boost::filesystem;
-
 namespace fwk {
 
-MimeType::MimeType(const char * filename)
-    : m_path(filename)
+MimeType::MimeType(const std::string & filename)
 {
-#if HAVE_GNOME_VFS_2_14
-		m_type = gnome_vfs_get_mime_type_for_name(filename);
-#else
-		std::string f("file:///");
-		f += filename;
-		m_type = gnome_vfs_get_mime_type(f.c_str());
-#endif
+    Glib::RefPtr<Gio::File> file = Gio::File::create_for_path(filename);
+    m_fileinfo = file->query_info();
+		m_type = m_fileinfo->get_content_type();
 }
 
-MimeType::MimeType(const boost::filesystem::path & filename)
-    : m_path(filename)
+MimeType::MimeType(const Glib::RefPtr<Gio::File> & file)
 {
-#if HAVE_GNOME_VFS_2_14
-		m_type = gnome_vfs_get_mime_type_for_name(filename.string().c_str());
-#else
-		std::string f("file:///");
-		f += filename.string();
-		m_type = gnome_vfs_get_mime_type(f.c_str());
-#endif
+    m_fileinfo = file->query_info();
+		m_type = m_fileinfo->get_content_type();
 }
 
 bool MimeType::isDigicamRaw() const
 {
-		return (gnome_vfs_mime_type_get_equivalence(m_type.c_str(), 
-                                                "image/x-dcraw") 
-            != GNOME_VFS_MIME_UNRELATED);
+		return Gio::content_type_is_a(m_type, "image/x-dcraw");
 }
 
 
 bool MimeType::isImage() const
 {
-		return (gnome_vfs_mime_type_get_equivalence(m_type.c_str(), "image/*") 
-            != GNOME_VFS_MIME_UNRELATED);
+		return Gio::content_type_is_a(m_type, "image/*");
 }
 	
 
 bool MimeType::isUnknown() const
 {
-		return (m_type == GNOME_VFS_MIME_TYPE_UNKNOWN);
+		return Gio::content_type_is_unknown(m_type);
 }
 
 
 bool MimeType::isXmp() const
 {
+    boost::filesystem::path path = m_fileinfo->get_name();
+    
 #if BOOST_VERSION >= 103600
-    return m_path.extension() == ".xmp";
+    return path.extension() == ".xmp";
 #else
-    return extension(m_path) == ".xmp";
+    return extension(path) == ".xmp";
 #endif
 }
 	
diff --git a/src/fwk/toolkit/mimetype.hpp b/src/fwk/toolkit/mimetype.hpp
index 3ac1aff..e34e9da 100644
--- a/src/fwk/toolkit/mimetype.hpp
+++ b/src/fwk/toolkit/mimetype.hpp
@@ -22,15 +22,17 @@
 #define _FWK_MIMETYPE_H_
 
 #include <string>
-#include <boost/filesystem/path.hpp>
+
+#include <giomm/file.h>
+#include <giomm/fileinfo.h>
 
 namespace fwk {
 
 	class MimeType
 	{
 	public:
-		MimeType(const char *filename);
-		MimeType(const boost::filesystem::path & filename);
+		MimeType(const std::string & filename);
+    MimeType(const Glib::RefPtr<Gio::File> & file);
 
 		bool isDigicamRaw() const;
 		bool isImage() const;
@@ -40,7 +42,7 @@ namespace fwk {
 		const std::string & string() const
 			{ return m_type; }
 	private:
-		boost::filesystem::path m_path;
+    Glib::RefPtr<Gio::FileInfo> m_fileinfo;
 		std::string m_type;
 	};
 
diff --git a/src/niepce/Makefile.am b/src/niepce/Makefile.am
index 06545b2..1fcf387 100644
--- a/src/niepce/Makefile.am
+++ b/src/niepce/Makefile.am
@@ -27,7 +27,7 @@ niepce_LDADD = \
 	$(top_builddir)/src/ext/libview/libview.a \
 	@LIBGLIBMM_LIBS@ \
 	@LIBGTKMM_LIBS@ @SQLITE3_LIBS@ \
-	@GNOMEVFS_LIBS@ @GCONF_LIBS@ @LIBGLIBMM_LIBS@ \
+	@GCONF_LIBS@ \
 	@BOOST_FILESYSTEM_LIBS@  \
 	@GOOCANVASMM_LIBS@ @BABL_LIBS@ \
 	@GEGLMM_LIBS@ @OPENRAW_LIBS@ @EXEMPI_LIBS@
diff --git a/src/niepce/modules/darkroom/Makefile.am b/src/niepce/modules/darkroom/Makefile.am
index 5e3ea86..b02ebc1 100644
--- a/src/niepce/modules/darkroom/Makefile.am
+++ b/src/niepce/modules/darkroom/Makefile.am
@@ -5,7 +5,7 @@ INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/src/niepce -I$(top_srcdir)/src/ex
 	-DDATADIR=\"$(datadir)\" \
 	@LIBGLIBMM_CFLAGS@ \
 	@LIBGTKMM_CFLAGS@ \
-	@GNOMEVFS_CFLAGS@ @GCONF_CFLAGS@ \
+	@GCONF_CFLAGS@ \
 	@GOOCANVASMM_CFLAGS@  \
 	@GEGLMM_CFLAGS@ @EXEMPI_CFLAGS@ @OPENRAW_CFLAGS@
 
diff --git a/src/niepce/ui/Makefile.am b/src/niepce/ui/Makefile.am
index a2957f8..d0fc817 100644
--- a/src/niepce/ui/Makefile.am
+++ b/src/niepce/ui/Makefile.am
@@ -16,7 +16,7 @@ INCLUDES = -I$(top_srcdir)/src/ -I$(srcdir)/.. -I$(srcdir)/thumb-view \
 	-DDATADIR=\"$(datadir)\" \
 	@LIBGLIBMM_CFLAGS@ \
 	@LIBGTKMM_CFLAGS@ \
-	@GNOMEVFS_CFLAGS@ @GCONF_CFLAGS@ \
+	@GCONF_CFLAGS@ \
 	@GOOCANVASMM_CFLAGS@ \
 	@EXEMPI_CFLAGS@
 
diff --git a/src/niepce/ui/thumb-view/eog-thumb-view.cpp b/src/niepce/ui/thumb-view/eog-thumb-view.cpp
index 69b2010..54a7a32 100644
--- a/src/niepce/ui/thumb-view/eog-thumb-view.cpp
+++ b/src/niepce/ui/thumb-view/eog-thumb-view.cpp
@@ -36,8 +36,6 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <string.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
 
 #include "fwk/utils/boost.hpp"
 #include "engine/db/libfile.hpp"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]