From d9b1a33529f8cb9b45f7c45090d7b48c377f8df7 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Thu, 11 Jun 2009 18:18:37 +0200 Subject: [PATCH] Fixes NB#108159, contacts startup is slow in Modest Pre-open the addressbook during the application start --- src/gnome/modest-address-book.c | 6 ++++++ src/hildon2/modest-address-book.c | 8 +++++++- src/maemo/modest-address-book.c | 9 +++++++-- src/modest-address-book.h | 8 ++++++++ src/modest-init.c | 4 ++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/gnome/modest-address-book.c b/src/gnome/modest-address-book.c index 273a171..d998286 100644 --- a/src/gnome/modest-address-book.c +++ b/src/gnome/modest-address-book.c @@ -32,6 +32,12 @@ #include void +modest_address_book_init (void) +{ + g_debug (__FUNCTION__); +} + +void modest_address_book_add_address (const gchar *address) { g_debug (__FUNCTION__); diff --git a/src/hildon2/modest-address-book.c b/src/hildon2/modest-address-book.c index c22165a..f3f21ec 100644 --- a/src/hildon2/modest-address-book.c +++ b/src/hildon2/modest-address-book.c @@ -1021,7 +1021,7 @@ resolve_address (const gchar *address, *canceled = FALSE; info = g_slice_new0 (CheckNamesInfo); show_check_names_banner (info); - + contact_model = osso_abook_contact_model_new (); if (!open_addressbook ()) { hide_check_names_banner (info); @@ -1165,3 +1165,9 @@ modest_address_book_get_my_name () else return NULL; } + +void +modest_address_book_init (void) +{ + open_addressbook (); +} diff --git a/src/maemo/modest-address-book.c b/src/maemo/modest-address-book.c index b881632..b8ee6fc 100644 --- a/src/maemo/modest-address-book.c +++ b/src/maemo/modest-address-book.c @@ -62,14 +62,12 @@ static GSList *select_email_addrs_for_contact(GList * email_addr_list); static gboolean resolve_address (const gchar *address, GSList **resolved_addresses, gchar **contact_id); static gchar *unquote_string (const gchar *str); - static void unref_gobject (GObject *obj) { if (obj) g_object_unref (obj); } - static void get_book_view_cb (EBook *book, EBookStatus status, EBookView *bookview, gpointer data) @@ -1046,3 +1044,10 @@ modest_address_book_get_my_name () /* There is no support to get my own contact in this version */ return NULL; } + + +void +modest_address_book_init (void) +{ + open_addressbook (); +} diff --git a/src/modest-address-book.h b/src/modest-address-book.h index 907c066..cdd231c 100644 --- a/src/modest-address-book.h +++ b/src/modest-address-book.h @@ -37,6 +37,14 @@ #include /** + * modest_address_book_init: + * + * initializes the addressbook + */ +void +modest_address_book_init (void); + +/** * modest_address_book_add_address: * @address: a string * diff --git a/src/modest-init.c b/src/modest-init.c index db9be25..a4f4a89 100644 --- a/src/modest-init.c +++ b/src/modest-init.c @@ -36,6 +36,7 @@ #include #include #include +#include "modest-address-book.h" #include #include #include @@ -245,6 +246,9 @@ modest_init (int argc, char *argv[]) return FALSE; } + /* Initialize addressbook */ + modest_address_book_init (); + reset = modest_runtime_get_debug_flags () & MODEST_RUNTIME_DEBUG_FACTORY_SETTINGS; if (!init_header_columns(modest_runtime_get_conf(), reset)) { modest_init_uninit (); -- 1.7.9.5