[rhythmbox] entry-view: relax sorting column assertion



commit 6bea4b5fd2bae6737e0095a7104ea33214aa710f
Author: Jonathan Matthew <jonathan d14n org>
Date:   Sat Apr 30 20:53:31 2011 +1000

    entry-view: relax sorting column assertion
    
    Sorting keys are now bound to settings during RBBrowserSource
    construction, and subclasses haven't had a chance to insert any
    custom columns at that point.  So, we need to allow the entry view
    to go unsorted for a while.  The sort order will be applied when
    the relevant column is inserted.

 widgets/rb-entry-view.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/widgets/rb-entry-view.c b/widgets/rb-entry-view.c
index 390cb12..471be38 100644
--- a/widgets/rb-entry-view.c
+++ b/widgets/rb-entry-view.c
@@ -1712,7 +1712,7 @@ rb_entry_view_insert_column_custom (RBEntryView *view,
 	g_object_set_data_full (G_OBJECT (column), "rb-entry-view-key",
 				g_strdup (key), g_free);
 
-	rb_debug ("appending column: %p (%s)", column, title);
+	rb_debug ("appending column: %p (title: %s, key: %s)", column, title, key);
 
 	gtk_tree_view_insert_column (GTK_TREE_VIEW (view->priv->treeview), column, position);
 
@@ -2406,7 +2406,7 @@ rb_entry_view_sync_columns_visible (RBEntryView *view)
 		int i;
 		for (i = 0; view->priv->visible_columns[i] != NULL && *(view->priv->visible_columns[i]); i++) {
 			int value = rhythmdb_propid_from_nice_elt_name (view->priv->db, (const xmlChar *)view->priv->visible_columns[i]);
-			rb_debug ("visible columns: %s => %d\n", view->priv->visible_columns[i], value);
+			rb_debug ("visible columns: %s => %d", view->priv->visible_columns[i], value);
 
 			if ((value >= 0) && (value < RHYTHMDB_NUM_PROPERTIES))
 				visible_properties = g_list_prepend (visible_properties, GINT_TO_POINTER (value));
@@ -2522,7 +2522,11 @@ rb_entry_view_resort_model (RBEntryView *view)
 {
 	struct RBEntryViewColumnSortData *sort_data;
 
-	g_assert (view->priv->sorting_column);
+	if (view->priv->sorting_column == NULL) {
+		rb_debug ("can't sort yet, the sorting column isn't here");
+		return;
+	}
+
 	sort_data = g_hash_table_lookup (view->priv->column_sort_data_map,
 					 view->priv->sorting_column);
 	g_assert (sort_data);



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