aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk_phone.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk_phone.c')
-rw-r--r--src/conversation/gnunet-conversation-gtk_phone.c82
1 files changed, 46 insertions, 36 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_phone.c b/src/conversation/gnunet-conversation-gtk_phone.c
index 59a8a23d..5ac64302 100644
--- a/src/conversation/gnunet-conversation-gtk_phone.c
+++ b/src/conversation/gnunet-conversation-gtk_phone.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2010-2013 Christian Grothoff (and other contributing authors) 3 (C) 2010-2014 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -20,7 +20,7 @@
20 20
21/** 21/**
22 * @file src/conversation/gnunet-conversation-gtk_phone.c 22 * @file src/conversation/gnunet-conversation-gtk_phone.c
23 * @brief 23 * @brief main logic to manage phone calls
24 * @author yids 24 * @author yids
25 * @author hark 25 * @author hark
26 * @author Christian Grothoff 26 * @author Christian Grothoff
@@ -253,16 +253,20 @@ static char *peer_name;
253 */ 253 */
254static char *address; 254static char *address;
255 255
256static GtkWidget *b_contact; 256static GtkWidget *b_add_contact;
257 257
258static GtkWidget *b_accept; 258static GtkWidget *b_accept;
259 259
260static GtkWidget *b_hangup; 260static GtkWidget *b_refuse;
261 261
262static GtkWidget *b_suspend; 262static GtkWidget *b_suspend; // pause
263 263
264static GtkWidget *b_resume; 264static GtkWidget *b_resume;
265 265
266static GtkWidget *b_call; // connect
267
268static GtkWidget *b_hangup; // disconnect up
269
266 270
267 271
268/** 272/**
@@ -446,7 +450,7 @@ update_active_call_list_buttons()
446 case CT_active: 450 case CT_active:
447 // hangup, pause 451 // hangup, pause
448 //GCG_log("CT_active state: %u ",cl_caller_state); 452 //GCG_log("CT_active state: %u ",cl_caller_state);
449 gtk_widget_set_sensitive (b_contact, TRUE); 453 gtk_widget_set_sensitive (b_add_contact, TRUE);
450 gtk_widget_set_sensitive (b_accept, FALSE); 454 gtk_widget_set_sensitive (b_accept, FALSE);
451 gtk_widget_set_sensitive (b_hangup, TRUE); 455 gtk_widget_set_sensitive (b_hangup, TRUE);
452 gtk_widget_set_sensitive (b_suspend, TRUE); 456 gtk_widget_set_sensitive (b_suspend, TRUE);
@@ -455,7 +459,7 @@ update_active_call_list_buttons()
455 case CT_ringing: 459 case CT_ringing:
456 // pickup, phonebook 460 // pickup, phonebook
457 //GCG_log("CT_ring show button"); 461 //GCG_log("CT_ring show button");
458 gtk_widget_set_sensitive (b_contact, TRUE); 462 gtk_widget_set_sensitive (b_add_contact, TRUE);
459 if (phone_state == PS_LISTEN) 463 if (phone_state == PS_LISTEN)
460 { 464 {
461 gtk_widget_set_sensitive (b_accept, TRUE); 465 gtk_widget_set_sensitive (b_accept, TRUE);
@@ -471,7 +475,7 @@ update_active_call_list_buttons()
471 case CT_rejected: 475 case CT_rejected:
472 //add to phonebook 476 //add to phonebook
473 //GCG_log("CT_rejected "); 477 //GCG_log("CT_rejected ");
474 gtk_widget_set_sensitive (b_contact, TRUE); 478 gtk_widget_set_sensitive (b_add_contact, TRUE);
475 gtk_widget_set_sensitive (b_accept, FALSE); 479 gtk_widget_set_sensitive (b_accept, FALSE);
476 gtk_widget_set_sensitive (b_hangup, FALSE); 480 gtk_widget_set_sensitive (b_hangup, FALSE);
477 gtk_widget_set_sensitive (b_suspend, FALSE); 481 gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -480,7 +484,7 @@ update_active_call_list_buttons()
480 case CT_suspended: 484 case CT_suspended:
481 // resume, hangup 485 // resume, hangup
482 //GCG_log("CT_suspended "); 486 //GCG_log("CT_suspended ");
483 gtk_widget_set_sensitive (b_contact, TRUE); 487 gtk_widget_set_sensitive (b_add_contact, TRUE);
484 gtk_widget_set_sensitive (b_accept, FALSE); 488 gtk_widget_set_sensitive (b_accept, FALSE);
485 gtk_widget_set_sensitive (b_hangup, TRUE); 489 gtk_widget_set_sensitive (b_hangup, TRUE);
486 gtk_widget_set_sensitive (b_suspend, FALSE); 490 gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -498,7 +502,7 @@ update_active_call_list_buttons()
498 case CT_other: 502 case CT_other:
499 //add to phonebook 503 //add to phonebook
500 //GCG_log("CT_rejected "); 504 //GCG_log("CT_rejected ");
501 gtk_widget_set_sensitive (b_contact, TRUE); 505 gtk_widget_set_sensitive (b_add_contact, TRUE);
502 gtk_widget_set_sensitive (b_accept, TRUE); 506 gtk_widget_set_sensitive (b_accept, TRUE);
503 gtk_widget_set_sensitive (b_hangup, TRUE); 507 gtk_widget_set_sensitive (b_hangup, TRUE);
504 gtk_widget_set_sensitive (b_suspend, TRUE); 508 gtk_widget_set_sensitive (b_suspend, TRUE);
@@ -532,7 +536,7 @@ gnunet_conversation_gtk_active_calls_treeview_selection_changed_cb ()
532static void 536static void
533disable_list_buttons() 537disable_list_buttons()
534{ 538{
535 gtk_widget_set_sensitive (b_contact, FALSE); 539 gtk_widget_set_sensitive (b_add_contact, FALSE);
536 gtk_widget_set_sensitive (b_accept, FALSE); 540 gtk_widget_set_sensitive (b_accept, FALSE);
537 gtk_widget_set_sensitive (b_hangup, FALSE); 541 gtk_widget_set_sensitive (b_hangup, FALSE);
538 gtk_widget_set_sensitive (b_suspend, FALSE); 542 gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -977,7 +981,7 @@ call_event_handler (void *cls,
977 * @param arg arguments given to the command 981 * @param arg arguments given to the command
978 */ 982 */
979void 983void
980GSC_do_call (const char *arg) 984GSC_PHONE_make_call (const char *arg)
981{ 985{
982 GtkEntry *address_entry; 986 GtkEntry *address_entry;
983 struct GNUNET_IDENTITY_Ego *caller_id; 987 struct GNUNET_IDENTITY_Ego *caller_id;
@@ -1366,12 +1370,11 @@ GNUNET_CONVERSATION_GTK_on_call_clicked ()
1366{ 1370{
1367 GtkEntry *address_entry; 1371 GtkEntry *address_entry;
1368 1372
1369 address_entry = GTK_ENTRY (GCG_get_main_window_object ("GNUNET_GTK_conversation_address")); 1373 address_entry = GTK_ENTRY (GCG_get_main_window_object
1374 ("GNUNET_GTK_conversation_address"));
1370 1375
1371 GSC_do_call (gtk_entry_get_text(address_entry)); 1376 GSC_PHONE_make_call (gtk_entry_get_text (address_entry));
1372 //disable_button ("GNUNET_GTK_conversation_accept_button");
1373 do_status (); 1377 do_status ();
1374// free(to_addr);
1375} 1378}
1376 1379
1377 1380
@@ -1394,6 +1397,9 @@ gnunet_conversation_gtk_ego_combobox_changed_cb (GtkComboBox *widget,
1394} 1397}
1395 1398
1396 1399
1400/**
1401 * Initialize phone subsystem.
1402 */
1397void 1403void
1398GCG_PHONE_init () 1404GCG_PHONE_init ()
1399{ 1405{
@@ -1403,16 +1409,20 @@ GCG_PHONE_init ()
1403 speaker = GNUNET_SPEAKER_create_from_hardware (cfg); 1409 speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
1404 mic = GNUNET_MICROPHONE_create_from_hardware (cfg); 1410 mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
1405 /* get gui objects */ 1411 /* get gui objects */
1406 b_contact = GTK_WIDGET (GCG_get_main_window_object 1412 b_add_contact = GTK_WIDGET (GCG_get_main_window_object
1407 ("GNUNET_GTK_conversation_use_current_button")); 1413 ("gnunet_conversation_gtk_add_contact_button"));
1408 b_accept = GTK_WIDGET (GCG_get_main_window_object 1414 b_accept = GTK_WIDGET (GCG_get_main_window_object
1409 ("GNUNET_GTK_conversation_accept_button")); 1415 ("gnunet_conversation_gtk_accept_button"));
1410 b_hangup = GTK_WIDGET (GCG_get_main_window_object 1416 b_refuse = GTK_WIDGET (GCG_get_main_window_object
1411 ("GNUNET_GTK_conversation_hangup_button")); 1417 ("gnunet_conversation_gtk_hangup_button"));
1412 b_suspend = GTK_WIDGET (GCG_get_main_window_object 1418 b_suspend = GTK_WIDGET (GCG_get_main_window_object
1413 ("GNUNET_GTK_conversation_suspend_button")); 1419 ("gnunet_conversation_gtk_suspend_button"));
1414 b_resume = GTK_WIDGET (GCG_get_main_window_object 1420 b_resume = GTK_WIDGET (GCG_get_main_window_object
1415 ("GNUNET_GTK_conversation_resume_button")); 1421 ("gnunet_conversation_gtk_resume_button"));
1422 b_call = GTK_WIDGET (GCG_get_main_window_object
1423 ("gnunet_conversation_gtk_call_button"));
1424 b_hangup = GTK_WIDGET (GCG_get_main_window_object
1425 ("gnunet_conversation_gtk_hangup_button"));
1416 1426
1417 active_liststore = 1427 active_liststore =
1418 GTK_LIST_STORE (GCG_get_main_window_object 1428 GTK_LIST_STORE (GCG_get_main_window_object
@@ -1423,25 +1433,23 @@ GCG_PHONE_init ()
1423} 1433}
1424 1434
1425 1435
1436/**
1437 * Shutdown phone subsystem.
1438 */
1426void 1439void
1427GCG_PHONE_shutdown () 1440GCG_PHONE_shutdown ()
1428{ 1441{
1429//TODO: make this work 1442 struct CallList *cl;
1430 //struct OperationContext *oc;
1431 1443
1432/* 1444 while (NULL != (cl = cl_head))
1433 GCG_advertise_shutdown_ ();
1434 while (NULL != (oc = oc_head))
1435 { 1445 {
1436 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1446 GNUNET_CONVERSATION_caller_hang_up (cl->caller);
1437 _("Operation not completed due to shutdown\n")); 1447 GNUNET_CONTAINER_DLL_remove (cl_head,
1438 GNUNET_IDENTITY_cancel (oc->op); 1448 cl_tail,
1439 GNUNET_CONTAINER_DLL_remove (oc_head, 1449 cl);
1440 oc_tail, 1450 // FIXME: release other memory?
1441 oc); 1451 GNUNET_free (cl);
1442 GNUNET_free (oc);
1443 } 1452 }
1444 */
1445 if (NULL != call) 1453 if (NULL != call)
1446 { 1454 {
1447 GNUNET_CONVERSATION_call_stop (call); 1455 GNUNET_CONVERSATION_call_stop (call);
@@ -1460,3 +1468,5 @@ GCG_PHONE_shutdown ()
1460 peer_name = NULL; 1468 peer_name = NULL;
1461 phone_state = PS_ERROR; 1469 phone_state = PS_ERROR;
1462} 1470}
1471
1472/* end of gnunet-conversation-gtk_phone.c */