diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-04-02 07:31:54 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-04-02 07:31:54 +0800 |
commit | a33ff2cef49fdf3b5b70320355a5f80540d6cd6e (patch) | |
tree | 4b6d39b43bb2b771f51873f17e06993d1f194199 /widgets/table/e-tree-selection-model.c | |
parent | 428f1353cef2a92d2a044b575dfb5aee7ee2e1d0 (diff) | |
download | gsoc2013-evolution-a33ff2cef49fdf3b5b70320355a5f80540d6cd6e.tar.gz gsoc2013-evolution-a33ff2cef49fdf3b5b70320355a5f80540d6cd6e.tar.zst gsoc2013-evolution-a33ff2cef49fdf3b5b70320355a5f80540d6cd6e.zip |
Monitor the sorted model and send selection and cursor changed signals.
2001-04-01 Christopher James Lahey <clahey@ximian.com>
* e-tree-selection-model.c: Monitor the sorted model and send
selection and cursor changed signals.
svn path=/trunk/; revision=9090
Diffstat (limited to 'widgets/table/e-tree-selection-model.c')
-rw-r--r-- | widgets/table/e-tree-selection-model.c | 112 |
1 files changed, 111 insertions, 1 deletions
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c index 92e0144f63..554c071254 100644 --- a/widgets/table/e-tree-selection-model.c +++ b/widgets/table/e-tree-selection-model.c @@ -59,6 +59,13 @@ struct ETreeSelectionModelPriv { int tree_model_node_col_changed_id; int tree_model_node_inserted_id; int tree_model_node_removed_id; + + int sorted_model_pre_change_id; + int sorted_model_node_changed_id; + int sorted_model_node_data_changed_id; + int sorted_model_node_col_changed_id; + int sorted_model_node_inserted_id; + int sorted_model_node_removed_id; }; /* ETreeSelectionModelNode helpers */ @@ -369,10 +376,47 @@ etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_p } + +static void +etsm_sorted_pre_change (ETreeModel *etm, ETreeSelectionModel *etsm) +{ +} + +static void +etsm_sorted_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm) +{ + e_selection_model_selection_changed(E_SELECTION_MODEL(etsm)); + e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), etsm_cursor_row_real(etsm), etsm->priv->cursor_col); +} + +static void +etsm_sorted_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm) +{ +} + +static void +etsm_sorted_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionModel *etsm) +{ +} + +static void +etsm_sorted_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm) +{ + etsm_sorted_node_changed(etm, parent, etsm); +} + +static void +etsm_sorted_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm) +{ + etsm_sorted_node_changed(etm, parent, etsm); +} + + static void add_model(ETreeSelectionModel *etsm, ETreeModel *model) { ETreeSelectionModelPriv *priv = etsm->priv; + priv->model = model; if (!priv->model) @@ -425,6 +469,64 @@ drop_model(ETreeSelectionModel *etsm) priv->tree_model_node_removed_id = 0; } + +static void +add_ets(ETreeSelectionModel *etsm, ETreeSorted *ets) +{ + ETreeSelectionModelPriv *priv = etsm->priv; + + priv->ets = ets; + + if (!priv->ets) + return; + + gtk_object_ref(GTK_OBJECT(priv->ets)); + priv->sorted_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "pre_change", + GTK_SIGNAL_FUNC (etsm_sorted_pre_change), etsm); + priv->sorted_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_changed", + GTK_SIGNAL_FUNC (etsm_sorted_node_changed), etsm); + priv->sorted_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_data_changed", + GTK_SIGNAL_FUNC (etsm_sorted_node_data_changed), etsm); + priv->sorted_model_node_col_changed_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_col_changed", + GTK_SIGNAL_FUNC (etsm_sorted_node_col_changed), etsm); + priv->sorted_model_node_inserted_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_inserted", + GTK_SIGNAL_FUNC (etsm_sorted_node_inserted), etsm); + priv->sorted_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_removed", + GTK_SIGNAL_FUNC (etsm_sorted_node_removed), etsm); +} + +static void +drop_ets(ETreeSelectionModel *etsm) +{ + ETreeSelectionModelPriv *priv = etsm->priv; + + if (!priv->ets) + return; + + gtk_signal_disconnect (GTK_OBJECT (priv->ets), + priv->sorted_model_pre_change_id); + gtk_signal_disconnect (GTK_OBJECT (priv->ets), + priv->sorted_model_node_changed_id); + gtk_signal_disconnect (GTK_OBJECT (priv->ets), + priv->sorted_model_node_data_changed_id); + gtk_signal_disconnect (GTK_OBJECT (priv->ets), + priv->sorted_model_node_col_changed_id); + gtk_signal_disconnect (GTK_OBJECT (priv->ets), + priv->sorted_model_node_inserted_id); + gtk_signal_disconnect (GTK_OBJECT (priv->ets), + priv->sorted_model_node_removed_id); + + gtk_object_unref (GTK_OBJECT (priv->ets)); + priv->ets = NULL; + + priv->sorted_model_pre_change_id = 0; + priv->sorted_model_node_changed_id = 0; + priv->sorted_model_node_data_changed_id = 0; + priv->sorted_model_node_col_changed_id = 0; + priv->sorted_model_node_inserted_id = 0; + priv->sorted_model_node_removed_id = 0; +} + /* Virtual functions */ static void etsm_destroy (GtkObject *object) @@ -435,6 +537,7 @@ etsm_destroy (GtkObject *object) etsm_real_clear (etsm); drop_model(etsm); + drop_ets(etsm); g_free(etsm->priv); } @@ -491,7 +594,8 @@ etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) break; case ARG_ETS: - etsm->priv->ets = (ETreeSorted *) GTK_VALUE_OBJECT(*arg); + drop_ets(etsm); + add_ets(etsm, (ETreeSorted *) GTK_VALUE_OBJECT(*arg)); break; } } @@ -965,6 +1069,12 @@ e_tree_selection_model_init (ETreeSelectionModel *etsm) priv->tree_model_node_inserted_id = 0; priv->tree_model_node_removed_id = 0; + priv->sorted_model_pre_change_id = 0; + priv->sorted_model_node_changed_id = 0; + priv->sorted_model_node_data_changed_id = 0; + priv->sorted_model_node_col_changed_id = 0; + priv->sorted_model_node_inserted_id = 0; + priv->sorted_model_node_removed_id = 0; } static void |