From 2666b2fa59a412ab7f8f0ca125bb3599682403c4 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 9 May 2010 16:06:43 +0000 Subject: [PATCH] Implementing phone calls (untested) --- src/callbacks.c | 16 +++++++++++----- src/phone.c | 35 +++++++++++++++++++++++++---------- src/phone.h | 9 ++++++--- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index 90459bd..fe1f66d 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -81,21 +81,27 @@ static GdkFilterReturn _filter_message_show(Phone * phone, /* on_phone_call_answer */ void on_phone_call_answer(gpointer data) { - /* FIXME implement */ + Phone * phone = data; + + phone_call_answer(phone); } /* on_phone_call_hangup */ void on_phone_call_hangup(gpointer data) { - /* FIXME implement */ + Phone * phone = data; + + phone_call_hangup(phone); } /* on_phone_call_reject */ void on_phone_call_reject(gpointer data) { - /* FIXME implement */ + Phone * phone = data; + + phone_call_hangup(phone); } @@ -190,7 +196,7 @@ void on_phone_dialer_call(gpointer data) { Phone * phone = data; - phone_call(phone, NULL); + phone_dialer_call(phone, NULL); } @@ -210,7 +216,7 @@ void on_phone_dialer_hangup(gpointer data) { Phone * phone = data; - phone_hangup(phone); + phone_dialer_hangup(phone); } diff --git a/src/phone.c b/src/phone.c index 5911049..0ab3631 100644 --- a/src/phone.c +++ b/src/phone.c @@ -286,15 +286,17 @@ static int _error_text(char const * message, int ret) } -/* phone_call */ -void phone_call(Phone * phone, char const * number) +/* calls */ +void phone_call_answer(Phone * phone) { - if(number == NULL) - number = gtk_entry_get_text(GTK_ENTRY(phone->di_entry)); - if(number[0] == '\0') - number = NULL; /* call the last number dialled */ - gsm_call(phone->gsm, GSM_CALL_TYPE_VOICE, number); - phone_show_call(phone, TRUE, PHONE_CALL_OUTGOING); + gsm_call_answer(phone->gsm); +} + + +/* phone_call_hangup */ +void phone_call_hangup(Phone * phone) +{ + gsm_call_hangup(phone->gsm); } @@ -407,6 +409,7 @@ void phone_contacts_write_selected(Phone * phone) } +/* dialer */ /* phone_dialer_append */ int phone_dialer_append(Phone * phone, char character) { @@ -434,8 +437,20 @@ int phone_dialer_append(Phone * phone, char character) } -/* phone_hangup */ -void phone_hangup(Phone * phone) +/* phone_dialer_call */ +void phone_dialer_call(Phone * phone, char const * number) +{ + if(number == NULL) + number = gtk_entry_get_text(GTK_ENTRY(phone->di_entry)); + if(number[0] == '\0') + number = NULL; /* call the last number dialled */ + gsm_call(phone->gsm, GSM_CALL_TYPE_VOICE, number); + phone_show_call(phone, TRUE, PHONE_CALL_OUTGOING); +} + + +/* phone_dialer_hangup */ +void phone_dialer_hangup(Phone * phone) { gsm_call_hangup(phone->gsm); if(phone->di_window != NULL) diff --git a/src/phone.h b/src/phone.h index b4da8ed..c0d0699 100644 --- a/src/phone.h +++ b/src/phone.h @@ -72,6 +72,10 @@ void phone_show_dialer(Phone * phone, gboolean show); void phone_show_messages(Phone * phone, gboolean show); void phone_show_write(Phone * phone, gboolean show); +/* calls */ +void phone_call_answer(Phone * phone); +void phone_call_hangup(Phone * phone); + /* code */ int phone_code_append(Phone * phone, char character); void phone_code_clear(Phone * phone); @@ -84,10 +88,9 @@ void phone_contacts_call_selected(Phone * phone); void phone_contacts_write_selected(Phone * phone); /* dialer */ -void phone_call(Phone * phone, char const * number); -void phone_hangup(Phone * phone); - int phone_dialer_append(Phone * phone, char character); +void phone_dialer_call(Phone * phone, char const * number); +void phone_dialer_hangup(Phone * phone); /* messages */ void phone_messages_write(Phone * phone, char const * number,