[gthumb/f12/master] - Fix import problem when camera / SF/CF card contains a bad file or a file for which no preview i
chkr
chkr at fedoraproject.org
Wed Sep 1 21:36:37 UTC 2010
commit 9cfb4a9874fbab9b6cbd3c18fb86e33eaf3e2974
Author: Christian Krause <chkr at fedoraproject.org>
Date: Wed Sep 1 23:36:33 2010 +0200
- Fix import problem when camera / SF/CF card contains a bad file or
a file for which no preview image could be generated by libgphoto2
(#619172)
- Upstream patch taken from http://git.gnome.org/browse/gthumb/commit/?h=gthumb-2-10&id=3c7d20b7022a0c4a6fb76500c20c7f836f66d899
...ed-import-from-camera-if-one-photo-is-bad.patch | 394 ++++++++++++++++++++
gthumb.spec | 12 +-
2 files changed, 405 insertions(+), 1 deletions(-)
---
diff --git a/0001-Fixed-import-from-camera-if-one-photo-is-bad.patch b/0001-Fixed-import-from-camera-if-one-photo-is-bad.patch
new file mode 100644
index 0000000..4fd6db8
--- /dev/null
+++ b/0001-Fixed-import-from-camera-if-one-photo-is-bad.patch
@@ -0,0 +1,394 @@
+From 3c7d20b7022a0c4a6fb76500c20c7f836f66d899 Mon Sep 17 00:00:00 2001
+From: Marcel Stimberg <stimberg at users.sourceforge.net>
+Date: Thu, 6 May 2010 09:28:55 +0200
+Subject: [PATCH] Fixed import from camera if one photo is bad
+
+[bug #521891]
+---
+ libgthumb/file-utils.c | 2 +-
+ src/dlg-photo-importer.c | 58 ++++++++++++++++++++---------------
+ src/gth-window-actions-callbacks.c | 54 ++++++++++++++++----------------
+ 3 files changed, 61 insertions(+), 53 deletions(-)
+
+diff --git a/libgthumb/file-utils.c b/libgthumb/file-utils.c
+index b4b2df5..22c3e92 100644
+--- a/libgthumb/file-utils.c
++++ b/libgthumb/file-utils.c
+@@ -2488,7 +2488,7 @@ get_temp_file_name (const char *tmpdir,
+
+ g_static_mutex_lock (&count_mutex);
+ if (ext != NULL)
+- name = g_strdup_printf ("%d%s", count++, ext);
++ name = g_strdup_printf ("%d.%s", count++, ext);
+ else
+ name = g_strdup_printf ("%d", count++);
+ g_static_mutex_unlock (&count_mutex);
+diff --git a/src/dlg-photo-importer.c b/src/dlg-photo-importer.c
+index 53a7ab2..ff4ba50 100644
+--- a/src/dlg-photo-importer.c
++++ b/src/dlg-photo-importer.c
+@@ -253,14 +253,14 @@ static void update_info (DialogData *data);
+ static gboolean async_operation_step (gpointer callback_data);
+
+
+-static void
++static void
+ async_operation_next_step (AsyncOperationData *aodata)
+ {
+ aodata->current++;
+ aodata->scan = aodata->scan->next;
+ aodata->timer_id = g_timeout_add (ASYNC_STEP_TIMEOUT,
+ async_operation_step,
+- aodata);
++ aodata);
+ }
+
+
+@@ -810,18 +810,24 @@ load_images_preview__step (AsyncOperationData *aodata,
+
+ camera_folder = remove_level_from_path (camera_path);
+ camera_filename = file_name_from_path (camera_path);
+- gp_camera_file_get (data->camera,
+- camera_folder,
+- camera_filename,
+- GP_FILE_TYPE_PREVIEW,
+- file,
+- data->context);
++ if (gp_camera_file_get (data->camera,
++ camera_folder,
++ camera_filename,
++ GP_FILE_TYPE_PREVIEW,
++ file,
++ data->context) < 0) {
++ /* clear error flag if thumbnail generation failed (e.g. for
++ * movies), this should not stop the import*/
++ g_mutex_lock (data->data_mutex);
++ data->error = FALSE;
++ g_mutex_unlock (data->data_mutex);
++ }
+
+ tmp_dir = get_temp_dir_name ();
+- if (tmp_dir == NULL)
++ if (tmp_dir == NULL)
+ /* should we display an error message here? */
+ return;
+-
++
+ tmp_filename = get_temp_file_name (tmp_dir, get_filename_extension (camera_filename));
+
+ if (gp_file_save (file, tmp_filename) >= 0) {
+@@ -830,8 +836,10 @@ load_images_preview__step (AsyncOperationData *aodata,
+ FileData *fdata;
+
+ tmp_file = file_data_new_from_local_path (tmp_filename);
+- file_data_update_mime_type (tmp_file, FALSE); /* FIXME: always slow mime type ? */
+-
++ /* fast mime type should even work for empty files (if thumbnail creation failed)
++ * by using the extension*/
++ file_data_update_mime_type (tmp_file, TRUE);
++
+ pixbuf = gth_pixbuf_new_from_file (tmp_file, NULL, THUMB_SIZE, THUMB_SIZE, NULL);
+ if (pixbuf == NULL)
+ pixbuf = get_mime_type_icon (data, tmp_file);
+@@ -842,7 +850,7 @@ load_images_preview__step (AsyncOperationData *aodata,
+ camera_filename,
+ NULL,
+ fdata);
+-
++
+ g_object_unref (pixbuf);
+ file_data_unref (tmp_file);
+ file_data_unref (fdata);
+@@ -900,7 +908,7 @@ load_images_preview (DialogData *data)
+ gtk_widget_show (data->progress_info_box);
+ gtk_window_set_resizable (GTK_WINDOW (data->dialog), FALSE);
+ return;
+- }
++ }
+ else {
+ gtk_widget_show (data->import_preview_box);
+ gtk_widget_hide (data->progress_info_box);
+@@ -959,7 +967,7 @@ set_camera_model (DialogData *data,
+ _gtk_label_set_locale_text (GTK_LABEL (data->camera_model_label), model);
+ gtk_image_set_from_pixbuf (GTK_IMAGE (data->progress_camera_image), data->camera_present_pixbuf);
+ load_images_preview (data);
+- }
++ }
+ else {
+ data->camera_setted = FALSE;
+ display_error_dialog (data,
+@@ -1210,7 +1218,7 @@ get_file_name (DialogData *data,
+ if (data->keep_original_filename) {
+ file_name = g_strdup (file_name_from_path (camera_path));
+ /* set_lowercase (file_name); see #339291 */
+- }
++ }
+ else {
+ char *s, *new_ext;
+
+@@ -1246,7 +1254,7 @@ add_categories_to_image (DialogData *data,
+ CommentData *cdata;
+ GList *scan;
+ char *uri;
+-
++
+ if (data->categories_list == NULL)
+ return;
+
+@@ -1262,7 +1270,7 @@ add_categories_to_image (DialogData *data,
+
+ comments_save_categories (uri, cdata);
+ comment_data_free (cdata);
+-
++
+ g_free (uri);
+ }
+
+@@ -1297,13 +1305,13 @@ save_image (DialogData *data,
+
+ local_path = get_cache_filename_from_uri (file_uri);
+ if ((local_path != NULL) && gp_file_save (file, local_path) >= 0) {
+- if (data->adjust_orientation)
++ if (data->adjust_orientation)
+ data->adjust_orientation_list = g_list_prepend (data->adjust_orientation_list, g_strdup (file_uri));
+ if (data->delete_from_camera)
+ data->delete_list = g_list_prepend (data->delete_list, g_strdup (camera_path));
+ data->saved_images_list = g_list_prepend (data->saved_images_list, g_strdup (file_uri));
+ add_categories_to_image (data, local_path);
+- }
++ }
+ else {
+ g_mutex_lock (data->data_mutex);
+ data->error = TRUE;
+@@ -1401,7 +1409,7 @@ copy_images__step (AsyncOperationData *aodata,
+ {
+ const char *uri = aodata->scan->data;
+ FileData *file;
+-
++
+ file = file_data_new (uri, NULL);
+ update_file_from_cache (file, done_func, aodata);
+ file_data_unref (file);
+@@ -1503,7 +1511,7 @@ adjust_orientation__done (AsyncOperationData *aodata,
+ copy_images__step,
+ copy_images__done,
+ data);
+- async_operation_start (data->aodata);
++ async_operation_start (data->aodata);
+ }
+
+
+@@ -1625,7 +1633,7 @@ ok_clicked_cb (GtkButton *button,
+ }
+
+ sel_list = gth_image_list_get_selection (GTH_IMAGE_LIST (data->image_list));
+- if (sel_list == NULL)
++ if (sel_list == NULL)
+ sel_list = gth_image_list_get_list (GTH_IMAGE_LIST (data->image_list));
+
+ if (sel_list != NULL) {
+@@ -1911,7 +1919,7 @@ check_thread (gpointer cb_data)
+ default:
+ break;
+ }
+- }
++ }
+ else /* Add check again. */
+ data->check_id = g_timeout_add (REFRESH_RATE, check_thread, data);
+
+@@ -2055,7 +2063,7 @@ dlg_photo_importer (GthBrowser *browser)
+ if ((default_path == NULL) || (*default_path == 0))
+ default_path = xdg_user_dir_lookup ("PICTURES");
+ default_uri = add_scheme_if_absent (default_path);
+-
++
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (data->destination_filechooserbutton),
+ default_uri);
+ g_free (default_path);
+diff --git a/src/gth-window-actions-callbacks.c b/src/gth-window-actions-callbacks.c
+index d279b72..9abb105 100644
+--- a/src/gth-window-actions-callbacks.c
++++ b/src/gth-window-actions-callbacks.c
+@@ -178,7 +178,7 @@ print_done_cb (gpointer data)
+ g_free (tmp_dir);
+
+ tmp_dir = remove_level_from_path (tmp_filename);
+- local_dir_remove_recursive (tmp_dir);
++ local_dir_remove_recursive (tmp_dir);
+ g_free (tmp_dir);
+
+ g_free (tmp_filename);
+@@ -206,9 +206,9 @@ gth_window_activate_action_file_print (GtkAction *action,
+
+ image_viewer = gth_window_get_image_viewer (window);
+ pixbuf = image_viewer_get_current_pixbuf (image_viewer);
+- if (pixbuf == NULL)
++ if (pixbuf == NULL)
+ return;
+-
++
+ g_object_ref (pixbuf);
+ tmp_dir = get_temp_dir_name ();
+ if (tmp_dir == NULL) {
+@@ -219,22 +219,22 @@ gth_window_activate_action_file_print (GtkAction *action,
+
+ return;
+ }
+-
+- tmp_filename = get_temp_file_name (tmp_dir, ".jpeg");
++
++ tmp_filename = get_temp_file_name (tmp_dir, "jpeg");
+ if (! _gdk_pixbuf_save (pixbuf,
+ tmp_filename,
+ "jpeg",
+ &error,
+- NULL))
++ NULL))
+ {
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (window), &error);
+ local_dir_remove_recursive (tmp_dir);
+
+- g_object_unref (pixbuf);
++ g_object_unref (pixbuf);
+ g_free (tmp_filename);
+ g_free (tmp_dir);
+ file_data_list_free (list);
+-
++
+ return;
+ }
+
+@@ -244,7 +244,7 @@ gth_window_activate_action_file_print (GtkAction *action,
+ current = file_data_list_find_path (list, image_filename);
+ if (current != NULL) {
+ FileData *fd;
+-
++
+ fd = file_data_dup (current->data);
+ g_free (fd->path);
+ fd->path = get_uri_from_local_path (tmp_filename);
+@@ -253,7 +253,7 @@ gth_window_activate_action_file_print (GtkAction *action,
+
+ print_catalog_dlg_full (GTK_WINDOW (window), list, print_done_cb, get_uri_from_local_path (tmp_filename));
+
+- g_free (tmp_filename);
++ g_free (tmp_filename);
+ g_free (tmp_dir);
+ }
+ else
+@@ -648,9 +648,9 @@ typedef struct {
+ } SetWallpaperData;
+
+
+-static void
+-set_wallpaper_step_2 (const char *uri,
+- GnomeVFSResult result,
++static void
++set_wallpaper_step_2 (const char *uri,
++ GnomeVFSResult result,
+ gpointer callback_data)
+ {
+ SetWallpaperData *data = callback_data;
+@@ -667,14 +667,14 @@ set_wallpaper_step_2 (const char *uri,
+
+ if (path_is_file (uri)) {
+ char *image_path;
+-
++
+ image_path = get_local_path_from_uri (uri);
+ gconf_client_set_string (client,
+ "/desktop/gnome/background/picture_filename",
+ image_path,
+ NULL);
+ g_free (image_path);
+-
++
+ switch (data->align) {
+ case WALLPAPER_ALIGN_TILED:
+ options = "wallpaper";
+@@ -699,8 +699,8 @@ set_wallpaper_step_2 (const char *uri,
+ options,
+ NULL);
+ g_object_unref (G_OBJECT (client));
+-
+- g_free (data);
++
++ g_free (data);
+ }
+
+
+@@ -722,10 +722,10 @@ get_wallpaper_filename (int n)
+
+
+ static char *
+-get_new_wallpaper_filename (void)
++get_new_wallpaper_filename (void)
+ {
+ char *wallpaper_filename;
+-
++
+ wallpaper_filename = get_wallpaper_filename (1);
+ if (path_is_file (wallpaper_filename)) {
+ /* Use a new filename to force an update. */
+@@ -735,7 +735,7 @@ get_new_wallpaper_filename (void)
+ if (path_is_file (wallpaper_filename))
+ file_unlink (wallpaper_filename);
+ }
+-
++
+ return wallpaper_filename;
+ }
+
+@@ -746,16 +746,16 @@ set_wallpaper (GthWindow *window,
+ WallpaperAlign align)
+ {
+ SetWallpaperData *data;
+-
++
+ data = g_new0 (SetWallpaperData, 1);
+ data->window = window;
+ data->align = align;
+-
++
+ if (is_local_file (image_path))
+ set_wallpaper_step_2 (image_path, GNOME_VFS_OK, data);
+ else {
+ char *wallpaper_filename;
+-
++
+ wallpaper_filename = get_new_wallpaper_filename ();
+ copy_file_async (image_path, wallpaper_filename, set_wallpaper_step_2, data);
+ g_free (wallpaper_filename);
+@@ -773,7 +773,7 @@ set_wallpaper_from_window (GthWindow *window,
+ const char *filename = gth_window_get_image_filename (window);
+ if (filename != NULL)
+ image_path = g_strdup (filename);
+- }
++ }
+ else {
+ ImageViewer *image_viewer;
+ GdkPixbuf *pixbuf;
+@@ -794,17 +794,17 @@ set_wallpaper_from_window (GthWindow *window,
+ local_file,
+ "jpeg",
+ &error,
+- NULL))
++ NULL))
+ {
+ _gtk_error_dialog_from_gerror_run (GTK_WINDOW (window), &error);
+ g_object_unref (pixbuf);
+- g_free (local_file);
++ g_free (local_file);
+ g_free (wallpaper_filename);
+ return;
+ }
+
+ image_path = wallpaper_filename;
+-
++
+ g_object_unref (pixbuf);
+ g_free (local_file);
+ }
+--
+1.7.2.2
+
diff --git a/gthumb.spec b/gthumb.spec
index 3ab63f6..7739edc 100644
--- a/gthumb.spec
+++ b/gthumb.spec
@@ -9,7 +9,7 @@
Summary: Image viewer, editor, organizer
Name: gthumb
Version: 2.10.12
-Release: 1%{?dist}
+Release: 2%{?dist}
URL: http://gthumb.sourceforge.net
Source0: http://download.gnome.org/sources/gthumb/2.10/%{name}-%{version}.tar.bz2
Source1: gthumb-importer
@@ -51,6 +51,9 @@ Requires(postun): scrollkeeper
Requires(postun): desktop-file-utils >= %{desktop_file_utils_version}
Patch0: gthumb-libdir.patch
+# https://bugzilla.gnome.org/show_bug.cgi?id=625698
+# http://git.gnome.org/browse/gthumb/commit/?h=gthumb-2-10&id=3c7d20b7022a0c4a6fb76500c20c7f836f66d899
+Patch1: 0001-Fixed-import-from-camera-if-one-photo-is-bad.patch
%description
gthumb is an application for viewing, editing, and organizing
@@ -59,6 +62,7 @@ collections of images.
%prep
%setup -q
%patch0 -p1 -b .libdir
+%patch1 -p1 -b .import-fix
# force regeneration
rm data/gthumb.schemas
@@ -143,6 +147,12 @@ fi
%{_datadir}/icons/hicolor/48x48/apps/gthumb.png
%changelog
+* Wed Sep 01 2010 Christian Krause <chkr at fedoraproject.org> - 2.10.12-2
+- Fix import problem when camera / SF/CF card contains a bad file or
+ a file for which no preview image could be generated by libgphoto2
+ (#619172)
+- Upstream patch taken from http://git.gnome.org/browse/gthumb/commit/?h=gthumb-2-10&id=3c7d20b7022a0c4a6fb76500c20c7f836f66d899
+
* Fri Aug 20 2010 Christian Krause <chkr at fedoraproject.org> - 2.10.12-1
- Update to 2.10.12
- Drop upstreamed patch
More information about the scm-commits
mailing list