--- eog-2.28.2/src/eog-window.c	2011-03-02 12:35:46.566311721 -0500
+++ eog-2.28.2-bz320688/src/eog-window.c	2011-03-02 12:36:24.245229000 -0500
@@ -64,6 +64,7 @@
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
+#include <glib/gstdio.h>
 
 #if HAVE_LCMS
 #include <X11/Xlib.h>
@@ -2794,6 +2795,29 @@
 	g_object_unref (job);
 }
 
+static gboolean
+eog_window_overwite_readonly_error (GtkAction *action, gpointer user_data, GFile *file)
+{
+  GtkMessageDialog *dialog;
+  EogWindow *window;
+  gint response;
+
+  window = EOG_WINDOW (user_data);
+
+  dialog = (GtkMessageDialog *) gtk_message_dialog_new_with_markup (GTK_WINDOW(window),
+											   GTK_DIALOG_DESTROY_WITH_PARENT,
+											   GTK_MESSAGE_ERROR,
+											   GTK_BUTTONS_OK,
+											   "<span weight=\"bold\" size=\"large\">Error writing file</span>");
+
+  gtk_message_dialog_format_secondary_text (dialog, "Saving '%s' failed:\n\nPermission denied", g_file_get_path (file));
+  gtk_window_set_title (GTK_WINDOW(dialog), "Error writing file.");
+
+  response = gtk_dialog_run (GTK_DIALOG (dialog));
+  gtk_widget_hide (GTK_WIDGET(dialog));
+  return (response);
+}
+
 static void
 eog_window_cmd_save (GtkAction *action, gpointer user_data)
 {
@@ -2874,6 +2898,14 @@
 
 		file = eog_window_retrieve_save_as_file (window, images->data);
 
+		if (file) {
+		  if (g_access((gchar *)file, W_OK)) {
+			if (!eog_window_overwite_readonly_error (action, user_data, file)) {
+			  return;
+			}
+		  }
+		}
+
 		if (!file) {
 			g_list_free (images);
 			return;
