Index: www/htdocs/index.php
===================================================================
--- www/htdocs/index.php	(Revision 4861)
+++ www/htdocs/index.php	(Arbeitskopie)
@@ -1 +1,135 @@
-link anjuta.php
\ No newline at end of file
+
+<html>
+<head>
+	<title>Anjuta Integrated Development Environment</title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+	<meta content="programming, best, ide, free, user friendly, gnome, linux, anjuta, c, c++, php, versatile, gtk, website" name="keywords"/>
+        <link href="/css/docs.css" type="text/css" rel="StyleSheet"/>
+        <link href="/css/layout.css" rel="stylesheet" type="text/css" media="screen">
+        <link href="/css/style.css" rel="stylesheet" type="text/css" media="all">
+</head>
+
+<body>
+  <!-- site header -->
+  <div id="page">
+    <ul id="general">
+      <li id="siteaction-gnome_home" class="home">
+        <a href="http://anjuta.org/" title="Home">Home</a>
+      </li>
+      <li id="siteaction-gnome_news">
+        <a href="http://sourceforge.net/news/?group_id=14222" title="News">News</a>
+      </li>
+      <li id="siteaction-gnome_projects">
+        <a href="http://sourceforge.net/projects/anjuta" title="Project Site">Project Site</a>
+      </li>
+      <li id="siteaction-gnome_art">
+        <a href="http://sourceforge.net/project/showfiles.php?group_id=14222" title="Releases">Releases</a>
+
+      </li>
+      <li id="siteaction-gnome_support">
+        <a href="http://sourceforge.net/mail/?group_id=14222" title="Mailing lists">Mailing lists</a>
+      </li>
+      <li id="siteaction-gnome_development">
+        <a href="http://sourceforge.net/forum/?group_id=14222" title="Forums">Forums</a>
+      </li>
+    </ul>
+
+    <div id="header">
+       <h1>Anjuta DevStudio: GNOME Integrated Development Environment</h1>
+       <div id="tabs">
+	<ul id="portal-globalnav">
+		<li <?php if($_GET["page"] == "") echo("class=\"selected\"");?>><a href="/"><span>About</span></a></li>
+		<li <?php if($_GET["page"] == "development") echo("class=\"selected\"");?>><a href="/development"><span>Development</span></a></li>
+		<li <?php if($_GET["page"] == "downloads") echo("class=\"selected\"");?>><a href="/downloads"><span>Downloads</span></a></li>
+		<li <?php if($_GET["page"] == "screenshots" || $_GET["page"] == "screen-shots" ) echo("class=\"selected\"");?>><a href="/screen-shots"><span>Screenshots</span></a></li>
+		<li <?php if($_GET["page"] == "features") echo("class=\"selected\"");?>><a href="/features"><span>Features</span></a></li>
+		<li <?php if($_GET["page"] == "credits") echo("class=\"selected\"");?>><a href="/credits"><span>Credits</span></a></li>
+	</ul>
+     </div> <!-- end of #tabs -->
+    </div> <!-- end of #header -->
+  </div> <!-- end of #page -->
+
+<!-- end site header -->
+
+<div id="sidebar">
+	<h3>Project</h3>
+	<ul>
+		<li><a href="/changelog">ChangeLog</a></li>
+		<li><a href="/roadmap">Roadmap</a></li>
+		<li><a href="/hacking">Hacking</a></li>
+		<li><a href="/tasks">Tasks & Bounties</a></li>
+	</ul>
+	<h3>Documentations</h3>
+	<ul>
+                <li><a href="/documentations/subpage/documents/libanjuta/index.html">Anjuta API docs</a></li>
+		<li><a href="http://live.gnome.org/Anjuta">Anjuta wiki</a></li>
+		<li><a href="/documentations/subpage/documents/C/anjuta-faqs/anjuta-faqs.html">FAQ [English]</a></li>
+		<!--<li><a href="/documentations/subpage/documents/ja/anjuta-faqs/index.html">FAQ [Japanese]</a></li>
+		<li><a href="/documentations/subpage/documents/C/anjuta-tutorial/index.html">Tutorial [English]</a></li>
+		<li><a href="/documentations/subpage/documents/de/anjuta-tutorial/index.html">Tutorial [German]</a></li>
+		<li><a href="/documentations/subpage/documents/zh_CN/anjuta-tutorial/index.html">Tutorial [Chinese]</a></li> -->
+		<li><a href="/documentations/subpage/documents/C/anjuta-build-tutorial/index.html">Build Tutorial [English]</a></li> 
+		<li><a href="/documentations/subpage/documents/C/anjuta-manual/anjuta-manual.html">Manual [English]</a></li>
+		<!--<li><a href="/documentations/subpage/documents/ja/anjuta-manual/index.html">Manual [Japanese]</a></li> -->
+	</ul>
+	<h3>Project Status</h3>
+        <ul>
+        <li><a href="http://bugzilla.gnome.org/browse.cgi?product=anjuta">Bugs</a></li>
+        <li><a href="http://bugzilla.gnome.org/reports/patch-report.cgi?product=anjuta">Patches</a></li>
+        <li><a href="http://bugzilla.gnome.org/simple-bug-guide.cgi?product=anjuta">Submit</a></li>
+        </ul>
+        <p>
+	<a href="http://sourceforge.net/donate/index.php?group_id=14222"><img src="http://images.sourceforge.net/images/project-support.jpg" width="88" height="32" border="0" alt="Support This Project" /></a>
+        </p>
+        <p>
+        <A href="http://sourceforge.net"><IMG
+           src="http://sourceforge.net/sflogo.php?group_id=14222&amp;type=5"
+           width="210" height="62" border="0" alt="SourceForge.net Logo"/></A>
+        </p>
+</div> <!-- sidebar -->
+
+<div id="body">
+<div id="content">
+	<!-- Content starts here -->
+	<?php
+		$page = $_GET["page"];
+		if ($page == "credits"){
+			require("authors.php");
+		} else
+		if ($page == "development"){
+			require("development.php");
+		} else
+		if ($page == "downloads"){
+			require("downloads.php");
+		} else
+		if ($page == 'screenshots' || $page == 'screen-shots'){
+			require("screenshots.php");
+		} else
+		if ($page == 'features'){
+			require("features.php");
+		} else
+		if ($page == 'changelog'){
+			require("changelog.php");
+		} else
+		if ($page == 'roadmap'){
+			require("roadmap.php");
+		} else
+		if ($page == 'hacking'){
+			require("hacking.php");
+		} else
+		if ($page == 'tasks'){
+			require("tasks.php");
+                } else
+                if ($page == 'documentations'){
+		  $subpage = $_GET["subpage"];
+		  require("proxy.php");
+		} else
+		{
+			require("home.php");
+		}
+	?>
+</div> <!-- content -->
+</div> <!-- body -->
+
+</body>
+</html>
Index: src/anjuta-app.c
===================================================================
--- src/anjuta-app.c	(Revision 4861)
+++ src/anjuta-app.c	(Arbeitskopie)
@@ -498,6 +498,8 @@
 	
 	/* Loading accels */
 	anjuta_ui_load_accels (NULL);
+
+	app->save_count = 0;
 }
 
 static void
@@ -768,6 +770,20 @@
 	}
 }
 
+static void
+anjuta_app_saving_push (AnjutaShell* shell)
+{
+	AnjutaApp* app = ANJUTA_APP (shell);
+	app->save_count++;
+}
+
+static void
+anjuta_app_saving_pop (AnjutaShell* shell)
+{
+	AnjutaApp* app = ANJUTA_APP (shell);
+	app->save_count--;
+}
+
 static gboolean
 remove_from_widgets_hash (gpointer name, gpointer hash_widget, gpointer widget)
 {
@@ -1041,6 +1057,8 @@
 	iface->get_preferences = anjuta_app_get_preferences;
 	iface->get_plugin_manager = anjuta_app_get_plugin_manager;
 	iface->get_profile_manager = anjuta_app_get_profile_manager;
+	iface->saving_push = anjuta_app_saving_push;
+	iface->saving_pop = anjuta_app_saving_pop;
 }
 
 ANJUTA_TYPE_BEGIN(AnjutaApp, anjuta_app, GTK_TYPE_WINDOW);
Index: src/anjuta-app.h
===================================================================
--- src/anjuta-app.h	(Revision 4861)
+++ src/anjuta-app.h	(Arbeitskopie)
@@ -58,6 +58,8 @@
 	AnjutaPreferences *preferences;
 	AnjutaPluginManager *plugin_manager;
 	AnjutaProfileManager *profile_manager;
+
+	gint save_count;
 };
 
 struct _AnjutaAppClass
Index: src/anjuta.c
===================================================================
--- src/anjuta.c	(Revision 4861)
+++ src/anjuta.c	(Arbeitskopie)
@@ -79,6 +79,15 @@
 				break;
 		}
 	}
+	/* Wait for files to be really saved (asyncronous operation) */
+	if (app->save_count > 0)
+	{
+		g_message ("Waiting for %d file(s) to be saved!", app->save_count);
+		while (app->save_count > 0)
+		{
+			g_main_context_iteration (NULL, TRUE);
+		}
+	}
 	
 	/* If current active profile is "user", save current session as
 	 * default session
Index: src/main.c
===================================================================
--- src/main.c	(Revision 4861)
+++ src/main.c	(Arbeitskopie)
@@ -184,7 +184,7 @@
 	/* Initialize gnome program */
 	if (!g_option_context_parse (context, &argc, &argv, &error))
 	{
-		DEBUG_PRINT ("Option parsing failed: %s", error);
+		DEBUG_PRINT ("Option parsing failed: %s", error->message);
 		exit(1);
 	}
 	
Index: plugins/sourceview/sourceview-io.c
===================================================================
--- plugins/sourceview/sourceview-io.c	(Revision 4861)
+++ plugins/sourceview/sourceview-io.c	(Arbeitskopie)
@@ -236,14 +236,18 @@
 }
 
 static void
-on_save_finished (GObject* output_stream, GAsyncResult* result, gpointer data)
+on_save_finished (GObject* file, GAsyncResult* result, gpointer data)
 {
 	SourceviewIO* sio = SOURCEVIEW_IO(data);
+	AnjutaShell* shell = ANJUTA_PLUGIN (sio->sv->priv->plugin)->shell;
 	GError* err = NULL;
-	g_output_stream_write_finish (G_OUTPUT_STREAM(output_stream),
-								  result,
-								  &err);
+	gchar* etag;
+	g_file_replace_contents_finish (G_FILE (file),
+	                                result,
+	                                &etag,
+	                                &err);
 	g_free (sio->write_buffer);
+	g_free (etag);
 	sio->write_buffer = NULL;
 	if (err)
 	{
@@ -253,12 +257,11 @@
 	else
 	{
 		set_display_name (sio);
-		g_output_stream_close(G_OUTPUT_STREAM (output_stream), NULL, NULL);
 		setup_monitor (sio);
 		g_signal_emit_by_name (sio, "save-finished");
 	}
-	g_object_unref (output_stream);
 	g_object_unref (sio);
+	anjuta_shell_saving_pop (shell);
 }
 
 void
@@ -279,9 +282,9 @@
 void
 sourceview_io_save_as (SourceviewIO* sio, GFile* file)
 {
-	GFileOutputStream* output_stream;
-	GError* err = NULL;
+	AnjutaShell* shell = ANJUTA_PLUGIN (sio->sv->priv->plugin)->shell;
 	gboolean backup = TRUE;
+	gsize len;
 	
 	g_return_if_fail (file != NULL);
 	
@@ -290,19 +293,11 @@
 	backup = anjuta_preferences_get_int_with_default (sio->sv->priv->prefs,
 													  "sourceview.backup", TRUE);
 	
-	output_stream = g_file_replace (file, NULL, backup, G_FILE_CREATE_NONE,
-									NULL, NULL);
-	if (!output_stream)
-	{
-		g_signal_emit_by_name (sio, "save-failed", err);
-		g_error_free (err);
-		return;
-	}
-	
 	if (sio->last_encoding == NULL)
 	{
 		sio->write_buffer = ianjuta_editor_get_text_all (IANJUTA_EDITOR(sio->sv), 
 														 NULL);
+		len = strlen (sio->write_buffer);
 	}
 	else
 	{
@@ -312,7 +307,7 @@
 		sio->write_buffer = anjuta_convert_from_utf8 (buffer_text,
 													  -1,
 													  sio->last_encoding,
-													  NULL,
+													  &len,
 													  &err);
 		g_free (buffer_text);
 		if (err != NULL)
@@ -323,13 +318,16 @@
 		}
 	}
 	g_cancellable_reset (sio->cancel);
-	g_output_stream_write_async (G_OUTPUT_STREAM (output_stream),
-								 sio->write_buffer,
-								 strlen (sio->write_buffer),
-								 G_PRIORITY_LOW,
-								 sio->cancel,
-								 on_save_finished,
-								 sio);
+	g_file_replace_contents_async (file,
+	                               sio->write_buffer,
+	                               len,
+	                               NULL,
+	                               backup,
+	                               G_FILE_CREATE_NONE,
+	                               sio->cancel,
+	                               on_save_finished,
+	                               sio);
+	anjuta_shell_saving_push (shell);
 	
 	if (sio->file != file)
 	{
Index: plugins/git/git.plugin.in
===================================================================
--- plugins/git/git.plugin.in	(Revision 4861)
+++ plugins/git/git.plugin.in	(Arbeitskopie)
@@ -6,4 +6,4 @@
 Interfaces=IAnjutaVcs
 
 [Vcs]
-System=Git
+System=Git
\ No newline at end of file
Index: ChangeLog
===================================================================
--- ChangeLog	(Revision 4861)
+++ ChangeLog	(Arbeitskopie)
@@ -1,3 +1,21 @@
+2009-03-15  Johannes Schmid <jhs@gnome.org>
+
+	* libanjuta/anjuta-shell.c (anjuta_shell_saving_push),
+	(anjuta_shell_saving_pop):
+	* libanjuta/anjuta-shell.h:
+	* src/anjuta-app.c (anjuta_app_instance_init),
+	(anjuta_app_saving_push), (anjuta_app_saving_pop),
+	(anjuta_shell_iface_init):
+	* src/anjuta-app.h:
+	* src/anjuta.c (on_anjuta_delete_event):
+	* src/main.c (main):
+	Implemented infrastructure to wait for all async save operation before 
+	exiting
+
+	* plugins/sourceview/sourceview-io.c (on_save_finished),
+	(sourceview_io_save_as):
+	Use saving infrastructure to fix #574376 – Save doesn't always save
+
 2009-03-11  Johannes Schmid  <jhs@gnome.org>
 
 	* configure.in: Fixed "--enable-editor-scintilla"
Index: libanjuta/anjuta-shell.c
===================================================================
--- libanjuta/anjuta-shell.c	(Revision 4861)
+++ libanjuta/anjuta-shell.c	(Arbeitskopie)
@@ -754,6 +754,34 @@
 	return ANJUTA_SHELL_GET_IFACE (shell)->get_profile_manager (shell, error);
 }
 
+/**
+ * anjuta_shell_saving_push:
+ * @shell: A #AnjutaShell interface
+ *
+ * Increase the count of files that need to be saved 
+ *
+ */
+void anjuta_shell_saving_push	    (AnjutaShell* shell)
+{
+	g_return_if_fail (ANJUTA_IS_SHELL (shell));
+	
+	return ANJUTA_SHELL_GET_IFACE (shell)->saving_push (shell);
+}
+
+/**
+ * anjuta_shell_saving_push:
+ * @shell: A #AnjutaShell interface
+ *
+ * Decrease the count of files that need to be saved 
+ *
+ */
+void anjuta_shell_saving_pop	    (AnjutaShell* shell)
+{
+	g_return_if_fail (ANJUTA_IS_SHELL (shell));
+
+	return ANJUTA_SHELL_GET_IFACE (shell)->saving_pop (shell);
+}
+
 void
 anjuta_shell_session_save (AnjutaShell *shell, const gchar *session_directory,
 						   GError **error)
Index: libanjuta/anjuta-shell.h
===================================================================
--- libanjuta/anjuta-shell.h	(Revision 4861)
+++ libanjuta/anjuta-shell.h	(Arbeitskopie)
@@ -108,6 +108,8 @@
 	void (*remove_value)      (AnjutaShell  *shell,
 							   const char   *name,
 							   GError       **error);
+	void (*saving_push)       (AnjutaShell* shell);
+	void (*saving_pop)        (AnjutaShell* shell);
 	GObject* (*get_object)    (AnjutaShell  *shell,
 							   const char   *iface_name,
 							   GError       **error);
@@ -196,7 +198,10 @@
 									 AnjutaSavePrompt *prompt,
 									 GError **error);
 void anjuta_shell_notify_exit       (AnjutaShell *shell, GError **error);
+void anjuta_shell_saving_push	    (AnjutaShell* shell);
+void anjuta_shell_saving_pop	    (AnjutaShell* shell);
 
+
 /**
  * anjuta_shell_get_interface:
  * @shell: A #AnjutaShell object
