Implementing phone calls (untested)

This commit is contained in:
Pierre Pronchery 2010-05-09 16:06:43 +00:00
parent 44a150ecec
commit 2666b2fa59
3 changed files with 42 additions and 18 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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,