Index: data/gthumb.schemas.in
===================================================================
RCS file: /cvs/gnome/gthumb/data/gthumb.schemas.in,v
retrieving revision 1.25
diff -u -p -r1.25 gthumb.schemas.in
--- data/gthumb.schemas.in	6 Nov 2006 17:57:07 -0000	1.25
+++ data/gthumb.schemas.in	6 Nov 2006 21:35:40 -0000
@@ -236,7 +236,7 @@
 	<default>name</default>
 	<locale name="C">
 	  <short></short>
-	  <long> Possible values are: none, name, path, size, time.
+	  <long> Possible values are: none, name, path, size, time, comment.
 	  </long>
 	</locale>
       </schema>
Index: libgthumb/gth-file-view-list.c
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/gth-file-view-list.c,v
retrieving revision 1.10
diff -u -p -r1.10 gth-file-view-list.c
--- libgthumb/gth-file-view-list.c	14 Mar 2006 17:49:50 -0000	1.10
+++ libgthumb/gth-file-view-list.c	6 Nov 2006 21:35:41 -0000
@@ -1043,6 +1043,7 @@ gfv_sorted (GthFileView   *file_view,
 	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,6 +1585,19 @@ comp_func_path (gconstpointer  ptr1,
 
 
 static int
+comp_func_comment (gconstpointer  ptr1,
+		   gconstpointer  ptr2)
+{
+	const FileData *fd1 = ptr1, *fd2 = ptr2;
+
+	if ((fd1->comment == NULL) || (fd2->comment == NULL))
+		return 0;
+
+	return g_utf8_collate ( g_utf8_casefold (fd1->comment,-1), g_utf8_casefold (fd2->comment,-1) );
+}
+
+
+static int
 comp_func_none (gconstpointer  ptr1,
 		gconstpointer  ptr2)
 {
@@ -1608,6 +1622,9 @@ get_compfunc_from_method (GthSortMethod 
 		break;
 	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;
Index: libgthumb/gth-file-view-thumbs.c
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/gth-file-view-thumbs.c,v
retrieving revision 1.9
diff -u -p -r1.9 gth-file-view-thumbs.c
--- libgthumb/gth-file-view-thumbs.c	14 Mar 2006 17:49:50 -0000	1.9
+++ libgthumb/gth-file-view-thumbs.c	6 Nov 2006 21:35:41 -0000
@@ -671,6 +671,19 @@ comp_func_path (gconstpointer  ptr1,
 
 
 static int
+comp_func_comment (gconstpointer  ptr1,
+		   gconstpointer  ptr2)
+{
+        const GthImageListItem *item1 = ptr1, *item2 = ptr2;
+
+        if ((item1->comment == NULL) || (item2->comment == NULL))
+		return 0;
+	
+	return g_utf8_collate ( g_utf8_casefold (item1->comment,-1), g_utf8_casefold (item2->comment,-1) );
+}
+
+
+static int
 comp_func_none (gconstpointer  ptr1,
 		gconstpointer  ptr2)
 {
@@ -695,6 +708,9 @@ get_compfunc_from_method (GthSortMethod 
 		break;
 	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:
Index: libgthumb/preferences.c
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/preferences.c,v
retrieving revision 1.22
diff -u -p -r1.22 preferences.c
--- libgthumb/preferences.c	29 Dec 2005 18:26:37 -0000	1.22
+++ libgthumb/preferences.c	6 Nov 2006 21:35:41 -0000
@@ -96,6 +96,7 @@ static EnumStringTable arrange_type_tabl
         { 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 }
 };
Index: libgthumb/typedefs.h
===================================================================
RCS file: /cvs/gnome/gthumb/libgthumb/typedefs.h,v
retrieving revision 1.19
diff -u -p -r1.19 typedefs.h
--- libgthumb/typedefs.h	6 Nov 2006 17:57:10 -0000	1.19
+++ libgthumb/typedefs.h	6 Nov 2006 21:35:41 -0000
@@ -128,6 +128,7 @@ typedef enum { /*< skip >*/
 	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;
 
Index: src/catalog-png-exporter.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/catalog-png-exporter.c,v
retrieving revision 1.16
diff -u -p -r1.16 catalog-png-exporter.c
--- src/catalog-png-exporter.c	21 Mar 2006 16:37:43 -0000	1.16
+++ src/catalog-png-exporter.c	6 Nov 2006 21:35:41 -0000
@@ -1215,6 +1215,21 @@ comp_func_path (gconstpointer a, gconstp
 
 
 static gint
+comp_func_comment (gconstpointer a, gconstpointer b)
+{
+	ImageData *data_a, *data_b;
+
+	data_a = IMAGE_DATA (a);
+	data_b = IMAGE_DATA (b);
+
+        if ((data_a->comment == NULL) || (data_b->comment == NULL))
+                return 0;
+
+	return g_utf8_collate ( g_utf8_casefold (data_a->comment,-1), g_utf8_casefold (data_b->comment,-1) );
+}
+
+
+static gint
 comp_func_time (gconstpointer a, gconstpointer b)
 {
 	ImageData *data_a, *data_b;
@@ -1272,6 +1287,9 @@ get_sortfunc (CatalogPngExporter *ce)
 		break;
 	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;
Index: src/catalog-web-exporter.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/catalog-web-exporter.c,v
retrieving revision 1.43
diff -u -p -r1.43 catalog-web-exporter.c
--- src/catalog-web-exporter.c	6 Nov 2006 17:57:11 -0000	1.43
+++ src/catalog-web-exporter.c	6 Nov 2006 21:35:41 -0000
@@ -606,6 +606,21 @@ comp_func_path (gconstpointer a, gconstp
 
 
 static int
+comp_func_comment (gconstpointer a, gconstpointer b)
+{
+	ImageData *data_a, *data_b;
+
+	data_a = IMAGE_DATA (a);
+	data_b = IMAGE_DATA (b);
+
+        if ((data_a->comment == NULL) || (data_b->comment == NULL))
+		return 0;
+
+	return g_utf8_collate ( g_utf8_casefold (data_a->comment,-1), g_utf8_casefold (data_b->comment,-1) );
+}
+
+
+static int
 comp_func_time (gconstpointer a, gconstpointer b)
 {
 	ImageData *data_a, *data_b;
@@ -663,6 +678,9 @@ get_sortfunc (CatalogWebExporter *ce)
 		break;
 	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;
Index: src/dlg-png-exporter.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/dlg-png-exporter.c,v
retrieving revision 1.21
diff -u -p -r1.21 dlg-png-exporter.c
--- src/dlg-png-exporter.c	16 Mar 2006 19:12:26 -0000	1.21
+++ src/dlg-png-exporter.c	6 Nov 2006 21:35:41 -0000
@@ -56,11 +56,12 @@
 #define DEF_PAGE_HEIGHT     400
 #define DEF_THUMB_SIZE      128
 
-static int           sort_method_to_idx[] = { -1, 0, 1, 2, 3, 4 };
+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 {
Index: src/dlg-web-exporter.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/dlg-web-exporter.c,v
retrieving revision 1.38
diff -u -p -r1.38 dlg-web-exporter.c
--- src/dlg-web-exporter.c	6 Nov 2006 17:57:11 -0000	1.38
+++ src/dlg-web-exporter.c	6 Nov 2006 21:35:41 -0000
@@ -46,11 +46,12 @@
 #include "gth-browser.h"
 #include "glib-utils.h"
 
-static int           sort_method_to_idx[] = { -1, 0, 1, 2, 3, 4 };
+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 };
@@ -487,6 +488,8 @@ dlg_web_exporter (GthBrowser *browser)
 				   _("by size"));
 	gtk_combo_box_append_text (GTK_COMBO_BOX (data->wa_sort_images_combobox),
 				   _("by modified time"));
+	gtk_combo_box_append_text (GTK_COMBO_BOX (data->wa_sort_images_combobox),
+                                   _("by comment"));
 	if (reorderable)
 		gtk_combo_box_append_text (GTK_COMBO_BOX (data->wa_sort_images_combobox),
 					   _("manual order"));
Index: src/gth-browser-actions-entries.h
===================================================================
RCS file: /cvs/gnome/gthumb/src/gth-browser-actions-entries.h,v
retrieving revision 1.13
diff -u -p -r1.13 gth-browser-actions-entries.h
--- src/gth-browser-actions-entries.h	31 Oct 2006 20:29:52 -0000	1.13
+++ src/gth-browser-actions-entries.h	6 Nov 2006 21:35:41 -0000
@@ -435,6 +435,9 @@ static GtkRadioActionEntry gth_browser_s
 	{ "SortByTime", NULL,
 	  N_("by _Time"), NULL,
 	  N_("Sort images by modification time"), GTH_SORT_METHOD_BY_TIME },
+	{ "SortByComment", NULL,
+	  N_("by _Comment"), 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 }
Index: src/gth-browser-ui.h
===================================================================
RCS file: /cvs/gnome/gthumb/src/gth-browser-ui.h,v
retrieving revision 1.18
diff -u -p -r1.18 gth-browser-ui.h
--- src/gth-browser-ui.h	31 Oct 2006 20:29:52 -0000	1.18
+++ src/gth-browser-ui.h	6 Nov 2006 21:35:42 -0000
@@ -100,6 +100,7 @@ static const gchar *main_ui_info = 
 "        <menuitem action='SortByPath'/>"
 "        <menuitem action='SortBySize'/>"
 "        <menuitem action='SortByTime'/>"
+"        <menuitem action='SortByComment'/>"
 "        <menuitem action='SortManual'/>"
 "        <separator/>"
 "        <menuitem action='SortReversed'/>"
Index: src/gth-browser.c
===================================================================
RCS file: /cvs/gnome/gthumb/src/gth-browser.c,v
retrieving revision 1.69
diff -u -p -r1.69 gth-browser.c
--- src/gth-browser.c	5 Nov 2006 13:22:42 -0000	1.69
+++ src/gth-browser.c	6 Nov 2006 21:35:42 -0000
@@ -1146,6 +1146,7 @@ window_sync_sort_menu (GthBrowser    *br
 	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;
 	}
