diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-04-15 17:01:08 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-04-15 17:15:34 +0300 |
commit | 426ed2f9ba0abe9dbfedde43c8f1c9a19580b950 (patch) | |
tree | a27f370d1c9ccc39a8543f76463d58e2c7c8d163 /audio/telephony-maemo.c | |
parent | 66583544c6d586d4bf328ea5b1b4fb399820f11f (diff) | |
download | bluez-426ed2f9ba0abe9dbfedde43c8f1c9a19580b950.tar.gz |
Fix call indicator value for multiple calls
Getting the call indicator value right is actually pretty tricky. If we set it
to 1 in the first ->ACTIVE state transition then we need to change it to 0 when
we make the first transition that will result in the call becoming IDLE. As far
as I can see there are two possible such transitions: MT_RELEASE and
MO_RELEASE.
Diffstat (limited to 'audio/telephony-maemo.c')
-rw-r--r-- | audio/telephony-maemo.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/audio/telephony-maemo.c b/audio/telephony-maemo.c index 8ebb3d3a..26d8030b 100644 --- a/audio/telephony-maemo.c +++ b/audio/telephony-maemo.c @@ -173,6 +173,9 @@ static DBusConnection *connection = NULL; static GSList *calls = NULL; +/* Reference count for determining the call indicator status */ +static GSList *active_calls = NULL; + static char *msisdn = NULL; /* Subscriber number */ static char *vmbx = NULL; /* Voice mailbox number */ @@ -916,24 +919,6 @@ static void handle_outgoing_call(DBusMessage *msg) EV_CALLSETUP_OUTGOING); } -/* Convenience function for determining the value of the "call" indicator */ -static gboolean single_call(struct csd_call *call) -{ - GSList *l; - - for (l = calls; l != NULL; l = l->next) { - struct csd_call *c = l->data; - - if (c == call) - continue; - - if (c->status != CSD_CALL_STATUS_IDLE) - return FALSE; - } - - return TRUE; -} - static void handle_call_status(DBusMessage *msg, const char *call_path) { struct csd_call *call; @@ -973,9 +958,7 @@ static void handle_call_status(DBusMessage *msg, const char *call_path) EV_CALLSETUP_INACTIVE); if (!call->originating) telephony_calling_stopped_ind(); - } else if (single_call(call)) - telephony_update_indicator(maemo_indicators, "call", - EV_CALL_INACTIVE); + } g_free(call->number); call->number = NULL; @@ -1017,7 +1000,8 @@ static void handle_call_status(DBusMessage *msg, const char *call_path) "callheld", EV_CALLHELD_NONE); } else { - if (single_call(call)) + active_calls = g_slist_prepend(active_calls, call); + if (g_slist_length(active_calls) == 1) telephony_update_indicator(maemo_indicators, "call", EV_CALL_ACTIVE); @@ -1030,8 +1014,11 @@ static void handle_call_status(DBusMessage *msg, const char *call_path) } break; case CSD_CALL_STATUS_MO_RELEASE: - break; case CSD_CALL_STATUS_MT_RELEASE: + active_calls = g_slist_remove(active_calls, call); + if (g_slist_length(active_calls) == 0) + telephony_update_indicator(maemo_indicators, "call", + EV_CALL_INACTIVE); break; case CSD_CALL_STATUS_HOLD_INITIATED: break; |