[evince] Bump glib requirements to 2.31.0



commit bf90f90e0af99bbfdd20e6d21fd228c05cffae51
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sun Nov 20 17:05:09 2011 +0100

    Bump glib requirements to 2.31.0
    
    And remove the use of deprecated glib symbols.

 configure.ac                     |    2 +-
 libdocument/ev-document.c        |   34 ++++++++--------------------------
 libdocument/ev-mapping-list.c    |    2 +-
 libview/ev-job-scheduler.c       |   36 +++++++++++++++++-------------------
 previewer/ev-previewer.c         |    4 ----
 shell/main.c                     |    4 ----
 thumbnailer/evince-thumbnailer.c |   10 ++++------
 7 files changed, 31 insertions(+), 61 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5a85ade..839688c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -123,7 +123,7 @@ AM_CONDITIONAL([PLATFORM_WIN32],[test "$with_platform" = "win32"])
 
 dnl Specify required versions of dependencies
 CAIRO_REQUIRED=1.10.0
-GLIB_REQUIRED=2.25.11
+GLIB_REQUIRED=2.31.0
 KEYRING_REQUIRED=2.22.0
 GTK_REQUIRED=3.0.2
 NAUTILUS_REQUIRED=2.91.4
diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c
index 163a231..f6aca8b 100644
--- a/libdocument/ev-document.c
+++ b/libdocument/ev-document.c
@@ -69,8 +69,8 @@ static gchar          *_ev_document_get_page_label  (EvDocument *document,
 static EvDocumentInfo *_ev_document_get_info        (EvDocument *document);
 static gboolean        _ev_document_support_synctex (EvDocument *document);
 
-GMutex *ev_doc_mutex = NULL;
-GMutex *ev_fc_mutex = NULL;
+static GMutex ev_doc_mutex;
+static GMutex ev_fc_mutex;
 
 G_DEFINE_ABSTRACT_TYPE (EvDocument, ev_document, G_TYPE_OBJECT)
 
@@ -158,58 +158,40 @@ ev_document_class_init (EvDocumentClass *klass)
 	g_object_class->finalize = ev_document_finalize;
 }
 
-GMutex *
-ev_document_get_doc_mutex (void)
-{
-	if (ev_doc_mutex == NULL) {
-		ev_doc_mutex = g_mutex_new ();
-	}
-	return ev_doc_mutex;
-}
-
 void
 ev_document_doc_mutex_lock (void)
 {
-	g_mutex_lock (ev_document_get_doc_mutex ());
+	g_mutex_lock (&ev_doc_mutex);
 }
 
 void
 ev_document_doc_mutex_unlock (void)
 {
-	g_mutex_unlock (ev_document_get_doc_mutex ());
+	g_mutex_unlock (&ev_doc_mutex);
 }
 
 gboolean
 ev_document_doc_mutex_trylock (void)
 {
-	return g_mutex_trylock (ev_document_get_doc_mutex ());
-}
-
-GMutex *
-ev_document_get_fc_mutex (void)
-{
-	if (ev_fc_mutex == NULL) {
-		ev_fc_mutex = g_mutex_new ();
-	}
-	return ev_fc_mutex;
+	return g_mutex_trylock (&ev_doc_mutex);
 }
 
 void
 ev_document_fc_mutex_lock (void)
 {
-	g_mutex_lock (ev_document_get_fc_mutex ());
+	g_mutex_lock (&ev_fc_mutex);
 }
 
 void
 ev_document_fc_mutex_unlock (void)
 {
-	g_mutex_unlock (ev_document_get_fc_mutex ());
+	g_mutex_unlock (&ev_fc_mutex);
 }
 
 gboolean
 ev_document_fc_mutex_trylock (void)
 {
-	return g_mutex_trylock (ev_document_get_fc_mutex ());
+	return g_mutex_trylock (&ev_fc_mutex);
 }
 
 /**
diff --git a/libdocument/ev-mapping-list.c b/libdocument/ev-mapping-list.c
index 024cb49..f99b4f9 100644
--- a/libdocument/ev-mapping-list.c
+++ b/libdocument/ev-mapping-list.c
@@ -136,7 +136,7 @@ ev_mapping_list_unref (EvMappingList *mapping_list)
 	g_return_if_fail (mapping_list != NULL);
 	g_return_if_fail (mapping_list->ref_count > 0);
 
-	if (g_atomic_int_exchange_and_add (&mapping_list->ref_count, -1) - 1 == 0) {
+	if (g_atomic_int_add (&mapping_list->ref_count, -1) - 1 == 0) {
 		g_list_foreach (mapping_list->list,
 				(GFunc)mapping_list_free_foreach,
 				mapping_list->data_destroy_func);
diff --git a/libview/ev-job-scheduler.c b/libview/ev-job-scheduler.c
index 85e5add..5ed702a 100644
--- a/libview/ev-job-scheduler.c
+++ b/libview/ev-job-scheduler.c
@@ -42,8 +42,8 @@ static GQueue queue_high = G_QUEUE_INIT;
 static GQueue queue_low = G_QUEUE_INIT;
 static GQueue queue_none = G_QUEUE_INIT;
 
-static GCond *job_queue_cond = NULL;
-static GMutex *job_queue_mutex = NULL;
+static GCond job_queue_cond;
+static GMutex job_queue_mutex;
 static GQueue *job_queue[EV_JOB_N_PRIORITIES] = {
 	&queue_urgent,
 	&queue_high,
@@ -57,12 +57,12 @@ ev_job_queue_push (EvSchedulerJob *job,
 {
 	ev_debug_message (DEBUG_JOBS, "%s priority %d", EV_GET_TYPE_NAME (job->job), priority);
 	
-	g_mutex_lock (job_queue_mutex);
+	g_mutex_lock (&job_queue_mutex);
 
 	g_queue_push_tail (job_queue[priority], job);
-	g_cond_broadcast (job_queue_cond);
+	g_cond_broadcast (&job_queue_cond);
 	
-	g_mutex_unlock (job_queue_mutex);
+	g_mutex_unlock (&job_queue_mutex);
 }
 
 static EvSchedulerJob *
@@ -85,10 +85,8 @@ ev_job_queue_get_next_unlocked (void)
 static gpointer
 ev_job_scheduler_init (gpointer data)
 {
-	job_queue_cond = g_cond_new ();
-	job_queue_mutex = g_mutex_new ();
-	g_thread_create (ev_job_thread_proxy, NULL, FALSE, NULL);
-	
+	g_thread_new ("EvJobScheduler", ev_job_thread_proxy, NULL);
+
 	return NULL;
 }
 
@@ -154,7 +152,7 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job,
 	
 	ev_debug_message (DEBUG_JOBS, "%s", EV_GET_TYPE_NAME (job->job));
 
-	g_mutex_lock (job_queue_mutex);
+	g_mutex_lock (&job_queue_mutex);
 
 	/* If the job is not still running,
 	 * remove it from the job queue and job list.
@@ -164,10 +162,10 @@ ev_scheduler_thread_job_cancelled (EvSchedulerJob *job,
 	list = g_queue_find (job_queue[job->priority], job);
 	if (list) {
 		g_queue_delete_link (job_queue[job->priority], list);
-		g_mutex_unlock (job_queue_mutex);
+		g_mutex_unlock (&job_queue_mutex);
 		ev_scheduler_job_destroy (job);
 	} else {
-		g_mutex_unlock (job_queue_mutex);
+		g_mutex_unlock (&job_queue_mutex);
 	}
 }
 
@@ -207,14 +205,14 @@ ev_job_thread_proxy (gpointer data)
 	while (TRUE) {
 		EvSchedulerJob *job;
 
-		g_mutex_lock (job_queue_mutex);
+		g_mutex_lock (&job_queue_mutex);
 		job = ev_job_queue_get_next_unlocked ();
 		if (!job) {
-			g_cond_wait (job_queue_cond, job_queue_mutex);
-			g_mutex_unlock (job_queue_mutex);
+			g_cond_wait (&job_queue_cond, &job_queue_mutex);
+			g_mutex_unlock (&job_queue_mutex);
 			continue;
 		}
-		g_mutex_unlock (job_queue_mutex);
+		g_mutex_unlock (&job_queue_mutex);
 		
 		ev_job_thread (job->job);
 		ev_scheduler_job_destroy (job);
@@ -294,7 +292,7 @@ ev_job_scheduler_update_job (EvJob         *job,
 	if (need_resort) {
 		GList *list;
 	
-		g_mutex_lock (job_queue_mutex);
+		g_mutex_lock (&job_queue_mutex);
 		
 		list = g_queue_find (job_queue[s_job->priority], s_job);
 		if (list) {
@@ -302,10 +300,10 @@ ev_job_scheduler_update_job (EvJob         *job,
 					  EV_GET_TYPE_NAME (job), s_job->priority, priority);
 			g_queue_delete_link (job_queue[s_job->priority], list);
 			g_queue_push_tail (job_queue[priority], s_job);
-			g_cond_broadcast (job_queue_cond);
+			g_cond_broadcast (&job_queue_cond);
 		}
 		
-		g_mutex_unlock (job_queue_mutex);
+		g_mutex_unlock (&job_queue_mutex);
 	}
 }
 
diff --git a/previewer/ev-previewer.c b/previewer/ev-previewer.c
index 5029079..1b1b787 100644
--- a/previewer/ev-previewer.c
+++ b/previewer/ev-previewer.c
@@ -130,10 +130,6 @@ main (gint argc, gchar **argv)
 	}
 #endif
 
-	/* Init glib threads asap */
-	if (!g_thread_supported ())
-		g_thread_init (NULL);
-
 #ifdef ENABLE_NLS
 	/* Initialize the i18n stuff */
 	bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir());
diff --git a/shell/main.c b/shell/main.c
index ab4b8df..ed60960 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -260,10 +260,6 @@ main (int argc, char *argv[])
 	}
 #endif
 
-	/* Init glib threads asap */
-	if (!g_thread_supported ())
-		g_thread_init (NULL);
-
 #ifdef ENABLE_NLS
 	/* Initialize the i18n stuff */
 	bindtextdomain (GETTEXT_PACKAGE, ev_get_locale_dir());
diff --git a/thumbnailer/evince-thumbnailer.c b/thumbnailer/evince-thumbnailer.c
index 596d264..5d00617 100644
--- a/thumbnailer/evince-thumbnailer.c
+++ b/thumbnailer/evince-thumbnailer.c
@@ -83,7 +83,7 @@ static void
 time_monitor_start (const char *input)
 {
         finished = FALSE;
-        g_thread_create (time_monitor, (gpointer) input, FALSE, NULL);
+        g_thread_new ("EvThumbnailerTimer", time_monitor, (gpointer) input);
 }
 
 static void
@@ -294,9 +294,6 @@ main (int argc, char *argv[])
 
 	g_type_init ();
 
-	if (!g_thread_supported ())
-		g_thread_init (NULL);
-
         if (!ev_init ())
                 return -1;
 
@@ -321,8 +318,9 @@ main (int argc, char *argv[])
 		data.output = output;
 		data.size = size;
 
-		g_thread_create ((GThreadFunc) evince_thumbnail_pngenc_get_async,
-				 &data, FALSE, NULL);
+		g_thread_new ("EvThumbanilerAsyncRenderer",
+                              (GThreadFunc) evince_thumbnail_pngenc_get_async,
+                              &data);
 		
 		gtk_main ();
 



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