Print the cookie expiration date in the user's locale.
This commit is contained in:
parent
99c3154dd6
commit
fe53c0b703
1 changed files with 15 additions and 5 deletions
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <time.h>
|
||||
#include <midori/midori.h>
|
||||
#include <webkit/webkit.h>
|
||||
|
||||
|
@ -143,14 +144,25 @@ static void cm_refresh_store(CMData *cmdata)
|
|||
|
||||
static gchar *cm_get_cookie_description_text(SoupCookie *cookie)
|
||||
{
|
||||
static gchar date_fmt[512];
|
||||
gchar *expires;
|
||||
gchar *text;
|
||||
time_t expiration_time;
|
||||
const struct tm *tm;
|
||||
|
||||
g_return_val_if_fail(cookie != NULL, NULL);
|
||||
|
||||
expires = (cookie->expires != NULL) ?
|
||||
soup_date_to_string(cookie->expires, SOUP_DATE_HTTP) :
|
||||
g_strdup(_("At theend of the session"));
|
||||
if (cookie->expires != NULL)
|
||||
{
|
||||
expiration_time = soup_date_to_time_t(cookie->expires);
|
||||
tm = localtime(&expiration_time);
|
||||
/* even if some gcc versions complain about "%c", there is nothing wrong with and here we
|
||||
* want to use it */
|
||||
strftime(date_fmt, sizeof(date_fmt), "%c", tm);
|
||||
expires = date_fmt;
|
||||
}
|
||||
else
|
||||
expires = _("At the end of the session");
|
||||
|
||||
text = g_markup_printf_escaped(
|
||||
_("<b>Host: %s</b>\n<b>Name: %s</b>\nValue: %s\nPath: %s\nSecure: %s\nExpires: %s"),
|
||||
|
@ -161,8 +173,6 @@ static gchar *cm_get_cookie_description_text(SoupCookie *cookie)
|
|||
cookie->secure ? _("Yes") : _("No"),
|
||||
expires);
|
||||
|
||||
g_free(expires);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue