[librsvg] Switch to attribute-based deprecations
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] Switch to attribute-based deprecations
- Date: Mon, 7 Nov 2011 19:28:57 +0000 (UTC)
commit fa8c06aa93a14dc63357075112f0c9b539c7829c
Author: Christian Persch <chpe gnome org>
Date: Mon Nov 7 18:23:15 2011 +0100
Switch to attribute-based deprecations
Instead of hiding the definitions when RSVG_DISABLE_DEPRECATED is defined,
use G_DEPRECATED[_FOR] via a wrapper RSVG_DEPRECATED[_FOR].
To disable the deprecation warnings, define RSVG_DISABLE_DEPRECATION_WARNINGS.
Makefile.am | 1 +
rsvg.h | 22 +++++++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a446307..d34dcaf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -84,6 +84,7 @@ librsvg_ RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
-I$(top_builddir) \
-DG_LOG_DOMAIN=\"librsvg\" \
-DLIBRSVG_DATADIR="\"$(datadir)\"" \
+ -DRSVG_DISABLE_DEPRECATION_WARNINGS \
$(AM_CPPFLAGS)
librsvg_ RSVG_API_MAJOR_VERSION@_la_CFLAGS = \
diff --git a/rsvg.h b/rsvg.h
index 746d4af..a2459b5 100644
--- a/rsvg.h
+++ b/rsvg.h
@@ -33,6 +33,14 @@
G_BEGIN_DECLS
+#if defined(RSVG_DISABLE_DEPRECATION_WARNINGS) || !GLIB_CHECK_VERSION (2, 31, 0)
+#define RSVG_DEPRECATED
+#define RSVG_DEPRECATED_FOR(f)
+#else
+#define RSVG_DEPRECATED G_DEPRECATED
+#define RSVG_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
+#endif
+
#define RSVG_TYPE_HANDLE (rsvg_handle_get_type ())
#define RSVG_HANDLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RSVG_TYPE_HANDLE, RsvgHandle))
#define RSVG_HANDLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RSVG_TYPE_HANDLE, RsvgHandleClass))
@@ -173,8 +181,9 @@ const char *rsvg_handle_get_metadata (RsvgHandle * handle);
RsvgHandle *rsvg_handle_new_from_data (const guint8 * data, gsize data_len, GError ** error);
RsvgHandle *rsvg_handle_new_from_file (const gchar * file_name, GError ** error);
-#ifndef RSVG_DISABLE_DEPRECATED
+/* BEGIN deprecated APIs. Do not use! */
+RSVG_DEPRECATED_FOR(g_object_unref)
void rsvg_handle_free (RsvgHandle * handle);
/**
@@ -190,26 +199,33 @@ void rsvg_handle_free (RsvgHandle * handle);
*
* Deprecated: Set up a cairo matrix and use rsvg_handle_render_cairo() instead.
*/
-typedef void (*RsvgSizeFunc) (gint * width, gint * height, gpointer user_data);
+typedef RSVG_DEPRECATED void (*RsvgSizeFunc) (gint * width, gint * height, gpointer user_data);
+
+RSVG_DEPRECATED
void rsvg_handle_set_size_callback (RsvgHandle * handle,
RsvgSizeFunc size_func,
gpointer user_data, GDestroyNotify user_data_destroy);
/* GdkPixbuf convenience API */
+RSVG_DEPRECATED
GdkPixbuf *rsvg_pixbuf_from_file (const gchar * file_name, GError ** error);
+RSVG_DEPRECATED
GdkPixbuf *rsvg_pixbuf_from_file_at_zoom (const gchar * file_name,
double x_zoom, double y_zoom, GError ** error);
+RSVG_DEPRECATED
GdkPixbuf *rsvg_pixbuf_from_file_at_size (const gchar * file_name, gint width, gint height,
GError ** error);
+RSVG_DEPRECATED
GdkPixbuf *rsvg_pixbuf_from_file_at_max_size (const gchar * file_name,
gint max_width, gint max_height, GError ** error);
+RSVG_DEPRECATED
GdkPixbuf *rsvg_pixbuf_from_file_at_zoom_with_max (const gchar * file_name,
double x_zoom,
double y_zoom,
gint max_width, gint max_height, GError ** error);
-#endif /* RSVG_DISABLE_DEPRECATED */
+/* END deprecated APIs. */
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]