[libnotify] Conditionall call g_type_init() after a version check



commit 43aac613f1c2a56aa672c36c157c9b8eb193ac25
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jul 17 10:16:06 2017 +0100

    Conditionall call g_type_init() after a version check
    
    There's no need to call g_type_init() since GLib 2.36, so let's hide it
    when building against newer versions of GLib.

 libnotify/notify.c   |    2 ++
 tests/test-error.c   |    2 ++
 tests/test-replace.c |    2 ++
 tools/notify-send.c  |    2 ++
 4 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/libnotify/notify.c b/libnotify/notify.c
index efe8bd8..bf7d89b 100644
--- a/libnotify/notify.c
+++ b/libnotify/notify.c
@@ -153,7 +153,9 @@ notify_init (const char *app_name)
 
         notify_set_app_name (app_name);
 
+#if !GLIB_CHECK_VERSION (2, 36, 0)
         g_type_init ();
+#endif
 
         _initted = TRUE;
 
diff --git a/tests/test-error.c b/tests/test-error.c
index b7b9662..afcb59b 100644
--- a/tests/test-error.c
+++ b/tests/test-error.c
@@ -29,7 +29,9 @@ main ()
 {
         NotifyNotification *n;
 
+#if !GLIB_CHECK_VERSION (2, 36, 0)
         g_type_init ();
+#endif
 
         notify_init ("Error Handling");
 
diff --git a/tests/test-replace.c b/tests/test-replace.c
index 56b13c5..ec7b5fc 100644
--- a/tests/test-replace.c
+++ b/tests/test-replace.c
@@ -28,7 +28,9 @@ main ()
         GError             *error;
         error = NULL;
 
+#if !GLIB_CHECK_VERSION (2, 36, 0)
         g_type_init ();
+#endif
 
         notify_init ("Replace Test");
 
diff --git a/tools/notify-send.c b/tools/notify-send.c
index cafcf15..abfffe6 100644
--- a/tools/notify-send.c
+++ b/tools/notify-send.c
@@ -173,7 +173,9 @@ main (int argc, char *argv[])
 
         setlocale (LC_ALL, "");
 
+#if !GLIB_CHECK_VERSION (2, 36, 0)
         g_type_init ();
+#endif
 
         g_set_prgname (argv[0]);
         g_log_set_always_fatal (G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);


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