diff options
author | Jean-François Rameau <jframeau@cvs.gnome.org> | 2005-05-29 22:29:02 +0800 |
---|---|---|
committer | Jean-François Rameau <jframeau@src.gnome.org> | 2005-05-29 22:29:02 +0800 |
commit | 572d72e3739f3e1086544963a524ce74cffdbb3d (patch) | |
tree | 9f8df0b121c5a99846b424b4c6213328f9b1023c /lib | |
parent | d4aa01ce84c7a63669577252d3cbe1cce2e0ac3a (diff) | |
download | gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.tar gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.tar.gz gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.tar.bz2 gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.tar.lz gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.tar.xz gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.tar.zst gsoc2013-epiphany-572d72e3739f3e1086544963a524ce74cffdbb3d.zip |
Add warnings: - when downloading to not writable directory, - when
2005-05-29 Jean-François Rameau <jframeau@cvs.gnome.org>
* lib/ephy-gui.c: (ephy_gui_confirm_overwrite_file):
Add warnings:
- when downloading to not writable directory,
- when downloading to not writable file (overwrite).
Fixes bug #124236
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ephy-gui.c | 72 |
1 files changed, 64 insertions, 8 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c index 7cf082320..21c3bced2 100644 --- a/lib/ephy-gui.c +++ b/lib/ephy-gui.c @@ -193,27 +193,83 @@ ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename) { GtkWidget *dialog; - char *display_name, *path; - gboolean retval, writable; + char *display_name; + gboolean retval; if (filename == NULL) return FALSE; if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { + char *path = g_path_get_dirname (filename); + gboolean writable = access (path, W_OK) == 0; + /* check if path is writable to */ - path = g_path_get_dirname (filename); - writable = access (path, W_OK) == 0; + if (!writable) + { + dialog = gtk_message_dialog_new ( + parent ? GTK_WINDOW(parent) : NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("Directory %s is not writable"), path); + + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (dialog), + _("You do not have permission to " + "create files in this directory.")); + + gtk_window_set_title (GTK_WINDOW (dialog), _("Directory not writable")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser"); + + if (parent != NULL) + { + gtk_window_group_add_window ( + ephy_gui_ensure_window_group (GTK_WINDOW (parent)), + GTK_WINDOW (dialog)); + } + + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + } + g_free (path); - /* FIXME put up some UI to inform the user */ return writable; } + display_name = g_filename_display_basename (filename); + /* check if file is writable */ - /* FIXME put up some UI to inform the user */ - if (access (filename, W_OK) != 0) return FALSE; + if (access (filename, W_OK) != 0) + { + dialog = gtk_message_dialog_new ( + parent ? GTK_WINDOW(parent) : NULL, + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_CLOSE, + _("File %s is not writable"), display_name); - display_name = g_filename_display_basename (filename); + gtk_message_dialog_format_secondary_text ( + GTK_MESSAGE_DIALOG (dialog), + _("You do not have permission to overwrite this file.")); + + gtk_window_set_title (GTK_WINDOW (dialog), _("File not writable")); + gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser"); + + if (parent != NULL) + { + gtk_window_group_add_window ( + ephy_gui_ensure_window_group (GTK_WINDOW (parent)), + GTK_WINDOW (dialog)); + } + + gtk_dialog_run (GTK_DIALOG (dialog)); + + gtk_widget_destroy (dialog); + + return FALSE; + } dialog = gtk_message_dialog_new (parent ? GTK_WINDOW (parent) : NULL, |