diff --git a/src/pdm-dialog.c b/src/pdm-dialog.c
index 9a1d950..b9a6038 100644
--- a/src/pdm-dialog.c
+++ b/src/pdm-dialog.c
@@ -76,6 +76,7 @@ struct PdmActionInfo
 	char *scroll_to_host;
 	gboolean filled;
 	gboolean delete_row_on_remove;
+	int remove_all_type;
 };
 
 #define EPHY_PDM_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_PDM_DIALOG, PdmDialogPrivate))
@@ -146,6 +147,13 @@ static void pdm_dialog_class_init	(PdmDialogClass *klass);
 static void pdm_dialog_init		(PdmDialog *dialog);
 static void pdm_dialog_finalize		(GObject *object);
 
+static void passwords_changed_cb			(EphyPasswordManager *manager,
+							 PdmDialog *dialog);
+static void pdm_dialog_remove_all_confirmation_cb	(GtkWidget *dialog,
+							 int response,
+							 PdmActionInfo *info);
+
+
 static GObjectClass *parent_class = NULL;
 
 GType 
@@ -982,15 +990,14 @@ pdm_dialog_cookie_remove (PdmActionInfo *info,
 	ephy_cookie_manager_remove_cookie (manager, cookie);
 }
 
-static gboolean
+static void
 pdm_dialog_remove_all_confirmation (PdmActionInfo *info,
-				    int item)
+				    int type)
 {
 	GtkWidget *dialog, *button, *image, *parent;
-	gboolean answer;
 	gchar *title, *message;
 
-	switch (item)
+	switch (type)
 	{
 		case PROP_PASSWORDS_REMOVE_ALL:
 			title = _("Remove all passwords?");
@@ -1001,9 +1008,12 @@ pdm_dialog_remove_all_confirmation (PdmActionInfo *info,
 			message = _("Do you really want to remove all stored cookies?");
 			break;
 		default:
-			return FALSE;
+			return;
 	}
 
+	/* Store it for later use */
+	info->remove_all_type = type;
+
 	parent = ephy_dialog_get_control (EPHY_DIALOG (info->dialog),
 					  properties[PROP_WINDOW].id);
 
@@ -1014,37 +1024,74 @@ pdm_dialog_remove_all_confirmation (PdmActionInfo *info,
 					 "%s",
 					 message);
 
-	button = gtk_button_new_with_label (_("Remove _All"));
 	image = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_BUTTON);
+	button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("Remove _All"), GTK_RESPONSE_ACCEPT);
 	gtk_button_set_image (GTK_BUTTON (button), image);
-	gtk_widget_show (button);
 
-	gtk_dialog_add_button (GTK_DIALOG (dialog), button, GTK_RESPONSE_ACCEPT);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
 
 	gtk_window_set_title (GTK_WINDOW (dialog), title);
 	gtk_window_set_icon_name (GTK_WINDOW (dialog), EPHY_STOCK_EPHY);
 
-	answer = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT;
-
-	gtk_widget_destroy (dialog);
+	g_signal_connect (GTK_WIDGET (dialog), "response",
+			  G_CALLBACK (pdm_dialog_remove_all_confirmation_cb),
+			  info);
 
-	return answer;
+	gtk_window_present (GTK_WINDOW (dialog));
 }
 
 static void
-pdm_dialog_cookie_remove_all (PdmActionInfo *info,
-			      gpointer data)
+pdm_dialog_remove_all_confirmation_cb (GtkWidget *dialog,
+				       gint response,
+				       PdmActionInfo *info)
 {
-	EphyCookieManager *manager;
+	EphyCookieManager *cmanager;
+	EphyPasswordManager *pmanager;
 
-	if (pdm_dialog_remove_all_confirmation (info, PROP_COOKIES_REMOVE_ALL) == FALSE)
+	gtk_widget_destroy (dialog);
+
+	/* Don't do anything by default */
+	if (response != GTK_RESPONSE_ACCEPT)
 		return;
 
-	manager = EPHY_COOKIE_MANAGER (ephy_embed_shell_get_embed_single
-			(EPHY_EMBED_SHELL (ephy_shell)));
+	switch (info->remove_all_type)
+	{
+		case PROP_COOKIES_REMOVE_ALL:
+			cmanager = EPHY_COOKIE_MANAGER (ephy_embed_shell_get_embed_single
+							(EPHY_EMBED_SHELL (ephy_shell)));
+
+			ephy_cookie_manager_clear (cmanager);
+			break;
+
+		case PROP_PASSWORDS_REMOVE_ALL:
+			pmanager = EPHY_PASSWORD_MANAGER (ephy_embed_shell_get_embed_single
+							  (EPHY_EMBED_SHELL (ephy_shell)));
+
+			/* we don't remove the password from the liststore in the callback
+			 * like we do for cookies, since the callback doesn't carry that
+			 * information, and we'd have to reload the whole list, losing the
+			 * selection in the process.
+			 */
+			g_signal_handlers_block_by_func
+				(pmanager, G_CALLBACK (passwords_changed_cb), info->dialog);
+
+			/* Flush the list */
+			ephy_password_manager_remove_all_passwords (pmanager);
+
+			g_signal_handlers_unblock_by_func
+				(pmanager, G_CALLBACK (passwords_changed_cb), info->dialog);
+
+			/* And now refresh explicitly */
+			passwords_changed_cb (pmanager, info->dialog);
+			break;
+	}
+}
 
-	ephy_cookie_manager_clear (manager);
+static void
+pdm_dialog_cookie_remove_all (PdmActionInfo *info,
+			      gpointer data)
+{
+	pdm_dialog_remove_all_confirmation (info, PROP_COOKIES_REMOVE_ALL);
 }
 
 static void
@@ -1281,30 +1328,7 @@ static void
 pdm_dialog_password_remove_all (PdmActionInfo *info,
 				gpointer data)
 {
-	EphyPasswordManager *manager;
-
-	if (pdm_dialog_remove_all_confirmation (info, PROP_PASSWORDS_REMOVE_ALL) == FALSE)
-		return;
-
-	manager = EPHY_PASSWORD_MANAGER (ephy_embed_shell_get_embed_single
-			(EPHY_EMBED_SHELL (ephy_shell)));
-
-	/* we don't remove the password from the liststore in the callback
-	 * like we do for cookies, since the callback doesn't carry that
-	 * information, and we'd have to reload the whole list, losing the
-	 * selection in the process.
-	 */
-	g_signal_handlers_block_by_func
-		(manager, G_CALLBACK (passwords_changed_cb), info->dialog);
-
-	/* Flush the list */
-	ephy_password_manager_remove_all_passwords (manager);
-
-	g_signal_handlers_unblock_by_func
-		(manager, G_CALLBACK (passwords_changed_cb), info->dialog);
-
-	/* And now refresh explicitly */
-	passwords_changed_cb (manager, info->dialog);
+	pdm_dialog_remove_all_confirmation (info, PROP_PASSWORDS_REMOVE_ALL);
 }
 
 /* common routines */
