[nautilus] Hide the 'Arrange by Trash Time' option if we're not in the trash.
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] Hide the 'Arrange by Trash Time' option if we're not in the trash.
- Date: Thu, 13 May 2010 10:33:58 +0000 (UTC)
commit b521530ac4cba5327ea37af7b488355f1d87399c
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu May 13 12:27:49 2010 +0200
Hide the 'Arrange by Trash Time' option if we're not in the trash.
src/file-manager/fm-actions.h | 1 +
src/file-manager/fm-icon-view.c | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/src/file-manager/fm-actions.h b/src/file-manager/fm-actions.h
index 002a250..f00a367 100644
--- a/src/file-manager/fm-actions.h
+++ b/src/file-manager/fm-actions.h
@@ -106,5 +106,6 @@
#define FM_ACTION_STRETCH "Stretch"
#define FM_ACTION_UNSTRETCH "Unstretch"
#define FM_ACTION_ZOOM_ITEMS "Zoom Items"
+#define FM_ACTION_SORT_TRASH_TIME "Sort by Trash Time"
#endif /* FM_ACTIONS_H */
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index b3c8ff5..782e89f 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -624,12 +624,14 @@ update_layout_menus (FMIconView *view)
gboolean is_auto_layout;
GtkAction *action;
const char *action_name;
+ NautilusFile *file;
if (view->details->icon_action_group == NULL) {
return;
}
is_auto_layout = fm_icon_view_using_auto_layout (view);
+ file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (view));
if (fm_icon_view_supports_auto_layout (view)) {
/* Mark sort criterion. */
@@ -650,6 +652,15 @@ update_layout_menus (FMIconView *view)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
view->details->sort_reversed);
gtk_action_set_sensitive (action, is_auto_layout);
+
+ action = gtk_action_group_get_action (view->details->icon_action_group,
+ FM_ACTION_SORT_TRASH_TIME);
+
+ if (file != NULL && nautilus_file_is_in_trash (file)) {
+ gtk_action_set_visible (action, TRUE);
+ } else {
+ gtk_action_set_visible (action, FALSE);
+ }
}
action = gtk_action_group_get_action (view->details->icon_action_group,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]