From 94dcb761b95ee54ef1f1512d59721932d75ffb7f Mon Sep 17 00:00:00 2001 From: infirit Date: Sat, 17 May 2014 05:15:56 +0200 Subject: Fix glib deprecations Based on evince commit by Carlos Garcia Campos Url: https://git.gnome.org/browse/evince/commit/?id=bf90f90e0af99bbfdd20e6d21fd228c05cffae51 Url: https://git.gnome.org/browse/evince/commit/?id=76151be92239ed5f491cb26c87a2328b670e9f64 --- libdocument/ev-document.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'libdocument/ev-document.c') diff --git a/libdocument/ev-document.c b/libdocument/ev-document.c index 667f89f1..fc45830d 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) @@ -160,58 +160,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); } /** -- cgit v1.2.1