changeset 2279:5a9bdebb109f

This potentially fixes most deprecated warnings However, I tested it with gtk 2.46.2 on debian that pretend to be version 2.24.29. So I still get that warnings.
author Klaus Ethgen <Klaus@Ethgen.de>
date Sun, 06 Mar 2016 23:49:43 +0100
parents f69d3d47d874
children b523c366b192 f119fa101ffb
files src/image-load.c src/main.c
diffstat 2 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/image-load.c	Sun Mar 06 23:48:42 2016 +0100
+++ b/src/image-load.c	Sun Mar 06 23:49:43 2016 +0100
@@ -99,9 +99,16 @@
 	il->can_destroy = TRUE;
 
 #ifdef HAVE_GTHREAD
+#if GTK_CHECK_VERSION(2,32,0)
+	il->data_mutex = g_new(GMutex, 1);
+	g_mutex_init(il->data_mutex);
+	il->can_destroy_cond = g_new(GCond, 1);
+	g_cond_init((il->can_destroy_cond);
+#else
 	il->data_mutex = g_mutex_new();
 	il->can_destroy_cond = g_cond_new();
 #endif
+#endif
 	DEBUG_1("new image loader %p, bufsize=%" G_GSIZE_FORMAT " idle_loop=%u", il, il->read_buffer_size, il->idle_read_loop_count);
 }
 
@@ -210,9 +217,16 @@
 
 	file_data_unref(il->fd);
 #ifdef HAVE_GTHREAD
+#if GTK_CHECK_VERSION(2,32,0)
+	g_mutex_clear(il->data_mutex);
+	g_free(il->data_mutex);
+	g_cond_clear(il->can_destroy_cond);
+	g_free(il->can_destroy_cond);
+#else
 	g_mutex_free(il->data_mutex);
 	g_cond_free(il->can_destroy_cond);
 #endif
+#endif
 }
 
 void image_loader_free(ImageLoader *il)
@@ -1003,8 +1017,15 @@
         if (!image_loader_thread_pool)
 		{
 		image_loader_thread_pool = g_thread_pool_new(image_loader_thread_run, NULL, -1, FALSE, NULL);
+#if GTK_CHECK_VERSION(2,32,0)
+		if (!image_loader_prio_cond) image_loader_prio_cond = g_new(GCond, 1);
+		g_cond_init(image_loader_prio_cond);
+		if (!image_loader_prio_mutex) image_loader_prio_mutex = g_new(GMutex, 1);
+		g_mutex_init(image_loader_prio_mutex);
+#else
 		image_loader_prio_cond = g_cond_new();
 		image_loader_prio_mutex = g_mutex_new();
+#endif
 		}
 
 	il->can_destroy = FALSE; /* ImageLoader can't be freed until image_loader_thread_run finishes */
--- a/src/main.c	Sun Mar 06 23:48:42 2016 +0100
+++ b/src/main.c	Sun Mar 06 23:49:43 2016 +0100
@@ -737,7 +737,9 @@
 	CollectionData *cd = NULL;
 
 #ifdef HAVE_GTHREAD
+#if !GTK_CHECK_VERSION(2,32,0)
 	g_thread_init(NULL);
+#endif
 	gdk_threads_init();
 	gdk_threads_enter();