raster pushed a commit to branch master. http://git.enlightenment.org/core/enlightenment.git/commit/?id=7ca3f8f612f8891c9dfe785bd73b4278df81eaee
commit 7ca3f8f612f8891c9dfe785bd73b4278df81eaee Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com> Date: Sun Mar 7 20:07:59 2021 +0000 efm - option for display of dates explicitly and not in nice-human form --- src/bin/e_config.c | 1 + src/bin/e_config.h | 3 +- src/bin/e_utils.c | 75 ++++++++++++++++++++++---------------- src/modules/fileman/e_mod_config.c | 12 +++++- 4 files changed, 57 insertions(+), 34 deletions(-) diff --git a/src/bin/e_config.c b/src/bin/e_config.c index 3babbdd58..2834828d9 100644 --- a/src/bin/e_config.c +++ b/src/bin/e_config.c @@ -997,6 +997,7 @@ _e_config_edd_init(Eina_Bool old) //E_CONFIG_VAL(D, T, xkb.cur_group, INT); E_CONFIG_VAL(D, T, exe_always_single_instance, UCHAR); + E_CONFIG_VAL(D, T, explicit_date_time, UCHAR); } /* externally accessible functions */ diff --git a/src/bin/e_config.h b/src/bin/e_config.h index 7473a28db..8e19b248e 100644 --- a/src/bin/e_config.h +++ b/src/bin/e_config.h @@ -178,7 +178,7 @@ struct _E_Config int menu_eap_comment_show; // GUI int menu_favorites_show; // GUI int menu_apps_show; // GUI - Eina_Bool menu_icons_hide; // GUI + Eina_Bool menu_icons_hide; // GUI int menu_gadcon_client_toplevel; // GUI int fullscreen_policy; // GUI const char *exebuf_term_cmd; // GUI @@ -441,6 +441,7 @@ struct _E_Config Eina_List *menu_applications; unsigned char exe_always_single_instance; // GUI + unsigned char explicit_date_time; // GUI Eina_List *screen_profiles; }; diff --git a/src/bin/e_utils.c b/src/bin/e_utils.c index 783b35342..8db378add 100644 --- a/src/bin/e_utils.c +++ b/src/bin/e_utils.c @@ -584,41 +584,54 @@ e_util_file_time_get(time_t ftime) ltime = time(NULL); diff = ltime - ftime; buf[0] = 0; - if (ftime > ltime) - snprintf(buf, sizeof(buf), _("In the future")); - else + if (e_config->explicit_date_time) { - if (diff <= 60) - snprintf(buf, sizeof(buf), _("In the last minute")); - else if (diff >= 31526000) - { - test = diff / 31526000; - snprintf(buf, sizeof(buf), P_("Last year", "%li Years ago", test), test); - } - else if (diff >= 2592000) - { - test = diff / 2592000; - snprintf(buf, sizeof(buf), P_("Last month", "%li Months ago", test), test); - } - else if (diff >= 604800) - { - test = diff / 604800; - snprintf(buf, sizeof(buf), P_("Last week", "%li Weeks ago", test), test); - } - else if (diff >= 86400) - { - test = diff / 86400; - snprintf(buf, sizeof(buf), P_("Yesterday", "%li Days ago", test), test); - } - else if (diff >= 3600) + struct tm tm; + + if (localtime_r(&ftime, &tm)) { - test = diff / 3600; - snprintf(buf, sizeof(buf), P_("An hour ago", "%li Hours ago", test), test); + s = eina_strftime("%F %T", &tm); + if (s) return s; } - else if (diff > 60) + } + else + { + if (ftime > ltime) + snprintf(buf, sizeof(buf), _("In the future")); + else { - test = diff / 60; - snprintf(buf, sizeof(buf), P_("A minute ago", "%li Minutes ago", test), test); + if (diff <= 60) + snprintf(buf, sizeof(buf), _("In the last minute")); + else if (diff >= 31526000) + { + test = diff / 31526000; + snprintf(buf, sizeof(buf), P_("Last year", "%li Years ago", test), test); + } + else if (diff >= 2592000) + { + test = diff / 2592000; + snprintf(buf, sizeof(buf), P_("Last month", "%li Months ago", test), test); + } + else if (diff >= 604800) + { + test = diff / 604800; + snprintf(buf, sizeof(buf), P_("Last week", "%li Weeks ago", test), test); + } + else if (diff >= 86400) + { + test = diff / 86400; + snprintf(buf, sizeof(buf), P_("Yesterday", "%li Days ago", test), test); + } + else if (diff >= 3600) + { + test = diff / 3600; + snprintf(buf, sizeof(buf), P_("An hour ago", "%li Hours ago", test), test); + } + else if (diff > 60) + { + test = diff / 60; + snprintf(buf, sizeof(buf), P_("A minute ago", "%li Minutes ago", test), test); + } } } diff --git a/src/modules/fileman/e_mod_config.c b/src/modules/fileman/e_mod_config.c index 2bfaf9dbe..9c5a1bebc 100644 --- a/src/modules/fileman/e_mod_config.c +++ b/src/modules/fileman/e_mod_config.c @@ -49,6 +49,7 @@ struct _E_Config_Dialog_Data const char *key_hint; int max_thumb_size; } icon; + int explicit_date_time; /* how to sort files */ struct { @@ -91,7 +92,7 @@ struct _E_Config_Dialog_Data Evas_Object *dir_sort_first; Evas_Object *dir_sort_last; - E_Config_Dialog *cfd; + E_Config_Dialog *cfd; }; static void *_create_data(E_Config_Dialog *cfd); @@ -171,6 +172,7 @@ _fill_data(E_Config_Dialog_Data *cfdata) cfdata->dbus.desktop = e_config->device_desktop; cfdata->dbus.auto_mount = e_config->device_auto_mount; cfdata->dbus.auto_open = e_config->device_auto_open; + cfdata->explicit_date_time = e_config->explicit_date_time; } static void @@ -222,6 +224,7 @@ _basic_apply(E_Config_Dialog *cfd EINA_UNUSED, e_config->device_auto_mount = cfdata->dbus.auto_mount; e_config->device_auto_open = cfdata->dbus.auto_open; + e_config->explicit_date_time = cfdata->explicit_date_time; e_config_save_queue(); @@ -263,7 +266,9 @@ _basic_check_changed(E_Config_Dialog *cfd EINA_UNUSED, (fileman_config->list.sort.no_case != !(cfdata->list.sort.case_sen)) || (e_config->device_desktop != cfdata->dbus.desktop) || (e_config->device_auto_mount != cfdata->dbus.auto_mount) || - (e_config->device_auto_open != cfdata->dbus.auto_open); + (e_config->device_auto_open != cfdata->dbus.auto_open) || + (e_config->explicit_date_time != cfdata->explicit_date_time) + ; } static void @@ -354,6 +359,9 @@ _basic_create(E_Config_Dialog *cfd EINA_UNUSED, ob = e_widget_check_add(evas, _("Sidebar"), &(cfdata->view.show_sidebar)); e_widget_list_object_append(o, ob, 1, 1, 0.5); + ob = e_widget_check_add(evas, _("Show Detailed Time and Date"), + &(cfdata->explicit_date_time)); + e_widget_list_object_append(o, ob, 1, 1, 0.5); /* FIXME: this sucks ob = e_widget_check_add(evas, _("Regular Files In Menu (SLOW)"), &(cfdata->view.menu_shows_files)); --