diff -r -C3 gthumb/libgthumb/gth-file-view-list.c gthumb-changed/libgthumb/gth-file-view-list.c
*** gthumb/libgthumb/gth-file-view-list.c	2006-03-14 18:49:50.000000000 +0100
--- gthumb-changed/libgthumb/gth-file-view-list.c	2006-11-03 09:39:21.000000000 +0100
***************
*** 1043,1048 ****
--- 1043,1049 ----
  	case GTH_SORT_METHOD_BY_PATH: col = COLUMN_PATH; break;
  	case GTH_SORT_METHOD_BY_SIZE: col = COLUMN_SIZE; break;
  	case GTH_SORT_METHOD_BY_TIME: col = COLUMN_TIME; break;
+ 	case GTH_SORT_METHOD_BY_COMMENT: col = COLUMN_COMMENT; break;
  	default: col = GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID; break;
  	}
  
***************
*** 1584,1589 ****
--- 1585,1603 ----
  
  
  static int
+ comp_func_comment (gconstpointer  ptr1,
+ 		   gconstpointer  ptr2)
+ {
+ 	const FileData *fd1 = ptr1, *fd2 = ptr2;
+ 
+ 	if ((fd1 == NULL) || (fd2 == NULL))
+ 		return 0;
+ 
+ 	return strcmp (fd1->comment, fd2->comment);
+ }
+ 
+ 
+ static int
  comp_func_none (gconstpointer  ptr1,
  		gconstpointer  ptr2)
  {
***************
*** 1609,1614 ****
--- 1623,1631 ----
  	case GTH_SORT_METHOD_BY_PATH:
  		func = comp_func_path;
  		break;
+ 	case GTH_SORT_METHOD_BY_COMMENT:
+ 		func = comp_func_comment;
+ 		break;
  	default:
  		func = comp_func_none;
  		break;
diff -r -C3 gthumb/libgthumb/gth-file-view-thumbs.c gthumb-changed/libgthumb/gth-file-view-thumbs.c
*** gthumb/libgthumb/gth-file-view-thumbs.c	2006-03-14 18:49:50.000000000 +0100
--- gthumb-changed/libgthumb/gth-file-view-thumbs.c	2006-11-03 09:17:33.000000000 +0100
***************
*** 671,676 ****
--- 671,686 ----
  
  
  static int
+ comp_func_comment (gconstpointer  ptr1,
+ 		   gconstpointer  ptr2)
+ {
+         const GthImageListItem *item1 = ptr1, *item2 = ptr2;
+ 
+ 	return strcmp (item1->comment, item2->comment);
+ }
+ 
+ 
+ static int
  comp_func_none (gconstpointer  ptr1,
  		gconstpointer  ptr2)
  {
***************
*** 696,701 ****
--- 706,714 ----
  	case GTH_SORT_METHOD_BY_PATH:
  		func = comp_func_path;
  		break;
+ 	case GTH_SORT_METHOD_BY_COMMENT:
+ 		func = comp_func_comment;
+ 		break;
  	case GTH_SORT_METHOD_NONE:
  	case GTH_SORT_METHOD_MANUAL:
  	default:
diff -r -C3 gthumb/libgthumb/preferences.c gthumb-changed/libgthumb/preferences.c
*** gthumb/libgthumb/preferences.c	2005-12-29 19:26:37.000000000 +0100
--- gthumb-changed/libgthumb/preferences.c	2006-11-03 09:35:27.000000000 +0100
***************
*** 96,101 ****
--- 96,102 ----
          { GTH_SORT_METHOD_BY_PATH, "path" },
          { GTH_SORT_METHOD_BY_SIZE, "size" },
          { GTH_SORT_METHOD_BY_TIME, "time" },
+         { GTH_SORT_METHOD_BY_COMMENT, "comment" },
          { GTH_SORT_METHOD_MANUAL,  "manual" },
  	{ 0, NULL }
  };
diff -r -C3 gthumb/libgthumb/typedefs.h gthumb-changed/libgthumb/typedefs.h
*** gthumb/libgthumb/typedefs.h	2006-10-19 19:42:34.000000000 +0200
--- gthumb-changed/libgthumb/typedefs.h	2006-11-03 09:36:17.000000000 +0100
***************
*** 128,133 ****
--- 128,134 ----
  	GTH_SORT_METHOD_BY_PATH,
  	GTH_SORT_METHOD_BY_SIZE,
  	GTH_SORT_METHOD_BY_TIME,
+ 	GTH_SORT_METHOD_BY_COMMENT,
  	GTH_SORT_METHOD_MANUAL
  } GthSortMethod;
  
diff -r -C3 gthumb/src/catalog-png-exporter.c gthumb-changed/src/catalog-png-exporter.c
*** gthumb/src/catalog-png-exporter.c	2006-03-21 17:37:43.000000000 +0100
--- gthumb-changed/src/catalog-png-exporter.c	2006-11-03 09:13:52.000000000 +0100
***************
*** 1215,1220 ****
--- 1215,1232 ----
  
  
  static gint
+ comp_func_comment (gconstpointer a, gconstpointer b)
+ {
+ 	ImageData *data_a, *data_b;
+ 
+ 	data_a = IMAGE_DATA (a);
+ 	data_b = IMAGE_DATA (b);
+ 
+ 	return strcasecmp (data_a->comment, data_b->comment);
+ }
+ 
+ 
+ static gint
  comp_func_time (gconstpointer a, gconstpointer b)
  {
  	ImageData *data_a, *data_b;
***************
*** 1273,1278 ****
--- 1285,1293 ----
  	case GTH_SORT_METHOD_BY_PATH:
  		func = comp_func_path;
  		break;
+ 	case GTH_SORT_METHOD_BY_COMMENT:
+ 		func = comp_func_comment;
+ 		break;
  	case GTH_SORT_METHOD_NONE:
  		func = comp_func_none;
  		break;
diff -r -C3 gthumb/src/catalog-web-exporter.c gthumb-changed/src/catalog-web-exporter.c
*** gthumb/src/catalog-web-exporter.c	2006-10-08 10:45:16.000000000 +0200
--- gthumb-changed/src/catalog-web-exporter.c	2006-11-03 09:13:52.000000000 +0100
***************
*** 568,573 ****
--- 568,585 ----
  
  
  static int
+ comp_func_comment (gconstpointer a, gconstpointer b)
+ {
+ 	ImageData *data_a, *data_b;
+ 
+ 	data_a = IMAGE_DATA (a);
+ 	data_b = IMAGE_DATA (b);
+ 
+ 	return strcasecmp (data_a->comment, data_b->comment);
+ }
+ 
+ 
+ static int
  comp_func_time (gconstpointer a, gconstpointer b)
  {
  	ImageData *data_a, *data_b;
***************
*** 626,631 ****
--- 638,646 ----
  	case GTH_SORT_METHOD_BY_PATH:
  		func = comp_func_path;
  		break;
+ 	case GTH_SORT_METHOD_BY_COMMENT:
+ 		func = comp_func_comment;
+ 		break;
  	case GTH_SORT_METHOD_NONE:
  		func = comp_func_none;
  		break;
diff -r -C3 gthumb/src/dlg-png-exporter.c gthumb-changed/src/dlg-png-exporter.c
*** gthumb/src/dlg-png-exporter.c	2006-03-16 20:12:26.000000000 +0100
--- gthumb-changed/src/dlg-png-exporter.c	2006-11-03 09:21:34.000000000 +0100
***************
*** 56,66 ****
  #define DEF_PAGE_HEIGHT     400
  #define DEF_THUMB_SIZE      128
  
! static int           sort_method_to_idx[] = { -1, 0, 1, 2, 3, 4 };
  static GthSortMethod idx_to_sort_method[] = { GTH_SORT_METHOD_BY_NAME, 
  					      GTH_SORT_METHOD_BY_PATH, 
  					      GTH_SORT_METHOD_BY_SIZE, 
  					      GTH_SORT_METHOD_BY_TIME,
  					      GTH_SORT_METHOD_MANUAL};
  
  typedef struct {
--- 56,67 ----
  #define DEF_PAGE_HEIGHT     400
  #define DEF_THUMB_SIZE      128
  
! static int           sort_method_to_idx[] = { -1, 0, 1, 2, 3, 4, 5 };
  static GthSortMethod idx_to_sort_method[] = { GTH_SORT_METHOD_BY_NAME, 
  					      GTH_SORT_METHOD_BY_PATH, 
  					      GTH_SORT_METHOD_BY_SIZE, 
  					      GTH_SORT_METHOD_BY_TIME,
+ 					      GTH_SORT_METHOD_BY_COMMENT,
  					      GTH_SORT_METHOD_MANUAL};
  
  typedef struct {
diff -r -C3 gthumb/src/dlg-web-exporter.c gthumb-changed/src/dlg-web-exporter.c
*** gthumb/src/dlg-web-exporter.c	2006-11-02 15:43:13.000000000 +0100
--- gthumb-changed/src/dlg-web-exporter.c	2006-11-03 09:32:45.000000000 +0100
***************
*** 46,56 ****
  #include "gth-browser.h"
  #include "glib-utils.h"
  
! static int           sort_method_to_idx[] = { -1, 0, 1, 2, 3, 4 };
  static GthSortMethod idx_to_sort_method[] = { GTH_SORT_METHOD_BY_NAME, 
  					      GTH_SORT_METHOD_BY_PATH, 
  					      GTH_SORT_METHOD_BY_SIZE, 
  					      GTH_SORT_METHOD_BY_TIME,
  					      GTH_SORT_METHOD_MANUAL};
  static int           idx_to_resize_width[] = { 320, 320, 640, 640, 800, 800, 1024, 1024, 1280, 1280 };
  static int           idx_to_resize_height[] = { 200, 320, 480, 640, 600, 800, 768, 1024, 960, 1280 };
--- 46,57 ----
  #include "gth-browser.h"
  #include "glib-utils.h"
  
! static int           sort_method_to_idx[] = { -1, 0, 1, 2, 3, 4, 5 };
  static GthSortMethod idx_to_sort_method[] = { GTH_SORT_METHOD_BY_NAME, 
  					      GTH_SORT_METHOD_BY_PATH, 
  					      GTH_SORT_METHOD_BY_SIZE, 
  					      GTH_SORT_METHOD_BY_TIME,
+ 					      GTH_SORT_METHOD_BY_COMMENT,
  					      GTH_SORT_METHOD_MANUAL};
  static int           idx_to_resize_width[] = { 320, 320, 640, 640, 800, 800, 1024, 1024, 1280, 1280 };
  static int           idx_to_resize_height[] = { 200, 320, 480, 640, 600, 800, 768, 1024, 960, 1280 };
diff -r -C3 gthumb/src/gth-browser-actions-entries.h gthumb-changed/src/gth-browser-actions-entries.h
*** gthumb/src/gth-browser-actions-entries.h	2006-10-31 21:29:52.000000000 +0100
--- gthumb-changed/src/gth-browser-actions-entries.h	2006-11-03 09:30:54.000000000 +0100
***************
*** 435,440 ****
--- 435,443 ----
  	{ "SortByTime", NULL,
  	  N_("by _Time"), NULL,
  	  N_("Sort images by modification time"), GTH_SORT_METHOD_BY_TIME },
+ 	{ "SortByComment", NULL,
+ 	  N_("by _Time"), NULL,
+ 	  N_("Sort images by comment"), GTH_SORT_METHOD_BY_COMMENT },
  	{ "SortManual", NULL,
  	  N_("_Manual Order"), NULL,
  	  N_("Sort images manually"), GTH_SORT_METHOD_MANUAL }
diff -r -C3 gthumb/src/gth-browser.c gthumb-changed/src/gth-browser.c
*** gthumb/src/gth-browser.c	2006-10-31 21:29:52.000000000 +0100
--- gthumb-changed/src/gth-browser.c	2006-11-03 09:27:15.000000000 +0100
***************
*** 1146,1151 ****
--- 1146,1152 ----
  	case GTH_SORT_METHOD_BY_PATH: prop = "SortByPath"; break;
  	case GTH_SORT_METHOD_BY_SIZE: prop = "SortBySize"; break;
  	case GTH_SORT_METHOD_BY_TIME: prop = "SortByTime"; break;
+ 	case GTH_SORT_METHOD_BY_COMMENT: prop = "SortByComment"; break;
  	case GTH_SORT_METHOD_MANUAL:  prop = "SortManual"; break;
  	default: prop = "X"; break;
  	}
diff -r -C3 gthumb/src/gth-browser-ui.h gthumb-changed/src/gth-browser-ui.h
*** gthumb/src/gth-browser-ui.h	2006-10-31 21:29:52.000000000 +0100
--- gthumb-changed/src/gth-browser-ui.h	2006-11-03 09:28:51.000000000 +0100
***************
*** 100,105 ****
--- 100,106 ----
  "        <menuitem action='SortByPath'/>"
  "        <menuitem action='SortBySize'/>"
  "        <menuitem action='SortByTime'/>"
+ "        <menuitem action='SortByComment'/>"
  "        <menuitem action='SortManual'/>"
  "        <separator/>"
  "        <menuitem action='SortReversed'/>"
