--enable-glib-integration-always <- option. can be disabled by
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 22 Mar 2010 03:30:40 +0000 (03:30 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 22 Mar 2010 03:30:40 +0000 (03:30 +0000)
ecore_main_loop_glib_always_integrate_disable() before ecore_init()

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@47360 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

configure.ac
src/lib/ecore/Ecore.h
src/lib/ecore/ecore.c
src/lib/ecore/ecore_glib.c
src/lib/ecore/ecore_private.h

index fa0fce0..b51051f 100644 (file)
@@ -242,6 +242,15 @@ requirements_ecore_wince=""
 
 ### Additional options to configure
 
+want_glib_integration_always=no
+AC_ARG_ENABLE(glib-integration-always,
+  AC_HELP_STRING([--enable-glib-integration-always], [enable glib integration when ecore_init() is called always]),
+  [want_glib_integration_always=$enableval])
+
+if test "x${want_glib_integration_always}" = "xyes" ; then
+  AC_DEFINE([GLIB_INTEGRATION_ALWAYS], [1], [Always integrate glib if support compiled])
+fi
+
 # abstract sockets (ecore_con.c)
 AC_ARG_ENABLE([abstract-sockets],
    [AC_HELP_STRING([--disable-abstract-sockets], [disable abstract sockets.])],
@@ -1369,6 +1378,7 @@ echo
 echo "  Ecore........................: always"
 echo "    Thread support.............: $have_pthread"
 echo "    GLib support...............: $have_glib"
+echo "    Always integrate GLib......: $want_glib_integration_always"
 echo "    Gathering memory statistic.: $have_mallinfo"
 echo "  Ecore_Con....................: $have_ecore_con"
 if test "x$have_ecore_con" = "xyes" ; then
index 41ed0d3..4ea2ba9 100644 (file)
@@ -293,7 +293,8 @@ extern "C" {
    EAPI void             *ecore_main_loop_select_func_get(void);
 
    EAPI Eina_Bool         ecore_main_loop_glib_integrate(void);
-
+   EAPI void              ecore_main_loop_glib_always_integrate_disable(void);
+       
    EAPI void              ecore_main_loop_begin(void);
    EAPI void              ecore_main_loop_quit(void);
    EAPI Ecore_Fd_Handler *ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, int (*func) (void *data, Ecore_Fd_Handler *fd_handler), const void *data, int (*buf_func) (void *buf_data, Ecore_Fd_Handler *fd_handler), const void *buf_data);
index 8ad0dfb..7c10b96 100644 (file)
@@ -124,6 +124,10 @@ ecore_init(void)
      }
 #endif
 
+#ifdef GLIB_INTEGRATION_ALWAYS   
+   if (_ecore_glib_always_integrate) ecore_main_loop_glib_integrate();
+#endif
+   
    return _ecore_init_count;
 
  shutdown_log_dom:
index bac7fd6..a77b87d 100644 (file)
@@ -260,16 +260,9 @@ ecore_main_loop_glib_integrate(void)
 #ifdef HAVE_GLIB
    void *func;
 
-   if (_ecore_glib_active)
-     return EINA_TRUE;
-
+   if (_ecore_glib_active) return EINA_TRUE;
    func = ecore_main_loop_select_func_get();
-   if (func == _ecore_glib_select)
-     {
-       fputs("ERROR: glib already integrated.\n", stderr);
-       return EINA_FALSE;
-     }
-
+   if (func == _ecore_glib_select) return EINA_TRUE;
    _ecore_glib_select_original = func;
    ecore_main_loop_select_func_set(_ecore_glib_select);
    _ecore_glib_active = EINA_TRUE;
@@ -279,3 +272,20 @@ ecore_main_loop_glib_integrate(void)
    return EINA_FALSE;
 #endif
 }
+
+Eina_Bool _ecore_glib_always_integrate = 1;
+
+/**
+ * Disable always integrating glib
+ * 
+ * If ecore is compiled with --enable-glib-integration-always (to always
+ * call ecore_main_loop_glib_integrate() when ecore_init() is called), then
+ * calling this before calling ecore_init() will disable the integration.
+ * This is for apps that explicitly do not want this to happen for whatever
+ * reasons they may have.
+ */
+EAPI void
+ecore_main_loop_glib_always_integrate_disable(void)
+{
+   _ecore_glib_always_integrate = 0;
+}
index 3865fc3..ea59794 100644 (file)
@@ -196,5 +196,6 @@ void _ecore_job_shutdown(void);
 
 extern int    _ecore_fps_debug;
 extern double _ecore_loop_time;
+extern Eina_Bool _ecore_glib_always_integrate;
 
 #endif