summaryrefslogtreecommitdiff
path: root/gtk/gtktreesortable.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>2001-09-04 22:15:18 +0000
committerJonathan Blandford <jrb@src.gnome.org>2001-09-04 22:15:18 +0000
commit93d8c11ef7e5a4a31e11a4b9b923df73899038b5 (patch)
tree5936b55796d3479efefb5837c3466b58dd242981 /gtk/gtktreesortable.c
parentc9b26b3dc6eaf9f8314264cb1cfc763fcbf06243 (diff)
downloadgtk+-93d8c11ef7e5a4a31e11a4b9b923df73899038b5.tar.gz
fix initial val for sort column.
Tue Sep 4 18:13:43 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtkliststore.c (gtk_list_store_init): fix initial val for sort column. * gtk/gtktreestore.c (gtk_list_store_init): ditto * gtk/gtktreesortable.c: add docs.
Diffstat (limited to 'gtk/gtktreesortable.c')
-rw-r--r--gtk/gtktreesortable.c74
1 files changed, 68 insertions, 6 deletions
diff --git a/gtk/gtktreesortable.c b/gtk/gtktreesortable.c
index 97a52c10e9..8a114c33f8 100644
--- a/gtk/gtktreesortable.c
+++ b/gtk/gtktreesortable.c
@@ -67,6 +67,12 @@ gtk_tree_sortable_base_init (gpointer g_class)
}
}
+/**
+ * gtk_tree_sortable_sort_column_changed:
+ * @sortable: A #GtkTreeSortable
+ *
+ * Emits a GtkTreeSortable::sort_column_changed signal on
+ **/
void
gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable)
{
@@ -76,6 +82,18 @@ gtk_tree_sortable_sort_column_changed (GtkTreeSortable *sortable)
"sort_column_changed");
}
+/**
+ * gtk_tree_sortable_get_sort_column_id:
+ * @sortable: A #GtkTreeSortable
+ * @sort_column_id: The sort column id to be filled in
+ * @order: The #GtkSortType to be filled in
+ *
+ * Fills in @sort_column_id and @order with the current sort column and the
+ * order, if applicable. If the sort column is not set, then FALSE is returned,
+ * and the values in @sort_column_id and @order are unchanged.
+ *
+ * Return value: %TRUE, if the sort column has been set
+ **/
gboolean
gtk_tree_sortable_get_sort_column_id (GtkTreeSortable *sortable,
gint *sort_column_id,
@@ -93,6 +111,17 @@ gtk_tree_sortable_get_sort_column_id (GtkTreeSortable *sortable,
return (* iface->get_sort_column_id) (sortable, sort_column_id, order);
}
+/**
+ * gtk_tree_sortable_set_sort_column_id:
+ * @sortable: A #GtkTreeSortable
+ * @sort_column_id: the sort column id to set
+ * @order: The sort order of the column
+ *
+ * Sets the current sort column to be @sort_column_id. The @sortable will
+ * resort itself to reflect this change, after emitting a
+ * GtkTreeSortable::sort_column_changed signal. If @sort_column_id is -1, then
+ * the default sort function will be used, if it is set.
+ **/
void
gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
gint sort_column_id,
@@ -111,11 +140,23 @@ gtk_tree_sortable_set_sort_column_id (GtkTreeSortable *sortable,
}
+/**
+ * gtk_tree_sortable_set_sort_func:
+ * @sortable: A #GtkTreeSortable
+ * @sort_column_id: the sort column id to set the function for
+ * @sort_func: The sorting function
+ * @user_data: User data to pass to the sort func, or %NULL
+ * @destroy: Destroy notifier of @user_data, or %NULL
+ *
+ * Sets the comparison function used when sorting to be @sort_func. If the
+ * current sort column id of @sortable is the same as @sort_column_id, then the
+ * model will sort.
+ **/
void
gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,
gint sort_column_id,
- GtkTreeIterCompareFunc func,
- gpointer data,
+ GtkTreeIterCompareFunc sort_func,
+ gpointer user_data,
GtkDestroyNotify destroy)
{
GtkTreeSortableIface *iface;
@@ -127,13 +168,24 @@ gtk_tree_sortable_set_sort_func (GtkTreeSortable *sortable,
g_return_if_fail (iface != NULL);
g_return_if_fail (iface->set_sort_func != NULL);
- (* iface->set_sort_func) (sortable, sort_column_id, func, data, destroy);
+ (* iface->set_sort_func) (sortable, sort_column_id, sort_func, user_data, destroy);
}
+/**
+ * gtk_tree_sortable_set_default_sort_func:
+ * @sortable: A #GtkTreeSortable
+ * @sort_func: The sorting function
+ * @user_data: User data to pass to the sort func, or %NULL
+ * @destroy: Destroy notifier of @user_data, or %NULL
+ *
+ * Sets the default comparison function used when sorting to be @sort_func. If
+ * the current sort column id of @sortable is the same as @sort_column_id, then
+ * the model will sort.
+ **/
void
gtk_tree_sortable_set_default_sort_func (GtkTreeSortable *sortable,
- GtkTreeIterCompareFunc func,
- gpointer data,
+ GtkTreeIterCompareFunc sort_func,
+ gpointer user_data,
GtkDestroyNotify destroy)
{
GtkTreeSortableIface *iface;
@@ -145,9 +197,19 @@ gtk_tree_sortable_set_default_sort_func (GtkTreeSortable *sortable,
g_return_if_fail (iface != NULL);
g_return_if_fail (iface->set_default_sort_func != NULL);
- (* iface->set_default_sort_func) (sortable, func, data, destroy);
+ (* iface->set_default_sort_func) (sortable, sort_func, user_data, destroy);
}
+/**
+ * gtk_tree_sortable_has_default_sort_func:
+ * @sortable: A #GtkTreeSortable
+ *
+ * Returns %TRUE if the model has a default sort function. This is used
+ * primarily by GtkTreeViewColumns in order to determine if a model can go back
+ * to the default state, or not.
+ *
+ * Return value: %TRUE, if the model has a default sort function
+ **/
gboolean
gtk_tree_sortable_has_default_sort_func (GtkTreeSortable *sortable)
{