diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-02-14 05:39:05 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-02-14 05:39:05 +0800 |
commit | 2cacdc5d41cbf020f57ff782efcdd6e4bf999636 (patch) | |
tree | 0506872b59d74c15747c720e2de5809ceb803032 /addressbook/gui/widgets | |
parent | 32a1a69f13932b9304a937ca0cb39102d425bc93 (diff) | |
download | gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.gz gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.bz2 gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.lz gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.xz gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.zst gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.zip |
Make sure to only set the query once when creating a new book and not at
2002-02-13 Christopher James Lahey <clahey@ximian.com>
* gui/component/select-names/e-select-names.c (set_book): Make
sure to only set the query once when creating a new book and not
at all on addressbook model creation. This prevents an accidental
pair of changes from making the addressbook model load a remote
addressbook.
* gui/widgets/e-addressbook-model.c (get_view): If this is the
first_get_view and the addressbook is remote, empty the view
instead of leaving it in the state it used to be in. This only
occurs if you set the book after the model has existed for a
while.
(e_addressbook_model_set_arg): When setting the book, set
first_get_view to TRUE.
svn path=/trunk/; revision=15715
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index cd7688ba51..901ec22a0b 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -49,6 +49,21 @@ enum { static guint e_addressbook_model_signals [LAST_SIGNAL] = {0, }; static void +free_data (EAddressbookModel *model) +{ + int i; + + for ( i = 0; i < model->data_count; i++ ) { + gtk_object_unref(GTK_OBJECT(model->data[i])); + } + + g_free(model->data); + model->data = NULL; + model->data_count = 0; + model->allocated_count = 0; +} + +static void remove_book_view(EAddressbookModel *model) { if (model->book_view && model->create_card_id) @@ -86,7 +101,6 @@ static void addressbook_destroy(GtkObject *object) { EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - int i; if (model->get_view_idle) { g_source_remove(model->get_view_idle); @@ -94,6 +108,7 @@ addressbook_destroy(GtkObject *object) } remove_book_view(model); + free_data (model); if (model->book) { if (model->writable_status_id) @@ -105,13 +120,6 @@ addressbook_destroy(GtkObject *object) gtk_object_unref(GTK_OBJECT(model->book)); model->book = NULL; } - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - - g_free(model->data); - model->data = NULL; } static void @@ -358,7 +366,6 @@ static void book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) { EAddressbookModel *model = closure; - int i; remove_book_view(model); model->book_view = book_view; if (model->book_view) @@ -384,14 +391,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe GTK_SIGNAL_FUNC(sequence_complete), model); - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } + free_data (model); - g_free(model->data); - model->data = NULL; - model->data_count = 0; - model->allocated_count = 0; model->search_in_progress = TRUE; gtk_signal_emit (GTK_OBJECT (model), e_addressbook_model_signals [MODEL_CHANGED]); @@ -408,6 +409,13 @@ get_view (EAddressbookModel *model) capabilities = e_book_get_static_capabilities (model->book); if (capabilities && strstr (capabilities, "local")) { e_book_get_book_view (model->book, model->query, book_view_loaded, model); + } else { + remove_book_view(model); + free_data (model); + gtk_signal_emit (GTK_OBJECT (model), + e_addressbook_model_signals [MODEL_CHANGED]); + gtk_signal_emit (GTK_OBJECT (model), + e_addressbook_model_signals [STOP_STATE_CHANGED]); } model->first_get_view = FALSE; g_free (capabilities); @@ -452,6 +460,7 @@ e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) } model->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); if (model->book) { + model->first_get_view = TRUE; gtk_object_ref(GTK_OBJECT(model->book)); if (model->get_view_idle == 0) model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); @@ -533,7 +542,6 @@ e_addressbook_model_new (void) void e_addressbook_model_stop (EAddressbookModel *model) { remove_book_view(model); - model->search_in_progress = FALSE; gtk_signal_emit (GTK_OBJECT (model), e_addressbook_model_signals [STOP_STATE_CHANGED]); gtk_signal_emit (GTK_OBJECT (model), |