[telepathy-gabble/master] add gabble_init() doing misc initializations

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Wed Jul 22 09:13:10 PDT 2009


---
 src/gabble.c               |   13 ++++++++++---
 src/gabble.h               |    3 +++
 src/main.c                 |    1 +
 tests/twisted/main-debug.c |    3 ++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/gabble.c b/src/gabble.c
index 576b58a..dc86d0d 100644
--- a/src/gabble.c
+++ b/src/gabble.c
@@ -123,15 +123,22 @@ gabble_lm_debug (void)
 }
 #endif
 
-int
-gabble_main (int argc,
-    char **argv)
+
+void
+gabble_init (void)
 {
   /* libsoup uses glib in multiple threads and don't have this, so we have to
    * enable it manually here */
   if (!g_thread_supported ())
     g_thread_init (NULL);
 
+  g_type_init ();
+}
+
+int
+gabble_main (int argc,
+    char **argv)
+{
   tp_debug_divert_messages (g_getenv ("GABBLE_LOGFILE"));
 
 #ifdef ENABLE_DEBUG
diff --git a/src/gabble.h b/src/gabble.h
index 4a7d57b..9fd010a 100644
--- a/src/gabble.h
+++ b/src/gabble.h
@@ -33,6 +33,9 @@ void gabble_lm_debug (void);
 #define gabble_lm_debug() G_STMT_START { } G_STMT_END
 #endif
 
+/* To be used only by tests */
+void gabble_init (void);
+
 G_END_DECLS
 
 #endif /* #ifndef __GABBLE_H__*/
diff --git a/src/main.c b/src/main.c
index c36293d..e6fc228 100644
--- a/src/main.c
+++ b/src/main.c
@@ -24,5 +24,6 @@ int
 main (int argc,
       char **argv)
 {
+  gabble_init ();
   return gabble_main (argc, argv);
 }
diff --git a/tests/twisted/main-debug.c b/tests/twisted/main-debug.c
index 8393a6a..618a8c9 100644
--- a/tests/twisted/main-debug.c
+++ b/tests/twisted/main-debug.c
@@ -30,12 +30,13 @@ int
 main (int argc,
       char **argv)
 {
+  gabble_init ();
+
   /* needed for test-disco-no-reply.py */
   gabble_connection_set_disco_reply_timeout (3000);
 
   gabble_set_jingle_session_timeout (1500);
 
-  g_type_init ();
   gibber_resolver_set_resolver (GABBLE_TYPE_RESOLVER_FAKE);
   gabble_jingle_factory_set_test_mode ();
 
-- 
1.5.6.5



More information about the telepathy-commits mailing list