Handle the deprecation of g_type_init() to avoid compiler warnings

Maybe we should increment the glib version requirement one of these days...
parent 9db05c8e
......@@ -23,6 +23,7 @@ librsvg_@RSVG_API_MAJOR_VERSION@_la_SOURCES = \
librsvg-features.c \
rsvg-css.c \
rsvg-css.h \
rsvg-compat.h \
rsvg-defs.c \
rsvg-defs.h \
rsvg-image.c \
......
......@@ -24,6 +24,8 @@
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "rsvg-compat.h"
int
main (int argc, char **argv)
{
......@@ -49,7 +51,7 @@ main (int argc, char **argv)
/* Use the locally built rsvg loader, not the system one */
g_setenv ("GDK_PIXBUF_MODULE_FILE", "./gdk-pixbuf.loaders", TRUE);
g_type_init ();
RSVG_G_TYPE_INIT;
context = g_option_context_new ("- Pixbuf Test Loader");
g_option_context_add_main_entries (context, options_table, NULL);
......
......@@ -28,6 +28,7 @@
#define _GNU_SOURCE 1
#include "rsvg.h"
#include "rsvg-compat.h"
#include "rsvg-private.h"
#include "rsvg-css.h"
#include "rsvg-styles.h"
......@@ -1969,7 +1970,7 @@ rsvg_handle_new_from_stream_sync (GInputStream *input_stream,
void
rsvg_init (void)
{
g_type_init ();
RSVG_G_TYPE_INIT;
}
/**
......
/* rsvg-compat.h: miscellaneous compatibility functions to deal with deprecations in the platform */
#ifndef RSVG_COMPAT_H
#define RSVG_COMPAT_H
/* g_type_init() was deprecated in glib 2.36.0 */
#if !GLIB_CHECK_VERSION (2, 36, 0)
# define RSVG_G_TYPE_INIT g_type_init ()
#else
# define RSVG_G_TYPE_INIT {}
#endif
#endif /* RSVG_COMPAT_H */
......@@ -50,6 +50,7 @@
#include "rsvg-css.h"
#include "rsvg.h"
#include "rsvg-compat.h"
#include "rsvg-size-callback.h"
#ifdef CAIRO_HAS_PS_SURFACE
......@@ -164,7 +165,7 @@ main (int argc, char **argv)
/* Set the locale so that UTF-8 filenames work */
setlocale(LC_ALL, "");
g_type_init ();
RSVG_G_TYPE_INIT;
g_option_context = g_option_context_new (_("- SVG Converter"));
g_option_context_add_main_entries (g_option_context, options_table, NULL);
......
......@@ -18,7 +18,6 @@
*/
#include "config.h"
#include "rsvg.h"
#include "rsvg-private.h"
#include "rsvg-size-callback.h"
......@@ -30,6 +29,8 @@
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include "rsvg-compat.h"
#if 0 // defined (G_OS_UNIX)
#include <gio/gunixinputstream.h>
#endif
......@@ -659,7 +660,7 @@ main (int argc, char **argv)
/* Set the locale so that UTF-8 filenames work */
setlocale(LC_ALL, "");
g_type_init ();
RSVG_G_TYPE_INIT;
info.window = NULL;
info.popup_menu = NULL;
......
......@@ -2,6 +2,7 @@
#include <glib.h>
#include "rsvg.h"
#include "rsvg-compat.h"
#include "test-utils.h"
typedef struct _FixtureData
......@@ -39,7 +40,7 @@ main (int argc, char *argv[])
gint i;
int result;
g_type_init ();
RSVG_G_TYPE_INIT;
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
......
......@@ -2,6 +2,7 @@
#include <glib.h>
#include "rsvg.h"
#include "rsvg-compat.h"
#include "test-utils.h"
typedef struct _FixtureData
......@@ -54,7 +55,7 @@ main (int argc, char *argv[])
gint i;
int result;
g_type_init ();
RSVG_G_TYPE_INIT;
g_test_init (&argc, &argv, NULL);
for (i = 0; i < n_fixtures; i++)
......
......@@ -42,6 +42,7 @@
#include "rsvg.h"
#include "rsvg-private.h"
#include "rsvg-size-callback.h"
#include "rsvg-compat.h"
#include "pdiff.h"
......@@ -348,7 +349,7 @@ main (int argc, char **argv)
int i, j;
gsize length;
g_type_init ();
RSVG_G_TYPE_INIT;
printf ("===============\n"
"Rendering tests\n"
......
......@@ -2,6 +2,7 @@
#include <glib.h>
#include "rsvg.h"
#include "rsvg-compat.h"
#include "rsvg-private.h"
#include "rsvg-defs.h"
#include "rsvg-styles.h"
......@@ -114,7 +115,7 @@ main (int argc, char *argv[])
gint i;
int result;
g_type_init ();
RSVG_G_TYPE_INIT;
g_test_init (&argc, &argv, NULL);
g_test_bug_base ("https://bugzilla.gnome.org/show_bug.cgi?id=");
......
......@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <glib.h>
#include <rsvg.h>
#include "rsvg-compat.h"
static void
show_help (GOptionContext *context)
......@@ -40,7 +41,7 @@ main (int argc,
{ NULL }
};
g_type_init ();
RSVG_G_TYPE_INIT;
context = NULL;
fragment = NULL;
......
......@@ -32,6 +32,7 @@
#include "rsvg.h"
#include "rsvg-private.h"
#include "rsvg-tools-main.h"
#include "rsvg-compat.h"
static gboolean
read_contents (const gchar *file_name, guint8 **contents, gsize *length)
......@@ -127,7 +128,7 @@ rsvg_tools_main (int *argc, char ***argv)
exit (EXIT_FAILURE);
}
g_type_init ();
RSVG_G_TYPE_INIT;
for (j = 0; j < n_args; j++) {
if (!read_contents (args[j], &contents, &length))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment