Index: src/nautilus-file-management-properties.glade
===================================================================
--- src/nautilus-file-management-properties.glade (revision 13117)
+++ src/nautilus-file-management-properties.glade (working copy)
@@ -442,6 +442,24 @@
False
+
+
+ True
+ True
+ Scale icons based upon recent access/modifications
+ True
+ GTK_RELIEF_NORMAL
+ True
+ True
+ False
+ True
+
+
+ 0
+ False
+ False
+
+
Index: src/nautilus-file-management-properties.c
===================================================================
--- src/nautilus-file-management-properties.c (revision 13117)
+++ src/nautilus-file-management-properties.c (working copy)
@@ -66,6 +66,7 @@
#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET "sort_folders_first_checkbutton"
#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET "compact_layout_checkbutton"
#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET "labels_beside_icons_checkbutton"
+#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SCALE_ICONS_BY_ACCESS "scale_icons_by_access_checkbutton"
#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET "always_use_browser_checkbutton"
#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_LOCATION_ENTRY_WIDGET "always_use_location_entry_checkbutton"
#define NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET "trash_confirm_checkbutton"
@@ -551,6 +552,9 @@
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET,
NAUTILUS_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS);
eel_preferences_glade_connect_bool (xml_dialog,
+ NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SCALE_ICONS_BY_ACCESS,
+ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SCALE_BY_ACCESS);
+ eel_preferences_glade_connect_bool (xml_dialog,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET,
NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST);
eel_preferences_glade_connect_bool (xml_dialog,
Index: libnautilus-private/nautilus-icon-private.h
===================================================================
--- libnautilus-private/nautilus-icon-private.h (revision 13117)
+++ libnautilus-private/nautilus-icon-private.h (working copy)
@@ -304,4 +304,8 @@
gboolean needs_highlight,
gboolean is_prelit);
+/* get icon scale from file's last access time */
+double nautilus_icon_container_get_icon_scale_by_access (NautilusIconContainer *container,
+ NautilusIcon *icon);
+
#endif /* NAUTILUS_ICON_CONTAINER_PRIVATE_H */
Index: libnautilus-private/nautilus-global-preferences.h
===================================================================
--- libnautilus-private/nautilus-global-preferences.h (revision 13117)
+++ libnautilus-private/nautilus-global-preferences.h (working copy)
@@ -112,6 +112,7 @@
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "icon_view/default_sort_in_reverse_order"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER "icon_view/default_sort_order"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT "icon_view/default_use_tighter_layout"
+#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SCALE_BY_ACCESS "icon_view/default_scale_icon_by_access"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "icon_view/default_zoom_level"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "icon_view/default_use_manual_layout"
Index: libnautilus-private/nautilus-icon-container.c
===================================================================
--- libnautilus-private/nautilus-icon-container.c (revision 13117)
+++ libnautilus-private/nautilus-icon-container.c (working copy)
@@ -5709,6 +5709,8 @@
max_image_size = MAX (MAXIMUM_IMAGE_SIZE * EEL_CANVAS (container)->pixels_per_unit, NAUTILUS_ICON_MAXIMUM_SIZE);
/* Get the appropriate images for the file. */
+ if(icon->scale == 1.0)
+ icon->scale = nautilus_icon_container_get_icon_scale_by_access(container, icon);
icon_get_size (container, icon, &icon_size);
icon_size = MAX (icon_size, min_image_size);
@@ -8118,4 +8120,62 @@
EEL_CHECK_STRING_RESULT (check_compute_stretch (100, 100, 64, 105, 105, 40, 40), "35,35:129");
}
+double
+nautilus_icon_container_get_icon_scale_by_access(NautilusIconContainer *container,
+ NautilusIcon *icon)
+{
+ char * uri;
+ NautilusFile *file;
+ time_t last_access;
+ time_t current;
+ double diff_hrs;
+ double max_scale, min_scale;
+
+ gboolean do_scale;
+
+ do_scale = eel_preferences_get_boolean(NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SCALE_BY_ACCESS);
+
+ if(!do_scale)
+ return 1.0;
+
+ max_scale = 1.2;
+ min_scale = 0.5;
+
+ uri = nautilus_icon_container_get_icon_uri(container, icon);
+ if(uri == NULL)
+ {
+ return 1.0; //can not find uri of icon, no scaling
+ }
+
+ file = nautilus_file_get(uri);
+
+ //For directories we need to check the date modified not date accessed
+ gboolean last_access_check;
+ if(nautilus_file_is_directory(file))
+ {
+ last_access_check = nautilus_file_get_date(file, NAUTILUS_DATE_TYPE_MODIFIED, &last_access);
+ } else
+ {
+ last_access_check = nautilus_file_get_date(file, NAUTILUS_DATE_TYPE_ACCESSED, &last_access);
+ }
+ if(!last_access_check) {
+ return 1.0; //can not find last access date
+ }
+
+ //now find the current date
+ current = time(NULL);
+ if(current == NULL)
+ {
+ return 1.0; //can not find current time !!!
+ }
+
+ //now calculate the difference between two times and return
+ //scale value as double.
+ diff_hrs = (current - last_access) / 3600;
+ if(diff_hrs > 360)
+ return min_scale; //its not accessed in last 15 days so scale is minimum
+
+ return (max_scale - (diff_hrs/360)*(max_scale-min_scale));
+}
+
#endif /* ! NAUTILUS_OMIT_SELF_CHECK */