gedit string freeze breakage



According to what I know, the string freeze is still in effect.
It seems this change in bug-buddy broke it by changing one message and
adding a new one (or at least translators were not informed about this):

----------------------------
revision 1.13
date: 2002/08/13 18:31:00;  author: federico;  state: Exp;  lines: +52 -10
2002-08-13  Federico Mena Quintero  <federico@ximian.com>

        Fixes #90231.

        * gedit-file-selector-util.c (ok_clicked_cb): Test whether the
        file is read-only and present a confirmation dialog in that case.
        (replace_read_only_file): New function.
        (replace_existing_file): Use the replace_dialog() core.
        (replace_dialog): Moved the replace_existing_file() code to here
        and made it more generic.

        * gedit-document.c (gedit_document_save_as): Tell
        gedit_document_save_as_real() to create a backup file.

        * gedit-file.c (gedit_file_open_uri_list):
        gtk_message_dialog_new() takes a printf() format, so don't compose
        the string first - it may contain percent signs which will screw
        us here.

        * gedit-print.c (gedit_print_error_dialog): Likewise.
----------------------------


I don't know much about this change, maybe it's more trouble reverting
it (I'm attaching a diff of this change), but if further string changes
are expected, please branch gedit for gnome-2-0 or be more careful about
changing strings, or please at least give notice to translators on
gnome-i18n@gnome.org immediately after the change was committed.


Christian

Index: src/gedit-file-selector-util.c
===================================================================
RCS file: /cvs/gnome/gedit/src/gedit-file-selector-util.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- src/gedit-file-selector-util.c	23 Jul 2002 15:30:46 -0000	1.12
+++ src/gedit-file-selector-util.c	13 Aug 2002 18:31:00 -0000	1.13
@@ -51,6 +51,8 @@
 #include <bonobo/bonobo-file-selector-util.h>
 
 #include <string.h>
+#include <unistd.h>
+#include <errno.h>
 
 #include <bonobo/bonobo-event-source.h>
 #include <bonobo/bonobo-exception.h>
@@ -82,8 +84,11 @@
 	return TRUE;
 }
 
+/* Displays a confirmation dialog for whether to replace a file.  The message
+ * should contain a %s to include the file name.
+ */
 static gboolean
-replace_existing_file (GtkWindow *parent, const gchar* file_name)
+replace_dialog (GtkWindow *parent, const gchar *message, const gchar *file_name)
 {
 	GtkWidget *msgbox;
 	gint ret;
@@ -108,13 +113,11 @@
 	g_free (full_formatted_uri);
 
 	msgbox = gtk_message_dialog_new (parent,
-			GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-			GTK_MESSAGE_QUESTION,
-			GTK_BUTTONS_NONE,
-			_("A file named ''%s'' already exists.\n"
-			  "Do you want to replace it with the "
-			  "one you are saving?"), 
-			uri_for_display);
+					 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+					 GTK_MESSAGE_QUESTION,
+					 GTK_BUTTONS_NONE,
+					 message, 
+					 uri_for_display);
 	g_free (uri_for_display);
 
 	/* Add Don't Replace button */
@@ -136,6 +139,28 @@
 	return (ret == GTK_RESPONSE_YES);
 }
 
+/* Presents a confirmation dialog for whether to replace an existing file */
+static gboolean
+replace_existing_file (GtkWindow *parent, const gchar* file_name)
+{
+	return replace_dialog (parent,
+			       _("A file named \"%s\" already exists.\n"
+				 "Do you want to replace it with the "
+				 "one you are saving?"),
+			       file_name);
+}
+
+/* Presents a confirmation dialog for whether to replace a read-only file */
+static gboolean
+replace_read_only_file (GtkWindow *parent, const gchar* file_name)
+{
+	return replace_dialog (parent,
+			       _("The file \"%s\" is read-only.\n"
+				 "Do you want to try to replace it with the "
+				 "one you are saving?"),
+			       file_name);
+}
+
 static void
 listener_cb (BonoboListener *listener, 
 	     const gchar *event_name,
@@ -268,6 +293,16 @@
 		return g_strconcat (dir, file, NULL);
 }
 
+/* Tests whether we have write permissions for a file */
+static gboolean
+is_read_only (const gchar *filename)
+{
+	if (access (filename, W_OK) == -1)
+		return (errno == EACCES);
+	else
+		return FALSE;
+}
+
 static void
 ok_clicked_cb (GtkWidget *widget, gpointer data)
 {
@@ -298,9 +333,16 @@
 	} 
 	else
 	{	
-		if (g_file_test (file_name, G_FILE_TEST_EXISTS)) 
-			if (!replace_existing_file (GTK_WINDOW (fsel), file_name))
+		if (g_file_test (file_name, G_FILE_TEST_EXISTS))
+		{
+			if (is_read_only (file_name))
+			{
+				if (!replace_read_only_file (GTK_WINDOW (fsel), file_name))
+					return;
+			}
+			else if (!replace_existing_file (GTK_WINDOW (fsel), file_name))
 				return;
+		}
 
 		gtk_widget_hide (GTK_WIDGET (fsel));
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]