Index: src/bookmarks/ephy-topic-action.c
===================================================================
--- src/bookmarks/ephy-topic-action.c	(revision 6943)
+++ src/bookmarks/ephy-topic-action.c	(working copy)
@@ -309,10 +309,20 @@
 button_toggled_cb (GtkWidget *button,
 		   EphyTopicAction *action)
 {
+	GtkWidget *window = gtk_widget_get_ancestor (button,
+						     GTK_TYPE_WINDOW);
+
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
 	{
 		GtkWidget *popup;
 
+		g_object_set_data (G_OBJECT (window),
+				   "active-topic-action-button",
+				   button);
+		g_object_set_data (G_OBJECT (window),
+				   "active-topic-action",
+				   action);
+
 		popup = get_popup (action);
 
 		g_signal_connect_object (popup, "deactivate",
@@ -323,6 +333,14 @@
 				ephy_gui_menu_position_under_widget,
 				button, 1, gtk_get_current_event_time ());
 	}
+
+	else
+	{
+		g_object_set_data (G_OBJECT (window),
+				   "active-topic-action-button", NULL);
+		g_object_set_data (G_OBJECT (window),
+				   "active-topic-action", NULL);
+	}
 }
 
 static gboolean
@@ -357,6 +375,32 @@
 	return FALSE;
 }
 
+static gboolean
+button_enter_cb (GtkWidget *button,
+		 GdkEventCrossing *event,
+		 EphyTopicAction *action)
+{
+	GtkWidget *window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
+	GtkWidget *active_button = g_object_get_data (G_OBJECT (window),
+						      "active-topic-action-button");
+	EphyTopicAction *active_action = g_object_get_data (G_OBJECT (window),
+							    "active-topic-action");
+
+	if (active_button &&
+	    active_button != button &&
+	    GTK_IS_TOGGLE_BUTTON (active_button) &&
+	    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (active_button)))
+	{
+		g_assert (active_action);
+
+		erase_popup (active_action);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_button), FALSE);
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+	}
+
+	return FALSE;
+}
+
 static void
 connect_proxy (GtkAction *action,
 	       GtkWidget *proxy)
@@ -379,6 +423,8 @@
 				  G_CALLBACK (button_press_cb), action);
 		g_signal_connect (button, "button-release-event",
 				  G_CALLBACK (button_release_cb), action);
+		g_signal_connect (button, "enter-notify-event",
+				  G_CALLBACK (button_enter_cb), action);
 		/* FIXME: what about keyboard (toggled by Space) ? */
 
 		g_signal_connect (button, "drag-data-received",
