- g_signal_newc ("range_changed",
- GTK_TYPE_TREE_MODEL,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkTreeModelIface, range_changed),
- NULL, NULL,
- gtk_marshal_VOID__BOXED_BOXED_BOXED_BOXED,
- G_TYPE_NONE, 4,
- GTK_TYPE_TREE_PATH,
- GTK_TYPE_TREE_ITER,
- GTK_TYPE_TREE_PATH,
- GTK_TYPE_TREE_ITER);
- g_signal_newc ("inserted",
- GTK_TYPE_TREE_MODEL,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkTreeModelIface, inserted),
- NULL, NULL,
- gtk_marshal_VOID__BOXED_BOXED,
- G_TYPE_NONE, 2,
- GTK_TYPE_TREE_PATH,
- GTK_TYPE_TREE_ITER);
- g_signal_newc ("has_child_toggled",
- GTK_TYPE_TREE_MODEL,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkTreeModelIface, has_child_toggled),
- NULL, NULL,
- gtk_marshal_VOID__BOXED_BOXED,
- G_TYPE_NONE, 2,
- GTK_TYPE_TREE_PATH,
- GTK_TYPE_TREE_ITER);
- g_signal_newc ("deleted",
- GTK_TYPE_TREE_MODEL,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkTreeModelIface, deleted),
- NULL, NULL,
- gtk_marshal_VOID__BOXED,
- G_TYPE_NONE, 1,
- GTK_TYPE_TREE_PATH);
- g_signal_newc ("reordered",
- GTK_TYPE_TREE_MODEL,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkTreeModelIface, reordered),
- NULL, NULL,
- gtk_marshal_VOID__BOXED_BOXED_POINTER,
- G_TYPE_NONE, 3,
- GTK_TYPE_TREE_PATH,
- GTK_TYPE_TREE_ITER,
- G_TYPE_POINTER);
+ GType row_inserted_params[2];
+ GType row_deleted_params[1];
+ GType rows_reordered_params[3];
+
+ row_inserted_params[0] = GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE;
+ row_inserted_params[1] = GTK_TYPE_TREE_ITER;
+
+ row_deleted_params[0] = GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE;
+
+ rows_reordered_params[0] = GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE;
+ rows_reordered_params[1] = GTK_TYPE_TREE_ITER;
+ rows_reordered_params[2] = G_TYPE_POINTER;
+
+ /**
+ * GtkTreeModel::row-changed:
+ * @tree_model: the #GtkTreeModel on which the signal is emitted
+ * @path: a #GtkTreePath identifying the changed row
+ * @iter: a valid #GtkTreeIter pointing to the changed row
+ *
+ * This signal is emitted when a row in the model has changed.
+ */
+ tree_model_signals[ROW_CHANGED] =
+ g_signal_new (I_("row_changed"),
+ GTK_TYPE_TREE_MODEL,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkTreeModelIface, row_changed),
+ NULL, NULL,
+ _gtk_marshal_VOID__BOXED_BOXED,
+ G_TYPE_NONE, 2,
+ GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE,
+ GTK_TYPE_TREE_ITER);
+
+ /* We need to get notification about structure changes
+ * to update row references., so instead of using the
+ * standard g_signal_new() with an offset into our interface
+ * structure, we use a customs closures for the class
+ * closures (default handlers) that first update row references
+ * and then calls the function from the interface structure.
+ *
+ * The reason we don't simply update the row references from
+ * the wrapper functions (gtk_tree_model_row_inserted(), etc.)
+ * is to keep proper ordering with respect to signal handlers
+ * connected normally and after.
+ */
+
+ /**
+ * GtkTreeModel::row-inserted:
+ * @tree_model: the #GtkTreeModel on which the signal is emitted
+ * @path: a #GtkTreePath identifying the new row
+ * @iter: a valid #GtkTreeIter pointing to the new row
+ *
+ * This signal is emitted when a new row has been inserted in the model.
+ *
+ * Note that the row may still be empty at this point, since
+ * it is a common pattern to first insert an empty row, and
+ * then fill it with the desired values.
+ */
+ closure = g_closure_new_simple (sizeof (GClosure), NULL);
+ g_closure_set_marshal (closure, row_inserted_marshal);
+ tree_model_signals[ROW_INSERTED] =
+ g_signal_newv (I_("row_inserted"),
+ GTK_TYPE_TREE_MODEL,
+ G_SIGNAL_RUN_FIRST,
+ closure,
+ NULL, NULL,
+ _gtk_marshal_VOID__BOXED_BOXED,
+ G_TYPE_NONE, 2,
+ row_inserted_params);
+
+ /**
+ * GtkTreeModel::row-has-child-toggled:
+ * @tree_model: the #GtkTreeModel on which the signal is emitted
+ * @path: a #GtkTreePath identifying the row
+ * @iter: a valid #GtkTreeIter pointing to the row
+ *
+ * This signal is emitted when a row has gotten the first child row or lost
+ * its last child row.
+ */
+ tree_model_signals[ROW_HAS_CHILD_TOGGLED] =
+ g_signal_new (I_("row_has_child_toggled"),
+ GTK_TYPE_TREE_MODEL,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkTreeModelIface, row_has_child_toggled),
+ NULL, NULL,
+ _gtk_marshal_VOID__BOXED_BOXED,
+ G_TYPE_NONE, 2,
+ GTK_TYPE_TREE_PATH | G_SIGNAL_TYPE_STATIC_SCOPE,
+ GTK_TYPE_TREE_ITER);
+
+ /**
+ * GtkTreeModel::row-deleted:
+ * @tree_model: the #GtkTreeModel on which the signal is emitted
+ * @path: a #GtkTreePath identifying the row
+ *
+ * This signal is emitted when a row has been deleted.
+ *
+ * Note that no iterator is passed to the signal handler,
+ * since the row is already deleted.
+ *
+ * Implementations of GtkTreeModel must emit row-deleted
+ * <emphasis>before</emphasis> removing the node from its
+ * internal data structures. This is because models and
+ * views which access and monitor this model might have
+ * references on the node which need to be released in the
+ * row-deleted handler.
+ */
+ closure = g_closure_new_simple (sizeof (GClosure), NULL);
+ g_closure_set_marshal (closure, row_deleted_marshal);
+ tree_model_signals[ROW_DELETED] =
+ g_signal_newv (I_("row_deleted"),
+ GTK_TYPE_TREE_MODEL,
+ G_SIGNAL_RUN_FIRST,
+ closure,
+ NULL, NULL,
+ _gtk_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1,
+ row_deleted_params);
+
+ /**
+ * GtkTreeModel::rows-reordered:
+ * @tree_model: the #GtkTreeModel on which the signal is emitted
+ * @path: a #GtkTreePath identifying the tree node whose children
+ * have been reordered
+ * @iter: a valid #GtkTreeIter pointing to the node whose
+ *
+ * This signal is emitted when the children of a node in the #GtkTreeModel
+ * have been reordered.
+ *
+ * Note that this signal is <emphasis>not</emphasis> emitted
+ * when rows are reordered by DND, since this is implemented
+ * by removing and then reinserting the row.
+ */
+ closure = g_closure_new_simple (sizeof (GClosure), NULL);
+ g_closure_set_marshal (closure, rows_reordered_marshal);
+ tree_model_signals[ROWS_REORDERED] =
+ g_signal_newv (I_("rows_reordered"),
+ GTK_TYPE_TREE_MODEL,
+ G_SIGNAL_RUN_FIRST,
+ closure,
+ NULL, NULL,
+ _gtk_marshal_VOID__BOXED_BOXED_POINTER,
+ G_TYPE_NONE, 3,
+ rows_reordered_params);