[evolution-ews] Avoid using dynamic types for ESourceEwsFolder



commit addd8f6c940b2503fc2237f6c6667de2cb41e9c9
Author: David Woodhouse <David Woodhouse intel com>
Date:   Thu Sep 11 20:40:57 2014 +0100

    Avoid using dynamic types for ESourceEwsFolder
    
    If we register the same type from two *different* modules, the type
    system gets upset. That's precisely what happens if we enable addressbook
    DRA, because the addressbook and camel modules both get loaded into the
    same process.
    
    So make it a normal static class. We do have to use g_type_ensure()
    though, because e_source_get_extension() will look it up by name,
    iterating over the child classes of ESourceExtension.

 configure.ac                     |    4 ++--
 src/server/e-source-ews-folder.c |   14 ++++----------
 2 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 571c39f..349a726 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,8 +55,8 @@ m4_define([eds_minimum_version], [$EVOREQVER])
 m4_define([evo_minimum_version], [$EVOREQVER])
 
 dnl Keep these two definitions in agreement.
-m4_define([glib_minimum_version], [2.32])
-m4_define([glib_encoded_version], [GLIB_VERSION_2_32])
+m4_define([glib_minimum_version], [2.34])
+m4_define([glib_encoded_version], [GLIB_VERSION_2_34])
 
 dnl Keep these two definitions in agreement.
 m4_define([gdk_minimum_version], [3.0])
diff --git a/src/server/e-source-ews-folder.c b/src/server/e-source-ews-folder.c
index 8404760..48efbb2 100644
--- a/src/server/e-source-ews-folder.c
+++ b/src/server/e-source-ews-folder.c
@@ -44,7 +44,7 @@ enum {
        PROP_PUBLIC
 };
 
-G_DEFINE_DYNAMIC_TYPE (
+G_DEFINE_TYPE (
        ESourceEwsFolder,
        e_source_ews_folder,
        E_TYPE_SOURCE_EXTENSION)
@@ -236,11 +236,6 @@ e_source_ews_folder_class_init (ESourceEwsFolderClass *class)
 }
 
 static void
-e_source_ews_folder_class_finalize (ESourceEwsFolderClass *class)
-{
-}
-
-static void
 e_source_ews_folder_init (ESourceEwsFolder *extension)
 {
        extension->priv = E_SOURCE_EWS_FOLDER_GET_PRIVATE (extension);
@@ -250,10 +245,9 @@ e_source_ews_folder_init (ESourceEwsFolder *extension)
 void
 e_source_ews_folder_type_register (GTypeModule *type_module)
 {
-       /* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
-        *     function, so we have to wrap it with a public function in
-        *     order to register types from a separate compilation unit. */
-       e_source_ews_folder_register_type (type_module);
+       /* We need to ensure this is registered, because it's looked up
+        * by name in e_source_get_extension(). */
+       g_type_ensure (E_TYPE_SOURCE_EWS_FOLDER);
 }
 
 const gchar *


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