Commit f8faec45 authored by Jonathan Blandford's avatar Jonathan Blandford Committed by Jonathan Blandford

use the new BOXED marshallers.

Fri Nov 10 12:10:34 2000  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
	BOXED marshallers.

	* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
	(gtk_list_store_class_init): use the new BOXED marshallers.

	* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
	new_with_values to new_with_types.
	(gtk_tree_store_get_column_type): add this.
	(gtk_tree_store_class_init): use the new BOXED marshallers.

	* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
	mirror some POINTER marshallers.
parent c97d57eb
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
Fri Nov 10 12:10:34 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c (gtk_model_simple_class_init): use the new
BOXED marshallers.
* gtk/gtkliststore.c (gtk_list_store_get_column_type): Add this.
(gtk_list_store_class_init): use the new BOXED marshallers.
* gtk/gtktreestore.c (gtk_tree_store_new_with_types): change
new_with_values to new_with_types.
(gtk_tree_store_get_column_type): add this.
(gtk_tree_store_class_init): use the new BOXED marshallers.
* gtk/gtkmarshal.list: Added a number of BOXED marshallers to
mirror some POINTER marshallers.
Thu Nov 9 11:23:22 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h (struct _GtkTreeIter): added more fields to
......
......@@ -299,7 +299,7 @@ create_tree (void)
GtkTreeIter iter;
gint i;
model = gtk_tree_store_new_with_values (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
......
......@@ -299,7 +299,7 @@ create_tree (void)
GtkTreeIter iter;
gint i;
model = gtk_tree_store_new_with_values (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
......
......@@ -40,6 +40,8 @@ static void gtk_list_store_class_init (GtkListStoreClass *class);
static void gtk_list_store_tree_model_init (GtkTreeModelIface *iface);
static guint gtk_list_store_get_flags (GtkTreeModel *tree_model);
static gint gtk_list_store_get_n_columns (GtkTreeModel *tree_model);
static GType gtk_list_store_get_column_type (GtkTreeModel *tree_model,
gint index);
static gboolean gtk_list_store_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
......@@ -115,36 +117,36 @@ gtk_list_store_class_init (GtkListStoreClass *class)
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListStoreClass, changed),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_ITER);
list_store_signals[INSERTED] =
gtk_signal_new ("inserted",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListStoreClass, inserted),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_ITER);
list_store_signals[CHILD_TOGGLED] =
gtk_signal_new ("child_toggled",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListStoreClass, child_toggled),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_ITER);
list_store_signals[DELETED] =
gtk_signal_new ("deleted",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkListStoreClass, deleted),
gtk_marshal_VOID__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GTK_TYPE_TREE_PATH);
gtk_object_class_add_signals (object_class, list_store_signals, LAST_SIGNAL);
......@@ -155,6 +157,7 @@ gtk_list_store_tree_model_init (GtkTreeModelIface *iface)
{
iface->get_flags = gtk_list_store_get_flags;
iface->get_n_columns = gtk_list_store_get_n_columns;
iface->get_column_type = gtk_list_store_get_column_type;
iface->get_iter = gtk_list_store_get_iter;
iface->get_path = gtk_list_store_get_path;
iface->get_value = gtk_list_store_get_value;
......@@ -260,6 +263,17 @@ gtk_list_store_get_n_columns (GtkTreeModel *tree_model)
return GTK_LIST_STORE (tree_model)->n_columns;
}
static GType
gtk_list_store_get_column_type (GtkTreeModel *tree_model,
gint index)
{
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];
}
static gboolean
gtk_list_store_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
......@@ -643,7 +657,6 @@ gtk_list_store_append (GtkListStore *list_store,
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
g_return_if_fail (G_SLIST (iter)->next == NULL);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
......
......@@ -21,6 +21,9 @@
# NONE deprecated alias for VOID
# BOOL deprecated alias for BOOLEAN
BOOLEAN:BOXED
BOOLEAN:BOXED,BOXED
BOOLEAN:BOXED,BOXED,INT
BOOLEAN:POINTER
BOOLEAN:POINTER,POINTER
BOOLEAN:POINTER,INT,INT
......@@ -29,8 +32,10 @@ BOOLEAN:POINTER,POINTER,INT
BOOLEAN:POINTER,POINTER,INT,INT
BOOLEAN:POINTER,STRING,STRING,POINTER
BOOLEAN:VOID
BOXED:BOXED
ENUM:ENUM
INT:INT
INT:BOXED
INT:OBJECT,BOXED,BOXED
INT:POINTER
INT:POINTER,CHAR,CHAR
......@@ -40,9 +45,11 @@ POINTER:POINTER,INT
POINTER:VOID
VOID:BOOLEAN
VOID:BOXED
VOID:BOXED,OBJECT
VOID:BOXED,BOXED
VOID:BOXED,BOXED,BOOLEAN
VOID:BOXED,BOXED,INT,BOOLEAN
VOID:BOXED,INT,POINTER
VOID:BOXED,OBJECT
VOID:BOXED,UINT,FLAGS
VOID:ENUM
VOID:ENUM,FLOAT
......@@ -63,7 +70,6 @@ VOID:POINTER,BOOLEAN
VOID:POINTER,INT
VOID:POINTER,INT,INT,POINTER,UINT,UINT
VOID:POINTER,INT,POINTER
VOID:POINTER,POINTER
VOID:POINTER,POINTER,BOOLEAN
VOID:POINTER,POINTER,INT
VOID:POINTER,POINTER,INT,BOOLEAN
......
......@@ -21,6 +21,9 @@
# NONE deprecated alias for VOID
# BOOL deprecated alias for BOOLEAN
BOOLEAN:BOXED
BOOLEAN:BOXED,BOXED
BOOLEAN:BOXED,BOXED,INT
BOOLEAN:POINTER
BOOLEAN:POINTER,POINTER
BOOLEAN:POINTER,INT,INT
......@@ -29,8 +32,10 @@ BOOLEAN:POINTER,POINTER,INT
BOOLEAN:POINTER,POINTER,INT,INT
BOOLEAN:POINTER,STRING,STRING,POINTER
BOOLEAN:VOID
BOXED:BOXED
ENUM:ENUM
INT:INT
INT:BOXED
INT:OBJECT,BOXED,BOXED
INT:POINTER
INT:POINTER,CHAR,CHAR
......@@ -40,9 +45,11 @@ POINTER:POINTER,INT
POINTER:VOID
VOID:BOOLEAN
VOID:BOXED
VOID:BOXED,OBJECT
VOID:BOXED,BOXED
VOID:BOXED,BOXED,BOOLEAN
VOID:BOXED,BOXED,INT,BOOLEAN
VOID:BOXED,INT,POINTER
VOID:BOXED,OBJECT
VOID:BOXED,UINT,FLAGS
VOID:ENUM
VOID:ENUM,FLOAT
......@@ -63,7 +70,6 @@ VOID:POINTER,BOOLEAN
VOID:POINTER,INT
VOID:POINTER,INT,INT,POINTER,UINT,UINT
VOID:POINTER,INT,POINTER
VOID:POINTER,POINTER
VOID:POINTER,POINTER,BOOLEAN
VOID:POINTER,POINTER,INT
VOID:POINTER,POINTER,INT,BOOLEAN
......
......@@ -135,36 +135,36 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, changed),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_ITER);
model_simple_signals[INSERTED] =
gtk_signal_new ("inserted",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, inserted),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_ITER);
model_simple_signals[CHILD_TOGGLED] =
gtk_signal_new ("child_toggled",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, child_toggled),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_BOXED,
G_TYPE_NONE, 2,
GTK_TYPE_TREE_PATH,
GTK_TYPE_TREE_ITER);
model_simple_signals[DELETED] =
gtk_signal_new ("deleted",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, deleted),
gtk_marshal_VOID__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED,
G_TYPE_NONE, 1,
GTK_TYPE_TREE_PATH);
model_simple_signals[GET_N_COLUMNS] =
gtk_signal_new ("get_n_columns",
......@@ -172,93 +172,94 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_INT__VOID,
GTK_TYPE_INT, 0);
G_TYPE_INT, 0);
model_simple_signals[GET_COLUMN_TYPE] =
gtk_signal_new ("get_column_type",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_INT__INT,
GTK_TYPE_INT, 1,
GTK_TYPE_INT);
G_TYPE_INT, 1,
G_TYPE_INT);
model_simple_signals[GET_ITER] =
gtk_signal_new ("get_iter",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_BOOLEAN__POINTER_POINTER,
GTK_TYPE_BOOL, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_BOOLEAN__BOXED_BOXED,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_PATH);
model_simple_signals[GET_PATH] =
gtk_signal_new ("get_path",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
GTK_TYPE_POINTER);
gtk_marshal_BOXED__BOXED,
GTK_TYPE_TREE_PATH, 1,
GTK_TYPE_TREE_ITER);
model_simple_signals[GET_VALUE] =
gtk_signal_new ("get_value",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_VOID__POINTER_INT_POINTER,
GTK_TYPE_NONE, 3,
GTK_TYPE_POINTER,
GTK_TYPE_INT,
GTK_TYPE_POINTER);
gtk_marshal_VOID__BOXED_INT_POINTER,
G_TYPE_NONE, 3,
GTK_TYPE_TREE_ITER,
G_TYPE_INT,
G_TYPE_POINTER);
model_simple_signals[ITER_NEXT] =
gtk_signal_new ("iter_next",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_BOOLEAN__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_POINTER);
gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GTK_TYPE_TREE_ITER);
model_simple_signals[ITER_CHILDREN] =
gtk_signal_new ("iter_children",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_BOOLEAN__POINTER_POINTER,
GTK_TYPE_POINTER, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_BOOLEAN__BOXED_BOXED,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_ITER);
model_simple_signals[ITER_HAS_CHILD] =
gtk_signal_new ("iter_has_child",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_BOOLEAN__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_POINTER);
gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GTK_TYPE_TREE_ITER);
model_simple_signals[ITER_N_CHILDREN] =
gtk_signal_new ("iter_n_children",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_INT__POINTER,
GTK_TYPE_INT, 1,
GTK_TYPE_POINTER);
gtk_marshal_INT__BOXED,
G_TYPE_INT, 1,
GTK_TYPE_TREE_ITER);
model_simple_signals[ITER_NTH_CHILD] =
gtk_signal_new ("node_nth_child",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_BOOLEAN__POINTER_POINTER_INT,
GTK_TYPE_BOOL, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_BOOLEAN__BOXED_BOXED_INT,
GTK_TYPE_BOOL, 3,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_ITER,
G_TYPE_INT);
model_simple_signals[ITER_PARENT] =
gtk_signal_new ("node_parent",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_BOOLEAN__POINTER_POINTER,
GTK_TYPE_BOOL, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_marshal_BOOLEAN__BOXED_BOXED,
G_TYPE_BOOLEAN, 2,
GTK_TYPE_TREE_ITER,
GTK_TYPE_TREE_ITER);
gtk_object_class_add_signals (object_class, model_simple_signals, LAST_SIGNAL);
}
......
......@@ -17,8 +17,16 @@
* Boston, MA 02111-1307, USA.
*/
/* NOTE: There is a potential for confusion in this code as to whether an iter,
* path or value refers to the GtkTreeModelSort model, or the model being
* sorted. As a convention, variables referencing the sorted model will have an
* s_ prefix before them (ie. s_iter, s_value, s_path);
*/
#include "gtktreemodelsort.h"
#include "gtksignal.h"
#include <string.h>
enum {
CHANGED,
......@@ -372,27 +380,31 @@ gtk_tree_model_sort_finalize (GObject *object)
}
static void
gtk_tree_model_sort_changed (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gtk_tree_model_sort_changed (GtkTreeModel *s_model,
GtkTreePath *s_path,
GtkTreeIter *s_iter,
gpointer data)
{
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
GtkTreePath *local_path;
GtkTreeIter local_iter;
GtkTreePath *path;
GtkTreeIter iter;
gboolean free_s_path = FALSE;
g_return_if_fail (s_path != NULL || s_iter != NULL);
g_return_if_fail (path != NULL || iter != NULL);
if (s_path == NULL)
{
free_s_path = TRUE;
s_path = gtk_tree_model_get_path (s_model, s_iter);
}
if (path == NULL)
path = gtk_tree_model_get_path (model, iter);
path = gtk_tree_model_sort_convert_path (tree_model_sort, s_path);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
gtk_signal_emit_by_name (GTK_OBJECT (data), "changed", path, &iter);
local_path = gtk_tree_model_sort_convert_path (tree_model_sort, path);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &local_iter, local_path);
gtk_signal_emit_by_name (GTK_OBJECT (data),
"changed",
local_path,
&local_iter);
gtk_tree_path_free (local_path);
gtk_tree_path_free (path);
if (free_s_path)
gtk_tree_path_free (s_path);
}
#if 0
......@@ -442,14 +454,17 @@ gtk_tree_model_sort_insert_value (GtkTreeModelSort *sort,
new_elt.parent = ((SortElt *) iter.tree_node);
new_elt.children = NULL;
last = 0;
j = array->len/2;
low = 0;
high = array->len;
middle = (low + high)/2;
/* Insert the value into the array */
while (1)
{
gint cmp;
tmp_elt = &(g_array_index (array, SortElt, j));
tmp_elt = &(g_array_index (array, SortElt,middle));
gtk_tree_model_get_value (sort->model, tmp_elt, sort->sort_col, &tmp_value);
cmp = ((func) (&tmp_value, value));
if (retval < 0)
;
......@@ -463,91 +478,123 @@ gtk_tree_model_sort_insert_value (GtkTreeModelSort *sort,
#endif
static void
gtk_tree_model_sort_inserted (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gtk_tree_model_sort_inserted (GtkTreeModel *s_model,
GtkTreePath *s_path,
GtkTreeIter *s_iter,
gpointer data)
{
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
GtkTreePath *local_path;
GtkTreeIter local_iter;
GValue value;
GtkTreePath *path;
GtkTreeIter iter;
g_return_if_fail (path != NULL || iter != NULL);
g_return_if_fail (s_path != NULL || s_iter != NULL);
if (!(tree_model_sort->flags & GTK_TREE_MODEL_ITERS_PERSIST) &&
(tree_model_sort->root != NULL))
if (!(tree_model_sort->flags & GTK_TREE_MODEL_ITERS_PERSIST))
{
gtk_tree_model_sort_free_level ((GArray *)tree_model_sort->root);
tree_model_sort->root = NULL;
}
else
{
}
if (path == NULL)
path = gtk_tree_model_get_path (model, iter);
if (s_path == NULL)
s_path = gtk_tree_model_get_path (s_model, s_iter);
local_path = gtk_tree_model_sort_convert_path (tree_model_sort, path);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &local_iter, local_path);
gtk_signal_emit_by_name (GTK_OBJECT (data),
"inserted",
local_path,
&local_iter);
gtk_tree_path_free (local_path);
path = gtk_tree_model_sort_convert_path (tree_model_sort, s_path);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
gtk_signal_emit_by_name (GTK_OBJECT (data), "inserted", path, iter);
gtk_tree_path_free (path);
}
static void
gtk_tree_model_sort_child_toggled (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
gtk_tree_model_sort_child_toggled (GtkTreeModel *s_model,
GtkTreePath *s_path,
GtkTreeIter *s_iter,
gpointer data)
{
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
GtkTreePath *local_path;
GtkTreeIter local_iter;
GtkTreePath *path;
GtkTreeIter iter;
gboolean free_s_path = FALSE;
g_return_if_fail (path != NULL || iter != NULL);
g_return_if_fail (s_path != NULL || s_iter != NULL);
if (!(tree_model_sort->flags & GTK_TREE_MODEL_ITERS_PERSIST) &&
(tree_model_sort->root != NULL))
if (!(tree_model_sort->flags & GTK_TREE_MODEL_ITERS_PERSIST))
{
gtk_tree_model_sort_free_level ((GArray *)tree_model_sort->root);
tree_model_sort->root = NULL;
}
if (path == NULL)
path = gtk_tree_model_get_path (model, iter);
if (s_path == NULL)
{
s_path = gtk_tree_model_get_path (s_model, s_iter);
free_s_path = TRUE;
}
local_path = gtk_tree_model_sort_convert_path (tree_model_sort, path);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &local_iter, local_path);
path = gtk_tree_model_sort_convert_path (tree_model_sort, s_path);
gtk_tree_model_get_iter (GTK_TREE_MODEL (data), &iter, path);
gtk_signal_emit_by_name (GTK_OBJECT (data),
"child_toggled",
local_path,
&local_iter);
gtk_tree_path_free (local_path);
path, &iter);
gtk_tree_path_free (path);
if (free_s_path)
gtk_tree_path_free (s_path);
}
static void
gtk_tree_model_sort_deleted (GtkTreeModel *model,
GtkTreePath *path,
gtk_tree_model_sort_deleted (GtkTreeModel *s_model,
GtkTreePath *s_path,
gpointer data)
{
GtkTreeModelSort *tree_model_sort = GTK_TREE_MODEL_SORT (data);
GtkTreePath *local_path;
GtkTreePath *path;
g_return_if_fail (s_path != NULL);
path = gtk_tree_model_sort_convert_path (tree_model_sort, s_path);
g_return_if_fail (path != NULL);
if (!(tree_model_sort->flags & GTK_TREE_MODEL_ITERS_PERSIST) &&
(tree_model_sort->root != NULL))
if (!(tree_model_sort->flags & GTK_TREE_MODEL_ITERS_PERSIST))
{
gtk_tree_model_sort_free_level ((GArray *)tree_model_sort->root);
tree_model_sort->root = NULL;
}
local_path = gtk_tree_model_sort_convert_path (tree_model_sort, path);
tree_model_sort->stamp++;
gtk_signal_emit_by_name (GTK_OBJECT (data),
"deleted",
local_path);
else
{
GArray *array;
GtkTreeIter iter;
SortElt *elt;
gint offset;
gint i;
gtk_tree_model_get_iter (GTK_TREE_MODEL (tree_model_sort), &iter, path);
elt = (SortElt *) iter.tree_node;
offset = elt->offset;
array = get_array (elt, tree_model_sort);
if (array->len == 1)
{
if (((SortElt *)array->data)->parent == NULL)
tree_model_sort->root = NULL;
else
(((SortElt *)array->data)->parent)->children = NULL;
gtk_tree_model_sort_free_level (array);
}