Fixes NB#108159, contacts startup is slow in Modest
authorSergio Villar Senin <svillar@igalia.com>
Thu, 11 Jun 2009 16:18:37 +0000 (18:18 +0200)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 11 Jun 2009 16:52:11 +0000 (18:52 +0200)
Pre-open the addressbook during the application start

src/gnome/modest-address-book.c
src/hildon2/modest-address-book.c
src/maemo/modest-address-book.c
src/modest-address-book.h
src/modest-init.c

index 273a171..d998286 100644 (file)
 #include <modest-address-book.h>
 
 void
+modest_address_book_init (void)
+{
+       g_debug (__FUNCTION__);
+}
+
+void
 modest_address_book_add_address (const gchar *address)
 {
        g_debug (__FUNCTION__);
index c22165a..f3f21ec 100644 (file)
@@ -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 ();
+}
index b881632..b8ee6fc 100644 (file)
@@ -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 ();
+}
index 907c066..cdd231c 100644 (file)
 #include <widgets/modest-recpt-editor.h>
 
 /**
+ * modest_address_book_init:
+ *
+ * initializes the addressbook
+ */
+void
+modest_address_book_init (void);
+
+/**
  * modest_address_book_add_address:
  * @address: a string
  *
index db9be25..a4f4a89 100644 (file)
@@ -36,6 +36,7 @@
 #include <modest-runtime-priv.h>
 #include <modest-init.h>
 #include <modest-defs.h>
+#include "modest-address-book.h"
 #include <modest-singletons.h>
 #include <widgets/modest-header-view.h>
 #include <widgets/modest-folder-view.h>
@@ -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 ();