Commit 12d9a9de authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

Working hang up when dialing

parent b7b7cdbd
......@@ -201,7 +201,7 @@ sflphone_keypad( guint keyval, gchar * key)
sflphone_place_call(c);
break;
case 65307: /* ESCAPE */
sflphone_hang_up(c);
dbus_hang_up(c);
break;
case 65288: /* BACKSPACE */
{ /* Brackets mandatory because of local vars */
......@@ -214,11 +214,11 @@ sflphone_keypad( guint keyval, gchar * key)
g_free(c->from);
c->from = g_strconcat("\"\" <", c->to, ">", NULL);
screen_set_call(c);
update_call_tree();
update_call_tree(c);
}
else if(strlen(c->to) == 1)
{
sflphone_hang_up(c);
dbus_hang_up(c);
}
}
......@@ -241,7 +241,7 @@ sflphone_keypad( guint keyval, gchar * key)
g_free(c->from);
c->from = g_strconcat("\"\" <", c->to, ">", NULL);
screen_set_call(c);
update_call_tree();
update_call_tree(c);
}
break;
}
......@@ -254,23 +254,36 @@ sflphone_keypad( guint keyval, gchar * key)
switch (keyval)
{
case 65307: /* ESCAPE */
sflphone_hang_up(c);
dbus_hang_up(c);
break;
}
}
else // Not in a call, not dialing, create a new call
else
{
if (keyval < 255 || (keyval >65453 && keyval < 65466))
{
/* Brackets mandatory because of local vars */
call_t * c = g_new0 (call_t, 1);
c->state = CALL_STATE_DIALING;
c->from = g_strconcat("\"\" <", key, ">", NULL);
c->callID = "asdf"; // TODO generate a unique number
c->to = g_strdup(key);
call_list_add(c);
screen_set_call(c);
update_call_tree();
call_t * c = (call_t*) call_list_get_by_state (CALL_STATE_RINGING);
if(c) // Currently ring => edit number
{
switch (keyval)
{
case 65307: /* ESCAPE */
dbus_hang_up(c);
break;
}
}
else
{ // Not in a call, not dialing, create a new call
if (keyval < 255 || (keyval >65453 && keyval < 65466))
{
/* Brackets mandatory because of local vars */
call_t * c = g_new0 (call_t, 1);
c->state = CALL_STATE_DIALING;
c->from = g_strconcat("\"\" <", key, ">", NULL);
c->callID = "asdf"; // TODO generate a unique number
c->to = g_strdup(key);
call_list_add(c);
screen_set_call(c);
update_call_tree_add(c);
}
}
}
}
......
......@@ -404,7 +404,7 @@ update_call_tree (call_t * c)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/hold.svg", NULL);
}
else if (c->state == CALL_STATE_RINGING)
else if (c->state == CALL_STATE_INCOMING || c->state == CALL_STATE_RINGING)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/ring.svg", NULL);
}
......@@ -412,6 +412,10 @@ update_call_tree (call_t * c)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/current.svg", NULL);
}
else if (c->state == CALL_STATE_DIALING)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/dial.svg", NULL);
}
//Resize it
if(pixbuf)
{
......@@ -446,17 +450,35 @@ update_call_tree_add (call_t * c)
// New call in the list
gchar * markup;
markup = g_markup_printf_escaped("<b>%s</b>\n"
if (c->state == CALL_STATE_CURRENT)
{
markup = g_markup_printf_escaped("<big><b>%s</b></big>\n"
"%s",
call_get_name(c),
call_get_number(c));
}
else
{
markup = g_markup_printf_escaped("<b>%s</b>\n"
"%s",
call_get_name(c),
call_get_number(c));
}
gtk_list_store_append (store, &iter);
if (c->state == CALL_STATE_INCOMING)
if (c->state == CALL_STATE_HOLD)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/hold.svg", NULL);
}
else if (c->state == CALL_STATE_INCOMING || c->state == CALL_STATE_RINGING)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/ring.svg", NULL);
}
else if (c->state == CALL_STATE_CURRENT)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/current.svg", NULL);
}
else if (c->state == CALL_STATE_DIALING)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/dial.svg", NULL);
......@@ -479,6 +501,8 @@ update_call_tree_add (call_t * c)
g_object_unref(G_OBJECT(pixbuf));
//g_free(markup);
update_buttons();
//return row_ref;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment