[gthumb] Seem to need slow mimetype checking on the gphoto backend



commit a03866b06f22b2012c0956e6a514622b14f666aa
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Mon Jun 8 10:17:04 2009 -0400

    Seem to need slow mimetype checking on the gphoto backend
    
    Also, some logical fixes.
---
 libgthumb/gfile-utils.c  |    5 ++++-
 src/dlg-photo-importer.c |   12 ++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/libgthumb/gfile-utils.c b/libgthumb/gfile-utils.c
index 7886988..669941b 100644
--- a/libgthumb/gfile-utils.c
+++ b/libgthumb/gfile-utils.c
@@ -255,8 +255,11 @@ gfile_get_mime_type (GFile      *file,
                 else
                         value = g_file_info_get_content_type (info);
 
-		if (!value)
+		if (!value) {
+			char *utf8_path = g_file_get_parse_name (file);
+			debug (DEBUG_INFO, "%s returned a NULL mime type", utf8_path);
 			return NULL;
+		}
 		
                 /*
                  * If the file content is determined to be binary data (octet-stream), check for
diff --git a/src/dlg-photo-importer.c b/src/dlg-photo-importer.c
index f41e2bd..dfca171 100644
--- a/src/dlg-photo-importer.c
+++ b/src/dlg-photo-importer.c
@@ -522,7 +522,7 @@ gfile_import_file_list_recursive (GFile  *gfile,
                         files = gfile_import_file_list_recursive (child, files);
                         break;
                 case G_FILE_TYPE_REGULAR:
-			mime_type = gfile_get_mime_type (child, TRUE);
+			mime_type = gfile_get_mime_type (child, FALSE);
 		        if ((mime_type_is_image (mime_type) ||
 		             mime_type_is_video (mime_type) ||
 		             mime_type_is_audio (mime_type)))
@@ -562,6 +562,7 @@ get_all_files (DialogData *data)
 	if (data->gfile_import_from && !gfile_is_dir (data->gfile_import_from)) {
 		_gtk_info_dialog_run (GTK_WINDOW (data->dialog), _("%s is not a valid directory, scanning for attached devices instead"), utf8_path);
 	} else if (data->gfile_import_from) {
+		debug (DEBUG_INFO, "Scanning %s for folders", utf8_path);
 		if (data->dcim_dirs_only) {
 			data->dcim_dirs = gfile_import_dir_list_recursive (data->gfile_import_from,
 									   data->dcim_dirs, NULL, 0);
@@ -569,13 +570,12 @@ get_all_files (DialogData *data)
 			data->dcim_dirs = g_list_prepend (data->dcim_dirs,
 							  data->gfile_import_from);
 			}
-
-		if (!file_list) {
-			_gtk_info_dialog_run (GTK_WINDOW (data->dialog), _("No files found in %s, scanning for attached devices instead"), utf8_path);
-		}
 	}
 
-	if (!file_list) {
+	if (data->gfile_import_from && !data->dcim_dirs)
+		_gtk_info_dialog_run (GTK_WINDOW (data->dialog), _("No folders found in %s, scanning for attached devices instead"), utf8_path);
+
+	if (!data->dcim_dirs) {
 		char *gvfs_dir = g_strconcat (g_get_home_dir (), "/", ".gvfs", NULL);
 		GFile *gfile = gfile_new (gvfs_dir);
 		data->dcim_dirs = gfile_import_dir_list_recursive (gfile, data->dcim_dirs, "gphoto", 0);



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