evolution r36366 - in branches/kill-bonobo: addressbook/gui/component addressbook/gui/merging addressbook/gui/widgets shell



Author: mbarnes
Date: Thu Sep 18 02:32:04 2008
New Revision: 36366
URL: http://svn.gnome.org/viewvc/evolution?rev=36366&view=rev

Log:
Progress update:

	- Get context menus working in the contact preview pane.

	- Kill EABPopup.

	- Yet more code refactoring.

	- Add a handy utility function: e_shell_window_show_popup_menu()
	  Takes a widget path in the shell window's UI definition.



Removed:
   branches/kill-bonobo/addressbook/gui/widgets/eab-popup-control.c
   branches/kill-bonobo/addressbook/gui/widgets/eab-popup-control.h
   branches/kill-bonobo/addressbook/gui/widgets/eab-popup.c
   branches/kill-bonobo/addressbook/gui/widgets/eab-popup.h
Modified:
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h
   branches/kill-bonobo/addressbook/gui/component/e-book-shell-view.c
   branches/kill-bonobo/addressbook/gui/merging/eab-contact-merging.c
   branches/kill-bonobo/addressbook/gui/widgets/Makefile.am
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.c
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.h
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c
   branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h
   branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c
   branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h
   branches/kill-bonobo/addressbook/gui/widgets/eab-vcard-control.c
   branches/kill-bonobo/shell/e-shell-sidebar.c
   branches/kill-bonobo/shell/e-shell-window.c
   branches/kill-bonobo/shell/e-shell-window.h

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-actions.c	Thu Sep 18 02:32:04 2008
@@ -393,6 +393,7 @@
 	EShellContent *shell_content;
 	GString *string;
 	EAddressbookView *view;
+	EABContactDisplay *display;
 	const gchar *search_format;
 	const gchar *search_text;
 	gchar *search_query;
@@ -463,10 +464,8 @@
 	g_object_set (view, "query", search_query, NULL);
 	g_free (search_query);
 
-	/* FIXME view->displayed_contact = -1; */
-	eab_contact_display_render (
-		EAB_CONTACT_DISPLAY (book_shell_view->priv->preview),
-		NULL, EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+	display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
+	eab_contact_display_set_contact (display, NULL);
 }
 
 static GtkActionEntry contact_entries[] = {
@@ -747,12 +746,12 @@
 }
 
 void
-e_book_shell_view_actions_update (EBookShellView *book_shell_view,
-                                  EAddressbookView *view)
+e_book_shell_view_actions_update (EBookShellView *book_shell_view)
 {
 	EShellView *shell_view;
 	EShellWindow *shell_window;
 	EAddressbookModel *model;
+	EAddressbookView *view;
 	EBookShellSidebar *book_shell_sidebar;
 	ESelectionModel *selection_model;
 	ESourceSelector *selector;
@@ -764,11 +763,9 @@
 	gint n_contacts;
 	gint n_selected;
 
-	if (e_book_shell_view_get_current_view (book_shell_view) != view)
-		return;
-
 	shell_view = E_SHELL_VIEW (book_shell_view);
 	shell_window = e_shell_view_get_shell_window (shell_view);
+	view = e_book_shell_view_get_current_view (book_shell_view);
 
 	book_shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
 	selector = e_book_shell_sidebar_get_selector (book_shell_sidebar);

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.c	Thu Sep 18 02:32:04 2008
@@ -26,6 +26,22 @@
 #include <addressbook.h>
 
 static void
+popup_event (EBookShellView *book_shell_view,
+             GdkEventButton *event)
+{
+	EShellView *shell_view;
+	EShellWindow *shell_window;
+	const gchar *widget_path;
+
+	widget_path = "/contact-popup";
+	shell_view = E_SHELL_VIEW (book_shell_view);
+	shell_window = e_shell_view_get_shell_window (shell_view);
+
+	e_book_shell_view_actions_update (book_shell_view);
+	e_shell_window_show_popup_menu (shell_window, widget_path, event);
+}
+
+static void
 set_status_message (EAddressbookView *view,
                     const gchar *message,
                     EBookShellView *book_shell_view)
@@ -56,20 +72,90 @@
 }
 
 static void
-preview_contact (EBookShellView *book_shell_view,
-                 EContact *contact,
-                 EAddressbookView *view)
+book_shell_view_selection_change_foreach (gint row,
+                                          EBookShellView *book_shell_view)
+{
+	EAddressbookView *view;
+	EAddressbookModel *model;
+	EABContactDisplay *display;
+	EContact *contact;
+
+	/* XXX A "foreach" function is kind of a silly way to retrieve
+	 *     the one and only selected contact, but this is the only
+	 *     means that ESelectionModel provides. */
+
+	view = e_book_shell_view_get_current_view (book_shell_view);
+	model = e_addressbook_view_get_model (view);
+	contact = e_addressbook_model_get_contact (model, row);
+
+	display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
+	eab_contact_display_set_contact (display, contact);
+}
+
+static void
+selection_change (EBookShellView *book_shell_view,
+                  EAddressbookView *view)
 {
 	EAddressbookView *current_view;
+	ESelectionModel *selection_model;
+	EABContactDisplay *display;
 
 	current_view = e_book_shell_view_get_current_view (book_shell_view);
 
 	if (view != current_view)
 		return;
 
-	eab_contact_display_render (
-		EAB_CONTACT_DISPLAY (book_shell_view->priv->preview),
-		contact, EAB_CONTACT_DISPLAY_RENDER_NORMAL);
+	e_book_shell_view_actions_update (book_shell_view);
+
+	display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
+	selection_model = e_addressbook_view_get_selection_model (view);
+
+	if (e_selection_model_selected_count (selection_model) == 1)
+		e_selection_model_foreach (
+			selection_model, (EForeachFunc)
+			book_shell_view_selection_change_foreach,
+			book_shell_view);
+	else
+		eab_contact_display_set_contact (display, NULL);
+}
+
+static void
+contact_changed (EBookShellView *book_shell_view,
+                 EContact *contact)
+{
+	EABContactDisplay *display;
+	EContact *displayed_contact;
+
+	display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
+	displayed_contact = eab_contact_display_get_contact (display);
+
+	if (contact != displayed_contact)
+		return;
+
+	/* Re-render the same contact. */
+	eab_contact_display_set_contact (display, contact);
+}
+
+static void
+contacts_removed (EBookShellView *book_shell_view,
+                  GArray *removed_indices,
+                  EAddressbookModel *model)
+{
+	EABContactDisplay *display;
+	EContact *displayed_contact;
+
+	display = EAB_CONTACT_DISPLAY (book_shell_view->priv->preview);
+	displayed_contact = eab_contact_display_get_contact (display);
+
+	if (displayed_contact == NULL)
+		return;
+
+	/* Is the displayed contact still in the model? */
+	if (e_addressbook_model_find (model, displayed_contact) < 0)
+		return;
+
+	/* If not, clear the contact display. */
+	eab_contact_display_set_contact (display, NULL);
 }
 
 static void
@@ -84,10 +170,6 @@
 	source = e_book_get_source (book);
 	model = e_addressbook_view_get_model (view);
 
-	/* We always set the "source" property on the EAddressbookView
-	 * since we use it to reload a previously failed book. */
-	g_object_set (view, "source", source, NULL);
-
 	if (status == E_BOOK_ERROR_OK) {
 		e_addressbook_model_set_book (model, book);
 		e_addressbook_model_force_folder_bar_message (model);
@@ -133,23 +215,13 @@
 		 * suggests a previous load failed, so try again. */
 		view = E_ADDRESSBOOK_VIEW (widget);
 		model = e_addressbook_view_get_model (view);
-		book = e_addressbook_model_get_book (model);
-
-		if (book != NULL)
-			g_object_unref (book);
-		else {
-			g_object_get (view, "source", &source, NULL);
-
-			/* Source can be NULL if a previous load
-			 * has not yet reached book_open_cb(). */
-			if (source != NULL) {
-				book = e_book_new (source, NULL);
+		source = e_addressbook_view_get_source (view);
 
-				if (book != NULL)
-					addressbook_load (book, book_open_cb, view);
+		if (e_addressbook_model_get_book (model) == NULL) {
+			book = e_book_new (source, NULL);
 
-				g_object_unref (source);
-			}
+			if (book != NULL)
+				addressbook_load (book, book_open_cb, view);
 		}
 
 	} else {
@@ -158,7 +230,7 @@
 
 		/* Create a view for this UID. */
 		shell_view = E_SHELL_VIEW (book_shell_view);
-		widget = e_addressbook_view_new (shell_view);
+		widget = e_addressbook_view_new (shell_view, source);
 		g_object_set (widget, "type", E_ADDRESSBOOK_VIEW_TABLE, NULL);
 		gtk_widget_show (widget);
 
@@ -166,6 +238,10 @@
 		gtk_notebook_append_page (notebook, widget, NULL);
 		g_hash_table_insert (hash_table, g_strdup (uid), widget);
 
+		g_signal_connect_swapped (
+			widget, "popup-event",
+			G_CALLBACK (popup_event), book_shell_view);
+
 		g_signal_connect (
 			widget, "status-message",
 			G_CALLBACK (set_status_message), book_shell_view);
@@ -176,8 +252,8 @@
 			book_shell_view);
 
 		g_signal_connect_swapped (
-			widget, "preview-contact",
-			G_CALLBACK (preview_contact), book_shell_view);
+			widget, "selection-change",
+			G_CALLBACK (selection_change), book_shell_view);
 
 		book = e_book_new (source, NULL);
 
@@ -186,34 +262,33 @@
 
 		view = E_ADDRESSBOOK_VIEW (widget);
 		model = e_addressbook_view_get_model (view);
+
+		g_signal_connect_swapped (
+			model, "contact-changed",
+			G_CALLBACK (contact_changed), book_shell_view);
+
+		g_signal_connect_swapped (
+			model, "contacts-removed",
+			G_CALLBACK (contacts_removed), book_shell_view);
 	}
 
 	page_num = gtk_notebook_page_num (notebook, widget);
 	gtk_notebook_set_current_page (notebook, page_num);
 
 	e_addressbook_model_force_folder_bar_message (model);
+	selection_change (book_shell_view, view);
 }
 
 static gboolean
 book_shell_view_show_popup_menu (GdkEventButton *event,
                                  EShellView *shell_view)
 {
-	GtkWidget *menu;
 	EShellWindow *shell_window;
 	const gchar *widget_path;
 
 	widget_path = "/address-book-popup";
 	shell_window = e_shell_view_get_shell_window (shell_view);
-	menu = e_shell_window_get_managed_widget (shell_window, widget_path);
-
-	if (event != NULL)
-		gtk_menu_popup (
-			GTK_MENU (menu), NULL, NULL, NULL, NULL,
-			event->button, event->time);
-	else
-		gtk_menu_popup (
-			GTK_MENU (menu), NULL, NULL, NULL, NULL,
-			0, gtk_get_current_event_time ());
+	e_shell_window_show_popup_menu (shell_window, widget_path, event);
 
 	return TRUE;
 }
@@ -376,6 +451,9 @@
 	container = widget;
 
 	widget = eab_contact_display_new ();
+	eab_contact_display_set_mode (
+		EAB_CONTACT_DISPLAY (widget),
+		EAB_CONTACT_DISPLAY_RENDER_NORMAL);
 	gtk_container_add (GTK_CONTAINER (container), widget);
 	priv->preview = g_object_ref (widget);
 	gtk_widget_show (widget);
@@ -408,20 +486,19 @@
 		G_CALLBACK (book_shell_view_activate_selected_source),
 		book_shell_view);
 
-	book_shell_view_activate_selected_source (book_shell_view, selector);
-
 	e_categories_register_change_listener (
 		G_CALLBACK (book_shell_view_categories_changed_cb),
 		book_shell_view);
 
 	e_book_shell_view_actions_init (book_shell_view);
 	e_book_shell_view_update_search_filter (book_shell_view);
+	book_shell_view_activate_selected_source (book_shell_view, selector);
 
 	/* Bind GObject properties to GConf keys. */
 
 	bridge = gconf_bridge_get ();
 
-	object = G_OBJECT (ACTION (CONTACT_PREVIEW));
+	object = G_OBJECT (book_shell_view->priv->paned);
 	key = "/apps/evolution/addressbook/display/vpane_position";
 	gconf_bridge_bind_property_delayed (bridge, key, object, "position");
 }

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view-private.h	Thu Sep 18 02:32:04 2008
@@ -122,8 +122,7 @@
 void		e_book_shell_view_actions_init
 					(EBookShellView *book_shell_view);
 void		e_book_shell_view_actions_update
-					(EBookShellView *book_shell_view,
-					 EAddressbookView *view);
+					(EBookShellView *book_shell_view);
 EAddressbookView *
 		e_book_shell_view_get_current_view
 					(EBookShellView *book_shell_view);

Modified: branches/kill-bonobo/addressbook/gui/component/e-book-shell-view.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/component/e-book-shell-view.c	(original)
+++ branches/kill-bonobo/addressbook/gui/component/e-book-shell-view.c	Thu Sep 18 02:32:04 2008
@@ -33,7 +33,6 @@
                                         ESourceList *source_list)
 {
 	EBookShellViewPrivate *priv = book_shell_view->priv;
-	EAddressbookView *view;
 	GtkNotebook *notebook;
 	GList *keys, *iter;
 
@@ -76,14 +75,7 @@
 	}
 	g_list_free (keys);
 
-	/* Select and update the current view. */
-	view = e_book_shell_view_get_current_view (book_shell_view);
-	if (view != NULL) {
-#if 0
-		eab_view_setup_menus (view, bonobo_uic);
-#endif
-		e_book_shell_view_actions_update (book_shell_view, view);
-	}
+	e_book_shell_view_actions_update (book_shell_view);
 }
 
 static void

Modified: branches/kill-bonobo/addressbook/gui/merging/eab-contact-merging.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/merging/eab-contact-merging.c	(original)
+++ branches/kill-bonobo/addressbook/gui/merging/eab-contact-merging.c	Thu Sep 18 02:32:04 2008
@@ -472,12 +472,18 @@
 		}
 
 		widget = glade_xml_get_widget (ui, "custom-old-contact");
-		eab_contact_display_render (EAB_CONTACT_DISPLAY (widget),
-					    match, EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+		eab_contact_display_set_mode (
+			EAB_CONTACT_DISPLAY (widget),
+			EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+		eab_contact_display_set_contact (
+			EAB_CONTACT_DISPLAY (widget), match);
 
 		widget = glade_xml_get_widget (ui, "custom-new-contact");
-		eab_contact_display_render (EAB_CONTACT_DISPLAY (widget),
-					    contact, EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+		eab_contact_display_set_mode (
+			EAB_CONTACT_DISPLAY (widget),
+			EAB_CONTACT_DISPLAY_RENDER_COMPACT);
+		eab_contact_display_set_contact (
+			EAB_CONTACT_DISPLAY (widget), contact);
 
 		widget = glade_xml_get_widget (ui, "dialog-duplicate-contact");
 

Modified: branches/kill-bonobo/addressbook/gui/widgets/Makefile.am
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/Makefile.am	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/Makefile.am	Thu Sep 18 02:32:04 2008
@@ -25,8 +25,7 @@
 
 eabinclude_HEADERS = 			\
 	eab-config.h			\
-	eab-menu.h			\
-	eab-popup.h
+	eab-menu.h
 
 libeabwidgets_la_SOURCES =			\
 	$(MARSHAL_GENERATED)			\
@@ -36,10 +35,6 @@
 	eab-gui-util.c				\
 	eab-gui-util.h				\
 	eab-menu.c				\
-	eab-popup.c				\
-	eab-popup.h				\
-	eab-popup-control.c			\
-	eab-popup-control.h			\
 	eab-vcard-control.c			\
 	eab-vcard-control.h			\
 	e-minicard.c				\

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.c	Thu Sep 18 02:32:04 2008
@@ -233,8 +233,11 @@
 				continue;
 
 			g_object_unref (array->pdata[ii]);
-			array->pdata[ii] = e_contact_duplicate (contact);
-			g_signal_emit (model, signals[CONTACT_CHANGED], 0, ii);
+			contact = e_contact_duplicate (contact);
+			array->pdata[ii] = contact;
+
+			g_signal_emit (
+				model, signals[CONTACT_CHANGED], 0, contact);
 			break;
 		}
 
@@ -591,8 +594,8 @@
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (EAddressbookModelClass, contact_changed),
 			      NULL, NULL,
-			      g_cclosure_marshal_VOID__INT,
-			      G_TYPE_NONE, 1, G_TYPE_INT);
+			      g_cclosure_marshal_VOID__OBJECT,
+			      G_TYPE_NONE, 1, E_TYPE_CONTACT);
 
 	signals[MODEL_CHANGED] =
 		g_signal_new ("model_changed",
@@ -726,6 +729,32 @@
 	return model->priv->contacts->pdata[index];
 }
 
+gint
+e_addressbook_model_find (EAddressbookModel *model,
+                          EContact *contact)
+{
+	GPtrArray *array;
+	gint ii;
+
+	/* XXX This searches for a particular EContact instance,
+	 *     as opposed to an equivalent but possibly different
+	 *     EContact instance.  Might have to revise this in
+	 *     the future. */
+
+	g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), -1);
+	g_return_val_if_fail (E_IS_CONTACT (contact), -1);
+
+	array = model->priv->contacts;
+	for (ii = 0; ii < array->len; ii++) {
+		EContact *candidate = array->pdata[ii];
+
+		if (contact == candidate)
+			return ii;
+	}
+
+	return -1;
+}
+
 EBook *
 e_addressbook_model_get_book (EAddressbookModel *model)
 {

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-model.h	Thu Sep 18 02:32:04 2008
@@ -75,7 +75,7 @@
 	void		(*contacts_removed)	(EAddressbookModel *model,
 						 gpointer id_list);
 	void		(*contact_changed)	(EAddressbookModel *model,
-						 gint index);
+						 EContact *contact);
 	void		(*model_changed)	(EAddressbookModel *model);
 	void		(*stop_state_changed)	(EAddressbookModel *model);
 	void		(*backend_died)		(EAddressbookModel *model);
@@ -99,6 +99,8 @@
 						(EAddressbookModel *model);
 EContact *	e_addressbook_model_contact_at	(EAddressbookModel *model,
 						 gint index);
+gint		e_addressbook_model_find	(EAddressbookModel *model,
+						 EContact *contact);
 EBook *		e_addressbook_model_get_book	(EAddressbookModel *model);
 void		e_addressbook_model_set_book	(EAddressbookModel *model,
 						 EBook *book);

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.c	Thu Sep 18 02:32:04 2008
@@ -32,7 +32,6 @@
 #include <e-shell-sidebar.h>
 
 #include "addressbook/printing/e-contact-print.h"
-#include "addressbook/gui/widgets/eab-popup.h"
 #include "addressbook/gui/widgets/eab-menu.h"
 #include "a11y/addressbook/ea-addressbook.h"
 
@@ -73,8 +72,6 @@
 static void folder_bar_message (EAddressbookView *view, const gchar *status);
 static void stop_state_changed (GtkObject *object, EAddressbookView *view);
 static void backend_died       (EAddressbookView *view);
-static void contact_changed    (EAddressbookModel *model, gint index, EAddressbookView *view);
-static void contacts_removed    (EAddressbookModel *model, gpointer data, EAddressbookView *view);
 static GList *get_selected_contacts (EAddressbookView *view);
 
 static void command_state_change (EAddressbookView *view);
@@ -87,7 +84,6 @@
 
 	GList *clipboard_contacts;
 	ESource *source;
-	gint displayed_contact;
 
 	GObject *object;
 	GtkWidget *widget;
@@ -106,9 +102,10 @@
 };
 
 enum {
+	POPUP_EVENT,
 	STATUS_MESSAGE,
 	COMMAND_STATE_CHANGE,
-	PREVIEW_CONTACT,
+	SELECTION_CHANGE,
 	LAST_SIGNAL
 };
 
@@ -127,6 +124,19 @@
 static GdkAtom clipboard_atom = GDK_NONE;
 
 static void
+addressbook_view_emit_popup_event (EAddressbookView *view,
+                                   GdkEvent *event)
+{
+	g_signal_emit (view, signals[POPUP_EVENT], 0, event);
+}
+
+static void
+addressbook_view_emit_selection_change (EAddressbookView *view)
+{
+	g_signal_emit (view, signals[SELECTION_CHANGE], 0);
+}
+
+static void
 addressbook_view_selection_get_cb (EAddressbookView *view,
                                    GtkSelectionData *selection_data,
                                    guint info,
@@ -211,6 +221,15 @@
 }
 
 static void
+addressbook_view_set_source (EAddressbookView *view,
+                             ESource *source)
+{
+	g_return_if_fail (view->priv->source == NULL);
+
+	view->priv->source = g_object_ref (source);
+}
+
+static void
 addressbook_view_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
@@ -219,31 +238,21 @@
 	EAddressbookView *view = E_ADDRESSBOOK_VIEW (object);
 
 	switch (property_id){
-	case PROP_SHELL_VIEW:
-		addressbook_view_set_shell_view (
-			E_ADDRESSBOOK_VIEW (object),
-			g_value_get_object (value));
-		return;
+		case PROP_SHELL_VIEW:
+			addressbook_view_set_shell_view (
+				E_ADDRESSBOOK_VIEW (object),
+				g_value_get_object (value));
+			return;
 
-	case PROP_SOURCE:
-		if (view->priv->source) {
-			g_warning ("EAddressbookView at present does not support multiple writes on the \"source\" property.");
+		case PROP_SOURCE:
+			addressbook_view_set_source (
+				E_ADDRESSBOOK_VIEW (object),
+				g_value_get_object (value));
 			return;
-		}
-		else {
-			if (g_value_get_object (value)) {
-				view->priv->source = E_SOURCE(g_value_get_object (value));
-				g_object_ref (view->priv->source);
-			}
-			else {
-				view->priv->source = NULL;
-			}
-		}
-		return;
 
-	case PROP_TYPE:
-		change_view_type(view, g_value_get_int (value));
-		return;
+		case PROP_TYPE:
+			change_view_type(view, g_value_get_int (value));
+			return;
 	}
 
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -271,7 +280,9 @@
 			return;
 
 		case PROP_SOURCE:
-			g_value_set_object (value, view->priv->source);
+			g_value_set_object (
+				value, e_addressbook_view_get_source (
+				E_ADDRESSBOOK_VIEW (object)));
 			return;
 
 		case PROP_TYPE:
@@ -336,20 +347,20 @@
 	EShellView *shell_view;
 	EShellViewClass *shell_view_class;
 	GalViewCollection *view_collection;
-	EAddressbookModel *model;
-	EBook *book;
-	const gchar *uri;
+	ESource *source;
+	gchar *uri;
 
 	shell_view = e_addressbook_view_get_shell_view (view);
 	shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
 	view_collection = shell_view_class->view_collection;
 
-	model = e_addressbook_view_get_model (view);
-	book = e_addressbook_model_get_book (model);
-	uri = e_book_get_uri (book);
+	source = e_addressbook_view_get_source (view);
+	uri = e_source_get_uri (source);
 
 	view->priv->view_instance =
 		gal_view_instance_new (view_collection, uri);
+
+	g_free (uri);
 }
 
 static void
@@ -395,7 +406,8 @@
 			_("Source"),
 			NULL,
 			E_TYPE_SOURCE,
-			G_PARAM_READWRITE));
+			G_PARAM_READWRITE |
+			G_PARAM_CONSTRUCT_ONLY));
 
 	g_object_class_install_property (
 		object_class,
@@ -409,6 +421,16 @@
 			E_ADDRESSBOOK_VIEW_NONE,
 			G_PARAM_READWRITE));
 
+	signals[POPUP_EVENT] = g_signal_new (
+		"popup-event",
+		G_OBJECT_CLASS_TYPE (object_class),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EAddressbookViewClass, popup_event),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__BOXED,
+		G_TYPE_NONE, 1,
+		GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
+
 	signals[STATUS_MESSAGE] = g_signal_new (
 		"status-message",
 		G_OBJECT_CLASS_TYPE (object_class),
@@ -428,15 +450,14 @@
 		g_cclosure_marshal_VOID__VOID,
 		G_TYPE_NONE, 0);
 
-	signals[PREVIEW_CONTACT] = g_signal_new (
-		"preview-contact",
+	signals[SELECTION_CHANGE] = g_signal_new (
+		"selection-change",
 		G_OBJECT_CLASS_TYPE (object_class),
 		G_SIGNAL_RUN_LAST,
-		G_STRUCT_OFFSET (EAddressbookViewClass, preview_contact),
+		G_STRUCT_OFFSET (EAddressbookViewClass, selection_change),
 		NULL, NULL,
-		g_cclosure_marshal_VOID__OBJECT,
-		G_TYPE_NONE, 1,
-		E_TYPE_CONTACT);
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
 
 	if (clipboard_atom == NULL)
 		clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
@@ -453,7 +474,6 @@
 	view->priv->model = e_addressbook_model_new ();
 
 	view->priv->view_type = E_ADDRESSBOOK_VIEW_NONE;
-	view->priv->displayed_contact = -1;
 
 	view->priv->invisible = gtk_invisible_new ();
 
@@ -499,7 +519,8 @@
 }
 
 GtkWidget *
-e_addressbook_view_new (EShellView *shell_view)
+e_addressbook_view_new (EShellView *shell_view,
+                        ESource *source)
 {
 	GtkWidget *widget;
 	EAddressbookView *view;
@@ -507,8 +528,8 @@
 	g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), NULL);
 
 	widget = g_object_new (
-		E_TYPE_ADDRESSBOOK_VIEW,
-		"shell-view", shell_view, NULL);
+		E_TYPE_ADDRESSBOOK_VIEW, "shell-view",
+		shell_view, "source", source, NULL);
 
 	view = E_ADDRESSBOOK_VIEW (widget);
 
@@ -528,10 +549,6 @@
 	g_signal_connect_swapped (
 		view->priv->model, "backend_died",
 		G_CALLBACK (backend_died), view);
-	g_signal_connect (view->priv->model, "contact_changed",
-			  G_CALLBACK (contact_changed), view);
-	g_signal_connect (view->priv->model, "contacts_removed",
-			  G_CALLBACK (contacts_removed), view);
 
 	return widget;
 }
@@ -610,6 +627,14 @@
 	return view->priv->shell_view;
 }
 
+ESource *
+e_addressbook_view_get_source (EAddressbookView *view)
+{
+	g_return_val_if_fail (E_IS_ADDRESSBOOK_VIEW (view), NULL);
+
+	return view->priv->source;
+}
+
 static void
 display_view(GalViewInstance *instance,
 	     GalView *view,
@@ -631,41 +656,6 @@
 }
 
 static void
-do_popup_menu(EAddressbookView *view, GdkEvent *event)
-{
-	/* FIXME */
-}
-
-static void
-render_contact (int row, EAddressbookView *view)
-{
-	EContact *contact;
-
-	view->priv->displayed_contact = row;
-	contact = e_addressbook_model_get_contact (view->priv->model, row);
-	g_signal_emit (view, signals[PREVIEW_CONTACT], 0, contact);
-}
-
-static void
-selection_changed (GObject *o, EAddressbookView *view)
-{
-	ESelectionModel *selection_model;
-
-	command_state_change (view);
-
-	selection_model = e_addressbook_view_get_selection_model (view);
-
-	if (e_selection_model_selected_count (selection_model) == 1)
-		e_selection_model_foreach (selection_model,
-					   (EForeachFunc)render_contact, view);
-	else {
-		view->priv->displayed_contact = -1;
-		g_signal_emit (view, signals[PREVIEW_CONTACT], 0, NULL);
-	}
-
-}
-
-static void
 table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
 {
 	EAddressbookModel *model;
@@ -693,7 +683,7 @@
 static gint
 table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
 {
-	do_popup_menu(view, event);
+	addressbook_view_emit_popup_event (view, event);
 	return TRUE;
 }
 
@@ -701,7 +691,7 @@
 table_white_space_event(ETableScrolled *table, GdkEvent *event, EAddressbookView *view)
 {
 	if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3) {
-		do_popup_menu(view, event);
+		addressbook_view_emit_popup_event (view, event);
 		return TRUE;
 	} else {
 		return FALSE;
@@ -839,35 +829,6 @@
 }
 
 static void
-contact_changed (EAddressbookModel *model, gint index, EAddressbookView *view)
-{
-	/* if the contact that's presently displayed is changed, re-render it */
-	if (view->priv->displayed_contact == index)
-		render_contact (index, view);
-}
-
-static void
-contacts_removed (EAddressbookModel *model, gpointer data, EAddressbookView *view)
-{
-	GArray *indices = (GArray *) data;
-	int count = indices->len;
-	gboolean found = FALSE;
-	gint i;
-
-	for (i = 0; i < count && !found; i++) {
-		if (view->priv->displayed_contact == g_array_index (indices, gint, i))
-			found = TRUE;
-	}
-
-	if (found) {
-		/* if the contact that's presently displayed is changed,
-		 * clear the display */
-		g_signal_emit (view, signals[PREVIEW_CONTACT], 0, NULL);
-		view->priv->displayed_contact = -1;
-	}
-}
-
-static void
 create_minicard_view (EAddressbookView *view)
 {
 	GtkWidget *scrolled_window;
@@ -877,12 +838,13 @@
 	adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->priv->model));
 	minicard_view = e_minicard_view_widget_new(adapter);
 
-	g_signal_connect(minicard_view, "selection_change",
-			 G_CALLBACK(selection_changed), view);
+	g_signal_connect_swapped (
+		minicard_view, "selection_change",
+		G_CALLBACK (addressbook_view_emit_selection_change), view);
 
 	g_signal_connect_swapped (
 		minicard_view, "right_click",
-		G_CALLBACK (do_popup_menu), view);
+		G_CALLBACK (addressbook_view_emit_popup_event), view);
 
 	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
 	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
@@ -930,8 +892,10 @@
 			 G_CALLBACK(table_right_click), view);
 	g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "white_space_event",
 			 G_CALLBACK(table_white_space_event), view);
-	g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "selection_change",
-			 G_CALLBACK(selection_changed), view);
+	g_signal_connect_swapped (
+		e_table_scrolled_get_table (E_TABLE_SCROLLED(table)),
+		"selection_change", G_CALLBACK (
+		addressbook_view_emit_selection_change), view);
 
 	/* drag & drop signals */
 	e_table_drag_source_set (

Modified: branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/e-addressbook-view.h	Thu Sep 18 02:32:04 2008
@@ -73,17 +73,17 @@
 	GtkVBoxClass parent_class;
 
 	/* Signals */
+	void		(*popup_event)		(EAddressbookView *view,
+						 GdkEvent *event);
 	void		(*status_message)	(EAddressbookView *view,
 						 const gchar *message);
-	void		(*folder_bar_message)	(EAddressbookView *view,
-						 const gchar *message);
 	void		(*command_state_change)	(EAddressbookView *view);
-	void		(*preview_contact)	(EAddressbookView *view,
-						 EContact *contact);
+	void		(*selection_change)	(EAddressbookView *view);
 };
 
 GType		e_addressbook_view_get_type	(void);
-GtkWidget *	e_addressbook_view_new		(EShellView *shell_view);
+GtkWidget *	e_addressbook_view_new		(EShellView *shell_view,
+						 ESource *source);
 EAddressbookModel *
 		e_addressbook_view_get_model	(EAddressbookView *view);
 GalViewInstance *
@@ -98,6 +98,7 @@
 						(EAddressbookView *view);
 EShellView *	e_addressbook_view_get_shell_view
 						(EAddressbookView *view);
+ESource *	e_addressbook_view_get_source	(EAddressbookView *view);
 void		e_addressbook_view_save_as	(EAddressbookView *view,
 						 gboolean all);
 void		e_addressbook_view_view		(EAddressbookView *view);

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.c	Thu Sep 18 02:32:04 2008
@@ -25,11 +25,11 @@
 #endif
 
 #include "eab-contact-display.h"
-#include "eab-popup.h"
 
 #include "eab-gui-util.h"
 #include "e-util/e-html-utils.h"
 #include "e-util/e-icon-factory.h"
+#include "e-util/e-plugin-ui.h"
 
 #include <string.h>
 #include <glib/gi18n.h>
@@ -37,15 +37,29 @@
 #include <gtkhtml/gtkhtml.h>
 #include <gtkhtml/gtkhtml-stream.h>
 
-#define HANDLE_MAILTO_INTERNALLY 1
+#define EAB_CONTACT_DISPLAY_GET_PRIVATE(obj) \
+	(G_TYPE_INSTANCE_GET_PRIVATE \
+	((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayPrivate))
 
-#define PARENT_TYPE (GTK_TYPE_HTML)
+#define HANDLE_MAILTO_INTERNALLY 1
 
 struct _EABContactDisplayPrivate {
 	EContact *contact;
+	EABContactDisplayMode mode;
 
+	GtkUIManager *ui_manager;
+	GtkActionGroup *email_actions;
+	GtkActionGroup *uri_actions;
         GtkWidget *invisible;
-	char *selection_uri;
+
+	gchar *selected_uri;
+	gchar *clipboard_uri;
+};
+
+enum {
+	PROP_0,
+	PROP_CONTACT,
+	PROP_MODE
 };
 
 static struct {
@@ -76,155 +90,159 @@
 
 #define MAX_COMPACT_IMAGE_DIMENSION 48
 
-static void
-eab_uri_popup_link_open(EPopup *ep, EPopupItem *item, void *data)
-{
-	EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
-	GError *err = NULL;
+static const gchar *ui =
+"<ui>"
+"  <popup>"
+"    <menuitem action='open-link'/>"
+"    <menuitem action='copy-link'/>"
+"    <menuitem action='send-message'/>"
+"    <menuitem action='copy-address'/>"
+"  </popup>"
+"</ui>";
 
-	gnome_url_show(t->uri, &err);
-	if (err) {
-		g_warning("gnome_url_show: %s", err->message);
-		g_error_free(err);
-	}
-}
+static gpointer parent_class;
 
 static void
-eab_uri_popup_email_address_copy(EPopup *ep, EPopupItem *item, void *data)
+action_copy_address_cb (GtkAction *action,
+                        EABContactDisplay *display)
 {
-	EABContactDisplay *display = data;
-	struct _EABContactDisplayPrivate *p = display->priv;
-        EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
-        const char *url = t->uri;
-        char *html=NULL;
-        int i=0;
-        GList *email_list, *l;
-        int email_num = atoi (url + strlen ("internal-mailto:";));
-
-	email_list = e_contact_get (p->contact, E_CONTACT_EMAIL);
-	for (l = email_list; l; l=l->next) {
-		if(i==email_num)
-			html = e_text_to_html (l->data, 0);
-	i++;
-        }
+	EContact *contact;
+	GList *list;
+	const gchar *uri;
+	gchar *html;
+	gint index;
 
-       	g_free(p->selection_uri);
-	p->selection_uri = g_strdup(html);
-	g_free (html);
+	uri = display->priv->selected_uri;
+	index = atoi (uri + strlen ("internal-mailto:";));
+	contact = eab_contact_display_get_contact (display);
 
-	gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
-	gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
-}
-
-static void
-eab_uri_popup_link_copy(EPopup *ep, EPopupItem *pitem, void *data)
-{
-	EABContactDisplay *display = data;
-	struct _EABContactDisplayPrivate *p = display->priv;
+	list = e_contact_get (contact, E_CONTACT_EMAIL);
+	html = e_text_to_html (g_list_nth_data (list, index), 0);
+	g_list_foreach (list, (GFunc) g_free, NULL);
+	g_list_free (list);
 
-	g_free(p->selection_uri);
-	p->selection_uri = g_strdup(pitem->user_data);
+	display->priv->clipboard_uri = html;
+	display->priv->selected_uri = NULL;
 
-	gtk_selection_owner_set(p->invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time());
-	gtk_selection_owner_set(p->invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time());
+	gtk_selection_owner_set (
+		display->priv->invisible, GDK_SELECTION_PRIMARY,
+		gtk_get_current_event_time ());
+	gtk_selection_owner_set (
+		display->priv->invisible, GDK_SELECTION_CLIPBOARD,
+		gtk_get_current_event_time ());
 }
 
 static void
-eab_uri_popup_address_send(EPopup *ep, EPopupItem *item, void *data)
+action_copy_link_cb (GtkAction *action,
+                     EABContactDisplay *display)
 {
-         EABPopupTargetURI *t = (EABPopupTargetURI *)ep->target;
-         const char *url = t->uri;
-         EABContactDisplay *display = data;
-  	 struct _EABContactDisplayPrivate *p = display->priv;
-
-	 int mail_num = atoi (url + strlen ("internal-mailto:";));
-
-         if (mail_num == -1)
-         return;
-
-         eab_send_contact (p->contact, mail_num, EAB_DISPOSITION_AS_TO);
+	display->priv->clipboard_uri = display->priv->selected_uri;
+	display->priv->selected_uri = NULL;
 
+	gtk_selection_owner_set (
+		display->priv->invisible, GDK_SELECTION_PRIMARY,
+		gtk_get_current_event_time ());
+	gtk_selection_owner_set (
+		display->priv->invisible, GDK_SELECTION_CLIPBOARD,
+		gtk_get_current_event_time ());
 }
 
 static void
-eab_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, EABContactDisplay *display)
+action_open_link_cb (GtkAction *action,
+                     EABContactDisplay *display)
 {
-	struct _EABContactDisplayPrivate *p = display->priv;
+	GdkScreen *screen;
+	const gchar *uri;
+	GError *error = NULL;
 
-	if (p->selection_uri == NULL)
-		return;
+	screen = gtk_widget_get_screen (GTK_WIDGET (display));
+	uri = display->priv->selected_uri;
+	g_return_if_fail (uri != NULL);
 
-	gtk_selection_data_set(data, data->target, 8, (guchar *)p->selection_uri, strlen(p->selection_uri));
+	if (!gtk_show_uri (screen, uri, GDK_CURRENT_TIME, &error)) {
+		g_warning ("%s", error->message);
+		g_error_free (error);
+	}
 }
 
 static void
-eab_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, EABContactDisplay *display)
+action_send_message_cb (GtkAction *action,
+                        EABContactDisplay *display)
 {
-#if 0
-	struct _EABContactDisplayPrivate *p = display->priv;
+	EContact *contact;
+	const gchar *uri;
+	gint row;
 
-	g_free(p->selection_uri);
-	p->selection_uri = NULL;
-#endif
-}
+	uri = display->priv->selected_uri;
+	row = atoi (uri + strlen ("internal-mailto:";));
+	g_return_if_fail (row >= 0);
+
+	contact = eab_contact_display_get_contact (display);
+	eab_send_contact (contact, row, EAB_DISPOSITION_AS_TO);
+}
+
+static GtkActionEntry email_entries[] = {
+
+	{ "copy-address",
+	  NULL,
+	  N_("Copy _Email Address"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_copy_address_cb) },
+
+	{ "send-message",
+	  NULL,
+	  N_("_Send New Message To..."),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_send_message_cb) }
+};
 
-static EPopupItem eab_uri_popups[] = {
-	{ E_POPUP_ITEM, "05.open", N_("_Open Link in Browser"), eab_uri_popup_link_open, NULL, NULL, EAB_POPUP_URI_NOT_MAILTO },
-        { E_POPUP_ITEM, "10.copy", N_("_Copy Link Location"), eab_uri_popup_link_copy, NULL, "edit-copy", EAB_POPUP_URI_NOT_MAILTO },
-        { E_POPUP_ITEM, "15.send", N_("_Send New Message To..."), eab_uri_popup_address_send, NULL, "mail-message-new", EAB_POPUP_URI_MAILTO},
-	{ E_POPUP_ITEM, "20.copy", N_("Copy _Email Address"), eab_uri_popup_email_address_copy, NULL, "edit-copy", EAB_POPUP_URI_MAILTO},
-        };
+static GtkActionEntry uri_entries[] = {
 
+	{ "copy-link",
+	  NULL,
+	  N_("_Copy Link Location"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_copy_link_cb) },
+
+	{ "open-link",
+	  NULL,
+	  N_("_Open Link in Browser"),
+	  NULL,
+	  NULL,
+	  G_CALLBACK (action_open_link_cb) }
+};
 
 static void
-eab_uri_popup_free(EPopup *ep, GSList *list, void *data)
+contact_display_selection_get (EABContactDisplay *display,
+                               GtkSelectionData *data,
+                               guint info,
+                               guint time_stamp)
 {
-	while (list){
-		GSList *n = list->next;
-		struct _EPopupItem *item = list->data;
-
-		g_free(item->user_data);
-		item->user_data = NULL;
-		g_slist_free_1(list);
+	if (display->priv->clipboard_uri == NULL)
+		return;
 
-		list = n;
-         	}
+	gtk_selection_data_set (
+		data, data->target, 8,
+		(guchar *) display->priv->clipboard_uri,
+		strlen (display->priv->clipboard_uri));
 }
 
-static int
-eab_uri_popup_event(EABContactDisplay *display, GdkEvent *event, const char *uri)
+static void
+contact_display_selection_clear_event (EABContactDisplay *display,
+                                       GdkEventSelection *event)
 {
-	EABPopup *emp;
-	EABPopupTargetURI *t ;
-	GtkMenu *menu;
-	GSList *menus = NULL;
-	int i;
-
-	emp = eab_popup_new("org.gnome.evolution.addressbook.contactdisplay.popup");
-
-	t = eab_popup_target_new_uri(emp, uri);
-	t->target.widget = (GtkWidget *)display;
-
-	for (i=0;i<sizeof(eab_uri_popups)/sizeof(eab_uri_popups[0]);i++) {
-		eab_uri_popups[i].user_data = g_strdup(t->uri);
-		menus = g_slist_prepend(menus, &eab_uri_popups[i]);
-	}
-	e_popup_add_items((EPopup *)emp, menus, NULL, eab_uri_popup_free, display);
-
-        menu = e_popup_create_menu_once((EPopup *)emp,(EPopupTarget*)t, 0);
-
-        if (event == NULL) {
-		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time());
-	} else {
-		gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button.button, event->button.time);
-	}
-
-	return TRUE;
+	g_free (display->priv->clipboard_uri);
+	display->priv->clipboard_uri = NULL;
 }
 
 static void
-on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
-		  EABContactDisplay *display)
+contact_display_on_url_requested (GtkHTML *html,
+                                  const gchar *url,
+                                  GtkHTMLStream *handle,
+                                  EABContactDisplay *display)
 {
 	if (!strcmp (url, "internal-contact-photo:")) {
 		EContactPhoto *photo;
@@ -257,7 +275,9 @@
 }
 
 static void
-on_link_clicked (GtkHTML *html, const char *url, EABContactDisplay *display)
+contact_display_on_link_clicked (GtkHTML *html,
+                                 const gchar *url,
+                                 EABContactDisplay *display)
 {
 	GError *err = NULL;
 
@@ -282,44 +302,6 @@
 	}
 }
 
-#if 0
-static void
-render_address (GtkHTMLStream *html_stream, EContact *contact, const char *html_label, EContactField adr_field, EContactField label_field)
-{
-	EContactAddress *adr;
-	const char *label;
-
-	label = e_contact_get_const (contact, label_field);
-	if (label) {
-		char *html = e_text_to_html (label, E_TEXT_TO_HTML_CONVERT_NL);
-
-		gtk_html_stream_printf (html_stream, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\";>%s</a></td><td valign=\"top\">%s</td></tr>", html_label, _("(map)"), html);
-
-This shoul		g_free (html);
-		return;
-	}
-
-	adr = e_contact_get (contact, adr_field);
-	if (adr &&
-	    (adr->po || adr->ext || adr->street || adr->locality || adr->region || adr->code || adr->country)) {
-
-		gtk_html_stream_printf (html_stream, "<tr><td valign=\"top\" width=\"" IMAGE_COL_WIDTH "\"></td><td valign=\"top\" width=\"100\"><font color=" HEADER_COLOR ">%s:</font><br><a href=\"http://www.mapquest.com/\";>%s</a></td><td valign=\"top\">", html_label, _("map"));
-
-		if (adr->po && *adr->po) gtk_html_stream_printf (html_stream, "%s<br>", adr->po);
-		if (adr->ext && *adr->ext) gtk_html_stream_printf (html_stream, "%s<br>", adr->ext);
-		if (adr->street && *adr->street) gtk_html_stream_printf (html_stream, "%s<br>", adr->street);
-		if (adr->locality && *adr->locality) gtk_html_stream_printf (html_stream, "%s<br>", adr->locality);
-		if (adr->region && *adr->region) gtk_html_stream_printf (html_stream, "%s<br>", adr->region);
-		if (adr->code && *adr->code) gtk_html_stream_printf (html_stream, "%s<br>", adr->code);
-		if (adr->country && *adr->country) gtk_html_stream_printf (html_stream, "%s<br>", adr->country);
-
-		gtk_html_stream_printf (html_stream, "</td></tr>");
-	}
-	if (adr)
-		e_contact_address_free (adr);
-}
-#endif
-
 static void
 render_name_value (GtkHTMLStream *html_stream, const char *label, const char *str, const char *icon, unsigned int html_flags)
 {
@@ -677,12 +659,6 @@
 	GtkHTMLStream *html_stream;
 	gboolean is_rtl = (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL);
 
-	if (display->priv->contact)
-		g_object_unref (display->priv->contact);
-	display->priv->contact = contact;
-	if (display->priv->contact)
-		g_object_ref (display->priv->contact);
-
 	html_stream = gtk_html_begin (GTK_HTML (display));
 	gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
 	gtk_html_stream_printf (html_stream, "<body><table width=\"100%%\"><tr><td %s>\n", is_rtl ? " align=\"right\" " : "");
@@ -733,16 +709,11 @@
 }
 
 static void
-eab_contact_display_render_compact (EABContactDisplay *display, EContact *contact)
+eab_contact_display_render_compact (EABContactDisplay *display,
+                                    EContact *contact)
 {
 	GtkHTMLStream *html_stream;
 
-	if (display->priv->contact)
-		g_object_unref (display->priv->contact);
-	display->priv->contact = contact;
-	if (display->priv->contact)
-		g_object_ref (display->priv->contact);
-
 	html_stream = gtk_html_begin (GTK_HTML (display));
 	gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
 	gtk_html_stream_write (html_stream, "<body>\n", 7);
@@ -916,98 +887,254 @@
 	gtk_html_end (GTK_HTML (display), html_stream, GTK_HTML_STREAM_OK);
 }
 
-void
-eab_contact_display_render (EABContactDisplay *display, EContact *contact,
-			    EABContactDisplayRenderMode mode)
+static int
+contact_display_button_press_event (GtkWidget *widget,
+                                    GdkEvent *event,
+                                    EABContactDisplay *display)
+{
+	GtkUIManager *ui_manager;
+	GtkActionGroup *action_group;
+	GtkWidget *menu;
+	gboolean has_email;
+	gchar *uri;
+
+	if (event->button.button != 3)
+		return FALSE;
+
+       	uri = gtk_html_get_url_at (
+		GTK_HTML (widget),
+		event->button.x, event->button.y);
+
+	if (uri == NULL)
+		return FALSE;
+
+	g_free (display->priv->selected_uri);
+	display->priv->selected_uri = uri;
+
+	ui_manager = display->priv->ui_manager;
+	menu = gtk_ui_manager_get_widget (ui_manager, "/popup");
+	g_return_val_if_fail (GTK_IS_MENU (menu), FALSE);
+
+	has_email = (g_ascii_strncasecmp (uri, "internal-mailto:";, 16) == 0);
+
+	/* Show the appropriate actions. */
+	action_group = display->priv->email_actions;
+	gtk_action_group_set_visible (action_group, has_email);
+	action_group = display->priv->uri_actions;
+	gtk_action_group_set_visible (action_group, !has_email);
+
+        if (event != NULL)
+		gtk_menu_popup (
+			GTK_MENU (menu), NULL, NULL, NULL, NULL,
+			event->button.button, event->button.time);
+	else
+		gtk_menu_popup (
+			GTK_MENU (menu), NULL, NULL, NULL, NULL,
+			0, gtk_get_current_event_time ());
+
+	return TRUE;
+}
+
+static void
+contact_display_set_property (GObject *object,
+                              guint property_id,
+                              const GValue *value,
+                              GParamSpec *pspec)
+{
+	switch (property_id) {
+		case PROP_CONTACT:
+			eab_contact_display_set_contact (
+				EAB_CONTACT_DISPLAY (object),
+				g_value_get_object (value));
+			return;
+
+		case PROP_MODE:
+			eab_contact_display_set_mode (
+				EAB_CONTACT_DISPLAY (object),
+				g_value_get_int (value));
+			return;
+	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+contact_display_get_property (GObject *object,
+                              guint property_id,
+                              GValue *value,
+                              GParamSpec *pspec)
 {
-	switch (mode) {
-	case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
-		eab_contact_display_render_normal (display, contact);
-		break;
-	case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
-		eab_contact_display_render_compact (display, contact);
-		break;
+	switch (property_id) {
+		case PROP_CONTACT:
+			g_value_set_object (
+				value, eab_contact_display_get_contact (
+				EAB_CONTACT_DISPLAY (object)));
+			return;
+
+		case PROP_MODE:
+			g_value_set_int (
+				value, eab_contact_display_get_mode (
+				EAB_CONTACT_DISPLAY (object)));
+			return;
 	}
+
+	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 }
 
-static int
-eab_html_press_event (GtkWidget *widget, GdkEvent *event,EABContactDisplay *display)
+static void
+contact_display_dispose (GObject *object)
 {
-	char *uri;
-	gboolean res = FALSE;
+	EABContactDisplayPrivate *priv;
 
+	priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (object);
 
-	if (event->button.button!= 3 )
-		return FALSE;
+	if (priv->contact != NULL) {
+		g_object_unref (priv->contact);
+		priv->contact = NULL;
+	}
 
-       	uri = gtk_html_get_url_at (GTK_HTML (widget), event->button.x, event->button.y);
-	if (uri){
-		eab_uri_popup_event(display,event,uri);
-               	}
+	if (priv->ui_manager != NULL) {
+		g_object_unref (priv->ui_manager);
+		priv->ui_manager = NULL;
+	}
 
-         g_free(uri);
+	if (priv->email_actions != NULL) {
+		g_object_unref (priv->email_actions);
+		priv->email_actions = NULL;
+	}
 
-	return res;
-}
+	if (priv->uri_actions != NULL) {
+		g_object_unref (priv->uri_actions);
+		priv->uri_actions = NULL;
+	}
 
-GtkWidget*
-eab_contact_display_new (void)
-{
-	EABContactDisplay *display;
+	if (priv->invisible != NULL) {
+		g_object_unref (priv->invisible);
+		priv->invisible = NULL;
+	}
 
-	struct _EABContactDisplayPrivate *p;
+	/* Chain up to parent's dispose() method. */
+	G_OBJECT_CLASS (parent_class)->dispose (object);
+}
 
-	display = g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
-	p=display->priv = g_new0 (EABContactDisplayPrivate, 1);
+static void
+contact_display_finalize (GObject *object)
+{
+	EABContactDisplayPrivate *priv;
 
-	gtk_html_set_default_content_type (GTK_HTML (display), "text/html; charset=utf-8");
+	priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (object);
 
-	gtk_html_set_editable (GTK_HTML (display), FALSE);
-
-	g_signal_connect (display, "url_requested",
-			  G_CALLBACK (on_url_requested),
-			  display);
-	g_signal_connect (display, "link_clicked",
-			  G_CALLBACK (on_link_clicked),
-			  display);
-        g_signal_connect(display, "button_press_event",
-                          G_CALLBACK(eab_html_press_event),
-                           display);
-        p->invisible = gtk_invisible_new();
-	g_signal_connect(p->invisible, "selection_get", G_CALLBACK(eab_selection_get), display);
-	g_signal_connect(p->invisible, "selection_clear_event", G_CALLBACK(eab_selection_clear_event), display);
-	gtk_selection_add_target(p->invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
-	gtk_selection_add_target(p->invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
-
-#if 0
-	g_signal_connect (display, "object_requested",
-			  G_CALLBACK (on_object_requested),
-			  mail_display);
-	g_signal_connect (display, "button_press_event",
-			  G_CALLBACK (html_button_press_event), mail_display);
-	g_signal_connect (display, "motion_notify_event",
-			  G_CALLBACK (html_motion_notify_event), mail_display);
-	g_signal_connect (display, "enter_notify_event",
-			  G_CALLBACK (html_enter_notify_event), mail_display);
-	g_signal_connect (display, "iframe_created",
-			  G_CALLBACK (html_iframe_created), mail_display);
-	g_signal_connect (display, "on_url",
-			  G_CALLBACK (html_on_url), mail_display);
-#endif
+	g_free (priv->selected_uri);
+	g_free (priv->clipboard_uri);
 
-	return GTK_WIDGET (display);
+	/* Chain up to parent's finalize() method. */
+	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
 static void
-eab_contact_display_init (GObject *object)
+eab_contact_display_class_init (EABContactDisplayClass *class)
 {
-	gtk_html_construct ((GtkHTML *)object);
+	GObjectClass *object_class;
+
+	parent_class = g_type_class_peek_parent (class);
+	g_type_class_add_private (class, sizeof (EABContactDisplayPrivate));
+
+	object_class = G_OBJECT_CLASS (class);
+	object_class->set_property = contact_display_set_property;
+	object_class->get_property = contact_display_get_property;
+	object_class->dispose = contact_display_dispose;
+	object_class->finalize = contact_display_finalize;
+
+	g_object_class_install_property (
+		object_class,
+		PROP_CONTACT,
+		g_param_spec_object (
+			"contact",
+			NULL,
+			NULL,
+			E_TYPE_CONTACT,
+			G_PARAM_READWRITE));
+
+	/* XXX Make this a real enum property. */
+	g_object_class_install_property (
+		object_class,
+		PROP_MODE,
+		g_param_spec_int (
+			"mode",
+			NULL,
+			NULL,
+			EAB_CONTACT_DISPLAY_RENDER_NORMAL,
+			EAB_CONTACT_DISPLAY_RENDER_COMPACT,
+			EAB_CONTACT_DISPLAY_RENDER_NORMAL,
+			G_PARAM_READWRITE));
 }
 
 static void
-eab_contact_display_class_init (GtkObjectClass *object_class)
+eab_contact_display_init (EABContactDisplay *display)
 {
-	/*	object_class->destroy = mail_display_destroy;*/
+	GtkActionGroup *action_group;
+	GtkHTML *html;
+
+	display->priv = EAB_CONTACT_DISPLAY_GET_PRIVATE (display);
+	display->priv->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
+	display->priv->ui_manager = gtk_ui_manager_new ();
+	display->priv->invisible = gtk_invisible_new ();
+
+	g_object_ref_sink (display->priv->invisible);
+
+	action_group = gtk_action_group_new ("email");
+	gtk_action_group_set_translation_domain (
+		action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (
+		action_group, email_entries,
+		G_N_ELEMENTS (email_entries), display);
+	gtk_ui_manager_insert_action_group (
+		display->priv->ui_manager, action_group, 0);
+	display->priv->email_actions = action_group;
+
+	action_group = gtk_action_group_new ("uri");
+	gtk_action_group_set_translation_domain (
+		action_group, GETTEXT_PACKAGE);
+	gtk_action_group_add_actions (
+		action_group, uri_entries,
+		G_N_ELEMENTS (uri_entries), display);
+	gtk_ui_manager_insert_action_group (
+		display->priv->ui_manager, action_group, 0);
+	display->priv->uri_actions = action_group;
+
+	gtk_ui_manager_add_ui_from_string (
+		display->priv->ui_manager, ui, -1, NULL);
+
+	html = GTK_HTML (display);
+	gtk_html_construct (html);
+	gtk_html_set_editable (html, FALSE);
+	gtk_html_set_default_content_type (html, "text/html; charset=utf-8");
+
+	g_signal_connect (
+		display, "url-requested",
+		G_CALLBACK (contact_display_on_url_requested), display);
+	g_signal_connect (
+		display, "link-clicked",
+		G_CALLBACK (contact_display_on_link_clicked), display);
+	g_signal_connect (
+		display, "button-press-event",
+		G_CALLBACK (contact_display_button_press_event), display);
+
+	g_signal_connect_swapped (
+		display->priv->invisible, "selection-get",
+		G_CALLBACK (contact_display_selection_get), display);
+	g_signal_connect_swapped (
+		display->priv->invisible, "selection-clear-event",
+		G_CALLBACK (contact_display_selection_clear_event), display);
+	gtk_selection_add_target (
+		display->priv->invisible,
+		GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0);
+	gtk_selection_add_target (
+		display->priv->invisible,
+		GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1);
+
+	e_plugin_ui_register_manager (
+		"contact-display", display->priv->ui_manager, display);
 }
 
 GType
@@ -1015,21 +1142,98 @@
 {
 	static GType type = 0;
 
-	if (!type) {
-		static const GTypeInfo info =  {
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo type_info =  {
 			sizeof (EABContactDisplayClass),
-			NULL,           /* base_init */
-			NULL,           /* base_finalize */
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
 			(GClassInitFunc) eab_contact_display_class_init,
-			NULL,           /* class_finalize */
-			NULL,           /* class_data */
+			(GClassFinalizeFunc) NULL,
+			NULL,  /* class_data */
 			sizeof (EABContactDisplay),
-			0,             /* n_preallocs */
+			0,     /* n_preallocs */
 			(GInstanceInitFunc) eab_contact_display_init,
+			NULL   /* value_table */
 		};
 
-		type = g_type_register_static (PARENT_TYPE, "EABContactDisplay", &info, 0);
+		type = g_type_register_static (
+			GTK_TYPE_HTML, "EABContactDisplay", &type_info, 0);
 	}
 
 	return type;
 }
+
+GtkWidget *
+eab_contact_display_new (void)
+{
+	return g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
+}
+
+EContact *
+eab_contact_display_get_contact (EABContactDisplay *display)
+{
+	g_return_val_if_fail (EAB_IS_CONTACT_DISPLAY (display), NULL);
+
+	return display->priv->contact;
+}
+
+void
+eab_contact_display_set_contact (EABContactDisplay *display,
+                                 EContact *contact)
+{
+	EABContactDisplayMode mode;
+
+	g_return_if_fail (EAB_IS_CONTACT_DISPLAY (display));
+
+	mode = eab_contact_display_get_mode (display);
+
+	if (contact != NULL)
+		g_object_ref (contact);
+	if (display->priv->contact != NULL)
+		g_object_unref (display->priv->contact);
+	display->priv->contact = contact;
+
+	switch (mode) {
+		case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
+			eab_contact_display_render_normal (display, contact);
+			break;
+
+		case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
+			eab_contact_display_render_compact (display, contact);
+			break;
+	}
+
+	g_object_notify (G_OBJECT (display), "contact");
+}
+
+EABContactDisplayMode
+eab_contact_display_get_mode (EABContactDisplay *display)
+{
+	g_return_val_if_fail (EAB_IS_CONTACT_DISPLAY (display), 0);
+
+	return display->priv->mode;
+}
+
+void
+eab_contact_display_set_mode (EABContactDisplay *display,
+                              EABContactDisplayMode mode)
+{
+	EContact *contact;
+
+	g_return_if_fail (EAB_IS_CONTACT_DISPLAY (display));
+
+	display->priv->mode = mode;
+	contact = eab_contact_display_get_contact (display);
+
+	switch (mode) {
+		case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
+			eab_contact_display_render_normal (display, contact);
+			break;
+
+		case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
+			eab_contact_display_render_compact (display, contact);
+			break;
+	}
+
+	g_object_notify (G_OBJECT (display), "mode");
+}

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-contact-display.h	Thu Sep 18 02:32:04 2008
@@ -20,30 +20,44 @@
  *
  */
 
-#ifndef _EAB_CONTACT_DISPLAY_H_
-#define _EAB_CONTACT_DISPLAY_H_
+#ifndef EAB_CONTACT_DISPLAY_H
+#define EAB_CONTACT_DISPLAY_H
 
 #include <gtkhtml/gtkhtml.h>
 #include <libebook/e-contact.h>
 
-#define EAB_TYPE_CONTACT_DISPLAY        (eab_contact_display_get_type ())
-#define EAB_CONTACT_DISPLAY(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplay))
-#define EAB_CONTACT_DISPLAY_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST ((k), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
-#define IS_EAB_CONTACT_DISPLAY(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_CONTACT_DISPLAY))
-#define IS_EAB_CONTACT_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_CONTACT_DISPLAY))
+/* Standard GObject macros */
+#define EAB_TYPE_CONTACT_DISPLAY \
+	(eab_contact_display_get_type ())
+#define EAB_CONTACT_DISPLAY(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplay))
+#define EAB_CONTACT_DISPLAY_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
+#define EAB_IS_CONTACT_DISPLAY(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), EAB_TYPE_CONTACT_DISPLAY))
+#define EAB_IS_CONTACT_DISPLAY_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), EAB_TYPE_CONTACT_DISPLAY))
+#define EAB_CONTACT_DISPLAY_GET_CLASS(obj) \
+	(G_TYPE_ISNTANCE_GET_CLASS \
+	((obj), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
+
+G_BEGIN_DECLS
 
 typedef struct _EABContactDisplay EABContactDisplay;
-typedef struct _EABContactDisplayPrivate EABContactDisplayPrivate;
 typedef struct _EABContactDisplayClass EABContactDisplayClass;
+typedef struct _EABContactDisplayPrivate EABContactDisplayPrivate;
 
 typedef enum {
 	EAB_CONTACT_DISPLAY_RENDER_NORMAL,  /* for use in the preview pane */
 	EAB_CONTACT_DISPLAY_RENDER_COMPACT  /* for use with embedded vcards (e.g, the EABVCardControl) */
-} EABContactDisplayRenderMode;
+} EABContactDisplayMode;
 
 struct _EABContactDisplay {
 	GtkHTML parent;
-
 	EABContactDisplayPrivate *priv;
 };
 
@@ -51,10 +65,18 @@
 	GtkHTMLClass parent_class;
 };
 
-GType          eab_contact_display_get_type    (void);
-GtkWidget *    eab_contact_display_new         (void);
+GType		eab_contact_display_get_type	(void);
+GtkWidget *	eab_contact_display_new		(void);
+
+EContact *	eab_contact_display_get_contact	(EABContactDisplay *display);
+void		eab_contact_display_set_contact	(EABContactDisplay *display,
+						 EContact *contact);
+EABContactDisplayMode
+		eab_contact_display_get_mode	(EABContactDisplay *display);
+void		eab_contact_display_set_mode	(EABContactDisplay *display,
+						 EABContactDisplayMode mode);
+
 
-void           eab_contact_display_render      (EABContactDisplay *display, EContact *contact,
-						EABContactDisplayRenderMode render_mode);
+G_END_DECLS
 
-#endif /* _EAB_CONTACT_DISPLAY_H_ */
+#endif /* EAB_CONTACT_DISPLAY_H */

Modified: branches/kill-bonobo/addressbook/gui/widgets/eab-vcard-control.c
==============================================================================
--- branches/kill-bonobo/addressbook/gui/widgets/eab-vcard-control.c	(original)
+++ branches/kill-bonobo/addressbook/gui/widgets/eab-vcard-control.c	Thu Sep 18 02:32:04 2008
@@ -46,7 +46,7 @@
 	EABContactDisplay *display;
 	GList *card_list;
 	GtkWidget *label;
-	EABContactDisplayRenderMode render_mode;
+	EABContactDisplayMode mode;
 } EABVCardControl;
 
 #define VCARD_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_VCard_Control:" BASE_VERSION
@@ -134,8 +134,10 @@
 	g_free(vcard);
 	vcard_control->card_list = list;
 	if (list) {
-		eab_contact_display_render (vcard_control->display, E_CONTACT (list->data),
-					    vcard_control->render_mode);
+		eab_contact_display_set_mode (
+			vcard_control->display, vcard_control->mode);
+		eab_contact_display_set_contact (
+			vcard_control->display, E_CONTACT (list->data));
 	}
 	if (list && list->next) {
 		char *message;
@@ -218,23 +220,29 @@
 toggle_full_vcard(GtkWidget *button, gpointer data)
 {
 	EABVCardControl *vcard_control = data;
+	EContact *contact;
 	char *label;
 
 	if (!vcard_control->card_list)
 		return;
 
-	if (vcard_control->render_mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) {
-		vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
+	contact = E_CONTACT (vcard_control->card_list->data);
+
+	if (vcard_control->mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) {
+		vcard_control->mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
 		label = _("Show Full vCard");
 	}
 	else {
-		vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
+		vcard_control->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
 		label = _("Show Compact vCard");
 	}
 
 	gtk_button_set_label (GTK_BUTTON (button), label);
-	eab_contact_display_render (vcard_control->display, E_CONTACT (vcard_control->card_list->data),
-				    vcard_control->render_mode);
+
+	eab_contact_display_set_mode (
+		vcard_control->display, vcard_control->mode);
+	eab_contact_display_set_contact (
+		vcard_control->display, contact);
 }
 
 static void
@@ -265,7 +273,7 @@
 	vcard_control->display = NULL;
 	vcard_control->label = NULL;
 
-	vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
+	vcard_control->mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
 
 	/* Create the control. */
 

Modified: branches/kill-bonobo/shell/e-shell-sidebar.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-sidebar.c	(original)
+++ branches/kill-bonobo/shell/e-shell-sidebar.c	Thu Sep 18 02:32:04 2008
@@ -364,7 +364,6 @@
 	widget = gtk_event_box_new ();
 	style = gtk_widget_get_style (widget);
 	color = &style->bg[GTK_STATE_ACTIVE];
-	gtk_container_set_border_width (GTK_CONTAINER (widget), 1);
 	gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
 	gtk_widget_set_parent (widget, GTK_WIDGET (shell_sidebar));
 	shell_sidebar->priv->event_box = g_object_ref (widget);

Modified: branches/kill-bonobo/shell/e-shell-window.c
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.c	(original)
+++ branches/kill-bonobo/shell/e-shell-window.c	Thu Sep 18 02:32:04 2008
@@ -648,6 +648,38 @@
 }
 
 /**
+ * e_shell_window_show_popup_menu:
+ * @shell_window: an #EShellWindow
+ * @widget_path: path in the UI definition
+ * @event: a #GdkEventButton
+ *
+ * Displays a context-sensitive (or "popup") menu that is described in
+ * the UI definition loaded into @shell_window<!-- -->'s user interface
+ * manager.  The menu will be shown at the current mouse cursor position.
+ **/
+void
+e_shell_window_show_popup_menu (EShellWindow *shell_window,
+                                const gchar *widget_path,
+                                GdkEventButton *event)
+{
+	GtkWidget *menu;
+
+	g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+	menu = e_shell_window_get_managed_widget (shell_window, widget_path);
+	g_return_if_fail (GTK_IS_MENU (menu));
+
+	if (event != NULL)
+		gtk_menu_popup (
+			GTK_MENU (menu), NULL, NULL, NULL, NULL,
+			event->button, event->time);
+	else
+		gtk_menu_popup (
+			GTK_MENU (menu), NULL, NULL, NULL, NULL,
+			0, gtk_get_current_event_time ());
+}
+
+/**
  * e_shell_window_register_new_item_actions:
  * @shell_window: an #EShellWindow
  * @module_name: name of an #EShellModule

Modified: branches/kill-bonobo/shell/e-shell-window.h
==============================================================================
--- branches/kill-bonobo/shell/e-shell-window.h	(original)
+++ branches/kill-bonobo/shell/e-shell-window.h	Thu Sep 18 02:32:04 2008
@@ -80,6 +80,9 @@
 gboolean	e_shell_window_get_safe_mode	(EShellWindow *shell_window);
 void		e_shell_window_set_safe_mode	(EShellWindow *shell_window,
 						 gboolean safe_mode);
+void		e_shell_window_show_popup_menu	(EShellWindow *shell_window,
+						 const gchar *widget_path,
+						 GdkEventButton *event);
 
 /* These should be called from the shell module's window_created() handler. */
 



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