diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-10-31 06:29:08 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-10-31 06:29:08 +0800 |
commit | 47843d5fe0d8ef95d1d001af559e0b3c93e154a1 (patch) | |
tree | 4e457dff6323698a62203e218b04a87fbe871328 /shell/e-component-registry.c | |
parent | fff58fd097a00d653649469b96b4d0f5d041677c (diff) | |
download | gsoc2013-evolution-47843d5fe0d8ef95d1d001af559e0b3c93e154a1.tar.gz gsoc2013-evolution-47843d5fe0d8ef95d1d001af559e0b3c93e154a1.tar.zst gsoc2013-evolution-47843d5fe0d8ef95d1d001af559e0b3c93e154a1.zip |
New utility function. (sleep_with_g_main_loop_timeout_callback): Callback
* e-component-registry.c (sleep_with_g_main_loop): New utility
function.
(sleep_with_g_main_loop_timeout_callback): Callback function for
`sleep_with_g_main_loop()'.
(wait_for_corba_object_to_die): Use `sleep_with_g_main_loop()'
instead of `sleep()'.
svn path=/trunk/; revision=14493
Diffstat (limited to 'shell/e-component-registry.c')
-rw-r--r-- | shell/e-component-registry.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/shell/e-component-registry.c b/shell/e-component-registry.c index 07762ac9e5..77e2df95eb 100644 --- a/shell/e-component-registry.c +++ b/shell/e-component-registry.c @@ -60,6 +60,30 @@ struct _EComponentRegistryPrivate { /* Utility functions. */ +static int +sleep_with_g_main_loop_timeout_callback (void *data) +{ + GMainLoop *loop; + + loop = (GMainLoop *) data; + g_main_quit (loop); + + return FALSE; +} + +/* This function is like `sleep()', but it uses the GMainLoop so CORBA + invocations can get through. */ +static void +sleep_with_g_main_loop (int num_seconds) +{ + GMainLoop *loop; + + loop = g_main_new (TRUE); + g_timeout_add (1000 * num_seconds, sleep_with_g_main_loop_timeout_callback, loop); + g_main_run (loop); + g_main_destroy (loop); +} + static void wait_for_corba_object_to_die (Bonobo_Unknown corba_objref, const char *id) @@ -74,7 +98,7 @@ wait_for_corba_object_to_die (Bonobo_Unknown corba_objref, break; g_print ("Waiting for component to die -- %s (%d)\n", id, count); - sleep (1); + sleep_with_g_main_loop (1); count ++; } } |