Bug 579702 – Contact changes not shown until restart

This commit is contained in:
Matthew Barnes
2009-07-17 15:02:03 -04:00
parent da665f8f99
commit ec790f5761
4 changed files with 18 additions and 10 deletions

View File

@ -250,7 +250,7 @@ modify_contact(EBookView *book_view,
array->pdata[ii] = contact;
g_signal_emit (
model, signals[CONTACT_CHANGED], 0, contact);
model, signals[CONTACT_CHANGED], 0, ii);
break;
}
@ -607,8 +607,8 @@ addressbook_model_class_init (EAddressbookModelClass *class)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (EAddressbookModelClass, contact_changed),
NULL, NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1, E_TYPE_CONTACT);
g_cclosure_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT);
signals[MODEL_CHANGED] =
g_signal_new ("model_changed",

View File

@ -74,7 +74,7 @@ struct _EAddressbookModelClass {
void (*contacts_removed) (EAddressbookModel *model,
gpointer id_list);
void (*contact_changed) (EAddressbookModel *model,
EContact *contact);
gint index);
void (*model_changed) (EAddressbookModel *model);
void (*stop_state_changed) (EAddressbookModel *model);
void (*backend_died) (EAddressbookModel *model);

View File

@ -90,6 +90,7 @@ book_shell_view_selection_change_foreach (gint row,
contact = e_addressbook_model_get_contact (model, row);
e_book_shell_content_set_preview_contact (book_shell_content, contact);
book_shell_view->priv->preview_index = row;
}
static void
@ -121,24 +122,26 @@ selection_change (EBookShellView *book_shell_view,
selection_model, (EForeachFunc)
book_shell_view_selection_change_foreach,
book_shell_view);
else
else {
e_book_shell_content_set_preview_contact (
book_shell_content, NULL);
book_shell_view->priv->preview_index = -1;
}
}
static void
contact_changed (EBookShellView *book_shell_view,
EContact *contact)
gint index,
EAddressbookModel *model)
{
EBookShellContent *book_shell_content;
EContact *preview_contact;
EContact *contact;
book_shell_content = book_shell_view->priv->book_shell_content;
preview_contact =
e_book_shell_content_get_preview_contact (book_shell_content);
contact = e_addressbook_model_contact_at (model, index);
if (contact != preview_contact)
if (book_shell_view->priv->preview_index != index)
return;
/* Re-render the same contact. */
@ -167,6 +170,7 @@ contacts_removed (EBookShellView *book_shell_view,
/* If not, clear the contact display. */
e_book_shell_content_set_preview_contact (book_shell_content, NULL);
book_shell_view->priv->preview_index = -1;
}
static void
@ -422,6 +426,7 @@ e_book_shell_view_private_init (EBookShellView *book_shell_view,
priv->uid_to_view = uid_to_view;
priv->uid_to_editor = uid_to_editor;
priv->preview_index = -1;
if (!gal_view_collection_loaded (shell_view_class->view_collection))
book_shell_view_load_view_collection (shell_view_class);
@ -615,6 +620,7 @@ e_book_shell_view_execute_search (EBookShellView *book_shell_view)
g_free (query);
e_book_shell_content_set_preview_contact (book_shell_content, NULL);
book_shell_view->priv->preview_index = -1;
}
void

View File

@ -100,6 +100,8 @@ struct _EBookShellViewPrivate {
GHashTable *uid_to_view;
GHashTable *uid_to_editor;
gint preview_index;
};
void e_book_shell_view_private_init