Index: bindings/python/rhythmdb.override
===================================================================
--- bindings/python/rhythmdb.override	(revision 5236)
+++ bindings/python/rhythmdb.override	(working copy)
@@ -48,60 +48,9 @@
 	Py_XDECREF (o);
 }
 
-
-/* query model sorting stuff */
 typedef struct {
 	PyObject *func;
 	PyObject *data;
-} PyRhythmDBQueryModelSortData;
-
-static void
-_rhythmdb_query_model_sort_data_free (PyRhythmDBQueryModelSortData *data)
-{
-	PyGILState_STATE __py_state;
-	__py_state = pyg_gil_state_ensure();
-
-	Py_DECREF (data->func);
-	Py_DECREF (data->data);
-	g_free (data);
-
-	pyg_gil_state_release(__py_state);
-}
-
-static int
-_rhythmdb_query_model_sort_func (RhythmDBEntry *a, RhythmDBEntry *b, PyRhythmDBQueryModelSortData *data)
-{
-	PyObject *args;
-	PyObject *py_result;
-	PyObject *py_a, *py_b;
-	int result;
-	PyGILState_STATE __py_state;
-
-	__py_state = pyg_gil_state_ensure();
-
-	py_a = pyg_boxed_new (RHYTHMDB_TYPE_ENTRY, a, FALSE, FALSE);
-	py_b = pyg_boxed_new (RHYTHMDB_TYPE_ENTRY, b, FALSE, FALSE);
-	if (data->data)
-		args = Py_BuildValue ("(OOO)", py_a, py_b, data->data);
-	else
-		args = Py_BuildValue ("(OO)", py_a, py_b);
-
-	py_result = PyEval_CallObject (data->func, args);
-	result = PyInt_AsLong (py_result);
-
-	Py_DECREF (py_a);
-	Py_DECREF (py_b);
-	Py_DECREF (args);
-	Py_DECREF (py_result);
-	pyg_gil_state_release(__py_state);
-
-	return result;
-}
-/* end query model sorting stuff */
-
-typedef struct {
-	PyObject *func;
-	PyObject *data;
 } PyRhythmDBEntryForeachData;
 
 static void
Index: bindings/python/rb.override
===================================================================
--- bindings/python/rb.override	(revision 5236)
+++ bindings/python/rb.override	(working copy)
@@ -77,6 +77,80 @@
   *_get_type
   *_quark
 %%
+override rb_entry_view_append_column_custom kwargs
+static PyObject *
+_wrap_rb_entry_view_append_column_custom(PyGObject *self, PyObject *args,
+                                         PyObject *kwargs)
+{
+    static char *kwlist[] = { "column", "title", "key", "sort_func", "sort_data", NULL };
+    PyGObject *pycolumn = NULL;
+    PyObject *pyfunc, *pyarg = NULL;
+    PyRhythmDBQueryModelSortData *data;
+    char *title, *key;
+  
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "OzzO|O:RBEntryView.append_column_custom",
+                                     kwlist, &pycolumn, &title, &key, &pyfunc, &pyarg))
+        return NULL;
+
+    if (!PyCallable_Check(pyfunc)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "sort_func must be a callable object");
+        return NULL;
+    }
+    data = g_new0(PyRhythmDBQueryModelSortData, 1);
+    data->func = pyfunc;
+    data->data = pyarg;
+    Py_INCREF(data->func);
+    Py_XINCREF(data->data);
+ 
+    rb_entry_view_append_column_custom(RB_ENTRY_VIEW(self->obj),
+                                       GTK_TREE_VIEW_COLUMN(pycolumn->obj), title, key,
+                                       (GCompareDataFunc) _rhythmdb_query_model_sort_func,
+                                       data, (GDestroyNotify) _rhythmdb_query_model_sort_data_free);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+%%
+override rb_entry_view_insert_column_custom kwargs
+static PyObject *
+_wrap_rb_entry_view_insert_column_custom(PyGObject *self, PyObject *args,
+                                         PyObject *kwargs)
+{
+    static char *kwlist[] = { "column", "title", "key", "sort_func", "sort_data", "position", NULL };
+    PyGObject *pycolumn = NULL;
+    PyObject *pyfunc, *pyarg = NULL;
+    PyRhythmDBQueryModelSortData *data;
+    char *title, *key;
+    int position;
+  
+    if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+                                     "OzzOOi:RBEntryView.insert_column_custom",
+                                     kwlist, &pycolumn, &title, &key, &pyfunc, &pyarg, &position))
+        return NULL;
+
+    if (!PyCallable_Check(pyfunc)) {
+        PyErr_SetString(PyExc_TypeError,
+                        "sort_func must be a callable object");
+        return NULL;
+    }
+    data = g_new0(PyRhythmDBQueryModelSortData, 1);
+    data->func = pyfunc;
+    data->data = pyarg;
+    Py_INCREF(data->func);
+    Py_INCREF(data->data);
+ 
+    rb_entry_view_insert_column_custom(RB_ENTRY_VIEW(self->obj),
+                                       GTK_TREE_VIEW_COLUMN(pycolumn->obj), title, key,
+                                       (GCompareDataFunc) _rhythmdb_query_model_sort_func,
+                                       data, (GDestroyNotify) _rhythmdb_query_model_sort_data_free,
+                                       position);
+
+    Py_INCREF(Py_None);
+    return Py_None;
+}
+%%
 override rb_entry_view_get_selected_entries noargs
 static PyObject *
 _wrap_rb_entry_view_get_selected_entries(PyGObject *self)
Index: bindings/python/rb.defs
===================================================================
--- bindings/python/rb.defs	(revision 5236)
+++ bindings/python/rb.defs	(working copy)
@@ -1333,6 +1333,21 @@
   )
 )
 
+(define-method insert_column_custom
+  (of-object "RBEntryView")
+  (c-name "rb_entry_view_insert_column_custom")
+  (return-type "none")
+  (parameters
+    '("GtkTreeViewColumn*" "column")
+    '("const-char*" "title")
+    '("const-char*" "key")
+    '("GCompareDataFunc" "sort_func")
+    '("gpointer" "data")
+    '("GDestroyNotify" "data_destroy")
+    '("gint" "position")
+  )
+)
+
 (define-method set_columns_clickable
   (of-object "RBEntryView")
   (c-name "rb_entry_view_set_columns_clickable")
Index: bindings/python/override_common.c
===================================================================
--- bindings/python/override_common.c	(revision 5236)
+++ bindings/python/override_common.c	(working copy)
@@ -255,3 +255,53 @@
 	return array;
 }
 
+/* query model sorting stuff */
+void
+_rhythmdb_query_model_sort_data_free (PyRhythmDBQueryModelSortData *data)
+{
+	PyGILState_STATE __py_state;
+	__py_state = pyg_gil_state_ensure();
+
+	Py_DECREF (data->func);
+	Py_DECREF (data->data);
+	g_free (data);
+
+	pyg_gil_state_release(__py_state);
+}
+
+int
+_rhythmdb_query_model_sort_func (RhythmDBEntry *a, RhythmDBEntry *b, PyRhythmDBQueryModelSortData *data)
+{
+	PyObject *args;
+	PyObject *py_result;
+	PyObject *py_a, *py_b;
+	int result;
+	PyGILState_STATE __py_state;
+
+	__py_state = pyg_gil_state_ensure();
+
+	py_a = pyg_boxed_new (RHYTHMDB_TYPE_ENTRY, a, FALSE, FALSE);
+	py_b = pyg_boxed_new (RHYTHMDB_TYPE_ENTRY, b, FALSE, FALSE);
+	if (data->data)
+		args = Py_BuildValue ("(OOO)", py_a, py_b, data->data);
+	else
+		args = Py_BuildValue ("(OO)", py_a, py_b);
+
+	Py_DECREF (py_a);
+	Py_DECREF (py_b);
+
+	py_result = PyEval_CallObject (data->func, args);
+	Py_DECREF (args);
+
+	if (!py_result) {
+		PyErr_Print();
+		return NULL;
+	}
+	result = PyInt_AsLong (py_result);
+
+	Py_DECREF (py_result);
+	pyg_gil_state_release(__py_state);
+
+	return result;
+}
+/* end query model sorting stuff */
Index: bindings/python/override_common.h
===================================================================
--- bindings/python/override_common.h	(revision 5236)
+++ bindings/python/override_common.h	(working copy)
@@ -26,6 +26,8 @@
 #ifndef __OVERRIDE_COMMON_H
 #define __OVERRIDE_COMMON_H
 
+#include "rhythmdb.h"
+
 PyObject * _helper_wrap_gobject_glist (const GList *list); /* references objects */
 PyObject * _helper_wrap_string_glist (const GList *list); /* duplicated strings */
 PyObject * _helper_wrap_pointer_glist (const GList *list,
@@ -45,5 +47,19 @@
 					GType type);
 GList * _helper_unwrap_gobject_pylist (PyObject *py_list); /* does not reference objects */
 GPtrArray* _helper_unwrap_boxed_gptrarray (PyObject *list, GType type); /* does not copy boxed */
+
+/* query model sorting stuff */
+typedef struct {
+	PyObject *func;
+	PyObject *data;
+} PyRhythmDBQueryModelSortData;
+
+void _rhythmdb_query_model_sort_data_free (PyRhythmDBQueryModelSortData *data);
+
+int _rhythmdb_query_model_sort_func (RhythmDBEntry *a,
+				     RhythmDBEntry *b,
+				     PyRhythmDBQueryModelSortData *data);
+/* end query model sorting stuff */
+
 #endif /* __OVERRIDE_COMMON_H */
 
Index: widgets/rb-entry-view.c
===================================================================
--- widgets/rb-entry-view.c	(revision 5236)
+++ widgets/rb-entry-view.c	(working copy)
@@ -2124,7 +2124,7 @@
 	rhythmdb_query_model_set_sort_order (view->priv->model,
 					     sort_data->func,
 					     sort_data->data,
-					     sort_data->data_destroy,
+					     NULL,
 					     (view->priv->sorting_order == GTK_SORT_DESCENDING));
 }
 
