[glom] ImageGlom: Do not try to get a thumbnail for non-image, non-evince types.



commit 28a2d1c534db64b7596141fbeffc2c18b4774731
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 15 10:13:19 2011 +0200

    ImageGlom: Do not try to get a thumbnail for non-image, non-evince types.
    
    * glom/utility_widgets/imageglom.cc: Just use g_content_type_get_icon(),
    to avoid saving temporary files of huge content, such as video, when just
    navigating through rows.

 ChangeLog                         |    8 ++++++
 glom/utility_widgets/imageglom.cc |   50 +-----------------------------------
 2 files changed, 10 insertions(+), 48 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b8cff98..dc373c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-07-15  Murray Cumming  <murrayc murrayc com>
 
+	ImageGlom: Do not try to get a thumbnail for non-image, non-evince types.
+	
+	* glom/utility_widgets/imageglom.cc: Just use g_content_type_get_icon(),
+	to avoid saving temporary files of huge content, such as video, when just 
+	navigating through rows.
+
+2011-07-15  Murray Cumming  <murrayc murrayc com>
+
 	ImageGlom: Remove unused member variable.
 
 	* glom/utility_widgets/imageglom.[h|cc]: Also add a comment that 
diff --git a/glom/utility_widgets/imageglom.cc b/glom/utility_widgets/imageglom.cc
index a16807b..3ab4ca9 100644
--- a/glom/utility_widgets/imageglom.cc
+++ b/glom/utility_widgets/imageglom.cc
@@ -374,54 +374,8 @@ void ImageGlom::show_image_data()
     }
     else
     {
-      //Try to use a thumbnail via GFile:
-      //TODO: Do this asynchronously:
-      const Glib::ustring uri = save_to_temp_file(false /* don't show progress */);
-      if(uri.empty())
-      {
-        std::cerr << G_STRFUNC << "Could not save temp file to get a thumbnail." << std::endl;
-      }
-      else
-      {
-        Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(uri);
-        Glib::RefPtr<const Gio::FileInfo> file_info;
-
-        try
-        {
-          file_info = file->query_info(
-            G_FILE_ATTRIBUTE_THUMBNAIL_PATH ","
-            G_FILE_ATTRIBUTE_THUMBNAILING_FAILED ","
-            G_FILE_ATTRIBUTE_STANDARD_ICON);
-        }
-        catch(const Glib::Error& ex)
-        {
-          std::cerr << G_STRFUNC << ": query_info() failed: " << ex.what() << std::endl;
-        }
-      
-        if(file_info)
-        {
-          const std::string filepath = 
-            file_info->get_attribute_byte_string(G_FILE_ATTRIBUTE_THUMBNAIL_PATH);
-          const bool failed = 
-            file_info->get_attribute_boolean(G_FILE_ATTRIBUTE_THUMBNAILING_FAILED);
-          if(!filepath.empty())
-            m_pixbuf_original = Gdk::Pixbuf::create_from_file(filepath);
-          else
-          {
-            std::cerr << G_STRFUNC << ": Could not get attribute G_FILE_ATTRIBUTE_THUMBNAIL_PATH. failed=" << failed << std::endl;
-            //Note that gnome_desktop_thumbnail_factory_new() fails too, and 
-            //also requires a filepath rather than data in memory.
-            
-            //Use the standard icon instead:
-            icon = file_info->get_icon();
-            if(!icon)
-            {
-               std::cerr << G_STRFUNC << ": Could not get G_FILE_ATTRIBUTE_STANDARD_ICON" << std::endl;
-            }
-            
-          }
-        }
-      }
+      //Get an icon for the file type;
+      icon = Gio::content_type_get_icon(mime_type);
     }
     
     if(m_pixbuf_original)



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