diff options
author | Mika Liljeberg <mika.liljeberg@nokia.com> | 2011-03-29 10:48:28 +0300 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-03-30 12:26:19 -0500 |
commit | 3c191345241d462ce966c727c96d4a2cc0646c7a (patch) | |
tree | 2ec209c89e2771b88d7523c94aac074c34f62e1f | |
parent | 1f7cd4393f3f2b84055ce5da1ae8e37d7e57a150 (diff) | |
download | ofono-3c191345241d462ce966c727c96d4a2cc0646c7a.tar.bz2 |
core: notify watches of already registered atoms
-rw-r--r-- | src/modem.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/modem.c b/src/modem.c index 655994b2..d22c7189 100644 --- a/src/modem.c +++ b/src/modem.c @@ -271,6 +271,9 @@ unsigned int __ofono_modem_add_atom_watch(struct ofono_modem *modem, void *data, ofono_destroy_func destroy) { struct atom_watch *watch; + unsigned int id; + GSList *l; + struct ofono_atom *atom; if (notify == NULL) return 0; @@ -282,8 +285,19 @@ unsigned int __ofono_modem_add_atom_watch(struct ofono_modem *modem, watch->item.destroy = destroy; watch->item.notify_data = data; - return __ofono_watchlist_add_item(modem->atom_watches, + id = __ofono_watchlist_add_item(modem->atom_watches, (struct ofono_watchlist_item *)watch); + + for (l = modem->atoms; l; l = l->next) { + atom = l->data; + + if (atom->type != type || atom->unregister == NULL) + continue; + + notify(atom, OFONO_ATOM_WATCH_CONDITION_REGISTERED, data); + } + + return id; } gboolean __ofono_modem_remove_atom_watch(struct ofono_modem *modem, |