[libgdata/wip/rishi/drive: 4/8] documents: Deprecate GDataDocumentsEntry:edited



commit a953b1f7b81303a0c94a846262677463b1d4d827
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Apr 23 13:06:09 2015 +0200

    documents: Deprecate GDataDocumentsEntry:edited
    
    The Drive v2 API does not have the concept of ‘significant changes’, so
    GDataDocumentsEntry:edited is now identical to GDataEntry:updated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=684920

 gdata/services/documents/gdata-documents-entry.c |   37 +++-------------------
 gdata/services/documents/gdata-documents-entry.h |    2 +-
 gdata/tests/documents.c                          |    2 +
 3 files changed, 8 insertions(+), 33 deletions(-)
---
diff --git a/gdata/services/documents/gdata-documents-entry.c 
b/gdata/services/documents/gdata-documents-entry.c
index 22837ba..7a16764 100644
--- a/gdata/services/documents/gdata-documents-entry.c
+++ b/gdata/services/documents/gdata-documents-entry.c
@@ -112,7 +112,6 @@
 #include "gdata-documents-folder.h"
 
 static void gdata_documents_entry_access_handler_init (GDataAccessHandlerIface *iface);
-static GObject *gdata_documents_entry_constructor (GType type, guint n_construct_params, 
GObjectConstructParam *construct_params);
 static void gdata_documents_entry_finalize (GObject *object);
 static void gdata_entry_dispose (GObject *object);
 static void get_namespaces (GDataParsable *parsable, GHashTable *namespaces);
@@ -123,7 +122,6 @@ static gboolean post_parse_json (GDataParsable *parsable, gpointer user_data, GE
 static gchar *get_entry_uri (const gchar *id);
 
 struct _GDataDocumentsEntryPrivate {
-       gint64 edited;
        gint64 last_viewed;
        gchar *mime_type;
        gchar *resource_id;
@@ -156,7 +154,6 @@ gdata_documents_entry_class_init (GDataDocumentsEntryClass *klass)
 
        g_type_class_add_private (klass, sizeof (GDataDocumentsEntryPrivate));
 
-       gobject_class->constructor = gdata_documents_entry_constructor;
        gobject_class->get_property = gdata_documents_entry_get_property;
        gobject_class->set_property = gdata_documents_entry_set_property;
        gobject_class->finalize = gdata_documents_entry_finalize;
@@ -173,16 +170,14 @@ gdata_documents_entry_class_init (GDataDocumentsEntryClass *klass)
         *
         * The last time the document was edited. If the document has not been edited yet, the content 
indicates the time it was created.
         *
-        * For more information, see the <ulink type="http" 
url="http://www.atomenabled.org/developers/protocol/#appEdited";>
-        * Atom Publishing Protocol specification</ulink>.
-        *
         * Since: 0.4.0
+        * Deprecated: This is identical to #GDataEntry:updated. (Since: UNRELEASED)
         **/
        g_object_class_install_property (gobject_class, PROP_EDITED,
                                         g_param_spec_int64 ("edited",
                                                             "Edited", "The last time the document was 
edited.",
                                                             -1, G_MAXINT64, -1,
-                                                            G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+                                                            G_PARAM_READABLE | G_PARAM_STATIC_STRINGS | 
G_PARAM_DEPRECATED));
 
        /**
         * GDataDocumentsEntry:last-viewed:
@@ -316,32 +311,9 @@ static void
 gdata_documents_entry_init (GDataDocumentsEntry *self)
 {
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_DOCUMENTS_ENTRY, 
GDataDocumentsEntryPrivate);
-       self->priv->edited = -1;
        self->priv->last_viewed = -1;
 }
 
-static GObject *
-gdata_documents_entry_constructor (GType type, guint n_construct_params, GObjectConstructParam 
*construct_params)
-{
-       GObject *object;
-
-       /* Chain up to the parent class */
-       object = G_OBJECT_CLASS (gdata_documents_entry_parent_class)->constructor (type, n_construct_params, 
construct_params);
-
-       /* We can't create these in init, or they would collide with the group and control created when 
parsing the XML */
-       if (_gdata_parsable_is_constructed_from_xml (GDATA_PARSABLE (object)) == FALSE) {
-               GDataDocumentsEntryPrivate *priv = GDATA_DOCUMENTS_ENTRY (object)->priv;
-               GTimeVal time_val;
-
-               /* This can't be put in the init function of #GDataDocumentsEntry, as it would then be called 
even for entries parsed from XML from
-                * the server, which would break duplicate element detection for the app:edited element. */
-               g_get_current_time (&time_val);
-               priv->edited = time_val.tv_sec;
-       }
-
-       return object;
-}
-
 static void
 gdata_entry_dispose (GObject *object)
 {
@@ -386,7 +358,7 @@ gdata_documents_entry_get_property (GObject *object, guint property_id, GValue *
                        g_value_set_boolean (value, priv->is_deleted);
                        break;
                case PROP_EDITED:
-                       g_value_set_int64 (value, priv->edited);
+                       g_value_set_int64 (value, gdata_entry_get_updated (GDATA_ENTRY (object)));
                        break;
                case PROP_LAST_VIEWED:
                        g_value_set_int64 (value, priv->last_viewed);
@@ -801,12 +773,13 @@ get_entry_uri (const gchar *id)
  * Return value: the UNIX timestamp for the time the document was last edited, or <code 
class="literal">-1</code>
  *
  * Since: 0.4.0
+ * Deprecated: Use gdata_entry_get_updated() instead. See #GDataDocumentsEntry:edited. (Since: UNRELEASED)
  **/
 gint64
 gdata_documents_entry_get_edited (GDataDocumentsEntry *self)
 {
        g_return_val_if_fail (GDATA_IS_DOCUMENTS_ENTRY (self), -1);
-       return self->priv->edited;
+       return gdata_entry_get_updated (GDATA_ENTRY (self));
 }
 
 /**
diff --git a/gdata/services/documents/gdata-documents-entry.h 
b/gdata/services/documents/gdata-documents-entry.h
index f232144..9f21035 100644
--- a/gdata/services/documents/gdata-documents-entry.h
+++ b/gdata/services/documents/gdata-documents-entry.h
@@ -103,9 +103,9 @@ const gchar *gdata_documents_entry_get_resource_id (GDataDocumentsEntry *self) G
 
 #ifndef LIBGDATA_DISABLE_DEPRECATED
 const gchar *gdata_documents_entry_get_document_id (GDataDocumentsEntry *self) G_GNUC_PURE 
G_GNUC_DEPRECATED_FOR(gdata_documents_entry_get_resource_id);
+gint64 gdata_documents_entry_get_edited (GDataDocumentsEntry *self) 
G_GNUC_DEPRECATED_FOR(gdata_entry_get_updated);
 #endif /* !LIBGDATA_DISABLE_DEPRECATED */
 
-gint64 gdata_documents_entry_get_edited (GDataDocumentsEntry *self);
 gint64 gdata_documents_entry_get_last_viewed (GDataDocumentsEntry *self);
 
 void gdata_documents_entry_set_writers_can_invite (GDataDocumentsEntry *self, gboolean writers_can_invite);
diff --git a/gdata/tests/documents.c b/gdata/tests/documents.c
index b2ef4f1..e971b28 100644
--- a/gdata/tests/documents.c
+++ b/gdata/tests/documents.c
@@ -1671,7 +1671,9 @@ test_folder_parser_normal (void)
        g_free (path);
 
        /* Check dates. */
+       G_GNUC_BEGIN_IGNORE_DEPRECATIONS
        g_assert_cmpuint (gdata_documents_entry_get_edited (GDATA_DOCUMENTS_ENTRY (folder)), ==, 1334394740);
+       G_GNUC_END_IGNORE_DEPRECATIONS
        g_assert_cmpuint (gdata_documents_entry_get_last_viewed (GDATA_DOCUMENTS_ENTRY (folder)), ==, -1);
 
        author = gdata_documents_entry_get_last_modified_by (GDATA_DOCUMENTS_ENTRY (folder));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]