aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-model.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-09-09 11:48:20 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-09-09 11:48:20 +0800
commit91a2ff89c4ffe82aa07be175fb623b329d3d6a61 (patch)
tree2ff4e51eb0964fc60e691eb4434b73c17e5c726d /addressbook/gui/component/select-names/e-select-names-model.c
parent2e3a7b37fe4bb3adffd998d005e39fd4758e2c1e (diff)
downloadgsoc2013-evolution-91a2ff89c4ffe82aa07be175fb623b329d3d6a61.tar.gz
gsoc2013-evolution-91a2ff89c4ffe82aa07be175fb623b329d3d6a61.tar.zst
gsoc2013-evolution-91a2ff89c4ffe82aa07be175fb623b329d3d6a61.zip
(Apologies if you are seeing this multiple times. CVS is being annoying.)
2001-09-08 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-book-view-listener.c (e_book_view_listener_check_queue): See e_book_listener_check_queue below. (e_book_view_listener_queue_response): See e_book_listener_queue_response below. * backend/ebook/e-book-listener.c (e_book_listener_check_queue): Explicitly prohibit reentrancy. Use gtk-unref rather than bobobo-unref. (e_book_listener_queue_response): Hold a gtk-ref to the listener while the idle function runs, not a bonobo-ref. As far as I can tell, it is impossible to avoid a race condition here when we have to worry about bonobo reentrancy. * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_insert_length): Alter a copy of the original EDestination, rather than just using a new one. We need to do this to preserve prior-card information for possible reversion later. (e_select_names_text_model_delete): Ditto. * backend/ebook/e-destination.c (e_destination_clear_card): When clearing a destination where ->card != NULL, store it for possible reversion later. (e_destination_revert): If we have an old card stored, go back to using it for the destination. (e_destination_is_valid): Tries to detect obviously broken addresses. (e_destination_cardify): If our destination is invalid, first try to cardify simply by reverting to an older card. (e_destination_destroy): Unref any cached old card. (e_destination_copy): Copy the old card information. 2001-09-07 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names.c (sync_table_and_models): Show all rows in the table, and then remove the rows that correspond to entries in the ESelectNamesModels in the children. (real_add_address): Freeze/thaw our ESelectNamesModel, so that we don't change our table while we are in the middle of iterating over the selection. (remove_address): Just delete the address from the ESelectNamesModel, the signal handler will do the rest. (selected_rows_foreach_cb): Call remove_address to do our dirty work. (e_select_names_add_section): Connect to the 'changed' signal from the ESelectNamesModel, and call sync_table_and_models explicitly to get our initial state correct. * gui/component/select-names/e-select-names-table-model.c (fill_in_info): Deal with EDestinations in our table that don't come from cards. * gui/component/select-names/e-select-names-manager.c: Added another ESelectNamesModel* to the ESelectNamesManagerSection struct. Called 'original_model', this contains a copy of the model as it is when we begin using the SelectNames dialog. (section_copy): Copy the original model. (section_free): Free the original model. (e_select_names_manager_add_section_with_limit): Initialize the original model. (e_select_names_clicked): I've changed the semantics of this dialog quite a bit... no UI freeze can stop me! If OK is clicked, we do nothing. If Cancel is clicked, we revert to the 'original_model' copy of our address entry state before we started editting. Finally, we close the dialog before any of thing. Doing it last caused problems, because signals were being triggered which had dangling pointers as their closures. (e_select_names_manager_activate_dialog): Copy our current state to the original model, and share the same ESelectNamesModel between the dialog and the address entry in the composer.. (e_select_names_manager_get_cards): Removed. It had been #if 0/#endif-ed out for a while. * gui/component/select-names/e-select-names-model.c (e_select_names_model_freeze): Added. (e_select_names_model_thaw): Added. (e_select_names_model_uncardify): Added. If possible, "uncardifies" a specific model entry. (e_select_names_model_changed): Changed to pay attention to the freeze count. * gui/component/select-names/e-select-names-completion.c (clean_query_text): Strip leading/trailing whitespace from queries. * backend/ebook/e-destination.c (e_destination_uncardify): Added. Converts a card-associated destination into a text-associated destination w/ the e-mail address. (e_destination_list_to_vector): Added. A convenience routine. (e_destination_freev): Added. A convenience routine. (e_destination_touchv): Added. I'm lazy. svn path=/trunk/; revision=12710
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-model.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
index 0f43464507..89838f9b82 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -58,6 +58,9 @@ struct _ESelectNamesModelPrivate {
gchar *addr_text;
gint limit;
+
+ gint freeze_count;
+ gboolean pending_changed;
};
@@ -216,7 +219,12 @@ e_select_names_model_changed (ESelectNamesModel *model)
g_free (model->priv->addr_text);
model->priv->addr_text = NULL;
- gtk_signal_emit (GTK_OBJECT(model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]);
+ if (model->priv->freeze_count > 0) {
+ model->priv->pending_changed = TRUE;
+ } else {
+ gtk_signal_emit (GTK_OBJECT(model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]);
+ model->priv->pending_changed = FALSE;
+ }
}
static void
@@ -580,14 +588,17 @@ void
e_select_names_model_delete (ESelectNamesModel *model, gint index)
{
GList *node;
+ EDestination *dest;
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (0 <= index && index < g_list_length (model->priv->data));
node = g_list_nth (model->priv->data, index);
- disconnect_destination (model, E_DESTINATION (node->data));
- gtk_object_unref (GTK_OBJECT (node->data));
+ dest = E_DESTINATION (node->data);
+
+ disconnect_destination (model, dest);
+ gtk_object_unref (GTK_OBJECT (dest));
model->priv->data = g_list_remove_link (model->priv->data, node);
g_list_free_1 (node);
@@ -788,6 +799,31 @@ e_select_names_model_cardify (ESelectNamesModel *model, EBook *book, gint index,
}
}
+gboolean
+e_select_names_model_uncardify (ESelectNamesModel *model, gint index)
+{
+ EDestination *dest;
+ gboolean rv = FALSE;
+
+ g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE);
+ g_return_val_if_fail (0 <= index && index < g_list_length (model->priv->data), FALSE);
+
+ dest = E_DESTINATION (g_list_nth_data (model->priv->data, index));
+
+ if (!e_destination_is_empty (dest)) {
+ EDestination *cpy_dest = e_destination_copy (dest);
+
+ rv = e_destination_uncardify (cpy_dest);
+
+ if (rv) {
+ e_select_names_model_replace (model, index, cpy_dest);
+ }
+
+ }
+
+ return rv;
+}
+
void
e_select_names_model_cancel_cardify (ESelectNamesModel *model, gint index)
{
@@ -834,3 +870,21 @@ e_select_names_model_cancel_cardify_all (ESelectNamesModel *model)
}
}
+void
+e_select_names_model_freeze (ESelectNamesModel *model)
+{
+ g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
+
+ ++model->priv->freeze_count;
+}
+
+void
+e_select_names_model_thaw (ESelectNamesModel *model)
+{
+ g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
+ g_return_if_fail (model->priv->freeze_count > 0);
+
+ --model->priv->freeze_count;
+ if (model->priv->pending_changed)
+ e_select_names_model_changed (model);
+}