Refresh the book and book view in addressbook if it changes in the
authorJosé Dapena Paz <jdapena@igalia.com>
Fri, 12 Feb 2010 17:17:13 +0000 (18:17 +0100)
committerJosé Dapena Paz <jdapena@igalia.com>
Fri, 12 Feb 2010 17:34:31 +0000 (18:34 +0100)
abook roster.

Fixes NB#151325.

src/hildon2/modest-address-book.c

index 5653bc6..8fb7ba6 100644 (file)
@@ -69,6 +69,19 @@ static gboolean resolve_address (const gchar *address, GSList **resolved_address
 static gchar *unquote_string (const gchar *str);
 static void set_contact_from_display_name (EContact *contact, const gchar *display_name);
 
+static void
+on_roster_notify (GObject    *gobject,
+                 GParamSpec *pspec,
+                 gpointer    user_data)
+{
+       if ((g_strcmp0 (g_param_spec_get_name (pspec), "book") == 0) ||
+           (g_strcmp0 (g_param_spec_get_name (pspec), "book-view") == 0)) {
+               OssoABookRoster *roster = OSSO_ABOOK_ROSTER (gobject);
+               book = osso_abook_roster_get_book (roster);
+               book_view = osso_abook_roster_get_book_view (roster);
+       }
+}
+
 static gboolean
 open_addressbook ()
 {
@@ -101,6 +114,8 @@ open_addressbook ()
        book = osso_abook_roster_get_book (roster);
        book_view = osso_abook_roster_get_book_view (roster);
 
+       g_signal_connect (G_OBJECT (roster), "notify", G_CALLBACK (on_roster_notify), NULL);
+
        return TRUE;
  error:
        g_warning ("error opening addressbook %s", error->message);