Index: src/prefs-dialog.c
===================================================================
--- src/prefs-dialog.c	(revisione 7233)
+++ src/prefs-dialog.c	(copia locale)
@@ -118,6 +118,7 @@ enum
 	HOMEPAGE_ENTRY_PROP,
 	HOMEPAGE_CURRENT_PROP,
 	HOMEPAGE_BLANK_PROP,
+	CONFIRM_TABS_ON_CLOSE_PROP,
 	AUTO_OPEN_PROP,
 	DOWNLOAD_PATH_HBOX_PROP,
 	DOWNLOAD_PATH_LABEL_PROP,
@@ -164,6 +165,7 @@ EphyDialogProperty properties [] =
 	{ "homepage_entry",			CONF_GENERAL_HOMEPAGE,	  PT_AUTOAPPLY,	G_TYPE_STRING },
 	{ "homepage_current_button",		NULL,			  PT_NORMAL,	0 },
 	{ "homepage_blank_button",		NULL,			  PT_NORMAL,	0 },
+	{ "tabs_confirm_checkbutton",	CONF_CONFIRM_TABS_ON_CLOSE,	PT_AUTOAPPLY,	0 },
 	{ "automatic_downloads_checkbutton",	CONF_AUTO_DOWNLOADS,      PT_AUTOAPPLY,	0 },
 	{ "download_button_hbox",		NULL,			  PT_NORMAL,	0 },
 	{ "download_button_label",		NULL,			  PT_NORMAL,	0 },
Index: src/ephy-window.c
===================================================================
--- src/ephy-window.c	(revisione 7233)
+++ src/ephy-window.c	(copia locale)
@@ -65,6 +65,8 @@
 #include <gtk/gtkuimanager.h>
 #include <gtk/gtktoggleaction.h>
 #include <gtk/gtkdialog.h>
+#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtkbox.h>
 #include <gtk/gtkmessagedialog.h>
 
 #ifdef HAVE_X11_XF86KEYSYM_H
@@ -742,6 +744,71 @@ ephy_window_unfullscreen (EphyWindow *wi
 	sync_chromes_visibility (window);
 }
 
+static void
+tabs_confirm_toggled_cb (GtkWidget *checkbutton)
+{
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton)))
+	{
+		eel_gconf_set_boolean (CONF_CONFIRM_TABS_ON_CLOSE, FALSE);
+	}
+	else
+	{
+		eel_gconf_set_boolean (CONF_CONFIRM_TABS_ON_CLOSE, TRUE);
+	}	
+}
+
+
+static GtkWidget *
+construct_confirm_close_with_many_tabs_dialog (EphyWindow *window)
+{
+	GtkWidget *dialog, *hbox, *checkbutton;
+	int n_pages;
+	
+	n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook));
+	
+	dialog = (gtk_message_dialog_new
+		(GTK_WINDOW (window),
+		 GTK_DIALOG_MODAL | 
+		 GTK_DIALOG_DESTROY_WITH_PARENT,
+		 GTK_MESSAGE_WARNING,
+		 GTK_BUTTONS_CANCEL,
+	 	 g_strdup_printf (_("You are about to close a window with %i open tabs"), n_pages)));
+	
+	gtk_message_dialog_format_secondary_text
+		(GTK_MESSAGE_DIALOG (dialog),
+		 _("If you close the window, you will not be able "
+		   "to recover the opened tabs."));
+	
+	gtk_dialog_add_button (GTK_DIALOG (dialog),
+			       _("Close _Window"), GTK_RESPONSE_ACCEPT);
+	
+ 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
+	
+	hbox = gtk_hbox_new (FALSE, 0);
+	
+	checkbutton = (gtk_check_button_new_with_label ("Remember my choice"));
+
+	g_signal_connect (checkbutton,
+			  "toggled", G_CALLBACK (tabs_confirm_toggled_cb), NULL);
+
+	
+	/* 62px to align checkbutton to label (12 + 36 + 14) 
+	   14px is the spacing of dialog->vbox
+	   12px is the spacing of gtkmessagedialog's priv vbox */
+	gtk_box_pack_start (GTK_BOX (hbox), checkbutton, FALSE, FALSE, 62);
+	
+	gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), GTK_WIDGET (hbox));
+	
+	gtk_widget_show_all (hbox);
+
+	gtk_window_set_icon_name (GTK_WINDOW (dialog), EPHY_STOCK_EPHY);
+
+	gtk_window_group_add_window (GTK_WINDOW (window)->group, GTK_WINDOW (dialog));
+
+	return (GTK_WIDGET (dialog));
+
+}
+
 static GtkWidget *
 construct_confirm_close_dialog (EphyWindow *window)
 {
@@ -784,6 +851,21 @@ confirm_close_with_modified_forms (EphyW
 	gtk_widget_destroy (dialog);
 
 	return response == GTK_RESPONSE_ACCEPT;
+	
+}
+
+static gboolean
+confirm_close_with_many_tabs (EphyWindow *window)
+{
+	GtkWidget *dialog;
+	int response;
+	
+	dialog = construct_confirm_close_with_many_tabs_dialog (window);
+	response = gtk_dialog_run (GTK_DIALOG (dialog));
+	
+	gtk_widget_destroy (dialog);
+	
+	return response == GTK_RESPONSE_ACCEPT;
 }
 
 static void
@@ -917,6 +999,7 @@ ephy_window_delete_event (GtkWidget *wid
 	EphyTab *modified_tab = NULL;
 	GList *tabs, *l;
 	gboolean modified = FALSE;
+	int n_pages;
 
 	/* We ignore the delete_event if the disable_quit lockdown has been set
 	 */
@@ -937,8 +1020,10 @@ ephy_window_delete_event (GtkWidget *wid
 
 		return TRUE;
 	}
-
+	
 	tabs = ephy_window_get_tabs (window);
+	n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->priv->notebook));
+	
 	for (l = tabs; l != NULL; l = l->next)
 	{
 		EphyTab *tab = (EphyTab *) l->data;
@@ -969,10 +1054,17 @@ ephy_window_delete_event (GtkWidget *wid
 			return TRUE;
 		}
 	}
-	
+	else if (n_pages > 1 && eel_gconf_get_boolean (CONF_CONFIRM_TABS_ON_CLOSE))
+	{
+		if (confirm_close_with_many_tabs (window) == FALSE)
+		{
+			return TRUE;
+		}
+	}
+
 	/* See bug #114689 */
 	gtk_widget_hide (widget);
-
+	
 	/* proceed with window close */
 	if (GTK_WIDGET_CLASS (parent_class)->delete_event)
 	{
@@ -980,6 +1072,7 @@ ephy_window_delete_event (GtkWidget *wid
 	}
 
 	return FALSE;
+
 }
 
 static void
Index: lib/ephy-prefs.h
===================================================================
--- lib/ephy-prefs.h	(revisione 7233)
+++ lib/ephy-prefs.h	(copia locale)
@@ -37,6 +37,7 @@ G_BEGIN_DECLS
 #define CONF_AUTO_DOWNLOADS			"/apps/epiphany/general/automatic_downloads"
 #define CONF_DESKTOP_IS_HOME_DIR		"/apps/nautilus/preferences/desktop_is_home_dir"
 #define CONF_NETWORK_MANAGED			"/apps/epiphany/general/managed_network"
+#define CONF_CONFIRM_TABS_ON_CLOSE		"/apps/epiphany/general/confirm_for_tabs"
 
 /* i18n pref */
 #define CONF_GECKO_ENABLE_PANGO			"/apps/epiphany/web/enable_pango"
Index: data/epiphany.schemas.in
===================================================================
--- data/epiphany.schemas.in	(revisione 7233)
+++ data/epiphany.schemas.in	(copia locale)
@@ -497,5 +497,15 @@
         <short>Automatically manage offline status with NetworkManager</short>
         </locale>
       </schema>
+      <schema>
+        <key>/schemas/apps/epiphany/general/confirm_for_tabs</key>
+        <applyto>/apps/epiphany/general/confirm_for_tabs</applyto>
+        <owner>epiphany</owner>
+        <type>bool</type>
+        <default>true</default>
+        <locale name="C">
+        <short>Ask for close confirmation if more than a tab is opened</short>
+        </locale>
+      </schema>
     </schemalist>
 </gconfschemafile>
Index: data/glade/prefs-dialog.glade
===================================================================
--- data/glade/prefs-dialog.glade	(revisione 7233)
+++ data/glade/prefs-dialog.glade	(copia locale)
@@ -371,6 +371,68 @@
 			  <property name="fill">True</property>
 			</packing>
 		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label1400">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">&lt;b&gt;Tabs&lt;/b&gt;</property>
+			  <property name="use_underline">False</property>
+			  <property name="use_markup">True</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			  <property name="width_chars">-1</property>
+			  <property name="single_line_mode">False</property>
+			  <property name="angle">0</property>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkAlignment" id="alignment20">
+			  <property name="visible">True</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">1</property>
+			  <property name="yscale">1</property>
+			  <property name="top_padding">0</property>
+			  <property name="bottom_padding">0</property>
+			  <property name="left_padding">12</property>
+			  <property name="right_padding">0</property>
+			  <child>
+			    <widget class="GtkCheckButton" id="tabs_confirm_checkbutton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Ask for confirmation when closing a window with multiple tabs</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>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">False</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
