Index: embed/mozilla/ContentHandler.cpp
===================================================================
--- embed/mozilla/ContentHandler.cpp.orig	2007-03-11 20:59:09.000000000 +0100
+++ embed/mozilla/ContentHandler.cpp	2007-05-19 00:25:47.362311750 +0200
@@ -336,8 +336,11 @@
 
 	gtk_dialog_add_button (GTK_DIALOG (dialog),
 			       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
-	gtk_dialog_add_button (GTK_DIALOG (dialog),
-			       action_label, mAction);
+	if (mAction != CONTENT_ACTION_NONE)
+	{
+		gtk_dialog_add_button (GTK_DIALOG (dialog),
+				       action_label, mAction);
+	}
 
 	gtk_window_set_icon_name (GTK_WINDOW (dialog), EPHY_STOCK_EPHY);
  
@@ -385,20 +388,16 @@
 	}
 
 	if (auto_downloads)
-	{
-		mAction = CONTENT_ACTION_OPEN;
-	}
+		mAction = mHelperApp ? CONTENT_ACTION_OPEN : CONTENT_ACTION_DOWNLOAD;
 	else
-	{
-		mAction = CONTENT_ACTION_OPEN_TMP;
-	}
+		mAction = mHelperApp ? CONTENT_ACTION_OPEN_TMP : CONTENT_ACTION_SAVEAS;
 
-	if (!mHelperApp || mPermission != EPHY_MIME_PERMISSION_SAFE)
+	if (mPermission != EPHY_MIME_PERMISSION_SAFE)
 	{
-		mAction = CONTENT_ACTION_DOWNLOAD;
+		mAction = auto_downloads ? CONTENT_ACTION_DOWNLOAD : CONTENT_ACTION_NONE;
+		MIMEConfirmAction ();
 	}
-
-	if (!auto_downloads || mAction == CONTENT_ACTION_DOWNLOAD)
+	else if (mAction == CONTENT_ACTION_OPEN_TMP)
 	{
 		MIMEConfirmAction ();
 	}
Index: data/glade/prefs-dialog.glade
===================================================================
--- data/glade/prefs-dialog.glade.orig	2007-05-18 23:29:25.330948000 +0200
+++ data/glade/prefs-dialog.glade	2007-05-18 23:24:27.732349250 +0200
@@ -302,6 +302,25 @@
 			      <property name="spacing">6</property>
 
 			      <child>
+				<widget class="GtkCheckButton" id="automatic_downloads_checkbutton">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">A_utomatically download and open files</property>
+				  <property name="use_underline">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				  <property name="focus_on_click">True</property>
+				  <property name="active">False</property>
+				  <property name="inconsistent">False</property>
+				  <property name="draw_indicator">True</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
 				<widget class="GtkHBox" id="download_button_hbox">
 				  <property name="visible">True</property>
 				  <property name="homogeneous">False</property>
@@ -342,25 +361,6 @@
 				  <property name="fill">True</property>
 				</packing>
 			      </child>
-
-			      <child>
-				<widget class="GtkCheckButton" id="automatic_downloads_checkbutton">
-				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">A_utomatically download and open files</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
-				  <property name="active">False</property>
-				  <property name="inconsistent">False</property>
-				  <property name="draw_indicator">True</property>
-				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
-				</packing>
-			      </child>
 			    </widget>
 			  </child>
 			</widget>
Index: src/prefs-dialog.c
===================================================================
--- src/prefs-dialog.c.orig	2007-05-18 23:35:13.624715000 +0200
+++ src/prefs-dialog.c	2007-05-18 23:55:19.372069500 +0200
@@ -390,6 +390,13 @@
 }
 
 static void
+automatic_downloads_toggled (GtkToggleButton *button,
+			     GtkWidget *widget)
+{
+	g_object_set (widget, "sensitive", gtk_toggle_button_get_active (button), NULL);
+}
+
+static void
 setup_font_combo (EphyDialog *dialog,
 		  const char *type,
 		  const char *code,
@@ -1524,6 +1531,7 @@
 	EphyDialog *dialog = EPHY_DIALOG (pd);
 	EphyEncodings *encodings;
 	GtkWidget *window, *curr_button, *blank_button;
+	GtkWidget *automatic_downloads_checkbutton, *download_button_hbox;
 	GtkWidget *clear_cache_button, *font_prefs_button;
 	GtkWidget *css_checkbox, *css_edit_box, *css_edit_button, *css_container;
 	gboolean sensitive;
@@ -1544,6 +1552,8 @@
 		 properties[WINDOW_PROP].id, &window,
 		 properties[HOMEPAGE_CURRENT_PROP].id, &curr_button,
 		 properties[HOMEPAGE_BLANK_PROP].id, &blank_button,
+		 properties[AUTO_OPEN_PROP].id, &automatic_downloads_checkbutton,
+		 properties[DOWNLOAD_PATH_HBOX_PROP].id, &download_button_hbox,
 		 properties[FONT_PREFS_BUTTON_PROP].id, &font_prefs_button,
 		 properties[CSS_CHECKBOX_PROP].id, &css_checkbox,
 		 properties[CSS_EDIT_BOX_PROP].id, &css_edit_box,
@@ -1567,6 +1577,10 @@
 	gtk_widget_set_sensitive (curr_button, sensitive);
 	gtk_widget_set_sensitive (blank_button, sensitive);
 
+	automatic_downloads_toggled (GTK_TOGGLE_BUTTON (automatic_downloads_checkbutton), download_button_hbox);
+	g_signal_connect (automatic_downloads_checkbutton, "toggled",
+			  G_CALLBACK (automatic_downloads_toggled), download_button_hbox);
+
 	g_signal_connect (font_prefs_button, "clicked",
 			  G_CALLBACK (font_prefs_button_clicked_cb), dialog);
 
