[gtk+] Bug 589336 – Add GtkTreeViewColumn:sort-column-id property
- From: Philip Withnall <pwithnall src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+] Bug 589336 – Add GtkTreeViewColumn:sort-column-id property
- Date: Sun, 26 Jul 2009 09:52:44 +0000 (UTC)
commit f9a1bfb7b9c7fde1b45a263387b1b36fc7f7b492
Author: Philip Withnall <philip tecnocode co uk>
Date: Sat Jul 25 17:46:09 2009 +0100
Bug 589336 â?? Add GtkTreeViewColumn:sort-column-id property
Add the property, change notifications and documentation stubs.
docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml | 5 +++
gtk/gtktreeviewcolumn.c | 34 ++++++++++++++++++++++-
2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml
index 7412707..96cb94b 100644
--- a/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml
+++ b/docs/reference/gtk/tmpl/gtktreeviewcolumn.sgml
@@ -112,6 +112,11 @@ calling gtk_tree_view_column_set_cell_data_func()
</para>
+<!-- ##### ARG GtkTreeViewColumn:sort-column-id ##### -->
+<para>
+
+</para>
+
<!-- ##### ARG GtkTreeViewColumn:sort-indicator ##### -->
<para>
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index d3259d0..edec5de 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -51,7 +51,8 @@ enum
PROP_ALIGNMENT,
PROP_REORDERABLE,
PROP_SORT_INDICATOR,
- PROP_SORT_ORDER
+ PROP_SORT_ORDER,
+ PROP_SORT_COLUMN_ID
};
enum
@@ -325,7 +326,24 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
GTK_TYPE_SORT_TYPE,
GTK_SORT_ASCENDING,
GTK_PARAM_READWRITE));
-
+
+ /**
+ * GtkTreeViewColumn:sort-column-id:
+ *
+ * Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header
+ * clickable. Set to %-1 to make the column unsortable.
+ *
+ * Since: 2.18
+ **/
+ g_object_class_install_property (object_class,
+ PROP_SORT_COLUMN_ID,
+ g_param_spec_int ("sort-column-id",
+ P_("Sort column ID"),
+ P_("Logical sort column ID this column sorts on when selected for sorting"),
+ -1,
+ G_MAXINT,
+ -1,
+ GTK_PARAM_READWRITE));
}
static void
@@ -497,6 +515,11 @@ gtk_tree_view_column_set_property (GObject *object,
g_value_get_enum (value));
break;
+ case PROP_SORT_COLUMN_ID:
+ gtk_tree_view_column_set_sort_column_id (tree_column,
+ g_value_get_int (value));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -595,6 +618,11 @@ gtk_tree_view_column_get_property (GObject *object,
gtk_tree_view_column_get_sort_order (tree_column));
break;
+ case PROP_SORT_COLUMN_ID:
+ g_value_set_int (value,
+ gtk_tree_view_column_get_sort_column_id (tree_column));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -2381,6 +2409,7 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
gtk_tree_view_column_set_sort_order (tree_column, GTK_SORT_ASCENDING);
gtk_tree_view_column_set_sort_indicator (tree_column, FALSE);
gtk_tree_view_column_set_clickable (tree_column, FALSE);
+ g_object_notify (G_OBJECT (tree_column), "sort-column-id");
return;
}
@@ -2393,6 +2422,7 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
NULL);
gtk_tree_view_column_setup_sort_column_id_callback (tree_column);
+ g_object_notify (G_OBJECT (tree_column), "sort-column-id");
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]