From fa2c29c84fedc95946425d3a9f05730eb1bf4068 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 12 Aug 2010 13:13:53 -0500 Subject: voicecall: Move some stuff around --- src/voicecall.c | 74 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/voicecall.c b/src/voicecall.c index f07cea69..41976ac9 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -165,6 +165,43 @@ static const char *time_to_str(const time_t *t) return buf; } +static int voicecalls_num_with_status(struct ofono_voicecall *vc, + int status) +{ + GSList *l; + struct voicecall *v; + int num = 0; + + for (l = vc->call_list; l; l = l->next) { + v = l->data; + + if (v->call->status == status) + num += 1; + } + + return num; +} + +static int voicecalls_num_active(struct ofono_voicecall *vc) +{ + return voicecalls_num_with_status(vc, CALL_STATUS_ACTIVE); +} + +static int voicecalls_num_held(struct ofono_voicecall *vc) +{ + return voicecalls_num_with_status(vc, CALL_STATUS_HELD); +} + +static int voicecalls_num_connecting(struct ofono_voicecall *vc) +{ + int r = 0; + + r += voicecalls_num_with_status(vc, CALL_STATUS_DIALING); + r += voicecalls_num_with_status(vc, CALL_STATUS_ALERTING); + + return r; +} + static DBusMessage *voicecall_get_properties(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -620,43 +657,6 @@ static gboolean voicecalls_have_held(struct ofono_voicecall *vc) return voicecalls_have_with_status(vc, CALL_STATUS_HELD); } -static int voicecalls_num_with_status(struct ofono_voicecall *vc, - int status) -{ - GSList *l; - struct voicecall *v; - int num = 0; - - for (l = vc->call_list; l; l = l->next) { - v = l->data; - - if (v->call->status == status) - num += 1; - } - - return num; -} - -static int voicecalls_num_active(struct ofono_voicecall *vc) -{ - return voicecalls_num_with_status(vc, CALL_STATUS_ACTIVE); -} - -static int voicecalls_num_held(struct ofono_voicecall *vc) -{ - return voicecalls_num_with_status(vc, CALL_STATUS_HELD); -} - -static int voicecalls_num_connecting(struct ofono_voicecall *vc) -{ - int r = 0; - - r += voicecalls_num_with_status(vc, CALL_STATUS_DIALING); - r += voicecalls_num_with_status(vc, CALL_STATUS_ALERTING); - - return r; -} - static GSList *voicecalls_held_list(struct ofono_voicecall *vc) { GSList *l; -- cgit v1.2.3