callscreen: use ReleaseAndAnswer just when there is active call.
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 11 Aug 2012 20:35:35 +0000 (17:35 -0300)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>
Sat, 11 Aug 2012 20:35:35 +0000 (17:35 -0300)
Otherwise, if there is a Held call, we must call Hangup directly.

Fixes #23 (Hangup call turns into swap calls)

dialer/callscreen.c

index 97d100f..a7be0a3 100644 (file)
@@ -437,8 +437,11 @@ static void _on_clicked(void *data, Evas_Object *obj __UNUSED__,
        }
 
        if (strcmp(emission, "hangup") == 0) {
-               if (ctx->calls.active)
+               OFono_Call *c = ctx->calls.active;
+               if ((c) && (ofono_call_state_get(c) == OFONO_CALL_STATE_ACTIVE))
                        ofono_release_and_swap(NULL, NULL);
+               else if (c)
+                       ofono_call_hangup(c, NULL, NULL);
        } else if (strcmp(emission, "answer") == 0) {
                if (ctx->calls.active)
                        ofono_call_answer(ctx->calls.active, NULL, NULL);