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.c128
1 files changed, 52 insertions, 76 deletions
diff --git a/src/conversation/gnunet-conversation-gtk_phone.c b/src/conversation/gnunet-conversation-gtk_phone.c
index c2ee6c86..b1b76726 100644
--- a/src/conversation/gnunet-conversation-gtk_phone.c
+++ b/src/conversation/gnunet-conversation-gtk_phone.c
@@ -712,6 +712,40 @@ gnunet_conversation_gtk_active_calls_treeview_selection_changed_cb (GtkTreeSele
712 712
713 713
714/** 714/**
715 * Update all aspects of the GUI (visibility and sensitivity
716 * of all buttons) based on the current state.
717 */
718static void
719update_gui ()
720{
721 if ( (NULL != active_in) ||
722 (NULL != active_out) )
723 {
724 /* in a call, show hangup/suspend buttons */
725 gtk_widget_show (b_suspend);
726 gtk_widget_show (b_hangup);
727 gtk_widget_hide (b_call);
728 gtk_widget_set_sensitive (b_hangup, TRUE);
729 gtk_widget_set_sensitive (b_suspend, TRUE);
730 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), FALSE);
731 }
732 else
733 {
734 /* not in a call, show 'call' button */
735 gtk_widget_hide (b_suspend);
736 gtk_widget_hide (b_hangup);
737 gtk_widget_show (b_call);
738 gtk_widget_set_sensitive (b_hangup, FALSE);
739 gtk_widget_set_sensitive (b_suspend, FALSE);
740 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
741 check_call_sensitivity ();
742 }
743 update_call_buttons (gtk_tree_view_get_selection (active_treeview));
744 do_status ();
745}
746
747
748/**
715 * Set state of outgoing call. 749 * Set state of outgoing call.
716 * 750 *
717 * @param oc outgoing call to change state of 751 * @param oc outgoing call to change state of
@@ -895,7 +929,7 @@ phone_event_handler (void *cls,
895 GNUNET_break (valid); 929 GNUNET_break (valid);
896 break; 930 break;
897 } 931 }
898 do_status(); 932 update_gui ();
899} 933}
900 934
901 935
@@ -1032,7 +1066,9 @@ gnunet_conversation_gtk_accept_button_clicked_cb (GtkButton *button,
1032 GCG_HISTORY_add (GCG_HISTORY_TYPE_INCOMING_ACCEPTED, 1066 GCG_HISTORY_add (GCG_HISTORY_TYPE_INCOMING_ACCEPTED,
1033 ic->caller_id, 1067 ic->caller_id,
1034 ic->caller_num); 1068 ic->caller_num);
1035 do_status (); 1069 gtk_entry_set_text (address_entry,
1070 ic->caller_id);
1071 update_gui ();
1036} 1072}
1037 1073
1038 1074
@@ -1156,7 +1192,9 @@ gnunet_conversation_gtk_resume_button_clicked_cb (GtkButton *button,
1156 GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_LOCAL, 1192 GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_LOCAL,
1157 ic->caller_id, 1193 ic->caller_id,
1158 ic->caller_num); 1194 ic->caller_num);
1159 do_status (); 1195 gtk_entry_set_text (address_entry,
1196 ic->caller_id);
1197 update_gui ();
1160 return; 1198 return;
1161 } 1199 }
1162 if (NULL != oc) 1200 if (NULL != oc)
@@ -1169,7 +1207,9 @@ gnunet_conversation_gtk_resume_button_clicked_cb (GtkButton *button,
1169 GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_LOCAL, 1207 GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_LOCAL,
1170 oc->caller_id, 1208 oc->caller_id,
1171 oc->caller_num); 1209 oc->caller_num);
1172 do_status (); 1210 gtk_entry_set_text (address_entry,
1211 active_out->caller_id);
1212 update_gui ();
1173 return; 1213 return;
1174 } 1214 }
1175 /* resume button should not have been sensitive! */ 1215 /* resume button should not have been sensitive! */
@@ -1230,14 +1270,7 @@ gnunet_conversation_gtk_suspend_button_clicked_cb (GtkButton *button,
1230 set_outgoing_call_state (active_out, 1270 set_outgoing_call_state (active_out,
1231 os); 1271 os);
1232 active_out = NULL; 1272 active_out = NULL;
1233 gtk_widget_hide (b_suspend); 1273 update_gui ();
1234 gtk_widget_hide (b_hangup);
1235 gtk_widget_show (b_call);
1236 gtk_widget_set_sensitive (b_hangup, FALSE);
1237 gtk_widget_set_sensitive (b_suspend, FALSE);
1238 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1239 check_call_sensitivity ();
1240 do_status ();
1241 return; 1274 return;
1242 } 1275 }
1243 if (NULL != active_in) 1276 if (NULL != active_in)
@@ -1271,14 +1304,7 @@ gnunet_conversation_gtk_suspend_button_clicked_cb (GtkButton *button,
1271 set_incoming_call_state (active_in, 1304 set_incoming_call_state (active_in,
1272 is); 1305 is);
1273 active_in = NULL; 1306 active_in = NULL;
1274 gtk_widget_hide (b_suspend); 1307 update_gui ();
1275 gtk_widget_hide (b_hangup);
1276 gtk_widget_show (b_call);
1277 gtk_widget_set_sensitive (b_hangup, FALSE);
1278 gtk_widget_set_sensitive (b_suspend, FALSE);
1279 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1280 check_call_sensitivity ();
1281 do_status ();
1282 return; 1308 return;
1283 } 1309 }
1284 GNUNET_break (0); 1310 GNUNET_break (0);
@@ -1311,14 +1337,7 @@ gnunet_conversation_gtk_hangup_button_clicked_cb (GtkButton *button,
1311 OUT_STATE_NONE); 1337 OUT_STATE_NONE);
1312 destroy_out (active_out); 1338 destroy_out (active_out);
1313 active_out = NULL; 1339 active_out = NULL;
1314 gtk_widget_hide (b_suspend); 1340 update_gui ();
1315 gtk_widget_hide (b_hangup);
1316 gtk_widget_show (b_call);
1317 gtk_widget_set_sensitive (b_hangup, FALSE);
1318 gtk_widget_set_sensitive (b_suspend, FALSE);
1319 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1320 check_call_sensitivity ();
1321 do_status ();
1322 return; 1341 return;
1323 } 1342 }
1324 if (NULL != active_in) 1343 if (NULL != active_in)
@@ -1331,14 +1350,7 @@ gnunet_conversation_gtk_hangup_button_clicked_cb (GtkButton *button,
1331 IN_STATE_NONE); 1350 IN_STATE_NONE);
1332 destroy_in (active_in); 1351 destroy_in (active_in);
1333 active_in = NULL; 1352 active_in = NULL;
1334 gtk_widget_hide (b_suspend); 1353 update_gui ();
1335 gtk_widget_hide (b_hangup);
1336 gtk_widget_show (b_call);
1337 gtk_widget_set_sensitive (b_hangup, FALSE);
1338 gtk_widget_set_sensitive (b_suspend, FALSE);
1339 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1340 check_call_sensitivity ();
1341 do_status ();
1342 return; 1354 return;
1343 } 1355 }
1344 GNUNET_break (0); 1356 GNUNET_break (0);
@@ -1391,13 +1403,7 @@ call_event_handler (void *cls,
1391 oc->call = NULL; 1403 oc->call = NULL;
1392 destroy_out (oc); 1404 destroy_out (oc);
1393 active_out = NULL; 1405 active_out = NULL;
1394 gtk_widget_hide (b_suspend); 1406 update_gui ();
1395 gtk_widget_hide (b_hangup);
1396 gtk_widget_show (b_call);
1397 gtk_widget_set_sensitive (b_hangup, FALSE);
1398 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1399 check_call_sensitivity ();
1400 do_status ();
1401 break; 1407 break;
1402 case GNUNET_CONVERSATION_EC_CALL_HUNG_UP: 1408 case GNUNET_CONVERSATION_EC_CALL_HUNG_UP:
1403 GCG_HISTORY_add (GCG_HISTORY_TYPE_HANGUP, 1409 GCG_HISTORY_add (GCG_HISTORY_TYPE_HANGUP,
@@ -1408,14 +1414,7 @@ call_event_handler (void *cls,
1408 oc->call = NULL; 1414 oc->call = NULL;
1409 destroy_out (oc); 1415 destroy_out (oc);
1410 active_out = NULL; 1416 active_out = NULL;
1411 gtk_widget_hide (b_suspend); 1417 update_gui ();
1412 gtk_widget_hide (b_hangup);
1413 gtk_widget_show (b_call);
1414 gtk_widget_set_sensitive (b_hangup, FALSE);
1415 gtk_widget_set_sensitive (b_suspend, FALSE);
1416 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1417 check_call_sensitivity ();
1418 do_status ();
1419 break; 1418 break;
1420 case GNUNET_CONVERSATION_EC_CALL_SUSPENDED: 1419 case GNUNET_CONVERSATION_EC_CALL_SUSPENDED:
1421 GCG_HISTORY_add (GCG_HISTORY_TYPE_SUSPEND_REMOTE, 1420 GCG_HISTORY_add (GCG_HISTORY_TYPE_SUSPEND_REMOTE,
@@ -1480,15 +1479,7 @@ call_event_handler (void *cls,
1480 } 1479 }
1481 set_outgoing_call_state (oc, os); 1480 set_outgoing_call_state (oc, os);
1482 if (OUT_STATE_CONNECTED == os) 1481 if (OUT_STATE_CONNECTED == os)
1483 {
1484 GNUNET_break (active_out == oc); 1482 GNUNET_break (active_out == oc);
1485 gtk_widget_show (b_suspend);
1486 gtk_widget_show (b_hangup);
1487 gtk_widget_hide (b_call);
1488 gtk_widget_set_sensitive (b_hangup, TRUE);
1489 gtk_widget_set_sensitive (b_suspend, TRUE);
1490 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), FALSE);
1491 }
1492 do_status (); 1483 do_status ();
1493 break; 1484 break;
1494 case GNUNET_CONVERSATION_EC_CALL_ERROR: 1485 case GNUNET_CONVERSATION_EC_CALL_ERROR:
@@ -1500,14 +1491,7 @@ call_event_handler (void *cls,
1500 if (active_out == oc) 1491 if (active_out == oc)
1501 active_out = NULL; 1492 active_out = NULL;
1502 destroy_out (oc); 1493 destroy_out (oc);
1503 gtk_widget_hide (b_suspend); 1494 update_gui ();
1504 gtk_widget_hide (b_hangup);
1505 gtk_widget_show (b_call);
1506 gtk_widget_set_sensitive (b_hangup, FALSE);
1507 gtk_widget_set_sensitive (b_suspend, FALSE);
1508 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), TRUE);
1509 check_call_sensitivity ();
1510 do_status ();
1511 break; 1495 break;
1512 } 1496 }
1513} 1497}
@@ -1579,15 +1563,7 @@ gnunet_conversation_gtk_call_button_clicked_cb (GtkButton *button,
1579 oc->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (active_liststore), 1563 oc->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (active_liststore),
1580 path); 1564 path);
1581 gtk_tree_path_free (path); 1565 gtk_tree_path_free (path);
1582 /* hide "call" button, make address entry insensitive; 1566 update_gui ();
1583 show suspend button (but not sensitive),
1584 show hangup button (and make sensitive) */
1585 gtk_widget_hide (b_call);
1586 gtk_widget_set_sensitive (GTK_WIDGET (address_entry), FALSE);
1587 gtk_widget_show (b_suspend);
1588 gtk_widget_show (b_hangup);
1589 gtk_widget_set_sensitive (b_hangup, TRUE);
1590 do_status ();
1591} 1567}
1592 1568
1593 1569