diff options
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-file-operations.c | 44 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-icon-dnd.c | 2 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-stock-dialogs.c | 36 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-stock-dialogs.h | 1 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 44 | ||||
-rw-r--r-- | libnautilus-private/nautilus-icon-dnd.c | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-stock-dialogs.c | 36 | ||||
-rw-r--r-- | libnautilus-private/nautilus-stock-dialogs.h | 1 | ||||
-rw-r--r-- | src/nautilus-location-bar.c | 1 |
10 files changed, 133 insertions, 54 deletions
@@ -1,3 +1,23 @@ +2000-09-28 Rebecca Schulman <rebecka@eazel.com> + Fixed bug 3231, which crashed nautilus when file dialogs + were closed without choosing an option. Added a parameter + to nautilus_simple_dialog to allow the close button to be ignored + + * libnautilus-extensions/nautilus-file-operations.c: + (handle_xfer_vfs_error), (handle_xfer_overwrite), + (nautilus_file_operations_copy_move), + (nautilus_file_operations_move_to_trash): + * libnautilus-extensions/nautilus-icon-dnd.c: + (confirm_switch_to_manual_layout): + * src/nautilus-location-bar.c: (drag_data_received_callback): + Switched dialogs which really should receive a response from + the user to use dialog boxes which ignore the close box + + * libnautilus-extensions/nautilus-stock-dialogs.c: + * libnautilus-extensions/nautilus-stock-dialogs.h: + (delete_event_callback), (nautilus_simple_dialog): + Made the dialog ignore delete events. + 2000-09-28 J Shane Culpepper <pepper@eazel.com> * components/services/summary/nautilus-view/nautilus-summary-view.c diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c index 42adc2fef..56f6a4a5e 100644 --- a/libnautilus-extensions/nautilus-file-operations.c +++ b/libnautilus-extensions/nautilus-file-operations.c @@ -361,29 +361,25 @@ handle_xfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, || progress_info->vfs_status == GNOME_VFS_ERROR_READ_ONLY || progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) { - if (progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) { - text = g_strdup_printf - (_("Error while %s \"%s\".\n" - "The destination is read-only. " - "Would you like to continue?"), - current_operation, - unescaped_name); - } else { - text = g_strdup_printf - (_("Error while %s \"%s\".\n" - "The destination is read-only. " - "Would you like to continue?"), - current_operation, - unescaped_name); - } + text = g_strdup_printf + (_("Error while %s \"%s\".\n" + "The destination is read-only. " + "Would you like to continue?"), + current_operation, + unescaped_name); g_free (current_operation); g_free (unescaped_name); result = nautilus_simple_dialog - (xfer_info->parent_view, text, - _("Error while Copying"), + (xfer_info->parent_view, TRUE, text, + _("Error while Copying"), _("Skip"), _("Stop"), NULL); - + while (result == -1) { + result = nautilus_simple_dialog + (xfer_info->parent_view, TRUE, text, + _("Error while Copying"), + _("Skip"), _("Stop"), NULL); + } g_free (text); switch (result) { @@ -407,7 +403,7 @@ handle_xfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, g_free (unescaped_name); result = nautilus_simple_dialog - (xfer_info->parent_view, text, + (xfer_info->parent_view, TRUE, text, _("Error while Copying"), _("Skip"), _("Retry"), _("Stop"), NULL); g_free (text); @@ -458,7 +454,7 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info, * Replace All */ result = nautilus_simple_dialog - (xfer_info->parent_view, text, + (xfer_info->parent_view, TRUE, text, _("Conflict while Copying"), _("Replace"), _("Skip"), NULL); switch (result) { @@ -472,7 +468,7 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info, } } else { result = nautilus_simple_dialog - (xfer_info->parent_view, text, + (xfer_info->parent_view, TRUE, text, _("Conflict while Copying"), _("Replace All"), _("Replace"), _("Skip"), NULL); @@ -1135,6 +1131,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, if (check_target_directory_is_or_in_trash (trash_dir_uri, target_dir_uri)) { nautilus_simple_dialog (view, + FALSE, _("You cannot copy items into the Trash."), _("Can't Copy to Trash"), GNOME_STOCK_BUTTON_OK, NULL, NULL); @@ -1150,6 +1147,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, if (trash_dir_uri != NULL && gnome_vfs_uri_equal (uri, trash_dir_uri)) { nautilus_simple_dialog (view, + FALSE, ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0) ? _("The Trash must remain on the desktop.") : _("You cannot copy the Trash."), @@ -1171,6 +1169,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, || gnome_vfs_uri_is_parent (uri, target_dir_uri, TRUE))) { nautilus_simple_dialog (view, + FALSE, ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0) ? _("You cannot move a folder into itself.") : _("You cannot copy a folder into itself."), @@ -1330,6 +1329,7 @@ nautilus_file_operations_move_to_trash (const GList *item_uris, if (gnome_vfs_uri_equal (source_uri, trash_dir_uri)) { nautilus_simple_dialog (parent_view, + FALSE, _("The Trash must remain on the desktop."), _("Can't Change Trash Location"), GNOME_STOCK_BUTTON_OK, NULL, NULL); @@ -1341,7 +1341,7 @@ nautilus_file_operations_move_to_trash (const GList *item_uris, (_("You cannot throw \"%s\" into the Trash."), item_name); nautilus_simple_dialog - (parent_view, text, + (parent_view, FALSE, text, _("Error Moving to Trash"), GNOME_STOCK_BUTTON_OK, NULL, NULL); bail = TRUE; diff --git a/libnautilus-extensions/nautilus-icon-dnd.c b/libnautilus-extensions/nautilus-icon-dnd.c index 11f8d4c96..d46fea42c 100644 --- a/libnautilus-extensions/nautilus-icon-dnd.c +++ b/libnautilus-extensions/nautilus-icon-dnd.c @@ -692,7 +692,7 @@ confirm_switch_to_manual_layout (NautilusIconContainer *container) } return nautilus_simple_dialog - (GTK_WIDGET (container), message, + (GTK_WIDGET (container), TRUE, message, _("Switch to Manual Layout?"), _("Switch"), GNOME_STOCK_BUTTON_CANCEL, NULL) == 0; } diff --git a/libnautilus-extensions/nautilus-stock-dialogs.c b/libnautilus-extensions/nautilus-stock-dialogs.c index ccabacfec..ae34c91dd 100644 --- a/libnautilus-extensions/nautilus-stock-dialogs.c +++ b/libnautilus-extensions/nautilus-stock-dialogs.c @@ -252,13 +252,26 @@ convert_varargs_to_name_array (va_list args) return plain_ole_array; } +static gboolean +delete_event_callback (gpointer data, + gpointer user_data) +{ + g_return_val_if_fail (GNOME_IS_DIALOG (data), FALSE); + gtk_signal_emit_stop_by_name (GTK_OBJECT (data), + "delete_event"); + return TRUE; +} + int -nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, ...) +nautilus_simple_dialog (GtkWidget *parent, gboolean ignore_close_box, + const char *text, const char *title, ...) { va_list button_title_args; const char **button_titles; GtkWidget *dialog; GtkWidget *top_widget; + int result; + /* Create the dialog. */ va_start (button_title_args, title); @@ -268,8 +281,17 @@ nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, g_free (button_titles); /* Allow close. */ - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); + if (ignore_close_box) { + gtk_signal_connect (GTK_OBJECT (dialog), + "delete_event", + GTK_SIGNAL_FUNC (delete_event_callback), + NULL); + + } + gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); + + /* Parent it if asked to. */ if (parent != NULL) { top_widget = gtk_widget_get_toplevel (parent); @@ -280,10 +302,16 @@ nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, /* Title it if asked to. */ add_label_to_dialog (GNOME_DIALOG (dialog), text); - + /* Run it. */ gtk_widget_show_all (dialog); - return gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + while (result == -1 && ignore_close_box) { + gtk_widget_show (GTK_WIDGET (dialog)); + result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + } + + return result; } static void diff --git a/libnautilus-extensions/nautilus-stock-dialogs.h b/libnautilus-extensions/nautilus-stock-dialogs.h index c60fd53ea..4234c9d3c 100644 --- a/libnautilus-extensions/nautilus-stock-dialogs.h +++ b/libnautilus-extensions/nautilus-stock-dialogs.h @@ -40,6 +40,7 @@ void nautilus_timed_wait_stop (NautilusCancelCallback cancel_ /* Basic dialog with buttons. */ int nautilus_simple_dialog (GtkWidget *parent, + gboolean ignore_close_box, const char *text, const char *title, ...); diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index 42adc2fef..56f6a4a5e 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -361,29 +361,25 @@ handle_xfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, || progress_info->vfs_status == GNOME_VFS_ERROR_READ_ONLY || progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) { - if (progress_info->vfs_status == GNOME_VFS_ERROR_ACCESS_DENIED) { - text = g_strdup_printf - (_("Error while %s \"%s\".\n" - "The destination is read-only. " - "Would you like to continue?"), - current_operation, - unescaped_name); - } else { - text = g_strdup_printf - (_("Error while %s \"%s\".\n" - "The destination is read-only. " - "Would you like to continue?"), - current_operation, - unescaped_name); - } + text = g_strdup_printf + (_("Error while %s \"%s\".\n" + "The destination is read-only. " + "Would you like to continue?"), + current_operation, + unescaped_name); g_free (current_operation); g_free (unescaped_name); result = nautilus_simple_dialog - (xfer_info->parent_view, text, - _("Error while Copying"), + (xfer_info->parent_view, TRUE, text, + _("Error while Copying"), _("Skip"), _("Stop"), NULL); - + while (result == -1) { + result = nautilus_simple_dialog + (xfer_info->parent_view, TRUE, text, + _("Error while Copying"), + _("Skip"), _("Stop"), NULL); + } g_free (text); switch (result) { @@ -407,7 +403,7 @@ handle_xfer_vfs_error (const GnomeVFSXferProgressInfo *progress_info, g_free (unescaped_name); result = nautilus_simple_dialog - (xfer_info->parent_view, text, + (xfer_info->parent_view, TRUE, text, _("Error while Copying"), _("Skip"), _("Retry"), _("Stop"), NULL); g_free (text); @@ -458,7 +454,7 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info, * Replace All */ result = nautilus_simple_dialog - (xfer_info->parent_view, text, + (xfer_info->parent_view, TRUE, text, _("Conflict while Copying"), _("Replace"), _("Skip"), NULL); switch (result) { @@ -472,7 +468,7 @@ handle_xfer_overwrite (const GnomeVFSXferProgressInfo *progress_info, } } else { result = nautilus_simple_dialog - (xfer_info->parent_view, text, + (xfer_info->parent_view, TRUE, text, _("Conflict while Copying"), _("Replace All"), _("Replace"), _("Skip"), NULL); @@ -1135,6 +1131,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, if (check_target_directory_is_or_in_trash (trash_dir_uri, target_dir_uri)) { nautilus_simple_dialog (view, + FALSE, _("You cannot copy items into the Trash."), _("Can't Copy to Trash"), GNOME_STOCK_BUTTON_OK, NULL, NULL); @@ -1150,6 +1147,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, if (trash_dir_uri != NULL && gnome_vfs_uri_equal (uri, trash_dir_uri)) { nautilus_simple_dialog (view, + FALSE, ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0) ? _("The Trash must remain on the desktop.") : _("You cannot copy the Trash."), @@ -1171,6 +1169,7 @@ nautilus_file_operations_copy_move (const GList *item_uris, || gnome_vfs_uri_is_parent (uri, target_dir_uri, TRUE))) { nautilus_simple_dialog (view, + FALSE, ((move_options & GNOME_VFS_XFER_REMOVESOURCE) != 0) ? _("You cannot move a folder into itself.") : _("You cannot copy a folder into itself."), @@ -1330,6 +1329,7 @@ nautilus_file_operations_move_to_trash (const GList *item_uris, if (gnome_vfs_uri_equal (source_uri, trash_dir_uri)) { nautilus_simple_dialog (parent_view, + FALSE, _("The Trash must remain on the desktop."), _("Can't Change Trash Location"), GNOME_STOCK_BUTTON_OK, NULL, NULL); @@ -1341,7 +1341,7 @@ nautilus_file_operations_move_to_trash (const GList *item_uris, (_("You cannot throw \"%s\" into the Trash."), item_name); nautilus_simple_dialog - (parent_view, text, + (parent_view, FALSE, text, _("Error Moving to Trash"), GNOME_STOCK_BUTTON_OK, NULL, NULL); bail = TRUE; diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c index 11f8d4c96..d46fea42c 100644 --- a/libnautilus-private/nautilus-icon-dnd.c +++ b/libnautilus-private/nautilus-icon-dnd.c @@ -692,7 +692,7 @@ confirm_switch_to_manual_layout (NautilusIconContainer *container) } return nautilus_simple_dialog - (GTK_WIDGET (container), message, + (GTK_WIDGET (container), TRUE, message, _("Switch to Manual Layout?"), _("Switch"), GNOME_STOCK_BUTTON_CANCEL, NULL) == 0; } diff --git a/libnautilus-private/nautilus-stock-dialogs.c b/libnautilus-private/nautilus-stock-dialogs.c index ccabacfec..ae34c91dd 100644 --- a/libnautilus-private/nautilus-stock-dialogs.c +++ b/libnautilus-private/nautilus-stock-dialogs.c @@ -252,13 +252,26 @@ convert_varargs_to_name_array (va_list args) return plain_ole_array; } +static gboolean +delete_event_callback (gpointer data, + gpointer user_data) +{ + g_return_val_if_fail (GNOME_IS_DIALOG (data), FALSE); + gtk_signal_emit_stop_by_name (GTK_OBJECT (data), + "delete_event"); + return TRUE; +} + int -nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, ...) +nautilus_simple_dialog (GtkWidget *parent, gboolean ignore_close_box, + const char *text, const char *title, ...) { va_list button_title_args; const char **button_titles; GtkWidget *dialog; GtkWidget *top_widget; + int result; + /* Create the dialog. */ va_start (button_title_args, title); @@ -268,8 +281,17 @@ nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, g_free (button_titles); /* Allow close. */ - gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); + if (ignore_close_box) { + gtk_signal_connect (GTK_OBJECT (dialog), + "delete_event", + GTK_SIGNAL_FUNC (delete_event_callback), + NULL); + + } + gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE); + + /* Parent it if asked to. */ if (parent != NULL) { top_widget = gtk_widget_get_toplevel (parent); @@ -280,10 +302,16 @@ nautilus_simple_dialog (GtkWidget *parent, const char *text, const char *title, /* Title it if asked to. */ add_label_to_dialog (GNOME_DIALOG (dialog), text); - + /* Run it. */ gtk_widget_show_all (dialog); - return gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + while (result == -1 && ignore_close_box) { + gtk_widget_show (GTK_WIDGET (dialog)); + result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + } + + return result; } static void diff --git a/libnautilus-private/nautilus-stock-dialogs.h b/libnautilus-private/nautilus-stock-dialogs.h index c60fd53ea..4234c9d3c 100644 --- a/libnautilus-private/nautilus-stock-dialogs.h +++ b/libnautilus-private/nautilus-stock-dialogs.h @@ -40,6 +40,7 @@ void nautilus_timed_wait_stop (NautilusCancelCallback cancel_ /* Basic dialog with buttons. */ int nautilus_simple_dialog (GtkWidget *parent, + gboolean ignore_close_box, const char *text, const char *title, ...); diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c index 8d7194718..125753b07 100644 --- a/src/nautilus-location-bar.c +++ b/src/nautilus-location-bar.c @@ -133,6 +133,7 @@ drag_data_received_callback (GtkWidget *widget, name_count); new_windows_for_extras = nautilus_simple_dialog (GTK_WIDGET (nautilus_location_bar_get_window (widget)), + TRUE, prompt, _("View in Multiple Windows?"), GNOME_STOCK_BUTTON_OK, |