diff options
-rw-r--r-- | ChangeLog | 41 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-file-operations.c | 6 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.c | 39 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.h | 4 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-preferences-dialog.c | 2 | ||||
-rw-r--r-- | libnautilus-private/nautilus-file-operations.c | 6 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.c | 39 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.h | 4 | ||||
-rw-r--r-- | libnautilus-private/nautilus-preferences-dialog.c | 2 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 145 |
10 files changed, 252 insertions, 36 deletions
@@ -1,6 +1,47 @@ +2000-09-15 John Sullivan <sullivan@eazel.com> + + Fixed bug 1563 (Optionally hide ~-suffix files created by emacs) + Fixed bug 2274 (Implement Empty Trash confirmation preference) + + * libnautilus-extensions/nautilus-global-preferences.h: + define NAUTILUS_PREFERENCES_CONFIRM_TRASH and + NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES. + * libnautilus-extensions/nautilus-global-preferences.c: + (global_preferences_create_dialog): Put these two new preferences + on the Directory Views page; rename it Folder Views. + (global_preferences_register): Register default values for new + preferences. + * libnautilus-extensions/nautilus-preferences-dialog.c: + Increase initial height of window to account for new preferences. + There's an open bug about reorganizing the whole window for later. + + * libnautilus-extensions/nautilus-file-operations.c: + (confirm_empty_trash): Don't confirm if preference says not to. + * src/file-manager/fm-directory-view.c: + (fm_directory_view_initialize), (fm_directory_view_destroy): + Add & remove callbacks to monitor these two new preferences. + (queue_pending_files): Take SHOW_BACKUP_FILES preference into + account. + (file_name_from_uri): New helper routine to save a little code + duplication. + (fm_directory_view_confirm_deletion): Use yes_no dialog instead + of simple dialog to match other usage; improve dialog title. + (confirm_delete_from_trash): New function, confirms deleting + items from trash unless preference says not to bother. + (fm_directory_view_trash_or_delete_files): Call + confirm_delete_from_trash before deleting items from trash. + (compute_menu_item_info): Do or don't add ellipses to "Empty Trash" + and "Delete From Trash" depending on preference setting. + (schedule_update_menus_callback): New function, simple wrapper for + schedule_update_menus (called when CONFIRM_TRASH preference changes). + (filtering_changed_callback): Renamed and slightly generalized from + show_hidden_files_changed_callback, called when either the + SHOW_HIDDEN_FILES or SHOW_BACKUP_FILES preference changes. + 2000-09-15 Eli Goldberg <eli@eazel.com> * docs/smoketests.html: Added a few steps to include breakages last week. + 2000-09-15 Robin * Slomkowski <rslomkow@eazel.com> * nautilus.spec.in: removed dependencie on eog because diff --git a/libnautilus-extensions/nautilus-file-operations.c b/libnautilus-extensions/nautilus-file-operations.c index fc019d452..0101b81b0 100644 --- a/libnautilus-extensions/nautilus-file-operations.c +++ b/libnautilus-extensions/nautilus-file-operations.c @@ -35,6 +35,7 @@ #include <libnautilus-extensions/nautilus-file-changes-queue.h> #include <libnautilus-extensions/nautilus-file-utilities.h> #include <libnautilus-extensions/nautilus-glib-extensions.h> +#include <libnautilus-extensions/nautilus-global-preferences.h> #include <libnautilus-extensions/nautilus-stock-dialogs.h> #include "fm-directory-view.h" @@ -1424,6 +1425,11 @@ confirm_empty_trash (GtkWidget *parent_view) GnomeDialog *dialog; GtkWindow *parent_window; + /* Just Say Yes if the preference says not to confirm. */ + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH, TRUE)) { + return TRUE; + } + parent_window = GTK_WINDOW (gtk_widget_get_toplevel (parent_view)); dialog = nautilus_yes_no_dialog ( diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c index b536da761..4ec4d8265 100644 --- a/libnautilus-extensions/nautilus-global-preferences.c +++ b/libnautilus-extensions/nautilus-global-preferences.c @@ -109,8 +109,8 @@ global_preferences_create_dialog (void) * Directory Views pane */ directory_views_pane = nautilus_preferences_box_add_pane (preference_box, - _("Directory Views"), - _("Directory Views Settings")); + _("Folder Views"), + _("Folder Views Settings")); nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Window Behavior")); @@ -126,15 +126,27 @@ global_preferences_create_dialog (void) NAUTILUS_PREFERENCES_CLICK_POLICY, NAUTILUS_PREFERENCE_ITEM_ENUM); - nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Display")); + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Trash Behavior")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), 2, + NAUTILUS_PREFERENCES_CONFIRM_TRASH, + NAUTILUS_PREFERENCE_ITEM_BOOLEAN); + + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Display")); + + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), + 3, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, NAUTILUS_PREFERENCE_ITEM_BOOLEAN); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), - 2, + 3, + NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, + NAUTILUS_PREFERENCE_ITEM_BOOLEAN); + + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), + 3, NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS, NAUTILUS_PREFERENCE_ITEM_BOOLEAN); @@ -241,7 +253,7 @@ global_preferences_create_dialog (void) NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM); /* FIXME bugzilla.eazel.com 2560: This title phrase needs improvement. */ - nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (tradeoffs_pane), _("Make Directory Appearance Details Public")); + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (tradeoffs_pane), _("Make Folder Appearance Details Public")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (tradeoffs_pane), 2, @@ -634,6 +646,13 @@ global_preferences_register (void) FALSE, FALSE); + /* Trash confirm */ + global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_CONFIRM_TRASH, + _("Ask before deleting items from the trash"), + TRUE, + TRUE, + TRUE); + /* Click activation type */ global_preferences_register_enum_with_defaults (NAUTILUS_PREFERENCES_CLICK_POLICY, _("Click policy"), @@ -665,7 +684,7 @@ global_preferences_register (void) NAUTILUS_SPEED_TRADEOFF_ALWAYS); global_preferences_register_speed_tradeoff_with_defaults (NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA, - _("Read and write metadata in each directory"), + _("Read and write metadata in each folder"), NAUTILUS_SPEED_TRADEOFF_ALWAYS, NAUTILUS_SPEED_TRADEOFF_ALWAYS, NAUTILUS_SPEED_TRADEOFF_ALWAYS); @@ -745,7 +764,13 @@ global_preferences_register (void) global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, - _("Show hidden files"), + _("Show hidden files (starting with \".\")"), + FALSE, + FALSE, + TRUE); + + global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, + _("Show backup files (ending with \"~\")"), FALSE, FALSE, TRUE); diff --git a/libnautilus-extensions/nautilus-global-preferences.h b/libnautilus-extensions/nautilus-global-preferences.h index 111652db7..fe2fdde43 100644 --- a/libnautilus-extensions/nautilus-global-preferences.h +++ b/libnautilus-extensions/nautilus-global-preferences.h @@ -57,8 +57,12 @@ BEGIN_GNOME_DECLS /* Window options */ #define NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW "preferences/window_always_new" +/* Trash options */ +#define NAUTILUS_PREFERENCES_CONFIRM_TRASH "preferences/confirm_trash" + /* Display */ #define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES "preferences/show_hidden_files" +#define NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES "preferences/show_backup_files" #define NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS "preferences/show_special_flags" /* Home URI */ diff --git a/libnautilus-extensions/nautilus-preferences-dialog.c b/libnautilus-extensions/nautilus-preferences-dialog.c index eea159403..48d0dfd27 100644 --- a/libnautilus-extensions/nautilus-preferences-dialog.c +++ b/libnautilus-extensions/nautilus-preferences-dialog.c @@ -57,7 +57,7 @@ static const gint DEFAULT_BUTTON = 0; static const guint DEFAULT_BORDER_WIDTH = 0; static const guint PREFS_DIALOG_DEFAULT_WIDTH = 500; -static const guint PREFS_DIALOG_DEFAULT_HEIGHT = 300; +static const guint PREFS_DIALOG_DEFAULT_HEIGHT = 375; enum { diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c index fc019d452..0101b81b0 100644 --- a/libnautilus-private/nautilus-file-operations.c +++ b/libnautilus-private/nautilus-file-operations.c @@ -35,6 +35,7 @@ #include <libnautilus-extensions/nautilus-file-changes-queue.h> #include <libnautilus-extensions/nautilus-file-utilities.h> #include <libnautilus-extensions/nautilus-glib-extensions.h> +#include <libnautilus-extensions/nautilus-global-preferences.h> #include <libnautilus-extensions/nautilus-stock-dialogs.h> #include "fm-directory-view.h" @@ -1424,6 +1425,11 @@ confirm_empty_trash (GtkWidget *parent_view) GnomeDialog *dialog; GtkWindow *parent_window; + /* Just Say Yes if the preference says not to confirm. */ + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH, TRUE)) { + return TRUE; + } + parent_window = GTK_WINDOW (gtk_widget_get_toplevel (parent_view)); dialog = nautilus_yes_no_dialog ( diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c index b536da761..4ec4d8265 100644 --- a/libnautilus-private/nautilus-global-preferences.c +++ b/libnautilus-private/nautilus-global-preferences.c @@ -109,8 +109,8 @@ global_preferences_create_dialog (void) * Directory Views pane */ directory_views_pane = nautilus_preferences_box_add_pane (preference_box, - _("Directory Views"), - _("Directory Views Settings")); + _("Folder Views"), + _("Folder Views Settings")); nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Window Behavior")); @@ -126,15 +126,27 @@ global_preferences_create_dialog (void) NAUTILUS_PREFERENCES_CLICK_POLICY, NAUTILUS_PREFERENCE_ITEM_ENUM); - nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Display")); + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Trash Behavior")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), 2, + NAUTILUS_PREFERENCES_CONFIRM_TRASH, + NAUTILUS_PREFERENCE_ITEM_BOOLEAN); + + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), _("Display")); + + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), + 3, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, NAUTILUS_PREFERENCE_ITEM_BOOLEAN); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), - 2, + 3, + NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, + NAUTILUS_PREFERENCE_ITEM_BOOLEAN); + + nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (directory_views_pane), + 3, NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS, NAUTILUS_PREFERENCE_ITEM_BOOLEAN); @@ -241,7 +253,7 @@ global_preferences_create_dialog (void) NAUTILUS_PREFERENCE_ITEM_SHORT_ENUM); /* FIXME bugzilla.eazel.com 2560: This title phrase needs improvement. */ - nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (tradeoffs_pane), _("Make Directory Appearance Details Public")); + nautilus_preferences_pane_add_group (NAUTILUS_PREFERENCES_PANE (tradeoffs_pane), _("Make Folder Appearance Details Public")); nautilus_preferences_pane_add_item_to_nth_group (NAUTILUS_PREFERENCES_PANE (tradeoffs_pane), 2, @@ -634,6 +646,13 @@ global_preferences_register (void) FALSE, FALSE); + /* Trash confirm */ + global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_CONFIRM_TRASH, + _("Ask before deleting items from the trash"), + TRUE, + TRUE, + TRUE); + /* Click activation type */ global_preferences_register_enum_with_defaults (NAUTILUS_PREFERENCES_CLICK_POLICY, _("Click policy"), @@ -665,7 +684,7 @@ global_preferences_register (void) NAUTILUS_SPEED_TRADEOFF_ALWAYS); global_preferences_register_speed_tradeoff_with_defaults (NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA, - _("Read and write metadata in each directory"), + _("Read and write metadata in each folder"), NAUTILUS_SPEED_TRADEOFF_ALWAYS, NAUTILUS_SPEED_TRADEOFF_ALWAYS, NAUTILUS_SPEED_TRADEOFF_ALWAYS); @@ -745,7 +764,13 @@ global_preferences_register (void) global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, - _("Show hidden files"), + _("Show hidden files (starting with \".\")"), + FALSE, + FALSE, + TRUE); + + global_preferences_register_boolean_with_defaults (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, + _("Show backup files (ending with \"~\")"), FALSE, FALSE, TRUE); diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h index 111652db7..fe2fdde43 100644 --- a/libnautilus-private/nautilus-global-preferences.h +++ b/libnautilus-private/nautilus-global-preferences.h @@ -57,8 +57,12 @@ BEGIN_GNOME_DECLS /* Window options */ #define NAUTILUS_PREFERENCES_WINDOW_ALWAYS_NEW "preferences/window_always_new" +/* Trash options */ +#define NAUTILUS_PREFERENCES_CONFIRM_TRASH "preferences/confirm_trash" + /* Display */ #define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES "preferences/show_hidden_files" +#define NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES "preferences/show_backup_files" #define NAUTILUS_PREFERENCES_SHOW_SPECIAL_FLAGS "preferences/show_special_flags" /* Home URI */ diff --git a/libnautilus-private/nautilus-preferences-dialog.c b/libnautilus-private/nautilus-preferences-dialog.c index eea159403..48d0dfd27 100644 --- a/libnautilus-private/nautilus-preferences-dialog.c +++ b/libnautilus-private/nautilus-preferences-dialog.c @@ -57,7 +57,7 @@ static const gint DEFAULT_BUTTON = 0; static const guint DEFAULT_BORDER_WIDTH = 0; static const guint PREFS_DIALOG_DEFAULT_WIDTH = 500; -static const guint PREFS_DIALOG_DEFAULT_HEIGHT = 300; +static const guint PREFS_DIALOG_DEFAULT_HEIGHT = 375; enum { diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 986375902..295d516ea 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -116,6 +116,7 @@ struct FMDirectoryViewDetails gboolean menus_merged; gboolean show_hidden_files; + gboolean show_backup_files; }; /* forward declarations */ @@ -175,13 +176,14 @@ static void zoomable_zoom_out_callback static void zoomable_zoom_to_fit_callback (NautilusZoomable *zoomable, FMDirectoryView *directory_view); static void schedule_update_menus (FMDirectoryView *view); +static void schedule_update_menus_callback (gpointer callback_data); static void schedule_idle_display_of_pending_files (FMDirectoryView *view); static void unschedule_idle_display_of_pending_files (FMDirectoryView *view); static void schedule_timeout_display_of_pending_files (FMDirectoryView *view); static void unschedule_timeout_display_of_pending_files (FMDirectoryView *view); static void unschedule_display_of_pending_files (FMDirectoryView *view); static void disconnect_model_handlers (FMDirectoryView *view); -static void show_hidden_files_changed_callback (gpointer callback_data); +static void filtering_changed_callback (gpointer callback_data); static void get_required_metadata_keys (FMDirectoryView *view, GList **directory_keys_result, GList **file_keys_result); @@ -939,13 +941,26 @@ fm_directory_view_initialize (FMDirectoryView *directory_view) gtk_widget_show (GTK_WIDGET (directory_view)); - /* Obtain the user level for filtering */ + /* Obtain the filtering preferences */ directory_view->details->show_hidden_files = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, FALSE); + directory_view->details->show_backup_files = + nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE); + /* Keep track of changes in this pref to filter files accordingly. */ nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, - show_hidden_files_changed_callback, + filtering_changed_callback, + directory_view); + + /* Keep track of changes in this pref to filter files accordingly. */ + nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, + filtering_changed_callback, + directory_view); + + /* Keep track of changes in this pref to display menu names correctly. */ + nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH, + schedule_update_menus_callback, directory_view); /* Keep track of changes in text attribute names */ @@ -1015,7 +1030,13 @@ fm_directory_view_destroy (GtkObject *object) } nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, - show_hidden_files_changed_callback, + filtering_changed_callback, + view); + nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, + filtering_changed_callback, + view); + nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH, + schedule_update_menus_callback, view); nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_ICON_CAPTIONS, text_attribute_names_changed_callback, @@ -1580,9 +1601,10 @@ queue_pending_files (FMDirectoryView *view, GList *files_iterator; NautilusFile *file; char * name; + gboolean include_file; /* Filter out hidden files if needed */ - if (!view->details->show_hidden_files) { + if (!view->details->show_hidden_files || !view->details->show_backup_files) { /* FIXME bugzilla.eazel.com 653: * Eventually this should become a generic filtering thingy. */ @@ -1596,8 +1618,16 @@ queue_pending_files (FMDirectoryView *view, name = nautilus_file_get_name (file); g_assert (name != NULL); - - if (!nautilus_str_has_prefix (name, ".")) { + + if (!view->details->show_hidden_files && nautilus_str_has_prefix (name, ".")) { + include_file = FALSE; + } else if (!view->details->show_backup_files && nautilus_str_has_suffix (name, "~")) { + include_file = FALSE; + } else { + include_file = TRUE; + } + + if (include_file) { filtered_files = g_list_append (filtered_files, file); } @@ -2067,14 +2097,26 @@ fm_directory_view_can_move_file_to_trash (FMDirectoryView *view, NautilusFile *f return result; } +static char * +file_name_from_uri (const char *uri) +{ + NautilusFile *file; + char *file_name; + + file = nautilus_file_get (uri); + file_name = nautilus_file_get_name (file); + nautilus_file_unref (file); + + return file_name; +} + static gboolean fm_directory_view_confirm_deletion (FMDirectoryView *view, GList *uris, gboolean all) { + GnomeDialog *dialog; char *prompt; int uri_count; - NautilusFile *file; char *file_name; - gboolean result; g_assert (FM_IS_DIRECTORY_VIEW (view)); @@ -2082,9 +2124,7 @@ fm_directory_view_confirm_deletion (FMDirectoryView *view, GList *uris, gboolean g_assert (uri_count > 0); if (uri_count == 1) { - file = nautilus_file_get ( (char *)uris->data); - file_name = nautilus_file_get_name (file); - nautilus_file_unref (file); + file_name = file_name_from_uri ((char *)uris->data); prompt = g_strdup_printf (_("\"%s\" cannot be moved to the trash. Do " "you want to delete it immediately?"), file_name); @@ -2101,11 +2141,57 @@ fm_directory_view_confirm_deletion (FMDirectoryView *view, GList *uris, gboolean } } - result = nautilus_simple_dialog (GTK_WIDGET (view), prompt, _("Can't Move to Trash"), - _("Delete"), _("Cancel"), NULL) == 0; + dialog = nautilus_yes_no_dialog ( + prompt, + _("Nautilus: Delete immediately?"), + _("Delete"), + GNOME_STOCK_BUTTON_CANCEL, + get_containing_window (view)); g_free (prompt); - return result; + + return gnome_dialog_run (dialog) == GNOME_OK; +} + +static gboolean +confirm_delete_from_trash (FMDirectoryView *view, GList *uris) +{ + GnomeDialog *dialog; + char *prompt; + char *file_name; + int uri_count; + + g_assert (FM_IS_DIRECTORY_VIEW (view)); + + /* Just Say Yes if the preference says not to confirm. */ + if (!nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH, TRUE)) { + return TRUE; + } + + uri_count = g_list_length (uris); + g_assert (uri_count > 0); + + if (uri_count == 1) { + file_name = file_name_from_uri ((char *)uris->data); + + prompt = g_strdup_printf (_("Are you sure you want to permanently delete \"%s\" " + "from the trash?"), file_name); + g_free (file_name); + } else { + prompt = g_strdup_printf (_("Are you sure you want to permanently delete " + "the %d selected items from the trash?"), uri_count); + } + + dialog = nautilus_yes_no_dialog ( + prompt, + _("Nautilus: Delete from Trash?"), + _("Delete"), + GNOME_STOCK_BUTTON_CANCEL, + get_containing_window (view)); + + g_free (prompt); + + return gnome_dialog_run (dialog) == GNOME_OK; } static void @@ -2151,8 +2237,10 @@ fm_directory_view_trash_or_delete_files (FMDirectoryView *view, GList *files) } if (in_trash_uris != NULL && moveable_uris == NULL && unmoveable_uris == NULL) { - /* FIXME bugzilla.eazel.com 2274: Confirm here if preference set */ - nautilus_file_operations_delete (in_trash_uris, GTK_WIDGET (view)); + /* Don't confirm if the preference says not to. */ + if (confirm_delete_from_trash (view, in_trash_uris)) { + nautilus_file_operations_delete (in_trash_uris, GTK_WIDGET (view)); + } } if (unmoveable_uris != NULL) { @@ -2372,7 +2460,11 @@ compute_menu_item_info (FMDirectoryView *directory_view, name = g_strdup (_("New Folder")); *return_sensitivity = fm_directory_view_supports_creating_files (directory_view); } else if (strcmp (path, FM_DIRECTORY_VIEW_MENU_PATH_DELETE) == 0) { - name = g_strdup (_("Delete from _Trash")); + if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH, TRUE)) { + name = g_strdup (_("Delete from _Trash...")); + } else { + name = g_strdup (_("Delete from _Trash")); + } *return_sensitivity = selection != NULL; } else if (strcmp (path, FM_DIRECTORY_VIEW_MENU_PATH_TRASH) == 0) { name = g_strdup (_("Move to _Trash")); @@ -2394,7 +2486,11 @@ compute_menu_item_info (FMDirectoryView *directory_view, name = g_strdup (_("Show _Properties")); *return_sensitivity = selection != NULL && fm_directory_view_supports_properties (directory_view); } else if (strcmp (path, FM_DIRECTORY_VIEW_MENU_PATH_EMPTY_TRASH) == 0) { - name = g_strdup (_("_Empty Trash")); + if (nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH, TRUE)) { + name = g_strdup (_("_Empty Trash...")); + } else { + name = g_strdup (_("_Empty Trash")); + } *return_sensitivity = !nautilus_trash_monitor_is_empty (); } else if (strcmp (path, NAUTILUS_MENU_PATH_SELECT_ALL_ITEM) == 0) { name = g_strdup (_("_Select All Files")); @@ -3949,7 +4045,13 @@ fm_directory_view_update_menus (FMDirectoryView *view) } static void -show_hidden_files_changed_callback (gpointer callback_data) +schedule_update_menus_callback (gpointer callback_data) +{ + schedule_update_menus (FM_DIRECTORY_VIEW (callback_data)); +} + +static void +filtering_changed_callback (gpointer callback_data) { FMDirectoryView *directory_view; char *same_uri; @@ -3959,6 +4061,9 @@ show_hidden_files_changed_callback (gpointer callback_data) directory_view->details->show_hidden_files = nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES, FALSE); + directory_view->details->show_backup_files = + nautilus_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES, FALSE); + /* Reload the current uri so that the filtering changes take place. */ if (directory_view->details->model != NULL) { same_uri = nautilus_directory_get_uri (directory_view->details->model); |