gthumb r2370 - in branches/gthumb-2-10: . libgthumb src



Author: paobac
Date: Fri Aug  1 11:39:55 2008
New Revision: 2370
URL: http://svn.gnome.org/viewvc/gthumb?rev=2370&view=rev

Log:
2008-08-01  Paolo Bacchilega  <paobac svn gnome org>

	* src/gth-browser.c (window_update_sensitivity): set only_one_is_selected
	when n_selected is 1 (was 0).
	
	Fixes bug: doesn't allow to go to the image destination folder from the 
	catalog list.
	
	* libgthumb/thumb-loader.c (thumb_loader_start__step2): move the
	5 seconds test after the valid failed thumbnail test.
	
	* src/dlg-search.c (directory_load_cb): update the files mime type or the 
	thumbnail will not be created if necessary.
	
	* libgthumb/comments.c (save_comment): just check if data is NULL 
	before saving (#543771).
	
	* src/catalog-web-exporter.c (get_var_value): check whether 
	ce->eval_image is NULL before using it. 
	(export__save_html_files): init ce->eval_image to NULL.


Modified:
   branches/gthumb-2-10/ChangeLog
   branches/gthumb-2-10/libgthumb/comments.c
   branches/gthumb-2-10/libgthumb/thumb-loader.c
   branches/gthumb-2-10/src/catalog-png-exporter.c
   branches/gthumb-2-10/src/catalog-web-exporter.c
   branches/gthumb-2-10/src/dlg-search.c
   branches/gthumb-2-10/src/dlg-web-exporter.c
   branches/gthumb-2-10/src/gth-browser.c
   branches/gthumb-2-10/src/gth-location.c

Modified: branches/gthumb-2-10/libgthumb/comments.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/comments.c	(original)
+++ branches/gthumb-2-10/libgthumb/comments.c	Fri Aug  1 11:39:55 2008
@@ -790,13 +790,8 @@
 	char        *dest_dir = NULL;
 	char        *e_comment = NULL, *e_place = NULL, *e_keywords = NULL;
 
-	if ((uri == NULL) || ! is_local_file (uri))
-		return;
-
-	if (comment_data_is_void (data)) {
-		comment_delete (uri);
+	if ((data == NULL) || (uri == NULL) || ! is_local_file (uri))
 		return;
-	}
 
 	if (save_embedded) {
 #ifdef HAVE_LIBIPTCDATA
@@ -805,6 +800,11 @@
 #endif /* HAVE_LIBIPTCDATA */
 	}
 
+	if (comment_data_is_void (data)) {
+		comment_delete (uri);
+		return;
+	}
+
 	/* Convert data to strings. */
 
 	time_str = g_strdup_printf ("%ld", data->time);

Modified: branches/gthumb-2-10/libgthumb/thumb-loader.c
==============================================================================
--- branches/gthumb-2-10/libgthumb/thumb-loader.c	(original)
+++ branches/gthumb-2-10/libgthumb/thumb-loader.c	Fri Aug  1 11:39:55 2008
@@ -386,11 +386,12 @@
 							     tl->priv->file->path,
 							     tl->priv->file->mtime);
 
-		if ((cache_path == NULL) &&
-		    ((time (NULL) - tl->priv->file->mtime) > (time_t) 5) &&
-		    gnome_thumbnail_factory_has_valid_failed_thumbnail (tl->priv->thumb_factory,
-									tl->priv->file->path,
-									tl->priv->file->mtime)) {
+		if ((cache_path == NULL)  
+		    && gnome_thumbnail_factory_has_valid_failed_thumbnail (tl->priv->thumb_factory,
+									   tl->priv->file->path,
+									   tl->priv->file->mtime)
+		    && ((time (NULL) - tl->priv->file->mtime) > (time_t) 5)) 
+		{
 			/* Use the existing "failed" thumbnail, if it is over
 			   5 seconds old. Otherwise, try to thumbnail it again. 
 			   The minimum age requirement addresses bug 432759, 

Modified: branches/gthumb-2-10/src/catalog-png-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/catalog-png-exporter.c	(original)
+++ branches/gthumb-2-10/src/catalog-png-exporter.c	Fri Aug  1 11:39:55 2008
@@ -1455,9 +1455,10 @@
 		int h = gdk_pixbuf_get_height (pixbuf);
 
 		if (scale_keeping_ratio (&w, &h,
-					  ce->thumb_width,
-					  ce->thumb_height,
-					  FALSE)) {
+					 ce->thumb_width,
+					 ce->thumb_height,
+					 FALSE)) 
+		{
 			GdkPixbuf *scaled;
 			scaled = gdk_pixbuf_scale_simple (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->thumb);

Modified: branches/gthumb-2-10/src/catalog-web-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/catalog-web-exporter.c	(original)
+++ branches/gthumb-2-10/src/catalog-web-exporter.c	Fri Aug  1 11:39:55 2008
@@ -694,6 +694,14 @@
 }
 
 
+#define RETURN_IMAGE_FIELD(image, field) {	\
+	if (image == NULL)			\
+		return 0;			\
+	else					\
+		return image->field;		\
+}
+
+
 static int
 get_var_value (const char *var_name,
 	       gpointer    data)
@@ -716,17 +724,17 @@
 		return GTH_VISIBILITY_ALWAYS;
 
 	else if (strcmp (var_name, "image_width") == 0)
-		return ce->eval_image->image_width;
+		RETURN_IMAGE_FIELD (ce->eval_image, image_width)
 	else if (strcmp (var_name, "image_height") == 0)
-		return ce->eval_image->image_height;
+		RETURN_IMAGE_FIELD (ce->eval_image, image_height)
 	else if (strcmp (var_name, "preview_width") == 0)
-		return ce->eval_image->preview_width;
+		RETURN_IMAGE_FIELD (ce->eval_image, preview_width)
 	else if (strcmp (var_name, "preview_height") == 0)
-		return ce->eval_image->preview_height;
+		RETURN_IMAGE_FIELD (ce->eval_image, preview_height)
 	else if (strcmp (var_name, "thumb_width") == 0)
-		return ce->eval_image->thumb_width;
+		RETURN_IMAGE_FIELD (ce->eval_image, thumb_width)
 	else if (strcmp (var_name, "thumb_height") == 0)
-		return ce->eval_image->thumb_height;
+		RETURN_IMAGE_FIELD (ce->eval_image, thumb_height)
 
 	else if (strcmp (var_name, "image_dim_visibility_index") == 0)
 		return ce->index_caption_mask & GTH_CAPTION_IMAGE_DIM;
@@ -1201,10 +1209,10 @@
 			max_size = gth_tag_get_var (ce, tag, "max_size");
 			if (max_size > 0)
 				scale_keeping_ratio (&image_width,
-						      &image_height,
-						      max_size,
-						      max_size,
-						      FALSE);
+						     &image_height,
+						     max_size,
+						     max_size,
+						     FALSE);
 
 			image_src_relative = get_path_relative_to_uri (image_src, ce->location);
 			
@@ -1303,6 +1311,7 @@
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
 			ce->eval_image = idata;
+			
 			uri = get_image_uri (ce, idata, ce->location);
 			if (gth_tag_get_var (ce, tag, "relative_path") != 0) {
 				char *tmp;
@@ -1383,6 +1392,7 @@
 			idx = get_image_idx (tag, ce);
 			idata = g_list_nth (ce->file_list, idx)->data;
 			ce->eval_image = idata;
+			
 			if (idata->date_time == NULL)
 				break;
 
@@ -1460,7 +1470,6 @@
 					}
 				}
 				write_line ("  </tr>\n", fout);
-
 			}
 			break;
 
@@ -1585,6 +1594,7 @@
 			idx = MIN (ce->image, ce->n_images - 1);
 			idata = g_list_nth (ce->file_list, idx)->data;
 			ce->eval_image = idata;
+			
 			for (scan = tag->value.cond_list; scan; scan = scan->next) {
 				GthCondition *cond = scan->data;
 				if (expression_value (ce, cond->expr) != 0) {
@@ -2014,6 +2024,7 @@
 	}
 
 	ce->image = 0;
+	ce->eval_image = NULL;
 	ce->page = 0;
 	ce->saving_timeout = g_timeout_add (SAVING_TIMEOUT,
 					    save_html_index_cb,
@@ -2309,9 +2320,10 @@
 		int h = gdk_pixbuf_get_height (pixbuf);
 
 		if (scale_keeping_ratio (&w, &h,
-					  ce->preview_max_width,
-					  ce->preview_max_height,
-					  FALSE)) {
+					 ce->preview_max_width,
+					 ce->preview_max_height,
+					 FALSE)) 
+		{
 			GdkPixbuf *scaled;
 			scaled = pixbuf_scale (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->preview);
@@ -2341,9 +2353,10 @@
 		int h = gdk_pixbuf_get_height (pixbuf);
 
 		if (scale_keeping_ratio (&w, &h,
-					  ce->thumb_width,
-					  ce->thumb_height,
-					  FALSE)) {
+					 ce->thumb_width,
+					 ce->thumb_height,
+					 FALSE)) 
+		{
 			GdkPixbuf *scaled;
 			scaled = pixbuf_scale (pixbuf, w, h, GDK_INTERP_BILINEAR);
 			g_object_unref (idata->thumb);

Modified: branches/gthumb-2-10/src/dlg-search.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-search.c	(original)
+++ branches/gthumb-2-10/src/dlg-search.c	Fri Aug  1 11:39:55 2008
@@ -142,6 +142,8 @@
 	GHashTable     *folders_comment;
 	GHashTable     *hidden_files;
 	GHashTable     *visited_dirs;
+	
+	gboolean        fast_file_type;
 } DialogData;
 
 
@@ -557,6 +559,7 @@
 	data->folders_comment = g_hash_table_new (g_str_hash, g_str_equal);
 	data->hidden_files = NULL;
 	data->visited_dirs = NULL;
+	data->fast_file_type = eel_gconf_get_boolean (PREF_FAST_FILE_TYPE, TRUE);
 
 	/* Get the widgets. */
 
@@ -1023,8 +1026,13 @@
 			str_uri = gnome_vfs_uri_to_string (full_uri, GNOME_VFS_URI_HIDE_NONE);
 			unesc_uri = gnome_vfs_unescape_string (str_uri, "");
 
-			if (file_respects_search_criteria (data, unesc_uri))
-				files = g_list_prepend (files, file_data_new (str_uri, info));
+			if (file_respects_search_criteria (data, unesc_uri)) {
+				FileData *file;
+				
+				file = file_data_new (str_uri, info);
+				file_data_update_mime_type (file, data->fast_file_type);				
+				files = g_list_prepend (files, file);
+			}
 			else
 				g_free (str_uri);
 

Modified: branches/gthumb-2-10/src/dlg-web-exporter.c
==============================================================================
--- branches/gthumb-2-10/src/dlg-web-exporter.c	(original)
+++ branches/gthumb-2-10/src/dlg-web-exporter.c	Fri Aug  1 11:39:55 2008
@@ -854,7 +854,7 @@
 	/* Permit VFS URIs */
 	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (file_sel), FALSE);
 	gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (file_sel), g_get_home_dir ());
-	gtk_dialog_set_default_response(GTK_DIALOG (file_sel), GTK_RESPONSE_ACCEPT);
+	gtk_dialog_set_default_response (GTK_DIALOG (file_sel), GTK_RESPONSE_ACCEPT);
 
 	g_object_set_data (G_OBJECT (file_sel), "theme_dialog_data", tdata);
 

Modified: branches/gthumb-2-10/src/gth-browser.c
==============================================================================
--- branches/gthumb-2-10/src/gth-browser.c	(original)
+++ branches/gthumb-2-10/src/gth-browser.c	Fri Aug  1 11:39:55 2008
@@ -874,7 +874,7 @@
 
 	n_selected = gth_file_view_get_n_selected (priv->file_list->view);
 	sel_not_null = n_selected > 0;
-	only_one_is_selected = n_selected == 0;
+	only_one_is_selected = n_selected == 1;
 	image_is_void = image_viewer_is_void (IMAGE_VIEWER (priv->viewer));
 	image_is_ani = image_viewer_is_animation (IMAGE_VIEWER (priv->viewer));
 	playing = image_viewer_is_playing_animation (IMAGE_VIEWER (priv->viewer));
@@ -951,6 +951,9 @@
 
 	set_action_sensitive (browser, "Go_ToContainer", viewing_catalog && only_one_is_selected);
 
+g_print ("VIEWING CATALOG: %d\n", viewing_catalog);
+g_print ("ONLY ONE IS SEL: %d\n", only_one_is_selected);
+
 	/* Edit Catalog menu. */
 
 	if (priv->sidebar_content == GTH_SIDEBAR_CATALOG_LIST) {

Modified: branches/gthumb-2-10/src/gth-location.c
==============================================================================
--- branches/gthumb-2-10/src/gth-location.c	(original)
+++ branches/gthumb-2-10/src/gth-location.c	Fri Aug  1 11:39:55 2008
@@ -225,7 +225,7 @@
 
 	gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (chooser), FALSE);
 	gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (chooser), gth_location_get_folder_uri (location));
-	gtk_dialog_set_default_response(GTK_DIALOG (chooser), GTK_RESPONSE_OK);
+	gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
 
 	g_signal_connect (G_OBJECT (chooser),
 			  "response",



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