[json-glib] Use the new GLib deprecation scheme



commit c2429c07107edd6acf95e80b82d968771c669c35
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Oct 17 10:52:43 2011 +0100

    Use the new GLib deprecation scheme
    
    Instead of using a defined symbol to remove the deprecated functions
    from the library, we should use compiler warnings.

 json-glib/Makefile.am    |    1 -
 json-glib/json-gobject.h |    6 ++++--
 json-glib/json-types.h   |   19 +++++++++++++++++--
 3 files changed, 21 insertions(+), 5 deletions(-)
---
diff --git a/json-glib/Makefile.am b/json-glib/Makefile.am
index c75a817..262e69e 100644
--- a/json-glib/Makefile.am
+++ b/json-glib/Makefile.am
@@ -16,7 +16,6 @@ AM_CPPFLAGS = \
 	-DPREFIX=\""$(prefix)"\" 	\
 	-DLIBDIR=\""$(libdir)"\" 	\
 	-DJSON_COMPILATION=1		\
-	-DJSON_DISABLE_DEPRECATED	\
 	-DG_LOG_DOMAIN=\"Json\" 	\
 	$(JSON_DEBUG_CFLAGS) 		\
 	$(NULL)
diff --git a/json-glib/json-gobject.h b/json-glib/json-gobject.h
index 2e06d88..791fc9b 100644
--- a/json-glib/json-gobject.h
+++ b/json-glib/json-gobject.h
@@ -168,12 +168,14 @@ gchar *   json_gobject_to_data                 (GObject                 *gobject
                                                 gsize                   *length);
 
 #ifndef JSON_DISABLE_DEPRECATED
+JSON_DEPRECATED_FOR(json_gobject_from_data)
 GObject * json_construct_gobject               (GType                    gtype,
                                                 const gchar             *data,
                                                 gsize                    length,
-                                                GError                 **error) G_GNUC_DEPRECATED;
+                                                GError                 **error);
+JSON_DEPRECATED_FOR(json_gobject_to_data)
 gchar *   json_serialize_gobject               (GObject                 *gobject,
-                                                gsize                   *length) G_GNUC_MALLOC G_GNUC_DEPRECATED;
+                                                gsize                   *length) G_GNUC_MALLOC;
 #endif /* JSON_DISABLE_DEPRECATED */
 
 
diff --git a/json-glib/json-types.h b/json-glib/json-types.h
index ecbf198..8bb583b 100644
--- a/json-glib/json-types.h
+++ b/json-glib/json-types.h
@@ -32,6 +32,20 @@
 
 G_BEGIN_DECLS
 
+/* guards to avoid bumping up the GLib dependency */
+#ifndef G_DEPRECATED
+#define G_DEPRECATED            G_GNUC_DEPRECATED
+#define G_DEPRECATED_FOR(x)     G_GNUC_DEPRECATED_FOR(x)
+#endif
+
+#ifdef JSON_DISABLE_DEPRECATION_WARNINGS
+#define JSON_DEPRECATED
+#define JSON_DEPRECATED_FOR(x)
+#else
+#define JSON_DEPRECATED         G_DEPRECATED
+#define JSON_DEPRECATED_FOR(x)  G_DEPRECATED_FOR(x)
+#endif
+
 /**
  * JSON_NODE_TYPE:
  * @node: a #JsonNode
@@ -226,10 +240,11 @@ JsonObject *          json_object_ref                (JsonObject  *object);
 void                  json_object_unref              (JsonObject  *object);
 
 #ifndef JSON_DISABLE_DEPRECATED
+JSON_DEPRECATED_FOR(json_object_set_member)
 void                  json_object_add_member         (JsonObject  *object,
                                                       const gchar *member_name,
-                                                      JsonNode    *node) G_GNUC_DEPRECATED;
-#endif /* JSON_DISABLE_DEPRECATED */
+                                                      JsonNode    *node);
+#endif
 
 void                  json_object_set_member         (JsonObject  *object,
                                                       const gchar *member_name,



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