[gthumb/ext] Use a default sorting if the specified sort scheme is not recognized



commit 2d5849b4d592560bfde1532879147609d3639126
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Wed Aug 26 14:31:38 2009 -0400

    Use a default sorting if the specified sort scheme is not recognized
    
    Previously, it would crash if an old-style sort scheme like "name" was
    still stored in gconf.

 gthumb/gth-browser.c |    2 +-
 gthumb/gth-main.c    |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index ca9efdf..6d4478b 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -3239,7 +3239,7 @@ _gth_browser_construct (GthBrowser *browser)
 
 	browser->priv->file_list = gth_file_list_new (GTH_FILE_LIST_TYPE_NORMAL);
 	gth_browser_set_sort_order (browser,
-				    gth_main_get_sort_type (eel_gconf_get_string (PREF_SORT_TYPE, "gth::file::mtime")),
+				    gth_main_get_sort_type (eel_gconf_get_string (PREF_SORT_TYPE, "file::name")),
 				    FALSE);
 	gth_browser_enable_thumbnails (browser, eel_gconf_get_boolean (PREF_SHOW_THUMBNAILS, TRUE));
 	gth_file_list_set_thumb_size (GTH_FILE_LIST (browser->priv->file_list), eel_gconf_get_integer (PREF_THUMBNAIL_SIZE, DEF_THUMBNAIL_SIZE));
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 65e597a..eb46627 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -573,10 +573,17 @@ gth_main_register_sort_type (GthFileDataSort *sort_type)
 GthFileDataSort *
 gth_main_get_sort_type (const char *name)
 {
+	GthFileDataSort *retval =  NULL;
+
 	if (name == NULL)
 		return NULL;
+
+	retval = g_hash_table_lookup (Main->priv->sort_types, name);
+
+	if (retval != NULL)
+		return retval;
 	else
-		return g_hash_table_lookup (Main->priv->sort_types, name);
+		return g_hash_table_lookup (Main->priv->sort_types, "file::name");
 }
 
 



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