I talked with upstream again and mentionned the behavior of firefox and
Epi this time, and upstream proposed a patch which I attach here.
--
Lo�c Minier <[EMAIL PROTECTED]>
"Neutral President: I have no strong feelings one way or the other."
--- orig/utils/gul-gui.c
+++ mod/utils/gul-gui.c
@@ -28,6 +28,7 @@
/* system includes */
#include <ctype.h>
#include <string.h>
+#include <unistd.h>
#include <glib/gi18n.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtkmain.h>
@@ -374,9 +375,42 @@ gul_gui_confirm_overwrite_file (GtkWidge
g_return_val_if_fail (filename != NULL, FALSE);
+ /* See if the file exists */
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
{
- return TRUE;
+ char *path = g_path_get_dirname (filename);
+ char *utf8Path;
+
+ /* Check that files can be created in the specified directory */
+ if (access (path, W_OK) == 0)
+ {
+ g_free (path);
+ return TRUE;
+ }
+
+ utf8Path = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
+
+ dialog = hig_alert_new (parent ? GTK_WINDOW(parent) : NULL,
+ GTK_DIALOG_MODAL,
+ HIG_ALERT_ERROR,
+ _("Directory not writable"),
+ NULL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ hig_alert_set_secondary_printf (HIG_ALERT(dialog),
+ _("You do not have permission
to "
+ "create files in %s."),
+ utf8Path);
+
+ g_free (path);
+ g_free (utf8Path);
+
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+ return FALSE;
}
utf8File = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
@@ -388,6 +422,33 @@ gul_gui_confirm_overwrite_file (GtkWidge
fullname = g_strdup_printf ("<tt>\"%s\"</tt>", tmp);
g_free (tmp);
+ /* See if we have perms to overwrite it, or whether to ask about
+ * overwriting it */
+ if (access (filename, W_OK) == -1)
+ {
+ dialog = hig_alert_new (parent ? GTK_WINDOW(parent) : NULL,
+ GTK_DIALOG_MODAL,
+ HIG_ALERT_ERROR,
+ NULL, NULL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+
+ hig_alert_set_primary_printf (HIG_ALERT(dialog),
+ _("File \"%s\" is not writable"),
basename);
+ hig_alert_set_secondary_printf (HIG_ALERT(dialog),
+ _("You do not have permission
to overwrite %s."),
+ fullname);
+
+ g_free (basename);
+ g_free (fullname);
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ gtk_widget_destroy (dialog);
+ return FALSE;
+ }
+
+
dialog = hig_alert_new (parent ? GTK_WINDOW(parent) : NULL,
GTK_DIALOG_MODAL,
HIG_ALERT_CONFIRMATION,