Blob Blame History Raw
From ecfc461fd979aeb2d3ce4b9d811e4bf4a7730532 Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Sat, 5 Nov 2011 18:04:54 +0100
Subject: [PATCH 3/3] - glib 2.31 build fixes

---
 src/applet/applet.c |   14 +++++++++++++-
 src/gui-gtk/main.c  |    4 ++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/applet/applet.c b/src/applet/applet.c
index 95b7091..bead61f 100644
--- a/src/applet/applet.c
+++ b/src/applet/applet.c
@@ -766,10 +766,20 @@ int main(int argc, char** argv)
     textdomain(PACKAGE);
 #endif
 
+  /* Glib 2.31:
+    * Major changes to threading and synchronisation
+     - threading is now always enabled in GLib
+     - support for custom thread implementations (including our own internal
+     - support for errorcheck mutexes) has been removed
+  */
+#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 31)
+    //can't use log(), because g_verbose is not set yet
+    g_print("abrt-applet: glib < 2.31 - init threading\n");
     /* Need to be thread safe */
     g_thread_init(NULL);
     gdk_threads_init();
     gdk_threads_enter();
+#endif
 
     gtk_init(&argc, &argv);
 
@@ -869,8 +879,10 @@ int main(int argc, char** argv)
 
     /* Enter main loop */
     gtk_main();
-
+#if (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION < 31)
     gdk_threads_leave();
+#endif
+
     if (notify_is_initted())
         notify_uninit();
 
diff --git a/src/gui-gtk/main.c b/src/gui-gtk/main.c
index b31509b..a24745a 100644
--- a/src/gui-gtk/main.c
+++ b/src/gui-gtk/main.c
@@ -912,7 +912,7 @@ static gboolean handle_signal_pipe(GIOChannel *gio, GIOCondition condition, gpoi
      */
     gchar buf[16];
     gsize bytes_read;
-    g_io_channel_read(gio, buf, sizeof(buf), &bytes_read);
+    g_io_channel_read_chars(gio, buf, sizeof(buf), &bytes_read, NULL);
 
     /* Destroy zombies */
     while (safe_waitpid(-1, NULL, WNOHANG) > 0)
@@ -975,7 +975,7 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
     /* We read inotify events, but don't analyze them */
     gchar buf[sizeof(struct inotify_event) + PATH_MAX + 64];
     gsize bytes_read;
-    while (g_io_channel_read(gio, buf, sizeof(buf), &bytes_read) == G_IO_ERROR_NONE
+    while (g_io_channel_read_chars(gio, buf, sizeof(buf), &bytes_read, NULL) == G_IO_STATUS_NORMAL
         && bytes_read > 0
     ) {
         continue;
-- 
1.7.7