Bug 589336 – Add GtkTreeViewColumn:sort-column-id property

Add the property, change notifications and documentation stubs.
This commit is contained in:
Philip Withnall 2009-07-25 17:46:09 +01:00
parent 88d96c7246
commit f9a1bfb7b9
2 changed files with 37 additions and 2 deletions

View File

@ -112,6 +112,11 @@ calling gtk_tree_view_column_set_cell_data_func()
</para> </para>
<!-- ##### ARG GtkTreeViewColumn:sort-column-id ##### -->
<para>
</para>
<!-- ##### ARG GtkTreeViewColumn:sort-indicator ##### --> <!-- ##### ARG GtkTreeViewColumn:sort-indicator ##### -->
<para> <para>

View File

@ -51,7 +51,8 @@ enum
PROP_ALIGNMENT, PROP_ALIGNMENT,
PROP_REORDERABLE, PROP_REORDERABLE,
PROP_SORT_INDICATOR, PROP_SORT_INDICATOR,
PROP_SORT_ORDER PROP_SORT_ORDER,
PROP_SORT_COLUMN_ID
}; };
enum enum
@ -325,7 +326,24 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
GTK_TYPE_SORT_TYPE, GTK_TYPE_SORT_TYPE,
GTK_SORT_ASCENDING, GTK_SORT_ASCENDING,
GTK_PARAM_READWRITE)); 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 static void
@ -497,6 +515,11 @@ gtk_tree_view_column_set_property (GObject *object,
g_value_get_enum (value)); g_value_get_enum (value));
break; break;
case PROP_SORT_COLUMN_ID:
gtk_tree_view_column_set_sort_column_id (tree_column,
g_value_get_int (value));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -595,6 +618,11 @@ gtk_tree_view_column_get_property (GObject *object,
gtk_tree_view_column_get_sort_order (tree_column)); gtk_tree_view_column_get_sort_order (tree_column));
break; break;
case PROP_SORT_COLUMN_ID:
g_value_set_int (value,
gtk_tree_view_column_get_sort_column_id (tree_column));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; 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_order (tree_column, GTK_SORT_ASCENDING);
gtk_tree_view_column_set_sort_indicator (tree_column, FALSE); gtk_tree_view_column_set_sort_indicator (tree_column, FALSE);
gtk_tree_view_column_set_clickable (tree_column, FALSE); gtk_tree_view_column_set_clickable (tree_column, FALSE);
g_object_notify (G_OBJECT (tree_column), "sort-column-id");
return; return;
} }
@ -2393,6 +2422,7 @@ gtk_tree_view_column_set_sort_column_id (GtkTreeViewColumn *tree_column,
NULL); NULL);
gtk_tree_view_column_setup_sort_column_id_callback (tree_column); gtk_tree_view_column_setup_sort_column_id_callback (tree_column);
g_object_notify (G_OBJECT (tree_column), "sort-column-id");
} }
/** /**