forked from AuroraMiddleware/gtk
Discussed in #76249.
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org> Discussed in #76249. * gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean, added gtk_list_store_iter_is_valid. * gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean, added gtk_tree_store_iter_is_valid. * gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore and treestore sources, added gtk_tree_model_sort_iter_is_valid.
This commit is contained in:
parent
46006990c8
commit
f39b189d5c
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Discussed in #76249.
|
||||
|
||||
* gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean,
|
||||
added gtk_list_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean,
|
||||
added gtk_tree_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore
|
||||
and treestore sources, added gtk_tree_model_sort_iter_is_valid.
|
||||
|
||||
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter
|
||||
|
@ -1,3 +1,16 @@
|
||||
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Discussed in #76249.
|
||||
|
||||
* gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean,
|
||||
added gtk_list_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean,
|
||||
added gtk_tree_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore
|
||||
and treestore sources, added gtk_tree_model_sort_iter_is_valid.
|
||||
|
||||
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter
|
||||
|
@ -1,3 +1,16 @@
|
||||
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Discussed in #76249.
|
||||
|
||||
* gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean,
|
||||
added gtk_list_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean,
|
||||
added gtk_tree_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore
|
||||
and treestore sources, added gtk_tree_model_sort_iter_is_valid.
|
||||
|
||||
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter
|
||||
|
@ -1,3 +1,16 @@
|
||||
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Discussed in #76249.
|
||||
|
||||
* gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean,
|
||||
added gtk_list_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean,
|
||||
added gtk_tree_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore
|
||||
and treestore sources, added gtk_tree_model_sort_iter_is_valid.
|
||||
|
||||
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter
|
||||
|
@ -1,3 +1,16 @@
|
||||
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Discussed in #76249.
|
||||
|
||||
* gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean,
|
||||
added gtk_list_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean,
|
||||
added gtk_tree_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore
|
||||
and treestore sources, added gtk_tree_model_sort_iter_is_valid.
|
||||
|
||||
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter
|
||||
|
@ -1,3 +1,16 @@
|
||||
Tue Jun 4 19:24:41 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
Discussed in #76249.
|
||||
|
||||
* gtk/gtkliststore.[ch]: made gtk_list_store_remove return a gboolean,
|
||||
added gtk_list_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreestore.[ch]: made gtk_tree_store_remove return a gboolean,
|
||||
added gtk_tree_store_iter_is_valid.
|
||||
|
||||
* gtk/gtktreemodelsort.[ch]: added VALID_ITER macro as in liststore
|
||||
and treestore sources, added gtk_tree_model_sort_iter_is_valid.
|
||||
|
||||
Tue Jun 4 19:18:20 2002 Kristian Rietveld <kris@gtk.org>
|
||||
|
||||
* gtk/gtktreemodel.[ch]: add gtk_tree_model_get_string_from_iter
|
||||
|
@ -976,16 +976,17 @@ gtk_list_store_remove_silently (GtkListStore *list_store,
|
||||
* @iter is set to be the next valid row, or invalidated if it pointed
|
||||
* to the last row in @list_store.
|
||||
*
|
||||
* Return value: %TRUE if @iter is valid, %FALSE if not.
|
||||
**/
|
||||
void
|
||||
gboolean
|
||||
gtk_list_store_remove (GtkListStore *list_store,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreePath *path;
|
||||
GSList *next;
|
||||
|
||||
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
|
||||
g_return_if_fail (VALID_ITER (iter, list_store));
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), FALSE);
|
||||
g_return_val_if_fail (VALID_ITER (iter, list_store), FALSE);
|
||||
|
||||
next = G_SLIST (iter->user_data)->next;
|
||||
path = gtk_list_store_get_path (GTK_TREE_MODEL (list_store), iter);
|
||||
@ -1003,11 +1004,14 @@ gtk_list_store_remove (GtkListStore *list_store,
|
||||
{
|
||||
iter->stamp = list_store->stamp;
|
||||
iter->user_data = next;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->stamp = 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1339,6 +1343,41 @@ gtk_list_store_clear (GtkListStore *list_store)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_list_store_iter_is_valid:
|
||||
* @list_store: A #GtkListStore.
|
||||
* @iter: A #GtkTreeIter.
|
||||
*
|
||||
* WARNING: This function is slow. Only use it for debugging and/or testing
|
||||
* purposes.
|
||||
*
|
||||
* Checks if the given iter is a valid iter for this #GtkListStore.
|
||||
*
|
||||
* Return value: %TRUE if the iter is valid, %FALSE if the iter is invalid.
|
||||
**/
|
||||
gboolean
|
||||
gtk_list_store_iter_is_valid (GtkListStore *list_store,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
if (!VALID_ITER (iter, list_store))
|
||||
return FALSE;
|
||||
|
||||
if (iter->user_data == list_store->root)
|
||||
return TRUE;
|
||||
if (iter->user_data == list_store->tail)
|
||||
return TRUE;
|
||||
|
||||
for (list = ((GList *)list_store->root)->next; list; list = list->next)
|
||||
if (list == iter->user_data)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_list_store_drag_data_delete (GtkTreeDragSource *drag_source,
|
||||
|
@ -90,7 +90,7 @@ void gtk_list_store_set (GtkListStore *list_store,
|
||||
void gtk_list_store_set_valist (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_list_store_remove (GtkListStore *list_store,
|
||||
gboolean gtk_list_store_remove (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_insert (GtkListStore *list_store,
|
||||
GtkTreeIter *iter,
|
||||
@ -106,6 +106,8 @@ void gtk_list_store_prepend (GtkListStore *list_store,
|
||||
void gtk_list_store_append (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_list_store_clear (GtkListStore *list_store);
|
||||
gboolean gtk_list_store_iter_is_valid (GtkListStore *list_store,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -101,6 +101,8 @@ enum {
|
||||
|
||||
#define NO_SORT_FUNC ((GtkTreeIterCompareFunc) 0x1)
|
||||
|
||||
#define VALID_ITER(iter, tree_model_sort) (iter != NULL && iter->user_data != NULL && iter->user_data2 != NULL && tree_model_sort->stamp == iter->stamp)
|
||||
|
||||
/* general (object/interface init, etc) */
|
||||
static void gtk_tree_model_sort_init (GtkTreeModelSort *tree_model_sort);
|
||||
static void gtk_tree_model_sort_class_init (GtkTreeModelSortClass *tree_model_sort_class);
|
||||
@ -2251,3 +2253,50 @@ gtk_tree_model_sort_clear_cache (GtkTreeModelSort *tree_model_sort)
|
||||
if (tree_model_sort->zero_ref_count)
|
||||
gtk_tree_model_sort_clear_cache_helper (tree_model_sort, (SortLevel *)tree_model_sort->root);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_model_sort_iter_is_valid_helper (GtkTreeIter *iter,
|
||||
SortLevel *level)
|
||||
{
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < level->array->len; i++)
|
||||
{
|
||||
SortElt *elt = &g_array_index (level->array, SortElt, i);
|
||||
|
||||
if (iter->user_data == level && iter->user_data2 == elt)
|
||||
return TRUE;
|
||||
|
||||
if (elt->children)
|
||||
if (gtk_tree_model_sort_iter_is_valid_helper (iter, elt->children))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_model_sort_iter_is_valid:
|
||||
* @tree_model_sort: A #GtkTreeModelSort.
|
||||
* @iter: A #GtkTreeIter.
|
||||
*
|
||||
* WARNING: This function is slow. Only use it for debugging and/or testing
|
||||
* purposes.
|
||||
*
|
||||
* Checks if the given iter is a valid iter for this #GtkTreeModelSort.
|
||||
*
|
||||
* Return value: %TRUE if the iter is valid, %FALSE if the iter is invalid.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tree_model_sort_iter_is_valid (GtkTreeModelSort *tree_model_sort,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TREE_MODEL_SORT (tree_model_sort), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
if (!VALID_ITER (iter, tree_model_sort))
|
||||
return FALSE;
|
||||
|
||||
return gtk_tree_model_sort_iter_is_valid_helper (iter,
|
||||
tree_model_sort->root);
|
||||
}
|
||||
|
@ -92,6 +92,8 @@ void gtk_tree_model_sort_convert_iter_to_child_iter (GtkTreeModelSort *
|
||||
GtkTreeIter *sorted_iter);
|
||||
void gtk_tree_model_sort_reset_default_sort_func (GtkTreeModelSort *tree_model_sort);
|
||||
void gtk_tree_model_sort_clear_cache (GtkTreeModelSort *tree_model_sort);
|
||||
gboolean gtk_tree_model_sort_iter_is_valid (GtkTreeModelSort *tree_model_sort,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -1027,8 +1027,10 @@ gtk_tree_store_set (GtkTreeStore *tree_store,
|
||||
* Removes @iter from @tree_store. After being removed, @iter is set to the
|
||||
* next valid row at that level, or invalidated if it previously pointed to the
|
||||
* last one.
|
||||
*
|
||||
* Return value: %TRUE if @iter is still valid, %FALSE if not.
|
||||
**/
|
||||
void
|
||||
gboolean
|
||||
gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
@ -1037,8 +1039,8 @@ gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
GNode *parent;
|
||||
GNode *next_node;
|
||||
|
||||
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
|
||||
g_return_if_fail (VALID_ITER (iter, tree_store));
|
||||
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
||||
g_return_val_if_fail (VALID_ITER (iter, tree_store), FALSE);
|
||||
|
||||
parent = G_NODE (iter->user_data)->parent;
|
||||
|
||||
@ -1073,12 +1075,15 @@ gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
{
|
||||
iter->stamp = tree_store->stamp;
|
||||
iter->user_data = next_node;
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
iter->stamp = 0;
|
||||
iter->user_data = NULL;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1480,6 +1485,55 @@ gtk_tree_store_clear (GtkTreeStore *tree_store)
|
||||
gtk_tree_store_clear_traverse (tree_store->root, tree_store);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_tree_store_iter_is_valid_helper (GtkTreeIter *iter,
|
||||
GNode *first)
|
||||
{
|
||||
GNode *node;
|
||||
|
||||
node = first;
|
||||
|
||||
do
|
||||
{
|
||||
if (node == iter->user_data)
|
||||
return TRUE;
|
||||
|
||||
if (node->children)
|
||||
if (gtk_tree_store_iter_is_valid_helper (iter, node->children))
|
||||
return TRUE;
|
||||
|
||||
node = node->next;
|
||||
}
|
||||
while (node);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tree_store_iter_is_valid:
|
||||
* @tree_store: A #GtkTreeStore.
|
||||
* @iter: A #GtkTreeIter.
|
||||
*
|
||||
* WARNING: This function is slow. Only use it for debugging and/or testing
|
||||
* purposes.
|
||||
*
|
||||
* Checks if the given iter is a valid iter for this #GtkTreeStore.
|
||||
*
|
||||
* Return value: %TRUE if the iter is valid, %FALSE if the iter is invalid.
|
||||
**/
|
||||
gboolean
|
||||
gtk_tree_store_iter_is_valid (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TREE_STORE (tree_store), FALSE);
|
||||
g_return_val_if_fail (iter != NULL, FALSE);
|
||||
|
||||
if (!VALID_ITER (iter, tree_store))
|
||||
return FALSE;
|
||||
|
||||
return gtk_tree_store_iter_is_valid_helper (iter, tree_store->root);
|
||||
}
|
||||
|
||||
/* DND */
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ void gtk_tree_store_set (GtkTreeStore *tree_store,
|
||||
void gtk_tree_store_set_valist (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
va_list var_args);
|
||||
void gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
gboolean gtk_tree_store_remove (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_insert (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter,
|
||||
@ -115,6 +115,8 @@ gboolean gtk_tree_store_is_ancestor (GtkTreeStore *tree_store,
|
||||
gint gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
void gtk_tree_store_clear (GtkTreeStore *tree_store);
|
||||
gboolean gtk_tree_store_iter_is_valid (GtkTreeStore *tree_store,
|
||||
GtkTreeIter *iter);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
Reference in New Issue
Block a user