From cf022042c82501ba50622b144829a4ce9e301ecb Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 7 May 2000 05:53:59 +0000 Subject: Make the addressbook create the correct file uri. Added a default query. 2000-05-07 Christopher James Lahey * gui/component/addressbook.c: Make the addressbook create the correct file uri. Added a default query. Initialize view->model and view->view to NULL. * gui/component/e-addressbook-model.c, gui/minicard/e-minicard-view.c: Only call get_book_view if both book and query and non-null. svn path=/trunk/; revision=2861 --- addressbook/gui/component/addressbook.c | 16 +++++++++++++--- addressbook/gui/component/e-addressbook-model.c | 3 ++- addressbook/gui/minicard/e-minicard-view.c | 3 ++- addressbook/gui/widgets/e-addressbook-model.c | 3 ++- addressbook/gui/widgets/e-minicard-view.c | 3 ++- 5 files changed, 21 insertions(+), 7 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 7359249772..d21370891e 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -549,8 +549,11 @@ set_prop (BonoboPropertyBag *bag, uri_data = e_read_file(uri_file); - if (!uri_data) - uri_data = g_concat_dir_and_file(view->uri + 7, "addressbook.db"); + if (!uri_data) { + char *file_name = g_concat_dir_and_file(view->uri + 7, "addressbook.db"); + uri_data = g_strdup_printf("file://%s", file_name); + g_free(file_name); + } if (! e_book_load_uri (book, uri_data, book_open_cb, view)) { @@ -736,8 +739,12 @@ change_view_type (AddressbookView *view, AddressbookViewType view_type) if (view_type == view->view_type) return; + + if (view->view_type != ADDRESSBOOK_VIEW_NONE) + query = get_query(view); + else + query = g_strdup("(contains \"full_name\" \"\")"); - query = get_query(view); switch (view_type) { case ADDRESSBOOK_VIEW_MINICARD: @@ -788,6 +795,9 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure) /* Create the control. */ view->control = bonobo_control_new(view->vbox); + view->model = NULL; + view->view = NULL; + /* create the initial view */ change_view_type (view, ADDRESSBOOK_VIEW_TABLE); diff --git a/addressbook/gui/component/e-addressbook-model.c b/addressbook/gui/component/e-addressbook-model.c index 10b74dd7da..7bbdcaa5bd 100644 --- a/addressbook/gui/component/e-addressbook-model.c +++ b/addressbook/gui/component/e-addressbook-model.c @@ -263,7 +263,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe static gboolean get_view(EAddressbookModel *model) { - e_book_get_book_view(model->book, model->query, book_view_loaded, model); + if (model->book && model->query) + e_book_get_book_view(model->book, model->query, book_view_loaded, model); model->get_view_idle = 0; return FALSE; diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c index 35024d9564..812fee47f0 100644 --- a/addressbook/gui/minicard/e-minicard-view.c +++ b/addressbook/gui/minicard/e-minicard-view.c @@ -176,7 +176,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe static gboolean get_view(EMinicardView *view) { - e_book_get_book_view(view->book, view->query, book_view_loaded, view); + if (view->book && view->query) + e_book_get_book_view(view->book, view->query, book_view_loaded, view); view->get_view_idle = 0; return FALSE; diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 10b74dd7da..7bbdcaa5bd 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -263,7 +263,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe static gboolean get_view(EAddressbookModel *model) { - e_book_get_book_view(model->book, model->query, book_view_loaded, model); + if (model->book && model->query) + e_book_get_book_view(model->book, model->query, book_view_loaded, model); model->get_view_idle = 0; return FALSE; diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c index 35024d9564..812fee47f0 100644 --- a/addressbook/gui/widgets/e-minicard-view.c +++ b/addressbook/gui/widgets/e-minicard-view.c @@ -176,7 +176,8 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe static gboolean get_view(EMinicardView *view) { - e_book_get_book_view(view->book, view->query, book_view_loaded, view); + if (view->book && view->query) + e_book_get_book_view(view->book, view->query, book_view_loaded, view); view->get_view_idle = 0; return FALSE; -- cgit