diff -r -C3 gthumb/libgthumb/catalog-png-exporter.c gthumb-changed/libgthumb/catalog-png-exporter.c
*** gthumb/libgthumb/catalog-png-exporter.c	2002-09-30 13:49:32.000000000 +0200
--- gthumb-changed/libgthumb/catalog-png-exporter.c	2006-11-02 09:27:43.000000000 +0100
***************
*** 1183,1188 ****
--- 1183,1200 ----
  
  
  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;
***************
*** 1241,1246 ****
--- 1253,1261 ----
  	case SORT_BY_PATH:
  		func = comp_func_path;
  		break;
+ 	case SORT_BY_COMMENT:
+ 		func = comp_func_comment;
+ 		break;
  	case SORT_NONE:
  		func = comp_func_none;
  		break;
diff -r -C3 gthumb/libgthumb/file-list.c gthumb-changed/libgthumb/file-list.c
*** gthumb/libgthumb/file-list.c	2002-10-06 10:54:09.000000000 +0200
--- gthumb-changed/libgthumb/file-list.c	2006-11-02 09:32:17.000000000 +0100
***************
*** 43,48 ****
--- 43,60 ----
  
  static GdkPixbuf *unknown_pixbuf = NULL;
  
+ 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 gint
  comp_func_name (gconstpointer  ptr1,
***************
*** 201,206 ****
--- 213,221 ----
  	case SORT_BY_PATH:
  		func = comp_func_path;
  		break;
+ 	case SORT_BY_COMMENT:
+ 		func = comp_func_comment;
+ 		break;
  	case SORT_NONE:
  		func = comp_func_none;
  		break;
diff -r -C3 gthumb/libgthumb/preferences.c gthumb-changed/libgthumb/preferences.c
*** gthumb/libgthumb/preferences.c	2002-10-06 17:24:47.000000000 +0200
--- gthumb-changed/libgthumb/preferences.c	2006-11-02 09:25:10.000000000 +0100
***************
*** 95,100 ****
--- 95,101 ----
          { SORT_BY_PATH, "path" },
          { SORT_BY_SIZE, "size" },
          { SORT_BY_TIME, "time" },
+         { SORT_BY_COMMENT, "comment" },
  	{ 0, NULL }
  };
  
diff -r -C3 gthumb/libgthumb/typedefs.h gthumb-changed/libgthumb/typedefs.h
*** gthumb/libgthumb/typedefs.h	2002-10-06 17:24:47.000000000 +0200
--- gthumb-changed/libgthumb/typedefs.h	2006-11-02 09:24:12.000000000 +0100
***************
*** 89,95 ****
  	SORT_BY_NAME,
  	SORT_BY_PATH,
  	SORT_BY_SIZE,
! 	SORT_BY_TIME
  } SortMethod;
  
  
--- 89,96 ----
  	SORT_BY_NAME,
  	SORT_BY_PATH,
  	SORT_BY_SIZE,
! 	SORT_BY_TIME,
! 	SORT_BY_COMMENT
  } SortMethod;
  
  
diff -r -C3 gthumb/src/dlg-png-exporter.c gthumb-changed/src/dlg-png-exporter.c
*** gthumb/src/dlg-png-exporter.c	2002-10-06 17:24:47.000000000 +0200
--- gthumb-changed/src/dlg-png-exporter.c	2006-11-02 09:41:01.000000000 +0100
***************
*** 712,717 ****
--- 712,718 ----
  	case SORT_BY_PATH: return 1;
  	case SORT_BY_SIZE: return 2;
  	case SORT_BY_TIME: return 3;
+ 	case SORT_BY_COMMENT: return 4;
  	default: return -1;
  	}
  
***************
*** 727,732 ****
--- 728,734 ----
  	case 1: return SORT_BY_PATH;
  	case 2: return SORT_BY_SIZE;
  	case 3: return SORT_BY_TIME;
+ 	case 4: return SORT_BY_COMMENT;
  	}
  
  	return SORT_NONE;
diff -r -C3 gthumb/src/gthumb-ui.xml gthumb-changed/src/gthumb-ui.xml
*** gthumb/src/gthumb-ui.xml	2002-09-30 13:49:33.000000000 +0200
--- gthumb-changed/src/gthumb-ui.xml	2006-11-02 09:38:16.000000000 +0100
***************
*** 137,142 ****
--- 137,145 ----
  	<cmd name="SortByTime" _label="by _Time" 
  	     _tip="Sort images by modifiction time"
  	     type="radio" group="sort_type"/>
+ 	<cmd name="SortByComment" _label="by _Comment" 
+ 	     _tip="Sort images by comment"
+ 	     type="radio" group="sort_type"/>
  	<cmd name="SortReversed" _label="_Reversed Order" 
  	     _tip="Reverse images order"
  	     type="toggle"/>
***************
*** 371,376 ****
--- 374,380 ----
  			<menuitem name="SortByPath" verb=""/>
  			<menuitem name="SortBySize" verb=""/>
  			<menuitem name="SortByTime" verb=""/>
+ 			<menuitem name="SortByComment" verb=""/>
  			<separator/>
  			<menuitem name="SortReversed" verb=""/>
  		</submenu>
diff -r -C3 gthumb/src/gthumb-window.c gthumb-changed/src/gthumb-window.c
*** gthumb/src/gthumb-window.c	2002-10-06 10:54:09.000000000 +0200
--- gthumb-changed/src/gthumb-window.c	2006-11-02 09:36:18.000000000 +0100
***************
*** 2608,2613 ****
--- 2608,2615 ----
  		file_list_set_sort_method (window->file_list, SORT_BY_TIME);
  	if ((strcmp (path, "SortByPath") == 0) && s) 
  		file_list_set_sort_method (window->file_list, SORT_BY_PATH);
+ 	if ((strcmp (path, "SortByComment") == 0) && s) 
+ 		file_list_set_sort_method (window->file_list, SORT_BY_COMMENT);
  
  	if (strcmp (path, "SortReversed") == 0) {
  		GtkSortType new_type;
***************
*** 2729,2734 ****
--- 2731,2737 ----
  		"SortByPath",
  		"SortBySize",
  		"SortByTime",
+ 		"SortByComment",
  		"SortReversed",
  		"TranspTypeWhite",
  		"TranspTypeNone",
***************
*** 2809,2814 ****
--- 2812,2818 ----
  	case SORT_BY_PATH: prop = "SortByPath"; break;
  	case SORT_BY_SIZE: prop = "SortBySize"; break;
  	case SORT_BY_TIME: prop = "SortByTime"; break;
+ 	case SORT_BY_COMMENT: prop = "SortByComment"; break;
  	default: prop = "X";
  	}
  	set_command_state_without_notifing (window, prop, TRUE);
