Wait to account manager to become ready
authorArtem Garmash <artemgarmash@gmail.com>
Tue, 26 Jan 2010 08:19:17 +0000 (10:19 +0200)
committerArtem Garmash <artem.garmash@nokia.com>
Sun, 27 Jun 2010 19:13:44 +0000 (22:13 +0300)
src/el-home-applet.c

index 7c0b10a..761072e 100644 (file)
@@ -708,6 +708,8 @@ resolve_contact (ELHomeApplet *self)
         EBookQuery *query = NULL;
         GError *error = NULL;
 
+
+
         if (priv->local_id && priv->remote_id) {
                 const gchar *vcard = osso_abook_account_manager_get_vcard_field
                         (NULL, priv->local_id);
@@ -1322,6 +1324,17 @@ leave_notify_event_cb (GtkWidget        *widget,
 }
 
 static void
+abook_acount_manager_ready (OssoABookAccountManager *manager,
+                            const GError            *error,
+                            gpointer                 user_data)
+{
+        ELHomeApplet *self = EL_HOME_APPLET (user_data);
+
+        /* ignore error, continue in any case */
+        read_new_event (self);
+}
+
+static void
 el_home_applet_init (ELHomeApplet *self)
 {
         ELHomeAppletPrivate *priv;
@@ -1452,9 +1465,12 @@ el_home_applet_init (ELHomeApplet *self)
                           G_CALLBACK (new_event_cb),
                           self);
 
-        read_new_event (self);
-
         osso_abook_init_with_name (PACKAGE, NULL);
+
+        osso_abook_account_manager_call_when_ready  (NULL,
+                                                     abook_acount_manager_ready,
+                                                     self,
+                                                     NULL);
 #endif
 }