[evolution/kill-bonobo] Bug 579702 – Contact changes not shown until restart



commit ec790f576119e171ba9b77dd6f7bfcf7a42ebeb1
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jul 17 15:02:03 2009 -0400

    Bug 579702 â?? Contact changes not shown until restart

 addressbook/gui/widgets/e-addressbook-model.c   |    6 +++---
 addressbook/gui/widgets/e-addressbook-model.h   |    2 +-
 modules/addressbook/e-book-shell-view-private.c |   18 ++++++++++++------
 modules/addressbook/e-book-shell-view-private.h |    2 ++
 4 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index b68763c..7ae371d 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -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",
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index d17a8f3..b42de48 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -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);
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 95e4980..f930e6d 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -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
diff --git a/modules/addressbook/e-book-shell-view-private.h b/modules/addressbook/e-book-shell-view-private.h
index b4701ae..b496776 100644
--- a/modules/addressbook/e-book-shell-view-private.h
+++ b/modules/addressbook/e-book-shell-view-private.h
@@ -100,6 +100,8 @@ struct _EBookShellViewPrivate {
 
 	GHashTable *uid_to_view;
 	GHashTable *uid_to_editor;
+
+	gint preview_index;
 };
 
 void		e_book_shell_view_private_init



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]