add functions for signal emission.

Wed Feb 21 20:56:50 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreemodel.h: add functions for signal emission.

	* gtk/gtktreestore.c: move to use above functions instead of
	g_signal_emit.

	* gtk/gtkliststore.c: ditto
This commit is contained in:
Jonathan Blandford 2001-02-22 01:56:08 +00:00 committed by Jonathan Blandford
parent ef084e87e5
commit 851bd821a1
11 changed files with 175 additions and 75 deletions

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -1,3 +1,12 @@
Wed Feb 21 20:56:50 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreemodel.h: add functions for signal emission.
* gtk/gtktreestore.c: move to use above functions instead of
g_signal_emit.
* gtk/gtkliststore.c: ditto
Wed Feb 21 15:41:34 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreestore.c: removed signals. Moved to inherit from

View File

@ -524,6 +524,7 @@ gtk_list_store_set_cell (GtkListStore *list_store,
{
GtkTreeDataList *list;
GtkTreeDataList *prev;
GtkTreePath *path;
g_return_if_fail (list_store != NULL);
g_return_if_fail (GTK_IS_LIST_STORE (list_store));
@ -536,10 +537,10 @@ gtk_list_store_set_cell (GtkListStore *list_store,
{
if (column == 0)
{
path = gtk_list_store_get_path (GTK_TREE_MODEL (list_store), iter);
_gtk_tree_data_list_value_to_node (list, value);
g_signal_emit_by_name (G_OBJECT (list_store),
"changed",
NULL, iter);
gtk_tree_model_changed (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
return;
}
@ -566,10 +567,11 @@ gtk_list_store_set_cell (GtkListStore *list_store,
list->next = NULL;
column --;
}
path = gtk_list_store_get_path (GTK_TREE_MODEL (list_store), iter);
_gtk_tree_data_list_value_to_node (list, value);
g_signal_emit_by_name (G_OBJECT (list_store),
"changed",
NULL, iter);
gtk_tree_model_changed (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
}
/**
@ -743,10 +745,9 @@ gtk_list_store_remove (GtkListStore *list_store,
gtk_list_store_remove_silently (list_store, iter, path);
validate_list_store (list_store);
g_signal_emit_by_name (G_OBJECT (list_store),
"deleted",
path);
gtk_tree_model_deleted (GTK_TREE_MODEL (list_store), path);
gtk_tree_path_free (path);
}
@ -819,9 +820,7 @@ gtk_list_store_insert (GtkListStore *list_store,
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, position);
g_signal_emit_by_name (G_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
}
@ -900,9 +899,7 @@ gtk_list_store_insert_before (GtkListStore *list_store,
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
g_signal_emit_by_name (G_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
}
@ -954,9 +951,7 @@ gtk_list_store_insert_after (GtkListStore *list_store,
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
g_signal_emit_by_name (G_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
}
@ -995,9 +990,7 @@ gtk_list_store_prepend (GtkListStore *list_store,
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, 0);
g_signal_emit_by_name (G_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
}
@ -1038,9 +1031,7 @@ gtk_list_store_append (GtkListStore *list_store,
path = gtk_tree_path_new ();
gtk_tree_path_append_index (path, i);
g_signal_emit_by_name (G_OBJECT (list_store),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (list_store), path, iter);
gtk_tree_path_free (path);
}
@ -1162,6 +1153,7 @@ gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest,
GtkTreeDataList *copy_head = NULL;
GtkTreeDataList *copy_prev = NULL;
GtkTreeDataList *copy_iter = NULL;
GtkTreePath *path;
gint col;
col = 0;
@ -1183,11 +1175,11 @@ gtk_list_store_drag_data_received (GtkTreeDragDest *drag_dest,
}
G_SLIST (dest_iter.user_data)->data = copy_head;
g_signal_emit_by_name (G_OBJECT (tree_model),
"changed",
NULL, &dest_iter);
}
path = gtk_list_store_get_path (GTK_TREE_MODEL (tree_model), &dest_iter);
gtk_tree_model_changed (GTK_TREE_MODEL (tree_model), path, &dest_iter);
gtk_tree_path_free (path);
}
}
else
{

View File

@ -1267,3 +1267,53 @@ gtk_tree_model_get_valist (GtkTreeModel *tree_model,
column = va_arg (var_args, gint);
}
}
void
gtk_tree_model_changed (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_return_if_fail (iter != NULL);
g_signal_emit_by_name (tree_model, "changed", path, iter);
}
void
gtk_tree_model_inserted (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_return_if_fail (iter != NULL);
g_signal_emit_by_name (tree_model, "inserted", path, iter);
}
void
gtk_tree_model_child_toggled (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_return_if_fail (iter != NULL);
g_signal_emit_by_name (tree_model, "child_toggled", path, iter);
}
void
gtk_tree_model_deleted (GtkTreeModel *tree_model,
GtkTreePath *path)
{
g_return_if_fail (tree_model != NULL);
g_return_if_fail (GTK_IS_TREE_MODEL (tree_model));
g_return_if_fail (path != NULL);
g_signal_emit_by_name (tree_model, "deleted", path);
}

View File

@ -150,7 +150,6 @@ void gtk_tree_row_reference_free (GtkTreeRowReference *refer
GtkTreeIter *gtk_tree_iter_copy (GtkTreeIter *iter);
void gtk_tree_iter_free (GtkTreeIter *iter);
/* GtkTreeModel stuff */
GtkType gtk_tree_model_get_type (void) G_GNUC_CONST;
GtkTreeModelFlags gtk_tree_model_get_flags (GtkTreeModel *tree_model);
@ -200,6 +199,18 @@ void gtk_tree_model_get_valist (GtkTreeModel *tree_model,
GtkTreeIter *iter,
va_list var_args);
/* Signals */
void gtk_tree_model_changed (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void gtk_tree_model_inserted (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void gtk_tree_model_child_toggled (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter);
void gtk_tree_model_deleted (GtkTreeModel *tree_model,
GtkTreePath *path);
#ifdef __cplusplus

View File

@ -21,7 +21,6 @@
#include "gtktreestore.h"
#include "gtktreedatalist.h"
#include "gtktreednd.h"
#include "gtksignal.h"
#include <string.h>
#include <gobject/gvaluecollector.h>
@ -533,6 +532,7 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
{
GtkTreeDataList *list;
GtkTreeDataList *prev;
GtkTreePath *path = NULL;
g_return_if_fail (tree_store != NULL);
g_return_if_fail (GTK_IS_TREE_STORE (tree_store));
@ -540,14 +540,15 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
prev = list = G_NODE (iter->user_data)->data;
path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter);
while (list != NULL)
{
if (column == 0)
{
_gtk_tree_data_list_value_to_node (list, value);
g_signal_emit_by_name (G_OBJECT (tree_store),
"changed",
NULL, iter);
gtk_tree_model_changed (GTK_TREE_MODEL (tree_store), path, iter);
gtk_tree_path_free (path);
return;
}
@ -575,9 +576,8 @@ gtk_tree_store_set_cell (GtkTreeStore *tree_store,
column --;
}
_gtk_tree_data_list_value_to_node (list, value);
g_signal_emit_by_name (G_OBJECT (tree_store),
"changed",
NULL, iter);
gtk_tree_model_changed (GTK_TREE_MODEL (tree_store), path, iter);
gtk_tree_path_free (path);
}
/**
@ -668,7 +668,7 @@ gtk_tree_store_remove (GtkTreeStore *model,
GtkTreeIter *iter)
{
GtkTreePath *path;
GtkTreeIter new_iter = {0,};
GNode *parent;
g_return_if_fail (model != NULL);
@ -686,17 +686,15 @@ gtk_tree_store_remove (GtkTreeStore *model,
g_node_destroy (G_NODE (iter->user_data));
model->stamp++;
g_signal_emit_by_name (G_OBJECT (model),
"deleted",
path);
gtk_tree_model_deleted (GTK_TREE_MODEL (model), path);
if (parent != G_NODE (model->root) && parent->children == NULL)
{
gtk_tree_path_up (path);
g_signal_emit_by_name (G_OBJECT (model),
"child_toggled",
path,
parent);
new_iter.stamp = model->stamp;
new_iter.user_data = parent;
gtk_tree_model_child_toggled (GTK_TREE_MODEL (model), path, &new_iter);
}
gtk_tree_path_free (path);
}
@ -723,9 +721,8 @@ gtk_tree_store_insert (GtkTreeStore *model,
g_node_insert (parent_node, position, G_NODE (iter->user_data));
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
g_signal_emit_by_name (G_OBJECT (model),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (model), path, iter);
gtk_tree_path_free (path);
validate_tree ((GtkTreeStore*)model);
@ -768,9 +765,8 @@ gtk_tree_store_insert_before (GtkTreeStore *model,
iter->user_data = new_node;
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
g_signal_emit_by_name (G_OBJECT (model),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (model), path, iter);
gtk_tree_path_free (path);
validate_tree ((GtkTreeStore*)model);
@ -814,9 +810,8 @@ gtk_tree_store_insert_after (GtkTreeStore *model,
iter->user_data = new_node;
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
g_signal_emit_by_name (G_OBJECT (model),
"inserted",
path, iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (model), path, iter);
gtk_tree_path_free (path);
validate_tree ((GtkTreeStore*)model);
@ -850,20 +845,14 @@ gtk_tree_store_prepend (GtkTreeStore *model,
if (parent_node != model->root)
{
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), parent);
g_signal_emit_by_name (G_OBJECT (model),
"child_toggled",
path,
parent);
gtk_tree_model_child_toggled (GTK_TREE_MODEL (model), path, parent);
gtk_tree_path_append_index (path, 0);
}
else
{
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
}
g_signal_emit_by_name (G_OBJECT (model),
"inserted",
path,
iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (model), path, iter);
gtk_tree_path_free (path);
}
else
@ -902,10 +891,7 @@ gtk_tree_store_append (GtkTreeStore *model,
if (parent_node != model->root)
{
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), parent);
g_signal_emit_by_name (G_OBJECT (model),
"child_toggled",
path,
parent);
gtk_tree_model_child_toggled (GTK_TREE_MODEL (model), path, parent);
gtk_tree_path_append_index (path, 0);
}
else
@ -913,10 +899,7 @@ gtk_tree_store_append (GtkTreeStore *model,
path = gtk_tree_store_get_path (GTK_TREE_MODEL (model), iter);
}
g_signal_emit_by_name (G_OBJECT (model),
"inserted",
path,
iter);
gtk_tree_model_inserted (GTK_TREE_MODEL (model), path, iter);
gtk_tree_path_free (path);
}
else
@ -1015,6 +998,7 @@ copy_node_data (GtkTreeStore *tree_store,
GtkTreeDataList *copy_head = NULL;
GtkTreeDataList *copy_prev = NULL;
GtkTreeDataList *copy_iter = NULL;
GtkTreePath *path;
gint col;
col = 0;
@ -1037,9 +1021,9 @@ copy_node_data (GtkTreeStore *tree_store,
G_NODE (dest_iter->user_data)->data = copy_head;
g_signal_emit_by_name (G_OBJECT (tree_store),
"changed",
NULL, dest_iter);
path = gtk_tree_store_get_path (tree_store, dest_iter);
gtk_tree_model_changed (GTK_TREE_MODEL (tree_store), path, dest_iter);
gtk_tree_path_free (path);
}
static void