summaryrefslogtreecommitdiff
path: root/libdocument
diff options
context:
space:
mode:
Diffstat (limited to 'libdocument')
-rw-r--r--libdocument/ev-annotation.c6
-rw-r--r--libdocument/ev-annotation.h2
-rw-r--r--libdocument/ev-attachment.c12
-rw-r--r--libdocument/ev-attachment.h8
-rw-r--r--libdocument/ev-document-info.h4
-rw-r--r--libdocument/ev-document-misc.c29
-rw-r--r--libdocument/ev-document-misc.h2
7 files changed, 28 insertions, 35 deletions
diff --git a/libdocument/ev-annotation.c b/libdocument/ev-annotation.c
index 41bd4249..03fe925c 100644
--- a/libdocument/ev-annotation.c
+++ b/libdocument/ev-annotation.c
@@ -454,7 +454,7 @@ ev_annotation_get_modified (EvAnnotation *annot)
* @modified: string with the last modification date.
*
* Set the last modification date of @annot to @modified. To
- * set the last modification date using a #GTime, use
+ * set the last modification date using a #gint64, use
* ev_annotation_set_modified_from_time() instead. You can monitor
* changes to the last modification date by connecting to the
* notify::modified signal on @annot.
@@ -482,7 +482,7 @@ ev_annotation_set_modified (EvAnnotation *annot,
/**
* ev_annotation_set_modified_from_time:
* @annot: an #EvAnnotation
- * @utime: a #GTime
+ * @utime: a #gint64
*
* Set the last modification date of @annot to @utime. You can
* monitor changes to the last modification date by connectin to the
@@ -493,7 +493,7 @@ ev_annotation_set_modified (EvAnnotation *annot,
*/
gboolean
ev_annotation_set_modified_from_time (EvAnnotation *annot,
- GTime utime)
+ gint64 utime)
{
gchar *modified;
diff --git a/libdocument/ev-annotation.h b/libdocument/ev-annotation.h
index 408c4577..ce87e952 100644
--- a/libdocument/ev-annotation.h
+++ b/libdocument/ev-annotation.h
@@ -115,7 +115,7 @@ const gchar *ev_annotation_get_modified (EvAnnotation
gboolean ev_annotation_set_modified (EvAnnotation *annot,
const gchar *modified);
gboolean ev_annotation_set_modified_from_time (EvAnnotation *annot,
- GTime utime);
+ gint64 utime);
EV_DEPRECATED_FOR(ev_annotaion_get_rgba)
void ev_annotation_get_color (EvAnnotation *annot,
GdkColor *color);
diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c
index c0fb46f7..f87cfc13 100644
--- a/libdocument/ev-attachment.c
+++ b/libdocument/ev-attachment.c
@@ -38,8 +38,8 @@ enum
struct _EvAttachmentPrivate {
gchar *name;
gchar *description;
- GTime mtime;
- GTime ctime;
+ gint64 mtime;
+ gint64 ctime;
gsize size;
gchar *data;
gchar *mime_type;
@@ -217,8 +217,8 @@ ev_attachment_init (EvAttachment *attachment)
EvAttachment *
ev_attachment_new (const gchar *name,
const gchar *description,
- GTime mtime,
- GTime ctime,
+ gint64 mtime,
+ gint64 ctime,
gsize size,
gpointer data)
{
@@ -252,7 +252,7 @@ ev_attachment_get_description (EvAttachment *attachment)
return attachment->priv->description;
}
-GTime
+gint64
ev_attachment_get_modification_date (EvAttachment *attachment)
{
g_return_val_if_fail (EV_IS_ATTACHMENT (attachment), 0);
@@ -260,7 +260,7 @@ ev_attachment_get_modification_date (EvAttachment *attachment)
return attachment->priv->mtime;
}
-GTime
+gint64
ev_attachment_get_creation_date (EvAttachment *attachment)
{
g_return_val_if_fail (EV_IS_ATTACHMENT (attachment), 0);
diff --git a/libdocument/ev-attachment.h b/libdocument/ev-attachment.h
index 17999437..33e16e1b 100644
--- a/libdocument/ev-attachment.h
+++ b/libdocument/ev-attachment.h
@@ -56,15 +56,15 @@ GType ev_attachment_get_type (void) G_GNUC_CONST;
GQuark ev_attachment_error_quark (void) G_GNUC_CONST;
EvAttachment *ev_attachment_new (const gchar *name,
const gchar *description,
- GTime mtime,
- GTime ctime,
+ gint64 mtime,
+ gint64 ctime,
gsize size,
gpointer data);
const gchar *ev_attachment_get_name (EvAttachment *attachment);
const gchar *ev_attachment_get_description (EvAttachment *attachment);
-GTime ev_attachment_get_modification_date (EvAttachment *attachment);
-GTime ev_attachment_get_creation_date (EvAttachment *attachment);
+gint64 ev_attachment_get_modification_date (EvAttachment *attachment);
+gint64 ev_attachment_get_creation_date (EvAttachment *attachment);
const gchar *ev_attachment_get_mime_type (EvAttachment *attachment);
gboolean ev_attachment_save (EvAttachment *attachment,
GFile *file,
diff --git a/libdocument/ev-document-info.h b/libdocument/ev-document-info.h
index 54a4e94e..49698bfc 100644
--- a/libdocument/ev-document-info.h
+++ b/libdocument/ev-document-info.h
@@ -115,8 +115,8 @@ struct _EvDocumentInfo
char *producer;
char *linearized;
char *security;
- GTime creation_date;
- GTime modified_date;
+ gint64 creation_date;
+ gint64 modified_date;
EvDocumentLayout layout;
EvDocumentMode mode;
guint ui_hints;
diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c
index e25b9ca6..80948936 100644
--- a/libdocument/ev-document-misc.c
+++ b/libdocument/ev-document-misc.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <math.h>
+#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
@@ -359,25 +360,17 @@ ev_document_misc_get_monitor_dpi (GdkMonitor *monitor)
/* Returns a locale specific date and time representation */
gchar *
-ev_document_misc_format_date (GTime utime)
+ev_document_misc_format_date (gint64 utime)
{
- time_t time = (time_t) utime;
- char s[256];
- const char fmt_hack[] = "%c";
- size_t len;
-#ifdef HAVE_LOCALTIME_R
- struct tm t;
- if (time == 0 || !localtime_r (&time, &t)) return NULL;
- len = strftime (s, sizeof (s), fmt_hack, &t);
-#else
- struct tm *t;
- if (time == 0 || !(t = localtime (&time)) ) return NULL;
- len = strftime (s, sizeof (s), fmt_hack, t);
-#endif
-
- if (len == 0 || s[0] == '\0') return NULL;
-
- return g_locale_to_utf8 (s, -1, NULL, NULL, NULL);
+ GDateTime *date_time;
+ gchar *result = NULL;
+
+ date_time = g_date_time_new_from_unix_local (utime);
+ if (date_time != NULL) {
+ result = g_date_time_format (date_time, "%c");
+ g_date_time_unref (date_time);
+ }
+ return result;
}
void
diff --git a/libdocument/ev-document-misc.h b/libdocument/ev-document-misc.h
index 3b97e3f8..bd789971 100644
--- a/libdocument/ev-document-misc.h
+++ b/libdocument/ev-document-misc.h
@@ -63,7 +63,7 @@ void ev_document_misc_invert_pixbuf (GdkPixbuf *pixbuf);
gdouble ev_document_misc_get_monitor_dpi (GdkMonitor *monitor);
-gchar *ev_document_misc_format_date (GTime utime);
+gchar *ev_document_misc_format_date (gint64 utime);
void ev_document_misc_get_pointer_position (GtkWidget *widget,
gint *x,