forked from AuroraMiddleware/gtk
new "model" construct property for language bindings.
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new "model" construct property for language bindings. * gtk/gtktreestore.c (gtk_tree_store_set_column_types): New function to let you set the column types of a GtkTreeStore for language bindings. * gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
This commit is contained in:
parent
e9c62bf674
commit
43d4639743
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -1,3 +1,14 @@
|
||||
Tue Nov 13 21:00:59 2001 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gtk/gtktreemodelsort.c (gtk_tree_model_sort_class_init): new
|
||||
"model" construct property for language bindings.
|
||||
|
||||
* gtk/gtktreestore.c (gtk_tree_store_set_column_types): New
|
||||
function to let you set the column types of a GtkTreeStore for
|
||||
language bindings.
|
||||
|
||||
* gtk/gtkliststore.c (gtk_list_store_set_column_types): ditto.
|
||||
|
||||
2001-11-13 Havoc Pennington <hp@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_add_child_in_window): docs
|
||||
|
@ -252,6 +252,7 @@ gtk_list_store_init (GtkListStore *list_store)
|
||||
list_store->stamp = g_random_int ();
|
||||
list_store->length = 0;
|
||||
list_store->sort_column_id = -2;
|
||||
list_store->columns_dirty = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,6 +337,39 @@ gtk_list_store_newv (gint n_columns,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_list_store_set_column_types:
|
||||
* @list_store: A #GtkListStore
|
||||
* @n_columns: Number of columns for the list store
|
||||
* @types: An array length n of @GTypes
|
||||
*
|
||||
* This function is meant primarily for GObjects that inherit from GtkListStore,
|
||||
* and should only be used when constructing a new @GtkListStore. It will not
|
||||
* function after a row has been added, or a method on the @GtkTreeModel
|
||||
* interface is called.
|
||||
**/
|
||||
void
|
||||
gtk_list_store_set_column_types (GtkListStore *list_store,
|
||||
gint n_columns,
|
||||
GType *types)
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
|
||||
g_return_if_fail (list_store->columns_dirty == 0);
|
||||
|
||||
gtk_list_store_set_n_columns (list_store, n_columns);
|
||||
for (i = 0; i < n_columns; i++)
|
||||
{
|
||||
if (! _gtk_tree_data_list_check_type (types[i]))
|
||||
{
|
||||
g_warning ("%s: Invalid type %s passed to gtk_list_store_set_column_types\n", G_STRLOC, g_type_name (types[i]));
|
||||
continue;
|
||||
}
|
||||
gtk_list_store_set_column_type (list_store, i, types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_list_store_set_n_columns (GtkListStore *list_store,
|
||||
gint n_columns)
|
||||
@ -416,20 +450,28 @@ gtk_list_store_get_flags (GtkTreeModel *tree_model)
|
||||
static gint
|
||||
gtk_list_store_get_n_columns (GtkTreeModel *tree_model)
|
||||
{
|
||||
GtkListStore *list_store = (GtkListStore *) tree_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), 0);
|
||||
|
||||
return GTK_LIST_STORE (tree_model)->n_columns;
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
return list_store->n_columns;
|
||||
}
|
||||
|
||||
static GType
|
||||
gtk_list_store_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index)
|
||||
{
|
||||
GtkListStore *list_store = (GtkListStore *) tree_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), G_TYPE_INVALID);
|
||||
g_return_val_if_fail (index < GTK_LIST_STORE (tree_model)->n_columns &&
|
||||
index >= 0, G_TYPE_INVALID);
|
||||
|
||||
return GTK_LIST_STORE (tree_model)->column_headers[index];
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
return list_store->column_headers[index];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -437,24 +479,28 @@ gtk_list_store_get_iter (GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkListStore *list_store = (GtkListStore *) tree_model;
|
||||
GSList *list;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), FALSE);
|
||||
g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE);
|
||||
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
i = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
if (i >= GTK_LIST_STORE (tree_model)->length)
|
||||
if (i >= list_store->length)
|
||||
return FALSE;
|
||||
|
||||
list = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root), i);
|
||||
list = g_slist_nth (G_SLIST (list_store->root), i);
|
||||
|
||||
/* If this fails, list_store->length has gotten mangled. */
|
||||
g_assert (list);
|
||||
|
||||
iter->stamp = GTK_LIST_STORE (tree_model)->stamp;
|
||||
iter->stamp = list_store->stamp;
|
||||
iter->user_data = list;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -978,6 +1024,8 @@ gtk_list_store_insert (GtkListStore *list_store,
|
||||
g_return_if_fail (iter != NULL);
|
||||
g_return_if_fail (position >= 0);
|
||||
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
if (position == 0 ||
|
||||
GTK_LIST_STORE_IS_SORTED (list_store))
|
||||
{
|
||||
@ -1034,6 +1082,7 @@ gtk_list_store_insert_before (GtkListStore *list_store,
|
||||
if (sibling)
|
||||
g_return_if_fail (VALID_ITER (sibling, list_store));
|
||||
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
if (GTK_LIST_STORE_IS_SORTED (list_store))
|
||||
{
|
||||
@ -1122,6 +1171,8 @@ gtk_list_store_insert_after (GtkListStore *list_store,
|
||||
if (sibling)
|
||||
g_return_if_fail (VALID_ITER (sibling, list_store));
|
||||
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
if (sibling == NULL ||
|
||||
GTK_LIST_STORE_IS_SORTED (list_store))
|
||||
{
|
||||
@ -1171,6 +1222,8 @@ gtk_list_store_prepend (GtkListStore *list_store,
|
||||
iter->stamp = list_store->stamp;
|
||||
iter->user_data = g_slist_alloc ();
|
||||
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
if (list_store->root == NULL)
|
||||
list_store->tail = iter->user_data;
|
||||
|
||||
@ -1206,6 +1259,8 @@ gtk_list_store_append (GtkListStore *list_store,
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
|
||||
g_return_if_fail (iter != NULL);
|
||||
|
||||
list_store->columns_dirty = TRUE;
|
||||
|
||||
if (GTK_LIST_STORE_IS_SORTED (list_store))
|
||||
{
|
||||
gtk_list_store_prepend (list_store, iter);
|
||||
|
@ -54,6 +54,7 @@ struct _GtkListStore
|
||||
GtkTreeIterCompareFunc default_sort_func;
|
||||
gpointer default_sort_data;
|
||||
GtkDestroyNotify default_sort_destroy;
|
||||
guint columns_dirty : 1;
|
||||
};
|
||||
|
||||
struct _GtkListStoreClass
|
||||
@ -62,37 +63,40 @@ struct _GtkListStoreClass
|
||||
};
|
||||
|
||||
|
||||
GtkType gtk_list_store_get_type (void);
|
||||
GtkListStore *gtk_list_store_new (gint n_columns,
|
||||
...);
|
||||
GtkListStore *gtk_list_store_newv (gint n_columns,
|
||||
GType *types);
|
||||
void gtk_list_store_set_value (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
void gtk_list_store_set (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_list_store_set_valist (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_list_store_remove (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_insert (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
gint position);
|
||||
void gtk_list_store_insert_before (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_list_store_insert_after (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_list_store_prepend (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_append (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_clear (GtkListStore *list_store);
|
||||
GtkType gtk_list_store_get_type (void);
|
||||
GtkListStore *gtk_list_store_new (gint n_columns,
|
||||
...);
|
||||
GtkListStore *gtk_list_store_newv (gint n_columns,
|
||||
GType *types);
|
||||
void gtk_list_store_set_column_types (GtkListStore *list_store,
|
||||
gint n_columns,
|
||||
GType *types);
|
||||
void gtk_list_store_set_value (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
void gtk_list_store_set (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_list_store_set_valist (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_list_store_remove (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_insert (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
gint position);
|
||||
void gtk_list_store_insert_before (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_list_store_insert_after (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_list_store_prepend (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_append (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_clear (GtkListStore *list_store);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "gtksignal.h"
|
||||
#include "gtktreedatalist.h"
|
||||
#include <string.h>
|
||||
#include "gtkintl.h"
|
||||
|
||||
typedef struct _SortElt SortElt;
|
||||
typedef struct _SortLevel SortLevel;
|
||||
@ -75,6 +76,15 @@ struct _SortTuple
|
||||
gint offset;
|
||||
};
|
||||
|
||||
/* Properties */
|
||||
enum {
|
||||
PROP_0,
|
||||
/* Construct args */
|
||||
PROP_MODEL
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define GTK_TREE_MODEL_SORT_CACHE_CHILD_ITERS(tree_model_sort) \
|
||||
(((GtkTreeModelSort *)tree_model_sort)->child_flags>K_TREE_MODEL_ITERS_PERSIST)
|
||||
#define SORT_ELT(sort_elt) ((SortElt *)sort_elt)
|
||||
@ -87,6 +97,14 @@ static void gtk_tree_model_sort_class_init (GtkTreeModelSortClass *tr
|
||||
static void gtk_tree_model_sort_tree_model_init (GtkTreeModelIface *iface);
|
||||
static void gtk_tree_model_sort_tree_sortable_init (GtkTreeSortableIface *iface);
|
||||
static void gtk_tree_model_sort_finalize (GObject *object);
|
||||
static void gtk_tree_model_sort_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_tree_model_sort_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_tree_model_sort_row_changed (GtkTreeModel *model,
|
||||
GtkTreePath *start_path,
|
||||
GtkTreeIter *start_iter,
|
||||
@ -283,7 +301,19 @@ gtk_tree_model_sort_class_init (GtkTreeModelSortClass *class)
|
||||
object_class = (GObjectClass *) class;
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
object_class->set_property = gtk_tree_model_sort_set_property;
|
||||
object_class->get_property = gtk_tree_model_sort_get_property;
|
||||
|
||||
object_class->finalize = gtk_tree_model_sort_finalize;
|
||||
|
||||
/* Properties */
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_MODEL,
|
||||
g_param_spec_object ("model",
|
||||
_("TreeModelSort Model"),
|
||||
_("The model for the TreeModelSort to sort"),
|
||||
GTK_TYPE_TREE_MODEL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -358,6 +388,44 @@ gtk_tree_model_sort_finalize (GObject *object)
|
||||
parent_class->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MODEL:
|
||||
gtk_tree_model_sort_set_model (tree_model_sort, g_value_get_object (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MODEL:
|
||||
g_value_set_object (value, gtk_tree_model_sort_get_model(tree_model_sort));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_model_sort_row_changed (GtkTreeModel *s_model,
|
||||
GtkTreePath *start_s_path,
|
||||
|
@ -250,13 +250,17 @@ static void
|
||||
gtk_tree_store_init (GtkTreeStore *tree_store)
|
||||
{
|
||||
tree_store->root = g_node_new (NULL);
|
||||
/* While the odds are against us getting 0...
|
||||
*/
|
||||
do
|
||||
{
|
||||
tree_store->stamp = g_random_int ();
|
||||
}
|
||||
while (tree_store->stamp == 0);
|
||||
|
||||
tree_store->sort_list = NULL;
|
||||
tree_store->sort_column_id = -2;
|
||||
tree_store->columns_dirty = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -336,6 +340,40 @@ gtk_tree_store_newv (gint n_columns,
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_tree_store_set_column_types:
|
||||
* @tree_store: A #GtkTreeStore
|
||||
* @n_columns: Number of columns for the tree store
|
||||
* @types: An array length n of @GTypes
|
||||
*
|
||||
* This function is meant primarily for GObjects that inherit from GtkTreeStore,
|
||||
* and should only be used when constructing a new @GtkTreeStore. It will not
|
||||
* function after a row has been added, or a method on the @GtkTreeModel
|
||||
* interface is called.
|
||||
**/
|
||||
void
|
||||
gtk_tree_store_set_column_types (GtkTreeStore *tree_store,
|
||||
gint n_columns,
|
||||
GType *types)
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
||||
g_return_if_fail (tree_store->columns_dirty == 0);
|
||||
|
||||
gtk_tree_store_set_n_columns (tree_store, n_columns);
|
||||
for (i = 0; i < n_columns; i++)
|
||||
{
|
||||
if (! _gtk_tree_data_list_check_type (types[i]))
|
||||
{
|
||||
g_warning ("%s: Invalid type %s passed to gtk_tree_store_set_column_types\n", G_STRLOC, g_type_name (types[i]));
|
||||
continue;
|
||||
}
|
||||
gtk_tree_store_set_column_type (tree_store, i, types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
|
||||
gint n_columns)
|
||||
@ -438,20 +476,28 @@ gtk_tree_store_get_flags (GtkTreeModel *tree_model)
|
||||
static gint
|
||||
gtk_tree_store_get_n_columns (GtkTreeModel *tree_model)
|
||||
{
|
||||
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_model), 0);
|
||||
|
||||
return GTK_TREE_STORE (tree_model)->n_columns;
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
return tree_store->n_columns;
|
||||
}
|
||||
|
||||
static GType
|
||||
gtk_tree_store_get_column_type (GtkTreeModel *tree_model,
|
||||
gint index)
|
||||
{
|
||||
GtkTreeStore *tree_store = (GtkTreeStore *) tree_model;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_model), G_TYPE_INVALID);
|
||||
g_return_val_if_fail (index < GTK_TREE_STORE (tree_model)->n_columns &&
|
||||
index >= 0, G_TYPE_INVALID);
|
||||
|
||||
return GTK_TREE_STORE (tree_model)->column_headers[index];
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
return tree_store->column_headers[index];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -465,7 +511,9 @@ gtk_tree_store_get_iter (GtkTreeModel *tree_model,
|
||||
gint depth, i;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
||||
|
||||
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
indices = gtk_tree_path_get_indices (path);
|
||||
depth = gtk_tree_path_get_depth (path);
|
||||
|
||||
@ -1030,6 +1078,8 @@ gtk_tree_store_insert (GtkTreeStore *tree_store,
|
||||
else
|
||||
parent_node = tree_store->root;
|
||||
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
iter->stamp = tree_store->stamp;
|
||||
iter->user_data = g_node_new (NULL);
|
||||
g_node_insert (parent_node, position, G_NODE (iter->user_data));
|
||||
@ -1077,6 +1127,8 @@ gtk_tree_store_insert_before (GtkTreeStore *tree_store,
|
||||
if (sibling != NULL)
|
||||
g_return_if_fail (VALID_ITER (sibling, tree_store));
|
||||
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
new_node = g_node_new (NULL);
|
||||
|
||||
if (parent == NULL && sibling == NULL)
|
||||
@ -1141,6 +1193,8 @@ gtk_tree_store_insert_after (GtkTreeStore *tree_store,
|
||||
if (sibling != NULL)
|
||||
g_return_if_fail (VALID_ITER (sibling, tree_store));
|
||||
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
new_node = g_node_new (NULL);
|
||||
|
||||
if (parent == NULL && sibling == NULL)
|
||||
@ -1196,6 +1250,8 @@ gtk_tree_store_prepend (GtkTreeStore *tree_store,
|
||||
if (parent != NULL)
|
||||
g_return_if_fail (VALID_ITER (parent, tree_store));
|
||||
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
if (parent == NULL)
|
||||
parent_node = tree_store->root;
|
||||
else
|
||||
@ -1258,6 +1314,8 @@ gtk_tree_store_append (GtkTreeStore *tree_store,
|
||||
else
|
||||
parent_node = parent->user_data;
|
||||
|
||||
tree_store->columns_dirty = TRUE;
|
||||
|
||||
if (parent_node->children == NULL)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
|
@ -53,6 +53,7 @@ struct _GtkTreeStore
|
||||
GtkTreeIterCompareFunc default_sort_func;
|
||||
gpointer default_sort_data;
|
||||
GtkDestroyNotify default_sort_destroy;
|
||||
guint columns_dirty : 1;
|
||||
};
|
||||
|
||||
struct _GtkTreeStoreClass
|
||||
@ -61,47 +62,51 @@ struct _GtkTreeStoreClass
|
||||
};
|
||||
|
||||
|
||||
GtkType gtk_tree_store_get_type (void);
|
||||
GtkTreeStore *gtk_tree_store_new (gint n_columns,
|
||||
...);
|
||||
GtkTreeStore *gtk_tree_store_newv (gint n_columns,
|
||||
GType *types);
|
||||
void gtk_tree_store_set_value (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
void gtk_tree_store_set (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_tree_store_set_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_insert (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint position);
|
||||
void gtk_tree_store_insert_before (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_tree_store_insert_after (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_tree_store_prepend (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
void gtk_tree_store_append (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
gboolean gtk_tree_store_is_ancestor (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *descendant);
|
||||
gint gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_clear (GtkTreeStore *tree_store);
|
||||
GtkType gtk_tree_store_get_type (void);
|
||||
GtkTreeStore *gtk_tree_store_new (gint n_columns,
|
||||
...);
|
||||
GtkTreeStore *gtk_tree_store_newv (gint n_columns,
|
||||
GType *types);
|
||||
void gtk_tree_store_set_column_types (GtkTreeStore *tree_store,
|
||||
gint n_columns,
|
||||
GType *types);
|
||||
void gtk_tree_store_set_value (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
gint column,
|
||||
GValue *value);
|
||||
void gtk_tree_store_set (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
...);
|
||||
void gtk_tree_store_set_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_insert (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
gint position);
|
||||
void gtk_tree_store_insert_before (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_tree_store_insert_after (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent,
|
||||
GtkTreeIter *sibling);
|
||||
void gtk_tree_store_prepend (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
void gtk_tree_store_append (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *parent);
|
||||
gboolean gtk_tree_store_is_ancestor (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
GtkTreeIter *descendant);
|
||||
gint gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_clear (GtkTreeStore *tree_store);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -121,6 +121,7 @@ main (int argc, char *argv[])
|
||||
|
||||
initialize_model ();
|
||||
tree_view = gtk_tree_view_new_with_model (model);
|
||||
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
|
||||
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree_view),
|
||||
-1,
|
||||
|
Loading…
Reference in New Issue
Block a user