Commit f53d5919 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

FAILURE et BUSY feedback

parent 4ef84dc8
pixmapsdir = $(datadir)/pixmaps
pixmaps_DATA = sflphone.png accept.svg current.svg transfert.svg hang_up.svg hold.svg unhold.svg refuse.svg call.svg ring.svg dial.svg mic.svg speaker.svg
pixmaps_DATA = sflphone.png accept.svg current.svg transfert.svg hang_up.svg hold.svg unhold.svg refuse.svg call.svg ring.svg dial.svg mic.svg speaker.svg fail.svg
EXTRA_DIST = $(pixmaps_DATA)
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45"
version="1.0"
sodipodi:docbase="/home/plbeaudoin/SFLPhone/sflphone/sflphone-gtk/pixmaps"
sodipodi:docname="fail.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<defs
id="defs4">
<linearGradient
id="linearGradient4183">
<stop
id="stop4185"
offset="0"
style="stop-color:#b00014;stop-opacity:1;" />
<stop
id="stop4187"
offset="1"
style="stop-color:#70000c;stop-opacity:1;" />
</linearGradient>
<linearGradient
id="linearGradient4167">
<stop
style="stop-color:#80000e;stop-opacity:1;"
offset="0"
id="stop4169" />
<stop
style="stop-color:#b00014;stop-opacity:0;"
offset="1"
id="stop4171" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient4167"
id="linearGradient4173"
x1="7.1249466"
y1="23.946518"
x2="20.06057"
y2="16.478132"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.313453e-2,-0.384275)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="13.59101"
inkscape:cy="12.669149"
inkscape:document-units="px"
inkscape:current-layer="g3157"
width="32px"
height="32px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1014"
inkscape:window-height="691"
inkscape:window-x="5"
inkscape:window-y="49">
<sodipodi:guide
orientation="horizontal"
position="8.0357143"
id="guide3144" />
<sodipodi:guide
orientation="vertical"
position="15.982143"
id="guide3146" />
</sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g3157"
transform="matrix(0.8678614,0.8678614,-0.8678614,0.8678614,11.185569,-9.9643113)">
<path
style="opacity:1;fill:#7e001a;fill-opacity:1;stroke:#3b000b;stroke-width:1.22734141;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.60188085"
d="M 5.25 2.1875 C 4.8395257 2.1875 4.4395267 2.3417233 4.125 2.65625 L 2.59375 4.1875 C 1.9646967 4.8165533 1.9646968 5.8084466 2.59375 6.4375 L 8.3125 12.1875 L 2.59375 17.90625 C 1.9646967 18.535303 1.9646968 19.527197 2.59375 20.15625 L 4.125 21.6875 C 4.7540533 22.316553 5.7771965 22.316553 6.40625 21.6875 L 12.125 15.96875 L 17.84375 21.6875 C 18.472803 22.316553 19.495947 22.316553 20.125 21.6875 L 21.65625 20.15625 C 22.285303 19.527197 22.285303 18.535304 21.65625 17.90625 L 15.9375 12.1875 L 21.65625 6.4375 C 22.285303 5.8084467 22.285303 4.8165534 21.65625 4.1875 L 20.125 2.65625 C 19.495947 2.0271967 18.472803 2.0271966 17.84375 2.65625 L 12.125 8.375 L 6.40625 2.65625 C 6.0917233 2.3417233 5.6604743 2.1875 5.25 2.1875 z "
transform="matrix(0.5761289,-0.5761289,0.5761289,0.5761289,-0.7036018,12.185056)"
id="rect2182" />
</g>
</g>
</svg>
......@@ -132,6 +132,22 @@ sflphone_hang_up( call_t * c )
screen_clear();
}
void
sflphone_fail( call_t * c )
{
c->state = CALL_STATE_FAILURE;
update_call_tree(c);
screen_set_call(c);
}
void
sflphone_busy( call_t * c )
{
c->state = CALL_STATE_BUSY;
update_call_tree(c);
screen_set_call(c);
}
void
sflphone_current( call_t * c )
{
......@@ -248,6 +264,8 @@ sflphone_keypad( guint keyval, gchar * key)
break;
case CALL_STATE_CURRENT:
case CALL_STATE_RINGING:
case CALL_STATE_BUSY:
case CALL_STATE_FAILURE:
switch (keyval)
{
case 65307: /* ESCAPE */
......
......@@ -62,6 +62,9 @@ void sflphone_hold ( call_t * c);
*/
void sflphone_ringing(call_t * c );
void sflphone_busy( call_t * c );
void sflphone_fail( call_t * c );
/**
* Put the call in Current state
*/
......
......@@ -40,7 +40,11 @@ typedef enum
/** Call which numbers are being added by the user */
CALL_STATE_DIALING,
/** Call is on hold */
CALL_STATE_HOLD
CALL_STATE_HOLD,
/** Call has failed */
CALL_STATE_FAILURE,
/** Call is busy */
CALL_STATE_BUSY
} call_state_t;
......
......@@ -147,41 +147,40 @@ update_buttons ()
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), FALSE);
call_t * selectedCall = call_get_selected();
if(selectedCall) // TODO Make this a switch
if (selectedCall)
{
if( selectedCall->state == CALL_STATE_INCOMING)
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
}
else if( selectedCall->state == CALL_STATE_HOLD)
{
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), TRUE);
}
else if( selectedCall->state == CALL_STATE_RINGING)
{
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
}
else if(selectedCall->state == CALL_STATE_DIALING)
{
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
}
else if (selectedCall->state == CALL_STATE_CURRENT)
{
//gtk_widget_hide( callButton );
/* Hack : if hangupButton is put on the window in create_screen()
* the hbox will request space for 4 buttons making the window larger than needed */
//gtk_box_pack_start (GTK_BOX (hbox), hangupButton, TRUE /*expand*/, TRUE /*fill*/, 10 /*padding*/);
//gtk_box_reorder_child(GTK_BOX (hbox), hangupButton, 0);
gtk_widget_show( hangupButton );
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
}
}
switch(selectedCall->state) // TODO Make this a switch
{
case CALL_STATE_INCOMING:
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
case CALL_STATE_HOLD:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), TRUE);
break;
case CALL_STATE_RINGING:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
case CALL_STATE_DIALING:
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
case CALL_STATE_CURRENT:
gtk_widget_show( hangupButton );
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
break;
case CALL_STATE_BUSY:
case CALL_STATE_FAILURE:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
default:
g_error("Should not happen!");
break;
}
}
}
/* Call back when the user click on a call in the list */
static void
......@@ -365,21 +364,28 @@ update_call_tree (call_t * c)
call_get_name(c),
call_get_number(c));
if (c->state == CALL_STATE_HOLD)
switch(c->state)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/hold.svg", NULL);
}
else if (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);
case CALL_STATE_HOLD:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/hold.svg", NULL);
break;
case CALL_STATE_RINGING:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/ring.svg", NULL);
break;
case CALL_STATE_CURRENT:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/current.svg", NULL);
break;
case CALL_STATE_DIALING:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/dial.svg", NULL);
break;
case CALL_STATE_FAILURE:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/fail.svg", NULL);
break;
case CALL_STATE_BUSY:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/busy.svg", NULL);
break;
default:
g_error("Should not happen!");
}
//Resize it
if(pixbuf)
......@@ -422,14 +428,21 @@ update_call_tree_add (call_t * c)
gtk_list_store_append (store, &iter);
if (c->state == CALL_STATE_INCOMING)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/ring.svg", NULL);
}
else if (c->state == CALL_STATE_DIALING)
{
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/dial.svg", NULL);
}
switch(c->state)
{
case CALL_STATE_INCOMING:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/ring.svg", NULL);
break;
case CALL_STATE_DIALING:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/dial.svg", NULL);
break;
case CALL_STATE_RINGING:
pixbuf = gdk_pixbuf_new_from_file(PIXMAPS_DIR "/ring.svg", NULL);
break;
default:
g_error("Should not happen!");
}
//Resize it
if(pixbuf)
{
......
......@@ -112,6 +112,27 @@ call_state_cb (DBusGProxy *proxy,
{
sflphone_current (c);
}
else if ( strcmp(state, "FAILURE") == 0 )
{
sflphone_fail (c);
}
else if ( strcmp(state, "BUSY") == 0 )
{
sflphone_busy (c);
}
}
else
{ //The callID is unknow, threat it like a new call
if ( strcmp(state, "RINGING") == 0 )
{
g_print ("New ringing call! %s\n",callID);
call_t * c = g_new0 (call_t, 1);
c->accountID = g_strdup("1");
c->callID = g_strdup(callID);
c->from = g_strdup("\"\" <>");
c->state = CALL_STATE_RINGING;
sflphone_incoming_call (c);
}
}
}
......
......@@ -24,6 +24,7 @@
#include <actions.h>
#include <gtk/gtk.h>
#include <stdlib.h>
int
main (int argc, char *argv[])
......@@ -36,6 +37,8 @@ main (int argc, char *argv[])
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n\
There is NO WARRANTY, to the extent permitted by law.\n\n");
srand ( time(NULL) );
if(sflphone_init())
{
create_main_window ();
......
Markdown is supported
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