Not sure how this ever worked. Fixed it to use new iter stuff, and added

Fri Oct 27 17:56:26 2000  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtkliststore.c: Not sure how this ever worked.  Fixed it to
	use new iter stuff, and added all the appropriate signals et al.

	* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
	code is internal to gtk only.
This commit is contained in:
Jonathan Blandford 2000-10-27 23:34:58 +00:00 committed by Jonathan Blandford
parent 2bf87de4cb
commit 0ccb3e9aed
25 changed files with 945 additions and 698 deletions

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -1,3 +1,11 @@
Fri Oct 27 17:56:26 2000 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Not sure how this ever worked. Fixed it to
use new iter stuff, and added all the appropriate signals et al.
* gtk/gtktreedatalist.h: s/gtk/_gtk to further reinforce that this
code is internal to gtk only.
2000-10-28 Tor Lillqvist <tml@iki.fi>
* gtk/gtk.def
@ -56,7 +64,6 @@ Fri Oct 27 18:51:44 2000 Tim Janik <timj@gtk.org>
2000-10-26 Havoc Pennington <hp@redhat.com>
* gtk/gtkmarshal.list: add new marshallers used by the text widget
* gtk/gtktextbuffer.c (gtk_text_buffer_class_init): fix marshaller
types

View File

@ -214,14 +214,16 @@ button_press_event_cb (GtkTreeView *tree_view,
GVoidFunc func;
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_store_iter_get (model, &iter,
FUNC_COLUMN, &func,
ITALIC_COLUMN, &italic,
-1);
gtk_tree_store_get (GTK_TREE_STORE (model),
&iter,
FUNC_COLUMN, &func,
ITALIC_COLUMN, &italic,
-1);
(func) ();
gtk_tree_store_iter_set (model, &iter,
ITALIC_COLUMN, !italic,
-1);
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
ITALIC_COLUMN, !italic,
-1);
gtk_tree_path_free (path);
}
@ -243,9 +245,9 @@ selection_cb (GtkTreeSelection *selection,
if (! gtk_tree_selection_get_selected (selection, &iter))
return;
gtk_tree_model_iter_get_value (model, &iter,
FILENAME_COLUMN,
&value);
gtk_tree_model_get_value (model, &iter,
FILENAME_COLUMN,
&value);
load_file (g_value_get_string (&value));
g_value_unset (&value);
}
@ -307,15 +309,15 @@ create_tree (void)
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
{
gtk_tree_store_iter_append (GTK_TREE_STORE (model), &iter, NULL);
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
gtk_tree_store_iter_set (GTK_TREE_STORE (model),
&iter,
TITLE_COLUMN, testgtk_demos[i].title,
FILENAME_COLUMN, testgtk_demos[i].filename,
FUNC_COLUMN, testgtk_demos[i].func,
ITALIC_COLUMN, FALSE,
-1);
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
TITLE_COLUMN, testgtk_demos[i].title,
FILENAME_COLUMN, testgtk_demos[i].filename,
FUNC_COLUMN, testgtk_demos[i].func,
ITALIC_COLUMN, FALSE,
-1);
}
cell = gtk_cell_renderer_text_new ();

View File

@ -214,14 +214,16 @@ button_press_event_cb (GtkTreeView *tree_view,
GVoidFunc func;
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_store_iter_get (model, &iter,
FUNC_COLUMN, &func,
ITALIC_COLUMN, &italic,
-1);
gtk_tree_store_get (GTK_TREE_STORE (model),
&iter,
FUNC_COLUMN, &func,
ITALIC_COLUMN, &italic,
-1);
(func) ();
gtk_tree_store_iter_set (model, &iter,
ITALIC_COLUMN, !italic,
-1);
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
ITALIC_COLUMN, !italic,
-1);
gtk_tree_path_free (path);
}
@ -243,9 +245,9 @@ selection_cb (GtkTreeSelection *selection,
if (! gtk_tree_selection_get_selected (selection, &iter))
return;
gtk_tree_model_iter_get_value (model, &iter,
FILENAME_COLUMN,
&value);
gtk_tree_model_get_value (model, &iter,
FILENAME_COLUMN,
&value);
load_file (g_value_get_string (&value));
g_value_unset (&value);
}
@ -307,15 +309,15 @@ create_tree (void)
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
{
gtk_tree_store_iter_append (GTK_TREE_STORE (model), &iter, NULL);
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
gtk_tree_store_iter_set (GTK_TREE_STORE (model),
&iter,
TITLE_COLUMN, testgtk_demos[i].title,
FILENAME_COLUMN, testgtk_demos[i].filename,
FUNC_COLUMN, testgtk_demos[i].func,
ITALIC_COLUMN, FALSE,
-1);
gtk_tree_store_set (GTK_TREE_STORE (model),
&iter,
TITLE_COLUMN, testgtk_demos[i].title,
FILENAME_COLUMN, testgtk_demos[i].filename,
FUNC_COLUMN, testgtk_demos[i].func,
ITALIC_COLUMN, FALSE,
-1);
}
cell = gtk_cell_renderer_text_new ();

View File

@ -24,7 +24,7 @@
#include "gtksignal.h"
#define G_SLIST(x) ((GSList *) x)
#if 0
enum {
CHANGED,
INSERTED,
@ -35,31 +35,35 @@ enum {
static guint list_store_signals[LAST_SIGNAL] = { 0 };
static void gtk_list_store_init (GtkListStore *list_store);
static void gtk_list_store_class_init (GtkListStoreClass *class);
static void gtk_list_store_tree_model_init (GtkTreeModelIface *iface);
static gint gtk_list_store_get_n_columns (GtkTreeModel *tree_model);
static GtkTreeIter *gtk_list_store_get_iter (GtkTreeModel *tree_model,
GtkTreePath *path);
static GtkTreePath *gtk_list_store_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static void gtk_list_store_iter_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
static gboolean gtk_list_store_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static GtkTreeIter *gtk_list_store_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean gtk_list_store_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gint gtk_list_store_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static GtkTreeIter *gtk_list_store_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint n);
static GtkTreeIter *gtk_list_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static void gtk_list_store_init (GtkListStore *list_store);
static void gtk_list_store_class_init (GtkListStoreClass *class);
static void gtk_list_store_tree_model_init (GtkTreeModelIface *iface);
static gint gtk_list_store_get_n_columns (GtkTreeModel *tree_model);
static gboolean gtk_list_store_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
static GtkTreePath *gtk_list_store_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static void gtk_list_store_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
static gboolean gtk_list_store_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean gtk_list_store_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
static gboolean gtk_list_store_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gint gtk_list_store_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean gtk_list_store_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint n);
static gboolean gtk_list_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
GtkType
@ -151,7 +155,7 @@ gtk_list_store_tree_model_init (GtkTreeModelIface *iface)
iface->get_n_columns = gtk_list_store_get_n_columns;
iface->get_iter = gtk_list_store_get_iter;
iface->get_path = gtk_list_store_get_path;
iface->iter_get_value = gtk_list_store_iter_get_value;
iface->get_value = gtk_list_store_get_value;
iface->iter_next = gtk_list_store_iter_next;
iface->iter_children = gtk_list_store_iter_children;
iface->iter_has_child = gtk_list_store_iter_has_child;
@ -164,32 +168,32 @@ static void
gtk_list_store_init (GtkListStore *list_store)
{
list_store->root = NULL;
list_store->stamp = 1;
}
GtkObject *
GtkListStore *
gtk_list_store_new (void)
{
return GTK_OBJECT (gtk_type_new (gtk_list_store_get_type ()));
return GTK_LIST_STORE (gtk_type_new (gtk_list_store_get_type ()));
}
GtkObject *
GtkListStore *
gtk_list_store_new_with_types (gint n_columns,
...)
{
GtkObject *retval;
GtkListStore *retval;
va_list args;
gint i;
g_return_val_if_fail (n_columns > 0, NULL);
retval = gtk_list_store_new ();
gtk_list_store_set_n_columns (GTK_LIST_STORE (retval),
n_columns);
gtk_list_store_set_n_columns (retval, n_columns);
va_start (args, n_columns);
for (i = 0; i < n_columns; i++)
gtk_list_store_set_column_type (GTK_LIST_STORE (retval),
i, va_arg (args, GType));
gtk_list_store_set_column_type (retval, i, va_arg (args, GType));
va_end (args);
@ -204,6 +208,7 @@ gtk_list_store_set_n_columns (GtkListStore *list_store,
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (n_columns > 0);
if (list_store->n_columns == n_columns)
return;
@ -240,138 +245,160 @@ gtk_list_store_set_column_type (GtkListStore *list_store,
static gint
gtk_list_store_get_n_columns (GtkTreeModel *tree_model)
{
g_return_val_if_fail (tree_model != NULL, 0);
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), 0);
return GTK_LIST_STORE (tree_model)->n_columns;
}
static GtkTreeIter *
static gboolean
gtk_list_store_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path)
{
g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, NULL);
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);
iter->stamp = GTK_LIST_STORE (tree_model)->stamp;
iter->tree_node = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root),
gtk_tree_path_get_indices (path)[0]);
return (GtkTreeIter) g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root),
gtk_tree_path_get_indices (path)[0]);
return iter->tree_node != NULL;
}
static GtkTreePath *
gtk_list_store_get_path (GtkTreeModel *tree_model,
GtkTreeIter iter)
GtkTreeIter *iter)
{
GtkTreePath *retval;
GSList *list;
gint i = 0;
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), NULL);
g_return_val_if_fail (iter->stamp == GTK_LIST_STORE (tree_model)->stamp, NULL);
for (list = G_SLIST (GTK_LIST_STORE (tree_model)->root); list; list = list->next)
{
i++;
if (list == G_SLIST (iter))
if (list == G_SLIST (iter->tree_node))
break;
i++;
}
if (list == NULL)
return NULL;
retval = gtk_tree_path_new ();
gtk_tree_path_append_index (retval, i);
return retval;
}
static void
gtk_list_store_iter_get_value (GtkTreeModel *tree_model,
GtkTreeIter iter,
gint column,
GValue *value)
gtk_list_store_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
{
GtkTreeDataList *list;
gint tmp_column = column;
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (tree_model));
g_return_if_fail (iter != NULL);
g_return_if_fail (column < GTK_LIST_STORE (tree_model)->n_columns);
g_return_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp);
list = G_SLIST (iter)->data;
list = G_SLIST (iter->tree_node)->data;
while (tmp_column-- > 0 && list)
list = list->next;
g_return_if_fail (list != NULL);
gtk_tree_data_list_iter_to_value (list,
GTK_LIST_STORE (tree_model)->column_headers[column],
value);
if (list == NULL)
g_value_init (value, GTK_LIST_STORE (tree_model)->column_headers[column]);
else
_gtk_tree_data_list_node_to_value (list,
GTK_LIST_STORE (tree_model)->column_headers[column],
value);
}
static gboolean
gtk_list_store_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
if (iter == NULL || *iter == NULL)
return FALSE;
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), FALSE);
g_return_val_if_fail (GTK_LIST_STORE (tree_model)->stamp == iter->stamp, FALSE);
*iter = (GtkTreeIter) G_SLIST (*iter)->next;
iter->tree_node = G_SLIST (iter->tree_node)->next;
return (*iter != NULL);
return (iter->tree_node != NULL);
}
static GtkTreeIter
static gboolean
gtk_list_store_iter_children (GtkTreeModel *tree_model,
GtkTreeIter iter)
GtkTreeIter *iter,
GtkTreeIter *parent)
{
return NULL;
iter->stamp = 0;
iter->tree_node = NULL;
return FALSE;
}
static gboolean
gtk_list_store_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter iter)
GtkTreeIter *iter)
{
return FALSE;
}
static gint
gtk_list_store_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter iter)
GtkTreeIter *iter)
{
return 0;
}
static GtkTreeIter
static gboolean
gtk_list_store_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter iter,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint n)
{
return NULL;
g_return_val_if_fail (GTK_IS_LIST_STORE (tree_model), FALSE);
if (parent)
{
g_return_val_if_fail (iter->stamp == GTK_LIST_STORE (tree_model)->stamp, FALSE);
iter->stamp = 0;
iter->tree_node = NULL;
return FALSE;
}
iter->tree_node = g_slist_nth (G_SLIST (GTK_LIST_STORE (tree_model)->root), n);
if (iter->tree_node)
iter->stamp = GTK_LIST_STORE (tree_model)->stamp;
else
iter->stamp = 0;
return (iter->tree_node != NULL);
}
static GtkTreeIter
static gboolean
gtk_list_store_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter iter)
GtkTreeIter *iter,
GtkTreeIter *child)
{
return NULL;
iter->stamp = 0;
iter->tree_node = NULL;
return FALSE;
}
/* Public accessors */
GtkTreeIter
gtk_list_store_iter_new (void)
{
GtkTreeIter retval = (GtkTreeIter) g_slist_alloc ();
return retval;
}
/* This is a somewhat inelegant function that does a lot of list
* manipulations on it's own.
*/
void
gtk_list_store_iter_set_cell (GtkListStore *list_store,
GtkTreeIter iter,
gint column,
GValue *value)
gtk_list_store_set_cell (GtkListStore *list_store,
GtkTreeIter *iter,
gint column,
GValue *value)
{
GtkTreeDataList *list;
GtkTreeDataList *prev;
@ -381,13 +408,13 @@ gtk_list_store_iter_set_cell (GtkListStore *list_store,
g_return_if_fail (iter != NULL);
g_return_if_fail (column >= 0 && column < list_store->n_columns);
prev = list = G_SLIST (iter)->data;
prev = list = G_SLIST (iter->tree_node)->data;
while (list != NULL)
{
if (column == 0)
{
gtk_tree_data_list_value_to_iter (list, value);
_gtk_tree_data_list_value_to_node (list, value);
return;
}
@ -396,123 +423,235 @@ gtk_list_store_iter_set_cell (GtkListStore *list_store,
list = list->next;
}
if (G_SLIST (iter)->data == NULL)
if (G_SLIST (iter->tree_node)->data == NULL)
{
G_SLIST (iter)->data = list = gtk_tree_data_list_alloc ();
G_SLIST (iter->tree_node)->data = list = _gtk_tree_data_list_alloc ();
list->next = NULL;
}
else
{
list = prev->next = gtk_tree_data_list_alloc ();
list = prev->next = _gtk_tree_data_list_alloc ();
list->next = NULL;
}
while (column != 0)
{
list->next = gtk_tree_data_list_alloc ();
list->next = _gtk_tree_data_list_alloc ();
list = list->next;
list->next = NULL;
column --;
}
gtk_tree_data_list_value_to_iter (list, value);
_gtk_tree_data_list_value_to_node (list, value);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"changed",
NULL, iter);
}
void
gtk_list_store_iter_remove (GtkListStore *list_store,
GtkTreeIter iter)
gtk_list_store_remove (GtkListStore *list_store,
GtkTreeIter *iter)
{
/* FIXME: implement */
g_warning ("Remember to implement this function\n");
GtkTreePath *path;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
if (G_SLIST (iter->tree_node)->data)
_gtk_tree_data_list_free ((GtkTreeDataList *) G_SLIST (iter->tree_node)->data,
list_store->column_headers);
path = gtk_list_store_get_path (GTK_TREE_MODEL (list_store), iter);
list_store->root = g_slist_remove_link (G_SLIST (list_store->root),
G_SLIST (iter->tree_node));
list_store->stamp ++;
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"deleted",
path);
gtk_tree_path_free (path);
}
GtkTreeIter
gtk_list_store_iter_insert (GtkListStore *list_store,
gint position,
GtkTreeIter iter)
void
gtk_list_store_insert (GtkListStore *list_store,
GtkTreeIter *iter,
gint position)
{
GSList *list;
GtkTreePath *path;
g_return_val_if_fail (list_store != NULL, iter);
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), iter);
g_return_val_if_fail (iter != NULL, iter);
g_return_val_if_fail (position < 0, iter);
g_return_val_if_fail (G_SLIST (iter)->next == NULL, iter);
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 (position < 0);
if (position == 0)
{
gtk_list_store_iter_prepend (list_store, iter);
return iter;
gtk_list_store_prepend (list_store, iter);
return;
}
list = g_slist_nth (G_SLIST (list_store->root), position);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
list = g_slist_nth (G_SLIST (list_store->root), position - 1);
if (list)
{
G_SLIST (iter)->next = list->next;
list->next = G_SLIST (iter)->next;
G_SLIST (iter->tree_node)->next = list->next;
list->next = G_SLIST (iter->tree_node)->next;
}
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, position);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_path_free (path);
}
void
gtk_list_store_insert_before (GtkListStore *list_store,
GtkTreeIter *iter,
GtkTreeIter *sibling)
{
GtkTreePath *path;
GSList *list, *prev;
gint i = 0;
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);
if (sibling == NULL)
{
gtk_list_store_append (list_store, iter);
return;
}
return iter;
}
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
GtkTreeIter
gtk_list_store_iter_insert_before (GtkListStore *list_store,
GtkTreeIter sibling,
GtkTreeIter iter)
{
g_return_val_if_fail (list_store != NULL, iter);
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), iter);
g_return_val_if_fail (iter != NULL, iter);
/* FIXME: This is all wrong. This is actually insert_after */
if (sibling == NULL)
return gtk_list_store_iter_prepend (list_store, iter);
G_SLIST (iter)->next = G_SLIST (sibling)->next;
G_SLIST (sibling)->next = G_SLIST (iter);
return iter;
}
GtkTreeIter
gtk_list_store_iter_prepend (GtkListStore *list_store,
GtkTreeIter iter)
{
g_return_val_if_fail (list_store != NULL, iter);
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), iter);
g_return_val_if_fail (iter != NULL, iter);
G_SLIST (iter)->next = G_SLIST (list_store->root);
list_store->root = iter;
return iter;
}
GtkTreeIter
gtk_list_store_iter_append (GtkListStore *list_store,
GtkTreeIter iter)
{
GSList *list;
g_return_val_if_fail (list_store != NULL, iter);
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), iter);
g_return_val_if_fail (iter != NULL, iter);
g_return_val_if_fail (G_SLIST (iter)->next == NULL, iter);
list = g_slist_last (G_SLIST (list_store->root));
if (list == NULL)
list_store->root = iter;
prev = list = list_store->root;
while (list && list != sibling->tree_node)
{
prev = list;
list = list->next;
i++;
}
if (prev)
{
prev->next = iter->tree_node;
}
else
list->next = G_SLIST (iter);
{
G_SLIST (iter->tree_node)->next = list_store->root;
list_store->root = iter->tree_node;
}
return iter;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_path_free (path);
}
GtkTreeIter
gtk_list_store_iter_get_root (GtkListStore *list_store)
void
gtk_list_store_insert_after (GtkListStore *list_store,
GtkTreeIter *iter,
GtkTreeIter *sibling)
{
g_return_val_if_fail (list_store != NULL, NULL);
g_return_val_if_fail (GTK_IS_LIST_STORE (list_store), NULL);
GtkTreePath *path;
GSList *list;
gint i = 0;
return (GtkTreeIter *) list_store->root;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter == NULL);
if (sibling)
g_return_if_fail (sibling->stamp == list_store->stamp);
if (sibling == NULL)
{
gtk_list_store_prepend (list_store, iter);
return;
}
for (list = list_store->root; list && list != sibling->tree_node; list = list->next)
i++;
g_return_if_fail (list != NULL);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
G_SLIST (iter->tree_node)->next = G_SLIST (sibling->tree_node)->next;
G_SLIST (sibling)->next = G_SLIST (iter);
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_path_free (path);
}
void
gtk_list_store_prepend (GtkListStore *list_store,
GtkTreeIter *iter)
{
GtkTreePath *path;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
g_return_if_fail (iter != NULL);
iter->stamp = list_store->stamp;
iter->tree_node = g_slist_alloc ();
G_SLIST (iter->tree_node)->next = G_SLIST (list_store->root);
list_store->root = iter->tree_node;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, 0);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_path_free (path);
}
void
gtk_list_store_append (GtkListStore *list_store,
GtkTreeIter *iter)
{
GtkTreePath *path;
GSList *list, *prev;
gint i = 0;
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 ();
prev = list = list_store->root;
while (list)
{
prev = list;
list = list->next;
i++;
}
if (prev)
prev->next = iter->tree_node;
else
list_store->root = iter->tree_node;
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
gtk_signal_emit_by_name (GTK_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_path_free (path);
}
#endif

View File

@ -52,45 +52,48 @@ struct _GtkListStoreClass
/* signals */
/* Will be moved into the GtkTreeModelIface eventually */
void (* changed) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* inserted) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* child_toggled) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* deleted) (GtkTreeModel *tree_model,
GtkTreePath *path);
void (* changed) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* inserted) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* child_toggled) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void (* deleted) (GtkTreeModel *tree_model,
GtkTreePath *path);
};
GtkType gtk_list_store_get_type (void);
GtkObject *gtk_list_store_new (void);
GtkObject *gtk_list_store_new_with_types (gint n_columns,
...);
void gtk_list_store_set_n_columns (GtkListStore *store,
gint n_columns);
void gtk_list_store_set_column_type (GtkListStore *store,
gint column,
GType type);
GtkTreeIter *gtk_list_store_node_new (void);
void gtk_list_store_node_set_cell (GtkListStore *store,
GtkTreeIter *iter,
gint column,
GValue *value);
void gtk_list_store_node_remove (GtkListStore *store,
GtkTreeIter *iter);
GtkTreeIter *gtk_list_store_node_insert (GtkListStore *store,
gint position,
GtkTreeIter *iter);
GtkTreeIter *gtk_list_store_node_insert_before (GtkListStore *store,
GtkTreeIter sibling,
GtkTreeIter *iter);
GtkTreeIter *gtk_list_store_node_prepend (GtkListStore *store,
GtkTreeIter *iter);
GtkTreeIter *gtk_list_store_node_append (GtkListStore *store,
GtkTreeIter *iter);
GtkType gtk_list_store_get_type (void);
GtkListStore *gtk_list_store_new (void);
GtkListStore *gtk_list_store_new_with_types (gint n_columns,
...);
void gtk_list_store_set_n_columns (GtkListStore *store,
gint n_columns);
void gtk_list_store_set_column_type (GtkListStore *store,
gint column,
GType type);
void gtk_list_store_set_cell (GtkListStore *store,
GtkTreeIter *iter,
gint column,
GValue *value);
void gtk_list_store_remove (GtkListStore *store,
GtkTreeIter *iter);
void gtk_list_store_insert (GtkListStore *store,
GtkTreeIter *iter,
gint position);
void gtk_list_store_insert_before (GtkListStore *store,
GtkTreeIter *iter,
GtkTreeIter *sibling);
void gtk_list_store_insert_after (GtkListStore *store,
GtkTreeIter *iter,
GtkTreeIter *sibling);
void gtk_list_store_prepend (GtkListStore *store,
GtkTreeIter *iter);
void gtk_list_store_append (GtkListStore *store,
GtkTreeIter *iter);

View File

@ -22,12 +22,15 @@
# BOOL deprecated alias for BOOLEAN
BOOLEAN:POINTER
BOOLEAN:POINTER,POINTER
BOOLEAN:POINTER,INT,INT
BOOLEAN:POINTER,INT,INT,UINT
BOOLEAN:POINTER,POINTER,INT
BOOLEAN:POINTER,POINTER,INT,INT
BOOLEAN:POINTER,STRING,STRING,POINTER
BOOLEAN:VOID
ENUM:ENUM
INT:INT
INT:OBJECT,BOXED,POINTER
INT:POINTER
INT:POINTER,CHAR,CHAR

View File

@ -22,12 +22,15 @@
# BOOL deprecated alias for BOOLEAN
BOOLEAN:POINTER
BOOLEAN:POINTER,POINTER
BOOLEAN:POINTER,INT,INT
BOOLEAN:POINTER,INT,INT,UINT
BOOLEAN:POINTER,POINTER,INT
BOOLEAN:POINTER,POINTER,INT,INT
BOOLEAN:POINTER,STRING,STRING,POINTER
BOOLEAN:VOID
ENUM:ENUM
INT:INT
INT:OBJECT,BOXED,POINTER
INT:POINTER
INT:POINTER,CHAR,CHAR

View File

@ -16,26 +16,26 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#if 0
#include "gtkmodelsimple.h"
#include "gtksignal.h"
enum {
NODE_CHANGED,
NODE_INSERTED,
NODE_CHILD_TOGGLED,
NODE_DELETED,
CHANGED,
INSERTED,
CHILD_TOGGLED,
DELETED,
GET_N_COLUMNS,
GET_NODE,
GET_COLUMN_TYPE,
GET_ITER,
GET_PATH,
NODE_GET_VALUE,
NODE_COPY,
NODE_NEXT,
NODE_CHILDREN,
NODE_HAS_CHILD,
NODE_N_CHILDREN,
NODE_NTH_CHILD,
NODE_PARENT,
GET_VALUE,
ITER_NEXT,
ITER_CHILDREN,
ITER_HAS_CHILD,
ITER_N_CHILDREN,
ITER_NTH_CHILD,
ITER_PARENT,
LAST_SIGNAL
};
@ -43,27 +43,34 @@ static void gtk_model_simple_init (GtkModelSimple *
static void gtk_model_simple_class_init (GtkModelSimpleClass *class);
static void gtk_model_simple_tree_model_init (GtkTreeModelIface *iface);
static gint gtk_real_model_simple_get_n_columns (GtkTreeModel *tree_model);
static GtkTreeNode gtk_real_model_simple_get_node (GtkTreeModel *tree_model,
static GType gtk_real_model_simple_get_column_type (GtkTreeModel *tree_model,
gint index);
static gboolean gtk_real_model_simple_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
static GtkTreePath *gtk_real_model_simple_get_path (GtkTreeModel *tree_model,
GtkTreeNode node);
static void gtk_real_model_simple_node_get_value (GtkTreeModel *tree_model,
GtkTreeNode node,
GtkTreeIter *iter);
static void gtk_real_model_simple_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
static gboolean gtk_real_model_simple_node_next (GtkTreeModel *tree_model,
GtkTreeNode *node);
static GtkTreeNode gtk_real_model_simple_node_children (GtkTreeModel *tree_model,
GtkTreeNode node);
static gboolean gtk_real_model_simple_node_has_child (GtkTreeModel *tree_model,
GtkTreeNode node);
static gint gtk_real_model_simple_node_n_children (GtkTreeModel *tree_model,
GtkTreeNode node);
static GtkTreeNode gtk_real_model_simple_node_nth_child (GtkTreeModel *tree_model,
GtkTreeNode node,
static gboolean gtk_real_model_simple_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean gtk_real_model_simple_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
static gboolean gtk_real_model_simple_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gint gtk_real_model_simple_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static gboolean gtk_real_model_simple_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint n);
static GtkTreeNode gtk_real_model_simple_node_parent (GtkTreeModel *tree_model,
GtkTreeNode node);
static gboolean gtk_real_model_simple_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
@ -106,10 +113,14 @@ gtk_model_simple_get_type (void)
return model_simple_type;
}
GtkObject *
GtkModelSimple *
gtk_model_simple_new (void)
{
return GTK_OBJECT (gtk_type_new (GTK_TYPE_MODEL_SIMPLE));
GtkModelSimple *retval;
retval = GTK_MODEL_SIMPLE (gtk_type_new (GTK_TYPE_MODEL_SIMPLE));
return retval;
}
static void
@ -119,38 +130,38 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
object_class = (GtkObjectClass*) class;
model_simple_signals[NODE_CHANGED] =
gtk_signal_new ("node_changed",
model_simple_signals[CHANGED] =
gtk_signal_new ("changed",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_changed),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, changed),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
model_simple_signals[NODE_INSERTED] =
gtk_signal_new ("node_inserted",
model_simple_signals[INSERTED] =
gtk_signal_new ("inserted",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_inserted),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, inserted),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
model_simple_signals[NODE_CHILD_TOGGLED] =
gtk_signal_new ("node_child_toggled",
model_simple_signals[CHILD_TOGGLED] =
gtk_signal_new ("child_toggled",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_child_toggled),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, child_toggled),
gtk_marshal_VOID__POINTER_POINTER,
GTK_TYPE_NONE, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
model_simple_signals[NODE_DELETED] =
gtk_signal_new ("node_deleted",
model_simple_signals[DELETED] =
gtk_signal_new ("deleted",
GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, node_deleted),
GTK_SIGNAL_OFFSET (GtkModelSimpleClass, deleted),
gtk_marshal_VOID__POINTER,
GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
@ -162,13 +173,22 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
0,
gtk_marshal_INT__VOID,
GTK_TYPE_INT, 0);
model_simple_signals[GET_NODE] =
gtk_signal_new ("get_node",
model_simple_signals[GET_COLUMN_TYPE] =
gtk_signal_new ("get_column_type",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
gtk_marshal_INT__INT,
GTK_TYPE_INT, 1,
GTK_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);
model_simple_signals[GET_PATH] =
gtk_signal_new ("get_path",
@ -178,8 +198,8 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
GTK_TYPE_POINTER);
model_simple_signals[NODE_GET_VALUE] =
gtk_signal_new ("node_get_value",
model_simple_signals[GET_VALUE] =
gtk_signal_new ("get_value",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
@ -188,54 +208,56 @@ gtk_model_simple_class_init (GtkModelSimpleClass *class)
GTK_TYPE_POINTER,
GTK_TYPE_INT,
GTK_TYPE_POINTER);
model_simple_signals[NODE_NEXT] =
gtk_signal_new ("node_next",
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);
model_simple_signals[NODE_CHILDREN] =
gtk_signal_new ("node_children",
model_simple_signals[ITER_CHILDREN] =
gtk_signal_new ("iter_children",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
gtk_marshal_BOOLEAN__POINTER_POINTER,
GTK_TYPE_POINTER, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
model_simple_signals[NODE_HAS_CHILD] =
gtk_signal_new ("node_has_child",
model_simple_signals[ITER_HAS_CHILD] =
gtk_signal_new ("iter_has_child",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
gtk_marshal_BOOLEAN__POINTER,
GTK_TYPE_BOOL, 1,
GTK_TYPE_POINTER);
model_simple_signals[NODE_N_CHILDREN] =
gtk_signal_new ("node_n_children",
model_simple_signals[ITER_N_CHILDREN] =
gtk_signal_new ("iter_n_children",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
gtk_marshal_INT__POINTER,
GTK_TYPE_INT, 1,
GTK_TYPE_POINTER);
model_simple_signals[NODE_NTH_CHILD] =
model_simple_signals[ITER_NTH_CHILD] =
gtk_signal_new ("node_nth_child",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER_INT,
GTK_TYPE_POINTER, 2,
gtk_marshal_BOOLEAN__POINTER_POINTER_INT,
GTK_TYPE_BOOL, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
model_simple_signals[NODE_PARENT] =
model_simple_signals[ITER_PARENT] =
gtk_signal_new ("node_parent",
GTK_RUN_LAST,
GTK_CLASS_TYPE (object_class),
0,
gtk_marshal_POINTER__POINTER,
GTK_TYPE_POINTER, 1,
gtk_marshal_BOOLEAN__POINTER_POINTER,
GTK_TYPE_BOOL, 2,
GTK_TYPE_POINTER,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (object_class, model_simple_signals, LAST_SIGNAL);
@ -245,21 +267,23 @@ static void
gtk_model_simple_tree_model_init (GtkTreeModelIface *iface)
{
iface->get_n_columns = gtk_real_model_simple_get_n_columns;
iface->get_node = gtk_real_model_simple_get_node;
iface->get_column_type = gtk_real_model_simple_get_column_type;
iface->get_iter = gtk_real_model_simple_get_iter;
iface->get_path = gtk_real_model_simple_get_path;
iface->node_get_value = gtk_real_model_simple_node_get_value;
iface->node_next = gtk_real_model_simple_node_next;
iface->node_children = gtk_real_model_simple_node_children;
iface->node_has_child = gtk_real_model_simple_node_has_child;
iface->node_n_children = gtk_real_model_simple_node_n_children;
iface->node_nth_child = gtk_real_model_simple_node_nth_child;
iface->node_parent = gtk_real_model_simple_node_parent;
iface->get_value = gtk_real_model_simple_get_value;
iface->iter_next = gtk_real_model_simple_iter_next;
iface->iter_children = gtk_real_model_simple_iter_children;
iface->iter_has_child = gtk_real_model_simple_iter_has_child;
iface->iter_n_children = gtk_real_model_simple_iter_n_children;
iface->iter_nth_child = gtk_real_model_simple_iter_nth_child;
iface->iter_parent = gtk_real_model_simple_iter_parent;
}
static void
gtk_model_simple_init (GtkModelSimple *model_simple)
{
model_simple->stamp = 1;
}
static gint
@ -272,150 +296,164 @@ gtk_real_model_simple_get_n_columns (GtkTreeModel *tree_model)
return retval;
}
static GtkTreeNode
gtk_real_model_simple_get_node (GtkTreeModel *tree_model,
static GType
gtk_real_model_simple_get_column_type (GtkTreeModel *tree_model,
gint index)
{
GType retval = G_TYPE_INVALID;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[GET_COLUMN_TYPE], index, &retval);
return retval;
}
static gboolean
gtk_real_model_simple_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path)
{
GtkTreeNode retval;
gboolean retval;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[GET_NODE], path, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[GET_ITER], iter, path, &retval);
return retval;
}
static GtkTreePath *
gtk_real_model_simple_get_path (GtkTreeModel *tree_model,
GtkTreeNode node)
GtkTreeIter *iter)
{
GtkTreePath *retval;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[GET_PATH], node, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[GET_PATH], iter, &retval);
return retval;
}
static void
gtk_real_model_simple_node_get_value (GtkTreeModel *tree_model,
GtkTreeNode node,
gint column,
GValue *value)
gtk_real_model_simple_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
{
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_GET_VALUE], node, column, value);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[GET_VALUE], iter, column, value);
}
static gboolean
gtk_real_model_simple_node_next (GtkTreeModel *tree_model,
GtkTreeNode *node)
gtk_real_model_simple_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
gboolean retval = FALSE;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_NEXT], node, &retval);
return retval;
}
static GtkTreeNode
gtk_real_model_simple_node_children (GtkTreeModel *tree_model,
GtkTreeNode node)
{
GtkTreeNode retval = NULL;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_CHILDREN], node, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[ITER_NEXT], iter, &retval);
return retval;
}
static gboolean
gtk_real_model_simple_node_has_child (GtkTreeModel *tree_model,
GtkTreeNode node)
gtk_real_model_simple_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent)
{
gboolean retval = FALSE;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_HAS_CHILD], node, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[ITER_CHILDREN], iter, parent, &retval);
return retval;
}
static gboolean
gtk_real_model_simple_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
gboolean retval = FALSE;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[ITER_HAS_CHILD], iter, &retval);
return retval;
}
static gint
gtk_real_model_simple_node_n_children (GtkTreeModel *tree_model,
GtkTreeNode node)
gtk_real_model_simple_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
gint retval = 0;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_N_CHILDREN], node, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[ITER_N_CHILDREN], iter, &retval);
return retval;
}
static GtkTreeNode
gtk_real_model_simple_node_nth_child (GtkTreeModel *tree_model,
GtkTreeNode node,
static gboolean
gtk_real_model_simple_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint n)
{
GtkTreeNode retval = NULL;
gboolean retval = FALSE;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_NTH_CHILD], node, n, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[ITER_NTH_CHILD], iter, parent, n, &retval);
return retval;
}
static GtkTreeNode
gtk_real_model_simple_node_parent (GtkTreeModel *tree_model,
GtkTreeNode node)
static gboolean
gtk_real_model_simple_iter_parent (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child)
{
GtkTreeNode retval = NULL;
gboolean retval = FALSE;
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[NODE_PARENT], node, &retval);
gtk_signal_emit (GTK_OBJECT (tree_model), model_simple_signals[ITER_PARENT], iter, child, &retval);
return retval;
}
/* Public functions */
void
gtk_model_simple_node_changed (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node)
gtk_model_simple_changed (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (simple != NULL);
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
g_return_if_fail (path != NULL);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "node_changed", path, node);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "changed", path, iter);
}
void
gtk_model_simple_node_inserted (GtkModelSimple *simple,
gtk_model_simple_inserted (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (simple != NULL);
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
g_return_if_fail (path != NULL);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "inserted", path, iter);
}
void
gtk_model_simple_child_toggled (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node)
GtkTreeIter *iter)
{
g_return_if_fail (simple != NULL);
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
g_return_if_fail (path != NULL);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "node_inserted", path, node);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "child_toggled", path, iter);
}
void
gtk_model_simple_node_child_toggled (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node)
{
g_return_if_fail (simple != NULL);
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
g_return_if_fail (path != NULL);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "node_child_toggled", path, node);
}
void
gtk_model_simple_node_deleted (GtkModelSimple *simple,
gtk_model_simple_iter_deleted (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node)
GtkTreeIter *iter)
{
g_return_if_fail (simple != NULL);
g_return_if_fail (GTK_IS_MODEL_SIMPLE (simple));
g_return_if_fail (path != NULL);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "node_deleted", path, node);
gtk_signal_emit_by_name (GTK_OBJECT (simple), "iter_deleted", path, iter);
}
#endif

View File

@ -26,7 +26,6 @@
extern "C" {
#endif /* __cplusplus */
#if 0
#define GTK_TYPE_MODEL_SIMPLE (gtk_model_simple_get_type ())
#define GTK_MODEL_SIMPLE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_MODEL_SIMPLE, GtkModelSimple))
@ -40,6 +39,8 @@ typedef struct _GtkModelSimpleClass GtkModelSimpleClass;
struct _GtkModelSimple
{
GtkObject parent;
gint stamp;
};
struct _GtkModelSimpleClass
@ -49,37 +50,36 @@ struct _GtkModelSimpleClass
/* signals */
/* Will be moved into the GtkTreeModelIface eventually */
void (* changed) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeNode node);
GtkTreePath *path,
GtkTreeIter *iter);
void (* inserted) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeNode node);
GtkTreePath *path,
GtkTreeIter *iter);
void (* child_toggled) (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeNode node);
GtkTreePath *path,
GtkTreeIter *iter);
void (* deleted) (GtkTreeModel *tree_model,
GtkTreePath *path);
GtkTreePath *path);
};
GtkType gtk_model_simple_get_type (void);
GtkObject *gtk_model_simple_new (void);
void gtk_model_simple_node_changed (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node);
void gtk_model_simple_node_inserted (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node);
void gtk_model_simple_node_child_toggled (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node);
void gtk_model_simple_node_deleted (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeNode node);
GtkType gtk_model_simple_get_type (void);
GtkModelSimple *gtk_model_simple_new (void);
void gtk_model_simple_node_changed (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeIter *iter);
void gtk_model_simple_node_inserted (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeIter *iter);
void gtk_model_simple_node_child_toggled (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeIter *iter);
void gtk_model_simple_node_deleted (GtkModelSimple *simple,
GtkTreePath *path,
GtkTreeIter *iter);
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -68,7 +68,7 @@ gtk_tree_data_list_validate_allocator (GAllocator *allocator)
}
void
gtk_tree_data_list_push_allocator (GAllocator *allocator)
_gtk_tree_data_list_push_allocator (GAllocator *allocator)
{
G_LOCK (current_allocator);
gtk_tree_data_list_validate_allocator ( allocator );
@ -78,7 +78,7 @@ gtk_tree_data_list_push_allocator (GAllocator *allocator)
}
void
gtk_tree_data_list_pop_allocator (void)
_gtk_tree_data_list_pop_allocator (void)
{
G_LOCK (current_allocator);
if (current_allocator)
@ -94,7 +94,7 @@ gtk_tree_data_list_pop_allocator (void)
}
GtkTreeDataList *
gtk_tree_data_list_alloc (void)
_gtk_tree_data_list_alloc (void)
{
GtkTreeDataList *list;
@ -120,8 +120,28 @@ gtk_tree_data_list_alloc (void)
}
void
gtk_tree_data_list_free (GtkTreeDataList *list)
_gtk_tree_data_list_free (GtkTreeDataList *list,
GType *column_headers)
{
GtkTreeDataList *tmp;
gint i = 0;
for (tmp = list; tmp; tmp = tmp->next)
{
switch (column_headers [i])
{
case G_TYPE_STRING:
g_free ((gchar *) tmp->data.v_pointer);
break;
case G_TYPE_OBJECT:
g_object_unref (G_OBJECT (tmp->data.v_pointer));
break;
default:
break;
}
i++;
}
G_LOCK (current_allocator);
list->next = current_allocator->free_nodes;
current_allocator->free_nodes = list;
@ -129,9 +149,9 @@ gtk_tree_data_list_free (GtkTreeDataList *list)
}
void
gtk_tree_data_list_node_to_value (GtkTreeDataList *list,
GType type,
GValue *value)
_gtk_tree_data_list_node_to_value (GtkTreeDataList *list,
GType type,
GValue *value)
{
g_value_init (value, type);
@ -171,8 +191,8 @@ gtk_tree_data_list_node_to_value (GtkTreeDataList *list,
}
void
gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
GValue *value)
_gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
GValue *value)
{
switch (value->g_type)
{

View File

@ -39,17 +39,17 @@ struct _GtkTreeDataList
} data;
};
/* FIXME: s/gtk/_gtk/g to make internal */
void gtk_tree_data_list_push_allocator (GAllocator *allocator);
void gtk_tree_data_list_pop_allocator (void);
GtkTreeDataList *gtk_tree_data_list_alloc (void);
void gtk_tree_data_list_free (GtkTreeDataList *list);
void _gtk_tree_data_list_push_allocator (GAllocator *allocator);
void _gtk_tree_data_list_pop_allocator (void);
GtkTreeDataList *_gtk_tree_data_list_alloc (void);
void _gtk_tree_data_list_free (GtkTreeDataList *list,
GType *column_headers);
void _gtk_tree_data_list_node_to_value (GtkTreeDataList *list,
GType type,
GValue *value);
void _gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
GValue *value);
void gtk_tree_data_list_node_to_value (GtkTreeDataList *list,
GType type,
GValue *value);
void gtk_tree_data_list_value_to_node (GtkTreeDataList *list,
GValue *value);
#endif /* __GTK_TREE_DATA_LIST_H__ */

View File

@ -392,6 +392,8 @@ gtk_tree_path_down (GtkTreePath *path)
gint
gtk_tree_model_get_n_columns (GtkTreeModel *tree_model)
{
g_return_val_if_fail (tree_model != NULL, 0);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), 0);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_n_columns != NULL, 0);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_n_columns) (tree_model);
@ -418,10 +420,14 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
gint *indices;
gint depth, i;
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter != NULL)
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_iter) (tree_model, iter, path);
g_return_val_if_fail (path != NULL, FALSE);
indices = gtk_tree_path_get_indices (path);
depth = gtk_tree_path_get_depth (path);
@ -440,31 +446,6 @@ gtk_tree_model_get_iter (GtkTreeModel *tree_model,
return TRUE;
}
/**
* gtk_tree_model_iter_invalid:
* @tree_model: A #GtkTreeModel.
* @iter: The #GtkTreeIter.
*
* Tests the validity of @iter, and returns TRUE if it is invalid.
*
* Return value: TRUE, if @iter is invalid.
**/
gboolean
gtk_tree_model_iter_invalid (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
if (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_invalid)
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_invalid) (tree_model, iter);
/* Default implementation. Returns false if iter is false, or the stamp is 0 */
if (iter == NULL || iter->stamp == 0)
return TRUE;
return FALSE;
}
/**
* gtk_tree_model_get_path:
* @tree_model: A #GtkTreeModel.
@ -479,13 +460,16 @@ GtkTreePath *
gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, NULL);
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), NULL);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_path != NULL, NULL);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_path) (tree_model, iter);
}
/**
* gtk_tree_model_iter_get_value:
* gtk_tree_model_get_value:
* @tree_model: A #GtkTreeModel.
* @iter: The #GtkTreeIter.
* @column: The column to lookup the value at.
@ -495,14 +479,18 @@ gtk_tree_model_get_path (GtkTreeModel *tree_model,
* #g_value_unset needs to be called on it.
**/
void
gtk_tree_model_iter_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
gtk_tree_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
{
g_return_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_get_value != NULL);
g_return_if_fail (tree_model != NULL);
g_return_if_fail (iter != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (value != NULL);
g_return_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->get_value != NULL);
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_get_value) (tree_model, iter, column, value);
(* GTK_TREE_MODEL_GET_IFACE (tree_model)->get_value) (tree_model, iter, column, value);
}
/**
@ -519,6 +507,9 @@ gboolean
gtk_tree_model_iter_next (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_next != NULL, FALSE);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_next) (tree_model, iter);
@ -541,6 +532,9 @@ gtk_tree_model_iter_children (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_children != NULL, FALSE);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_children) (tree_model, iter, parent);
@ -559,6 +553,9 @@ gboolean
gtk_tree_model_iter_has_child (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_has_child != NULL, FALSE);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_has_child) (tree_model, iter);
@ -577,7 +574,10 @@ gint
gtk_tree_model_iter_n_children (GtkTreeModel *tree_model,
GtkTreeIter *iter)
{
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_n_children != NULL, -1);
g_return_val_if_fail (tree_model != NULL, 0);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), 0);
g_return_val_if_fail (iter != NULL, 0);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_n_children != NULL, 0);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_n_children) (tree_model, iter);
}
@ -602,6 +602,10 @@ gtk_tree_model_iter_nth_child (GtkTreeModel *tree_model,
GtkTreeIter *parent,
gint n)
{
g_return_val_if_fail (tree_model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
g_return_val_if_fail (n >= 0, FALSE);
g_return_val_if_fail (GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_nth_child != NULL, FALSE);
return (* GTK_TREE_MODEL_GET_IFACE (tree_model)->iter_nth_child) (tree_model, iter, parent, n);

View File

@ -71,11 +71,9 @@ struct _GtkTreeModelIface
gboolean (* get_iter) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
gboolean (* iter_invalid) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GtkTreePath *(* get_path) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
void (* iter_get_value) (GtkTreeModel *tree_model,
void (* get_value) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
@ -83,7 +81,7 @@ struct _GtkTreeModelIface
GtkTreeIter *iter);
gboolean (* iter_children) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *child);
GtkTreeIter *parent);
gboolean (* iter_has_child) (GtkTreeModel *tree_model,
GtkTreeIter *iter);
gint (* iter_n_children) (GtkTreeModel *tree_model,
@ -94,7 +92,7 @@ struct _GtkTreeModelIface
gint n);
gboolean (* iter_parent) (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreeIter *parent);
GtkTreeIter *child);
};
@ -133,11 +131,9 @@ GType gtk_tree_model_get_column_type (GtkTreeModel *tree_model,
gboolean gtk_tree_model_get_iter (GtkTreeModel *tree_model,
GtkTreeIter *iter,
GtkTreePath *path);
gboolean gtk_tree_model_iter_invalid (GtkTreeModel *tree_model,
GtkTreeIter *iter);
GtkTreePath *gtk_tree_model_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
void gtk_tree_model_iter_get_value (GtkTreeModel *tree_model,
void gtk_tree_model_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);

View File

@ -43,7 +43,7 @@ static void gtk_tree_store_tree_model_init (GtkTreeModelIface *iface);
static gint gtk_tree_store_get_n_columns (GtkTreeModel *tree_model);
static GtkTreePath *gtk_tree_store_get_path (GtkTreeModel *tree_model,
GtkTreeIter *iter);
static void gtk_tree_store_iter_get_value (GtkTreeModel *tree_model,
static void gtk_tree_store_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value);
@ -152,7 +152,7 @@ gtk_tree_store_tree_model_init (GtkTreeModelIface *iface)
{
iface->get_n_columns = gtk_tree_store_get_n_columns;
iface->get_path = gtk_tree_store_get_path;
iface->iter_get_value = gtk_tree_store_iter_get_value;
iface->get_value = gtk_tree_store_get_value;
iface->iter_next = gtk_tree_store_iter_next;
iface->iter_children = gtk_tree_store_iter_children;
iface->iter_has_child = gtk_tree_store_iter_has_child;
@ -312,10 +312,10 @@ gtk_tree_store_get_path (GtkTreeModel *tree_model,
static void
gtk_tree_store_iter_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
gtk_tree_store_get_value (GtkTreeModel *tree_model,
GtkTreeIter *iter,
gint column,
GValue *value)
{
GtkTreeDataList *list;
gint tmp_column = column;
@ -333,9 +333,9 @@ gtk_tree_store_iter_get_value (GtkTreeModel *tree_model,
if (list)
{
gtk_tree_data_list_node_to_value (list,
GTK_TREE_STORE (tree_model)->column_headers[column],
value);
_gtk_tree_data_list_node_to_value (list,
GTK_TREE_STORE (tree_model)->column_headers[column],
value);
}
else
{
@ -452,10 +452,10 @@ gtk_tree_store_iter_parent (GtkTreeModel *tree_model,
* manipulations on it's own.
*/
void
gtk_tree_store_iter_set_cell (GtkTreeStore *tree_store,
GtkTreeIter *iter,
gint column,
GValue *value)
gtk_tree_store_set_cell (GtkTreeStore *tree_store,
GtkTreeIter *iter,
gint column,
GValue *value)
{
GtkTreeDataList *list;
GtkTreeDataList *prev;
@ -470,7 +470,7 @@ gtk_tree_store_iter_set_cell (GtkTreeStore *tree_store,
{
if (column == 0)
{
gtk_tree_data_list_value_to_node (list, value);
_gtk_tree_data_list_value_to_node (list, value);
return;
}
@ -481,29 +481,32 @@ gtk_tree_store_iter_set_cell (GtkTreeStore *tree_store,
if (G_NODE (iter->tree_node)->data == NULL)
{
G_NODE (iter->tree_node)->data = list = gtk_tree_data_list_alloc ();
G_NODE (iter->tree_node)->data = list = _gtk_tree_data_list_alloc ();
list->next = NULL;
}
else
{
list = prev->next = gtk_tree_data_list_alloc ();
list = prev->next = _gtk_tree_data_list_alloc ();
list->next = NULL;
}
while (column != 0)
{
list->next = gtk_tree_data_list_alloc ();
list->next = _gtk_tree_data_list_alloc ();
list = list->next;
list->next = NULL;
column --;
}
gtk_tree_data_list_value_to_node (list, value);
_gtk_tree_data_list_value_to_node (list, value);
gtk_signal_emit_by_name (GTK_OBJECT (tree_store),
"changed",
NULL, iter);
}
void
gtk_tree_store_iter_setv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args)
gtk_tree_store_setv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args)
{
gint column;
@ -535,10 +538,10 @@ gtk_tree_store_iter_setv (GtkTreeStore *tree_store,
break;
}
gtk_tree_store_iter_set_cell (tree_store,
iter,
column,
&value);
gtk_tree_store_set_cell (tree_store,
iter,
column,
&value);
g_value_unset (&value);
@ -547,23 +550,23 @@ gtk_tree_store_iter_setv (GtkTreeStore *tree_store,
}
void
gtk_tree_store_iter_set (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...)
gtk_tree_store_set (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...)
{
va_list var_args;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
va_start (var_args, iter);
gtk_tree_store_iter_setv (tree_store, iter, var_args);
gtk_tree_store_setv (tree_store, iter, var_args);
va_end (var_args);
}
void
gtk_tree_store_iter_getv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args)
gtk_tree_store_getv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args)
{
gint column;
@ -582,7 +585,7 @@ gtk_tree_store_iter_getv (GtkTreeStore *tree_store,
break;
}
gtk_tree_store_iter_get_value (GTK_TREE_MODEL (tree_store), iter, column, &value);
gtk_tree_store_get_value (GTK_TREE_MODEL (tree_store), iter, column, &value);
G_VALUE_LCOPY (&value, var_args, &error);
if (error)
@ -603,24 +606,25 @@ gtk_tree_store_iter_getv (GtkTreeStore *tree_store,
}
void
gtk_tree_store_iter_get (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...)
gtk_tree_store_get (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...)
{
va_list var_args;
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
va_start (var_args, iter);
gtk_tree_store_iter_getv (tree_store, iter, var_args);
gtk_tree_store_getv (tree_store, iter, var_args);
va_end (var_args);
}
void
gtk_tree_store_iter_remove (GtkTreeStore *model,
GtkTreeIter *iter)
gtk_tree_store_remove (GtkTreeStore *model,
GtkTreeIter *iter)
{
GtkTreePath *path;
GNode *parent;
g_return_if_fail (model != NULL);
@ -628,8 +632,14 @@ gtk_tree_store_iter_remove (GtkTreeStore *model,
parent = G_NODE (iter->tree_node)->parent;
if (G_NODE (iter->tree_node)->data)
_gtk_tree_data_list_free ((GtkTreeDataList *) G_NODE (iter->tree_node)->data,
model->column_headers);
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
g_node_destroy (G_NODE (iter->tree_node));
model->stamp++;
gtk_signal_emit_by_name (GTK_OBJECT (model),
"deleted",
path);
@ -645,10 +655,10 @@ gtk_tree_store_iter_remove (GtkTreeStore *model,
}
void
gtk_tree_store_iter_insert (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint position)
gtk_tree_store_insert (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint position)
{
GtkTreePath *path;
@ -670,10 +680,10 @@ gtk_tree_store_iter_insert (GtkTreeStore *model,
}
void
gtk_tree_store_iter_insert_before (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent,
GtkTreeIter *sibling)
gtk_tree_store_insert_before (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent,
GtkTreeIter *sibling)
{
GtkTreePath *path;
GNode *parent_node = NULL;
@ -708,10 +718,10 @@ gtk_tree_store_iter_insert_before (GtkTreeStore *model,
}
void
gtk_tree_store_iter_insert_after (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent,
GtkTreeIter *sibling)
gtk_tree_store_insert_after (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent,
GtkTreeIter *sibling)
{
GtkTreePath *path;
GNode *parent_node;
@ -746,9 +756,9 @@ gtk_tree_store_iter_insert_after (GtkTreeStore *model,
}
void
gtk_tree_store_iter_prepend (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent)
gtk_tree_store_prepend (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent)
{
GNode *parent_node;
@ -793,14 +803,14 @@ gtk_tree_store_iter_prepend (GtkTreeStore *model,
}
else
{
gtk_tree_store_iter_insert_after (model, iter, parent, NULL);
gtk_tree_store_insert_after (model, iter, parent, NULL);
}
}
void
gtk_tree_store_iter_append (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent)
gtk_tree_store_append (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *parent)
{
GNode *parent_node;
@ -845,13 +855,13 @@ gtk_tree_store_iter_append (GtkTreeStore *model,
}
else
{
gtk_tree_store_iter_insert_before (model, iter, parent, NULL);
gtk_tree_store_insert_before (model, iter, parent, NULL);
}
}
void
gtk_tree_store_get_root (GtkTreeStore *model,
GtkTreeIter *iter)
gtk_tree_store_get_root_iter (GtkTreeStore *model,
GtkTreeIter *iter)
{
g_return_if_fail (model != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (model));
@ -863,9 +873,9 @@ gtk_tree_store_get_root (GtkTreeStore *model,
gboolean
gtk_tree_store_iter_is_ancestor (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *descendant)
gtk_tree_store_is_ancestor (GtkTreeStore *model,
GtkTreeIter *iter,
GtkTreeIter *descendant)
{
g_return_val_if_fail (model != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TREE_STORE (model), FALSE);

View File

@ -66,58 +66,59 @@ struct _GtkTreeStoreClass
};
GtkType gtk_tree_store_get_type (void);
GtkTreeStore *gtk_tree_store_new (void);
GtkTreeStore *gtk_tree_store_new_with_values (gint n_columns,
...);
void gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
gint n_columns);
void gtk_tree_store_set_column_type (GtkTreeStore *store,
gint column,
GType type);
void gtk_tree_store_iter_set_cell (GtkTreeStore *tree_store,
GtkTreeIter *iter,
gint column,
GValue *value);
void gtk_tree_store_iter_set (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...);
void gtk_tree_store_iter_setv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args);
void gtk_tree_store_iter_get (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...);
void gtk_tree_store_iter_getv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args);
void gtk_tree_store_iter_remove (GtkTreeStore *tree_store,
GtkTreeIter *iter);
void gtk_tree_store_iter_insert (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *parent,
gint position);
void gtk_tree_store_iter_insert_before (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *parent,
GtkTreeIter *sibling);
void gtk_tree_store_iter_insert_after (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *parent,
GtkTreeIter *sibling);
void gtk_tree_store_iter_prepend (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *parent);
void gtk_tree_store_iter_append (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *parent);
void gtk_tree_store_get_root (GtkTreeStore *tree_store,
GtkTreeIter *iter);
gboolean gtk_tree_store_iter_is_ancestor (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *descendant);
gint gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
GtkTreeIter *iter);
GtkType gtk_tree_store_get_type (void);
GtkTreeStore *gtk_tree_store_new (void);
GtkTreeStore *gtk_tree_store_new_with_values (gint n_columns,
...);
void gtk_tree_store_set_n_columns (GtkTreeStore *tree_store,
gint n_columns);
void gtk_tree_store_set_column_type (GtkTreeStore *store,
gint column,
GType type);
void gtk_tree_store_set_cell (GtkTreeStore *tree_store,
GtkTreeIter *iter,
gint column,
GValue *value);
void gtk_tree_store_set (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...);
void gtk_tree_store_setv (GtkTreeStore *tree_store,
GtkTreeIter *iter,
va_list var_args);
void gtk_tree_store_get (GtkTreeStore *tree_store,
GtkTreeIter *iter,
...);
void gtk_tree_store_getv (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);
void gtk_tree_store_get_root_iter (GtkTreeStore *tree_store,
GtkTreeIter *iter);
gboolean gtk_tree_store_is_ancestor (GtkTreeStore *tree_store,
GtkTreeIter *iter,
GtkTreeIter *descendant);
gint gtk_tree_store_iter_depth (GtkTreeStore *tree_store,
GtkTreeIter *iter);
#ifdef __cplusplus

View File

@ -1917,7 +1917,7 @@ gtk_tree_view_changed (GtkTreeModel *model,
gint height;
gboolean dirty_marked;
g_return_if_fail (path != NULL || node != NULL);
g_return_if_fail (path != NULL || iter != NULL);
if (path == NULL)
path = gtk_tree_model_get_path (model, iter);
@ -2067,7 +2067,7 @@ gtk_tree_view_child_toggled (GtkTreeModel *model,
GtkRBTree *tree;
GtkRBNode *node;
g_return_if_fail (path != NULL || node != NULL);
g_return_if_fail (path != NULL || iter != NULL);
if (iter)
real_iter = *iter;
@ -2237,9 +2237,6 @@ gtk_tree_view_build_tree (GtkTreeView *tree_view,
GtkRBNode *temp = NULL;
gint max_height;
if (gtk_tree_model_iter_invalid (tree_view->priv->model, iter))
return;
do
{
max_height = 0;
@ -2285,10 +2282,6 @@ gtk_tree_view_calc_size (GtkTreeView *tree_view,
gint max_height;
gint i;
/* FIXME: Make this function robust against internal inconsistencies! */
if (gtk_tree_model_iter_invalid (tree_view->priv->model, iter))
return;
TREE_VIEW_INTERNAL_ASSERT_VOID (tree != NULL);
while (temp->left != tree->nil)
@ -2399,11 +2392,6 @@ gtk_tree_view_discover_dirty (GtkTreeView *tree_view,
GtkTreeIter child;
gboolean is_all_dirty;
/* FIXME: Make this function robust against internal inconsistencies! */
if (gtk_tree_model_iter_invalid (tree_view->priv->model,
iter))
return;
TREE_VIEW_INTERNAL_ASSERT_VOID (tree != NULL);
while (temp->left != tree->nil)

View File

@ -336,10 +336,9 @@ gtk_tree_view_column_set_cell_data (GtkTreeViewColumn *tree_column,
while (list && list->next)
{
gtk_tree_model_iter_get_value (tree_model,
iter,
GPOINTER_TO_INT (list->next->data),
&value);
gtk_tree_model_get_value (tree_model, iter,
GPOINTER_TO_INT (list->next->data),
&value);
g_object_set_param (cell, (gchar *) list->data, &value);
g_value_unset (&value);
list = list->next->next;

View File

@ -1,7 +1,7 @@
#include <gtk/gtk.h>
#include <stdlib.h>
GtkObject *model;
GtkTreeStore *model;
static void
selection_changed (GtkTreeSelection *selection,
@ -21,7 +21,7 @@ node_set (GtkTreeIter *iter)
gchar *str;
str = g_strdup_printf ("FOO: %d", i++);
gtk_tree_store_iter_set (GTK_TREE_STORE (model), iter, 0, str, -1);
gtk_tree_store_set (model, iter, 0, str, -1);
g_free (str);
}
@ -33,8 +33,7 @@ iter_remove (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_remove (GTK_TREE_STORE (model),
&selected);
gtk_tree_store_remove (model, &selected);
}
}
@ -49,17 +48,17 @@ iter_insert (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_insert (GTK_TREE_STORE (model),
&iter,
&selected,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
gtk_tree_store_insert (model,
&iter,
&selected,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
}
else
{
gtk_tree_store_iter_insert (GTK_TREE_STORE (model),
&iter,
NULL,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
gtk_tree_store_insert (model,
&iter,
NULL,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
}
node_set (&iter);
@ -74,17 +73,17 @@ iter_insert_before (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_insert_before (GTK_TREE_STORE (model),
&iter,
NULL,
&selected);
gtk_tree_store_insert_before (model,
&iter,
NULL,
&selected);
}
else
{
gtk_tree_store_iter_insert_before (GTK_TREE_STORE (model),
&iter,
NULL,
NULL);
gtk_tree_store_insert_before (model,
&iter,
NULL,
NULL);
}
node_set (&iter);
@ -99,17 +98,17 @@ iter_insert_after (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_insert_after (GTK_TREE_STORE (model),
&iter,
NULL,
&selected);
gtk_tree_store_insert_after (model,
&iter,
NULL,
&selected);
}
else
{
gtk_tree_store_iter_insert_after (GTK_TREE_STORE (model),
&iter,
NULL,
&selected);
gtk_tree_store_insert_after (model,
&iter,
NULL,
&selected);
}
node_set (&iter);
@ -124,15 +123,15 @@ iter_prepend (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_prepend (GTK_TREE_STORE (model),
&iter,
&selected);
gtk_tree_store_prepend (model,
&iter,
&selected);
}
else
{
gtk_tree_store_iter_prepend (GTK_TREE_STORE (model),
&iter,
NULL);
gtk_tree_store_prepend (model,
&iter,
NULL);
}
node_set (&iter);
@ -147,15 +146,11 @@ iter_append (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_append (GTK_TREE_STORE (model),
&iter,
&selected);
gtk_tree_store_append (model, &iter, &selected);
}
else
{
gtk_tree_store_iter_append (GTK_TREE_STORE (model),
&iter,
NULL);
gtk_tree_store_append (model, &iter, NULL);
}
node_set (&iter);
@ -194,7 +189,7 @@ make_window ()
gtk_signal_connect (GTK_OBJECT (window), "destroy", gtk_main_quit, NULL);
/* buttons */
button = gtk_button_new_with_label ("gtk_tree_store_iter_remove");
button = gtk_button_new_with_label ("gtk_tree_store_remove");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (selection),
"selection_changed",
@ -203,7 +198,7 @@ make_window ()
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_remove, tree_view);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_iter_insert");
button = gtk_button_new_with_label ("gtk_tree_store_insert");
hbox = gtk_hbox_new (FALSE, 8);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@ -213,7 +208,7 @@ make_window ()
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert, tree_view);
button = gtk_button_new_with_label ("gtk_tree_store_iter_insert_before");
button = gtk_button_new_with_label ("gtk_tree_store_insert_before");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_before, tree_view);
gtk_signal_connect (GTK_OBJECT (selection),
@ -222,7 +217,7 @@ make_window ()
button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_iter_insert_after");
button = gtk_button_new_with_label ("gtk_tree_store_insert_after");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_after, tree_view);
gtk_signal_connect (GTK_OBJECT (selection),
@ -231,11 +226,11 @@ make_window ()
button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_iter_prepend");
button = gtk_button_new_with_label ("gtk_tree_store_prepend");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_prepend, tree_view);
button = gtk_button_new_with_label ("gtk_tree_store_iter_append");
button = gtk_button_new_with_label ("gtk_tree_store_append");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_append, tree_view);

View File

@ -1,7 +1,7 @@
#include <gtk/gtk.h>
#include <stdlib.h>
GtkObject *model;
GtkTreeStore *model;
static void
selection_changed (GtkTreeSelection *selection,
@ -21,7 +21,7 @@ node_set (GtkTreeIter *iter)
gchar *str;
str = g_strdup_printf ("FOO: %d", i++);
gtk_tree_store_iter_set (GTK_TREE_STORE (model), iter, 0, str, -1);
gtk_tree_store_set (model, iter, 0, str, -1);
g_free (str);
}
@ -33,8 +33,7 @@ iter_remove (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_remove (GTK_TREE_STORE (model),
&selected);
gtk_tree_store_remove (model, &selected);
}
}
@ -49,17 +48,17 @@ iter_insert (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_insert (GTK_TREE_STORE (model),
&iter,
&selected,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
gtk_tree_store_insert (model,
&iter,
&selected,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
}
else
{
gtk_tree_store_iter_insert (GTK_TREE_STORE (model),
&iter,
NULL,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
gtk_tree_store_insert (model,
&iter,
NULL,
atoi (gtk_entry_get_text (GTK_ENTRY (entry))));
}
node_set (&iter);
@ -74,17 +73,17 @@ iter_insert_before (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_insert_before (GTK_TREE_STORE (model),
&iter,
NULL,
&selected);
gtk_tree_store_insert_before (model,
&iter,
NULL,
&selected);
}
else
{
gtk_tree_store_iter_insert_before (GTK_TREE_STORE (model),
&iter,
NULL,
NULL);
gtk_tree_store_insert_before (model,
&iter,
NULL,
NULL);
}
node_set (&iter);
@ -99,17 +98,17 @@ iter_insert_after (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_insert_after (GTK_TREE_STORE (model),
&iter,
NULL,
&selected);
gtk_tree_store_insert_after (model,
&iter,
NULL,
&selected);
}
else
{
gtk_tree_store_iter_insert_after (GTK_TREE_STORE (model),
&iter,
NULL,
&selected);
gtk_tree_store_insert_after (model,
&iter,
NULL,
&selected);
}
node_set (&iter);
@ -124,15 +123,15 @@ iter_prepend (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_prepend (GTK_TREE_STORE (model),
&iter,
&selected);
gtk_tree_store_prepend (model,
&iter,
&selected);
}
else
{
gtk_tree_store_iter_prepend (GTK_TREE_STORE (model),
&iter,
NULL);
gtk_tree_store_prepend (model,
&iter,
NULL);
}
node_set (&iter);
@ -147,15 +146,11 @@ iter_append (GtkWidget *button, GtkTreeView *tree_view)
if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
&selected))
{
gtk_tree_store_iter_append (GTK_TREE_STORE (model),
&iter,
&selected);
gtk_tree_store_append (model, &iter, &selected);
}
else
{
gtk_tree_store_iter_append (GTK_TREE_STORE (model),
&iter,
NULL);
gtk_tree_store_append (model, &iter, NULL);
}
node_set (&iter);
@ -194,7 +189,7 @@ make_window ()
gtk_signal_connect (GTK_OBJECT (window), "destroy", gtk_main_quit, NULL);
/* buttons */
button = gtk_button_new_with_label ("gtk_tree_store_iter_remove");
button = gtk_button_new_with_label ("gtk_tree_store_remove");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (selection),
"selection_changed",
@ -203,7 +198,7 @@ make_window ()
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_remove, tree_view);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_iter_insert");
button = gtk_button_new_with_label ("gtk_tree_store_insert");
hbox = gtk_hbox_new (FALSE, 8);
entry = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@ -213,7 +208,7 @@ make_window ()
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert, tree_view);
button = gtk_button_new_with_label ("gtk_tree_store_iter_insert_before");
button = gtk_button_new_with_label ("gtk_tree_store_insert_before");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_before, tree_view);
gtk_signal_connect (GTK_OBJECT (selection),
@ -222,7 +217,7 @@ make_window ()
button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_iter_insert_after");
button = gtk_button_new_with_label ("gtk_tree_store_insert_after");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_insert_after, tree_view);
gtk_signal_connect (GTK_OBJECT (selection),
@ -231,11 +226,11 @@ make_window ()
button);
gtk_widget_set_sensitive (button, FALSE);
button = gtk_button_new_with_label ("gtk_tree_store_iter_prepend");
button = gtk_button_new_with_label ("gtk_tree_store_prepend");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_prepend, tree_view);
button = gtk_button_new_with_label ("gtk_tree_store_iter_append");
button = gtk_button_new_with_label ("gtk_tree_store_append");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked", iter_append, tree_view);