From 3ad04fff22808f26424bbec3c2327c2467be5cb2 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 14 Sep 2010 22:47:42 +0000 Subject: [PATCH] Sending PHONE_EVENT_ONLINE only once all configured plug-ins have initialized --- src/plugins/profiles.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/plugins/profiles.c b/src/plugins/profiles.c index 73829a6..2e2dd17 100644 --- a/src/plugins/profiles.c +++ b/src/plugins/profiles.c @@ -110,6 +110,8 @@ PhonePlugin plugin = /* private */ /* functions */ /* profiles_init */ +static gboolean _init_idle(gpointer data); + static int _profiles_init(PhonePlugin * plugin) { Profiles * profiles; @@ -146,11 +148,21 @@ static int _profiles_init(PhonePlugin * plugin) } pa_context_connect(profiles->pac, NULL, 0, NULL); pa_threaded_mainloop_start(profiles->pam); - /* XXX may already be online, may not be desired */ - plugin->helper->event(plugin->helper->phone, PHONE_EVENT_ONLINE); + profiles->source = g_idle_add(_init_idle, plugin); return 0; } +static gboolean _init_idle(gpointer data) +{ + PhonePlugin * plugin = data; + Profiles * profiles = plugin->priv; + + /* FIXME may already be online, may not be desired */ + plugin->helper->event(plugin->helper->phone, PHONE_EVENT_ONLINE); + profiles->source = 0; + return FALSE; +} + /* profiles_destroy */ static int _profiles_destroy(PhonePlugin * plugin)