efm - option for display of dates explicitly and not in nice-human form

This commit is contained in:
Carsten Haitzler 2021-03-07 20:07:59 +00:00
parent b288373ee6
commit 7ca3f8f612
4 changed files with 58 additions and 35 deletions

View File

@ -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 */

View File

@ -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;
};

View File

@ -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"));
if (e_config->explicit_date_time)
{
struct tm tm;
if (localtime_r(&ftime, &tm))
{
s = eina_strftime("%F %T", &tm);
if (s) return s;
}
}
else
{
if (diff <= 60)
snprintf(buf, sizeof(buf), _("In the last minute"));
else if (diff >= 31526000)
if (ftime > ltime)
snprintf(buf, sizeof(buf), _("In the future"));
else
{
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);
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);
}
}
}

View File

@ -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));