[epiphany/wip/sync: 9/11] bookmark: Invoke directly default (de)serialize method of JsonSerializableIface



commit c5e63ef70454d58a922a88fa2c37f72c0e030c35
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Wed Apr 19 16:29:10 2017 +0300

    bookmark: Invoke directly default (de)serialize method of JsonSerializableIface

 src/bookmarks/ephy-bookmark.c |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmark.c b/src/bookmarks/ephy-bookmark.c
index e3a7e35..aa36dfc 100644
--- a/src/bookmarks/ephy-bookmark.c
+++ b/src/bookmarks/ephy-bookmark.c
@@ -52,9 +52,7 @@ struct _EphyBookmark {
   gboolean     uploaded;
 };
 
-static JsonSerializableIface *serializable_iface = NULL;
-
-static void json_serializable_iface_init (gpointer g_iface);
+static void json_serializable_iface_init (JsonSerializableIface *iface);
 static void ephy_synchronizable_iface_init (EphySynchronizableInterface *iface);
 
 G_DEFINE_TYPE_WITH_CODE (EphyBookmark, ephy_bookmark, G_TYPE_OBJECT,
@@ -313,7 +311,7 @@ ephy_bookmark_json_serializable_serialize_property (JsonSerializable *serializab
   } else if (!g_strcmp0 (name, "time-added")) {
     /* This is not a Firefox bookmark property, skip it.  */
   } else {
-    node = serializable_iface->serialize_property (serializable, name, value, pspec);
+    node = json_serializable_default_serialize_property (serializable, name, value, pspec);
   }
 
   return node;
@@ -342,21 +340,16 @@ ephy_bookmark_json_serializable_deserialize_property (JsonSerializable *serializ
     }
 
     g_value_set_pointer (value, tags);
-  } else {
-    serializable_iface->deserialize_property (serializable, name,
-                                              value, pspec, node);
+
+    return TRUE;
   }
 
-  return TRUE;
+  return json_serializable_default_deserialize_property (serializable, name, value, pspec, node);
 }
 
 static void
-json_serializable_iface_init (gpointer g_iface)
+json_serializable_iface_init (JsonSerializableIface *iface)
 {
-  JsonSerializableIface *iface = g_iface;
-
-  serializable_iface = g_type_default_interface_peek (JSON_TYPE_SERIALIZABLE);
-
   iface->serialize_property = ephy_bookmark_json_serializable_serialize_property;
   iface->deserialize_property = ephy_bookmark_json_serializable_deserialize_property;
 }


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