? 335079.patch
? help/bg/.xml2po.mo
? help/bg/gedit.xml
? help/bg/legal.xml
? help/de/.xml2po.mo
? help/de/gedit.xml
? help/de/legal.xml
? help/es/.xml2po.mo
? help/es/gedit.xml
? help/es/legal.xml
? help/fr/.xml2po.mo
? help/fr/gedit.xml
? help/fr/legal.xml
? help/it/.xml2po.mo
? help/it/gedit.xml
? help/it/legal.xml
? help/ja/.xml2po.mo
? help/ja/gedit.xml
? help/ja/legal.xml
? help/zh_CN/.xml2po.mo
? help/zh_CN/gedit.xml
? help/zh_CN/legal.xml
? help/zh_HK/.xml2po.mo
? help/zh_HK/gedit.xml
? help/zh_HK/legal.xml
? help/zh_TW/.xml2po.mo
? help/zh_TW/gedit.xml
? help/zh_TW/legal.xml
? po/stamp-it
Index: gedit/gedit-commands-file.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-commands-file.c,v
retrieving revision 1.6
diff -u -p -r1.6 gedit-commands-file.c
--- gedit/gedit-commands-file.c	14 Mar 2006 10:53:10 -0000	1.6
+++ gedit/gedit-commands-file.c	19 Mar 2006 03:17:49 -0000
@@ -1596,6 +1596,8 @@ void
 _gedit_cmd_file_close_tab (GeditTab    *tab,
 			   GeditWindow *window)
 {
+	GeditDocument *doc;
+
 	gedit_debug (DEBUG_COMMANDS);
 
 	g_return_if_fail (GTK_WIDGET (window) == gtk_widget_get_toplevel (GTK_WIDGET (tab)));
@@ -1607,8 +1609,13 @@ _gedit_cmd_file_close_tab (GeditTab    *
 	g_object_set_data (G_OBJECT (window),
 			   GEDIT_IS_QUITTING,
 			   GBOOLEAN_TO_POINTER (FALSE));
-
-	if (tab_can_close (tab, GTK_WINDOW (window)))
+			   
+	doc = gedit_tab_get_document (tab);
+			   
+	/* automatically save titled documents when autosave is enabled */
+	if (gedit_tab_get_auto_save_enabled (tab) && !gedit_document_is_untitled (doc))
+		save_and_close (tab, window);
+	else if (tab_can_close (tab, GTK_WINDOW (window)))
 		gedit_window_close_tab (window, tab);
 }
 
@@ -1632,8 +1639,9 @@ static void
 file_close_all (GeditWindow *window,
 		gboolean     is_quitting)
 {
-	GList     *unsaved_docs;
-	GtkWidget *dlg;
+	GList         *unsaved_docs;
+	GtkWidget     *dlg;
+	GeditTab      *tab;
 
 	gedit_debug (DEBUG_COMMANDS);
 
@@ -1649,7 +1657,7 @@ file_close_all (GeditWindow *window,
 	g_object_set_data (G_OBJECT (window),
 			   GEDIT_IS_QUITTING,
 			   GBOOLEAN_TO_POINTER (is_quitting));
-			   
+	
 	unsaved_docs = gedit_window_get_unsaved_documents (window);
 
 	if (unsaved_docs == NULL)
@@ -1673,7 +1681,16 @@ file_close_all (GeditWindow *window,
 
 		tab = gedit_tab_get_from_document (doc);
 		g_return_if_fail (tab != NULL);
-
+		
+		/* handle autosave */
+		if (gedit_tab_get_auto_save_enabled (tab) && !gedit_document_is_untitled (doc))
+		{
+			save_and_close_all_documents (unsaved_docs, window);
+			g_list_free (unsaved_docs);
+				
+			return;
+		}
+			
 		gedit_window_set_active_tab (window, tab);
 
 		dlg = gedit_close_confirmation_dialog_new_single (
@@ -1683,13 +1700,39 @@ file_close_all (GeditWindow *window,
 	}
 	else
 	{
-		dlg = gedit_close_confirmation_dialog_new (GTK_WINDOW (window),
-							   unsaved_docs,
-							   FALSE);
+		GeditTab      *tab;
+		GeditDocument *doc;
+		GList         *l;
+		GList         *tmplist = NULL;
+		
+		/* handle autosave */
+		for (l = unsaved_docs; l != NULL; l = l->next)
+		{
+			doc = GEDIT_DOCUMENT (l->data);
+			
+			tab = gedit_tab_get_from_document (doc);
+			
+			if (!gedit_tab_get_auto_save_enabled (tab) || gedit_document_is_untitled (doc))
+				tmplist = g_list_prepend (tmplist, doc);
+		}
+		
+		if (tmplist != NULL) {
+			dlg = gedit_close_confirmation_dialog_new (GTK_WINDOW (window),
+								   tmplist,
+								   FALSE);
+			g_list_free (tmplist);	
+		} 
+		else
+		{
+			save_and_close_all_documents (unsaved_docs, window);
+			g_list_free (unsaved_docs);
+			
+			return;
+		}
 	}
 
 	g_list_free (unsaved_docs);
-
+	
 	g_signal_connect (dlg,
 			  "response",
 			  G_CALLBACK (close_confirmation_dialog_response_handler),
Index: gedit/gedit-tab.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-tab.c,v
retrieving revision 1.10
diff -u -p -r1.10 gedit-tab.c
--- gedit/gedit-tab.c	13 Mar 2006 07:40:06 -0000	1.10
+++ gedit/gedit-tab.c	19 Mar 2006 03:17:50 -0000
@@ -95,8 +95,6 @@ enum
 	PROP_AUTO_SAVE_INTERVAL
 };
 
-static gboolean gedit_tab_auto_save (GeditTab *tab);
-
 static void
 install_auto_save_timeout (GeditTab *tab)
 {
@@ -118,7 +116,7 @@ install_auto_save_timeout (GeditTab *tab
 	
 	/* Add a new timeout */
 	timeout = g_timeout_add (tab->priv->auto_save_interval * 1000 * 60,
-				 (GSourceFunc) gedit_tab_auto_save,
+				 (GSourceFunc) _gedit_tab_auto_save,
 				 tab);
 
 	tab->priv->auto_save_timeout = timeout;
@@ -1850,8 +1848,8 @@ _gedit_tab_save (GeditTab *tab)
 	gedit_document_save (doc, tab->priv->save_flags);
 }
 
-static gboolean
-gedit_tab_auto_save (GeditTab *tab)
+gboolean
+_gedit_tab_auto_save (GeditTab *tab)
 {
 	GeditDocument *doc;
 
@@ -1886,7 +1884,7 @@ gedit_tab_auto_save (GeditTab *tab)
 	
 		/* Add a new timeout */
 		timeout = g_timeout_add (30 * 1000,
-					(GSourceFunc) gedit_tab_auto_save,
+					(GSourceFunc) _gedit_tab_auto_save,
 					tab);
 
 		tab->priv->auto_save_timeout = timeout;
Index: gedit/gedit-tab.h
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-tab.h,v
retrieving revision 1.4
diff -u -p -r1.4 gedit-tab.h
--- gedit/gedit-tab.h	19 Feb 2006 18:01:09 -0000	1.4
+++ gedit/gedit-tab.h	19 Mar 2006 03:17:50 -0000
@@ -101,7 +101,7 @@ GType 		 gedit_tab_get_type 		(void) G_G
 
 GeditView	*gedit_tab_get_view		(GeditTab            *tab);
 
-/* This is only an helper function */
+/* This is only a helper function */
 GeditDocument	*gedit_tab_get_document		(GeditTab            *tab);
 
 GeditTab	*gedit_tab_get_from_document	(GeditDocument       *doc);
@@ -146,6 +146,7 @@ void		 _gedit_tab_save		(GeditTab       
 void		 _gedit_tab_save_as		(GeditTab            *tab,
 						 const gchar         *uri,
 						 const GeditEncoding *encoding);
+gboolean         _gedit_tab_auto_save           (GeditTab            *tab);
 void		 _gedit_tab_print		(GeditTab            *tab,
 						 GeditPrintJob       *pjob,
 						 GtkTextIter         *start, 
Index: gedit/gedit-window.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit-window.c,v
retrieving revision 1.20
diff -u -p -r1.20 gedit-window.c
--- gedit/gedit-window.c	3 Mar 2006 16:31:17 -0000	1.20
+++ gedit/gedit-window.c	19 Mar 2006 03:17:52 -0000
@@ -235,6 +235,29 @@ gedit_window_key_press_event (GtkWidget 
 		return GTK_WIDGET_CLASS (gedit_window_parent_class)->key_press_event (widget, event);
 }
 
+static gboolean
+gedit_window_focus_out (GtkWidget     *widget, 
+                        GdkEventFocus *event)
+{
+	GeditTab      *tab;
+	GeditDocument *doc;
+	GList         *unsaved_docs;
+	GList         *l;
+	
+	unsaved_docs = gedit_window_get_unsaved_documents (GEDIT_WINDOW (widget));
+	
+	for (l = unsaved_docs; l != NULL; l = l->next)
+	{
+		doc = GEDIT_DOCUMENT (l->data);
+		tab = gedit_tab_get_from_document (doc);
+		
+		if (gedit_tab_get_auto_save_enabled (tab) && !gedit_document_is_untitled (doc))
+			_gedit_tab_auto_save (tab);
+	}
+	
+	return TRUE;
+}
+
 static void
 gedit_window_tab_removed (GeditWindow         *window,
 			      GeditTab *tab) 
@@ -259,6 +282,7 @@ gedit_window_class_init (GeditWindowClas
 	widget_class->window_state_event = gedit_window_window_state_event;
 	widget_class->configure_event = gedit_window_configure_event;
 	widget_class->key_press_event = gedit_window_key_press_event;
+	widget_class->focus_out_event = gedit_window_focus_out;
 
 	signals[TAB_ADDED] =
 		g_signal_new ("tab_added",
Index: gedit/gedit.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/gedit.c,v
retrieving revision 1.135
diff -u -p -r1.135 gedit.c
--- gedit/gedit.c	13 Mar 2006 17:39:33 -0000	1.135
+++ gedit/gedit.c	19 Mar 2006 03:17:52 -0000
@@ -468,7 +468,7 @@ main (int argc, char *argv[])
 
 	gedit_debug_message (DEBUG_APP, "Create bacon connection");
 
-	connection = bacon_message_connection_new ("gedit");
+	connection = bacon_message_connection_new ("gedit-dev");
 
 	if (connection != NULL)
 	{
