[evolution-data-server] Make use of G_DEFINE_QUARK()



commit a761eade00974da17547a76d042c4e1da505c33d
Author: Mathias Hasselmann <mathias openismus com>
Date:   Wed Jan 23 17:11:45 2013 +0100

    Make use of G_DEFINE_QUARK()
    
    This reduces boilerplate and ensures that quark definition functions make
    proper use of the G_UNLIKELY macro.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692398

 addressbook/libebook/e-book-client.c               |   10 +---------
 addressbook/libebook/e-book.c                      |   10 +---------
 addressbook/libebook/e-phone-number.c              |   11 +----------
 .../libedata-book/e-book-backend-sqlitedb.c        |   15 +++------------
 calendar/libecal/e-cal-client.c                    |   10 +---------
 calendar/libecal/e-cal.c                           |   11 +----------
 camel/camel-folder.c                               |   13 +------------
 camel/camel-imapx-stream.c                         |   13 +------------
 camel/camel-object.c                               |   13 +------------
 camel/camel-service.c                              |   13 +------------
 camel/camel-store.c                                |   13 +------------
 camel/camel-tcp-stream-raw.c                       |   13 +------------
 configure.ac                                       |    2 +-
 libebackend/e-authentication-session.c             |   16 +++-------------
 libedataserver/e-client.c                          |   11 +----------
 15 files changed, 19 insertions(+), 155 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index f80bc63..fa10f51 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -63,15 +63,7 @@ G_DEFINE_TYPE (EBookClient, e_book_client, E_TYPE_CLIENT)
  *   @CLIENT_BACKEND_PROPERTY_CACHE_DIR, @CLIENT_BACKEND_PROPERTY_CAPABILITIES
  */
 
-GQuark
-e_book_client_error_quark (void)
-{
-	static GQuark q = 0;
-	if (q == 0)
-		q = g_quark_from_static_string ("e-book-client-error-quark");
-
-	return q;
-}
+G_DEFINE_QUARK (e-book-client-error-quark, e_book_client_error)
 
 /**
  * e_book_client_error_to_string:
diff --git a/addressbook/libebook/e-book.c b/addressbook/libebook/e-book.c
index 3f7af4a..492f94d 100644
--- a/addressbook/libebook/e-book.c
+++ b/addressbook/libebook/e-book.c
@@ -92,15 +92,7 @@ G_DEFINE_TYPE_WITH_CODE (
 	EBook, e_book, G_TYPE_OBJECT,
 	G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, e_book_initable_init))
 
-GQuark
-e_book_error_quark (void)
-{
-	static GQuark q = 0;
-	if (q == 0)
-		q = g_quark_from_static_string ("e-book-error-quark");
-
-	return q;
-}
+G_DEFINE_QUARK (e-book-error-quark, e_book_error)
 
 static void
 book_backend_died_cb (EClient *client,
diff --git a/addressbook/libebook/e-phone-number.c b/addressbook/libebook/e-phone-number.c
index a24272d..47dfea1 100644
--- a/addressbook/libebook/e-phone-number.c
+++ b/addressbook/libebook/e-phone-number.c
@@ -40,16 +40,7 @@ G_DEFINE_BOXED_TYPE (EPhoneNumber,
 
 #endif /* ENABLE_PHONENUMBER */
 
-GQuark
-e_phone_number_error_quark (void)
-{
-	static GQuark q = 0;
-
-	if (q == 0)
-		q = g_quark_from_static_string ("e-phone-number-error-quark");
-
-	return q;
-}
+G_DEFINE_QUARK (e-phone-number-error-quark, e_phone_number_error)
 
 static const gchar *
 e_phone_number_error_to_string (EPhoneNumberError code)
diff --git a/addressbook/libedata-book/e-book-backend-sqlitedb.c b/addressbook/libedata-book/e-book-backend-sqlitedb.c
index 1382de6..a8aaa50 100644
--- a/addressbook/libedata-book/e-book-backend-sqlitedb.c
+++ b/addressbook/libedata-book/e-book-backend-sqlitedb.c
@@ -151,18 +151,9 @@ typedef struct {
 	GSList *list;
 } StoreVCardData;
 
-GQuark
-e_book_backend_sqlitedb_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "e-book-backend-sqlitedb-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (
+	e-book-backend-sqlitedb-error-quark,
+	e_book_backend_sqlitedb_error)
 
 static void
 e_book_backend_sqlitedb_dispose (GObject *object)
diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c
index c78ceb2..906426c 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -95,15 +95,7 @@ free_zone_cb (gpointer zone)
  *   @CLIENT_BACKEND_PROPERTY_CACHE_DIR, @CLIENT_BACKEND_PROPERTY_CAPABILITIES
  */
 
-GQuark
-e_cal_client_error_quark (void)
-{
-	static GQuark q = 0;
-	if (q == 0)
-		q = g_quark_from_static_string ("e-cal-client-error-quark");
-
-	return q;
-}
+G_DEFINE_QUARK (e-cal-client-error-quark, e_cal_client_error)
 
 /**
  * e_cal_client_error_to_string:
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index 9dc5d47..94ed245 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -101,16 +101,7 @@ G_DEFINE_TYPE_WITH_CODE (
 	ECal, e_cal, G_TYPE_OBJECT,
 	G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, e_cal_initable_init))
 
-/* Error quark */
-GQuark
-e_calendar_error_quark (void)
-{
-	static GQuark q = 0;
-	if (q == 0)
-		q = g_quark_from_static_string ("e-calendar-error-quark");
-
-	return q;
-}
+G_DEFINE_QUARK (e-calendar-error-quark, e_calendar_error)
 
 /*
  * If the GError is a remote error, extract the EBookStatus embedded inside.
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 94f2a5a..ad3bec2 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -1922,18 +1922,7 @@ camel_folder_init (CamelFolder *folder)
 	g_mutex_init (&folder->priv->property_lock);
 }
 
-GQuark
-camel_folder_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "camel-folder-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (camel-folder-error-quark, camel_folder_error)
 
 /**
  * camel_folder_set_lock_async:
diff --git a/camel/camel-imapx-stream.c b/camel/camel-imapx-stream.c
index 50da4ee..9b60568 100644
--- a/camel/camel-imapx-stream.c
+++ b/camel/camel-imapx-stream.c
@@ -340,18 +340,7 @@ camel_imapx_stream_grow (CamelIMAPXStream *is,
 		*bufptr = is->priv->buf + (*bufptr - oldbuf);
 }
 
-GQuark
-camel_imapx_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "camel-imapx-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (camel-imapx-error-quark, camel_imapx_error)
 
 /**
  * camel_imapx_stream_new:
diff --git a/camel/camel-object.c b/camel/camel-object.c
index 25eed39..70fd3e7 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -372,18 +372,7 @@ camel_object_init (CamelObject *object)
 	object->priv = CAMEL_OBJECT_GET_PRIVATE (object);
 }
 
-GQuark
-camel_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "camel-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (camel-error-quark, camel_error)
 
 /**
  * camel_object_state_read:
diff --git a/camel/camel-service.c b/camel/camel-service.c
index ab89ac0..3250b6a 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -1142,18 +1142,7 @@ camel_service_init (CamelService *service)
 	service->priv->status = CAMEL_SERVICE_DISCONNECTED;
 }
 
-GQuark
-camel_service_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "camel-service-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (camel-service-error-quark, camel_service_error)
 
 /**
  * camel_service_migrate_files:
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 2337a2d..60dfd6f 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -1244,18 +1244,7 @@ camel_store_init (CamelStore *store)
 	g_rec_mutex_init (&store->priv->folder_lock);
 }
 
-GQuark
-camel_store_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "camel-store-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (camel-store-error-quark, camel_store_error)
 
 /**
  * camel_store_folder_created:
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 9fd242f..97cc318 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -1230,18 +1230,7 @@ camel_tcp_stream_raw_init (CamelTcpStreamRaw *stream)
 	stream->priv = CAMEL_TCP_STREAM_RAW_GET_PRIVATE (stream);
 }
 
-GQuark
-camel_proxy_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string = "camel-proxy-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (camel-proxy-error-quark, camel_proxy_error)
 
 /**
  * camel_tcp_stream_raw_new:
diff --git a/configure.ac b/configure.ac
index 68b495b..b5729c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ m4_define([gdk_minimum_version], [3.2])
 m4_define([gdk_encoded_version], [GDK_VERSION_3_2])
 
 dnl Keep these two definitions in agreement.
-m4_define([soup_minimum_version], [2.40.3])
+m4_define([soup_minimum_version], [2.40.0])
 m4_define([soup_encoded_version], [SOUP_VERSION_2_40])
 
 m4_define([gcr_minimum_version], [3.4])
diff --git a/libebackend/e-authentication-session.c b/libebackend/e-authentication-session.c
index d83e01a..ce2c65e 100644
--- a/libebackend/e-authentication-session.c
+++ b/libebackend/e-authentication-session.c
@@ -815,19 +815,9 @@ e_authentication_session_init (EAuthenticationSession *session)
 	g_mutex_init (&session->priv->property_lock);
 }
 
-GQuark
-e_authentication_session_error_quark (void)
-{
-	static GQuark quark = 0;
-
-	if (G_UNLIKELY (quark == 0)) {
-		const gchar *string;
-		string = "e-authentication-session-error-quark";
-		quark = g_quark_from_static_string (string);
-	}
-
-	return quark;
-}
+G_DEFINE_QUARK (
+	e-authentication-session-error-quark,
+	e_authentication_session_error);
 
 /**
  * e_authentication_session_new:
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index 724e597..9f3a891 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -94,16 +94,7 @@ G_DEFINE_ABSTRACT_TYPE (EClient, e_client, G_TYPE_OBJECT)
  *   e_client_check_capability().
  */
 
-GQuark
-e_client_error_quark (void)
-{
-	static GQuark q = 0;
-
-	if (q == 0)
-		q = g_quark_from_static_string ("e-client-error-quark");
-
-	return q;
-}
+G_DEFINE_QUARK (e-client-error-quark, e_client_error)
 
 /**
  * e_client_error_to_string:



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