aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/gnunet-conversation-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk.c')
-rw-r--r--src/conversation/gnunet-conversation-gtk.c444
1 files changed, 217 insertions, 227 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index 7b6b9fa6..80766cae 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -34,19 +34,23 @@ struct GNUNET_CONVERSATION_Caller *caller_selected = NULL;
34 * common * 34 * common *
35 *************/ 35 *************/
36 36
37/**
38 * Handle to our main loop.
39 */
40static struct GNUNET_GTK_MainLoop *ml;
41
42
37 43
38/** 44/**
39 * Get our configuration. 45 * Get our configuration.
40 * 46 *
41 * @return configuration handle 47 * @return configuration handle
42 */ 48 **/
43const struct GNUNET_CONFIGURATION_Handle * 49extern struct GNUNET_CONFIGURATION_Handle *
44GIG_get_configuration (); 50GIG_get_configuration ()
45 51{
46/** 52 return GNUNET_GTK_main_loop_get_configuration (ml);
47 * Our configurations. 53}
48 */
49static struct GNUNET_CONFIGURATION_Handle *cfg;
50 54
51/** 55/**
52 * Name of our ego. 56 * Name of our ego.
@@ -222,19 +226,13 @@ static GtkListStore *zone_liststore;
222/** 226/**
223 * zone tree model 227 * zone tree model
224 */ 228 */
225static GtkTreeModel *zone_treemodel; 229//static GtkTreeModel *zone_treemodel;
226 230
227/** 231/**
228 * Our ego. 232 * Our ego.
229 */ 233 */
230static struct GNUNET_IDENTITY_Ego *caller_id; 234static struct GNUNET_IDENTITY_Ego *caller_id;
231 235
232
233/**
234 * Handle to our main loop.
235 */
236static struct GNUNET_GTK_MainLoop *ml;
237
238/************ 236/************
239 * extern's * 237 * extern's *
240 * **********/ 238 * **********/
@@ -293,6 +291,186 @@ update_state ()
293{ 291{
294// LOG('update_state called',NULL); 292// LOG('update_state called',NULL);
295} 293}
294/*
295 * @brief print info for currently selected call
296 */
297void
298print_call_info()
299{
300 GtkTreeIter gtkiter;
301 gboolean valid;
302 gint row_count = 0;
303
304 valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), &gtkiter );
305
306 if (!valid)
307 GNUNET_break(0);
308
309 while (valid)
310 {
311 gchar *str_data;
312 gint int_data;
313 gpointer cl_caller;
314
315 gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gtkiter,
316 AL_caller, &cl_caller,
317 AL_caller_id,&str_data,
318 AL_caller_num,&int_data,-1);
319 if (caller_selected == cl_caller)
320 {
321 // LOG (_("info for active call:%s number: %u row: %u"), str_data,int_data,row_count);
322 currentlySelectedCallAddress = str_data;
323// FPRINTF(stderr,"cal addr: %s\n",currentlySelectedCallAddress);
324 break ;
325 }
326 g_free (str_data);
327 row_count++;
328 valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore), &gtkiter);
329 }
330
331
332
333}
334
335
336
337/*
338 * @brief sets caller_selected, and enables or disables the active call list buttons
339 */
340void
341update_active_call_list_buttons()
342{
343 gchar *caller_id;
344 gpointer cl_caller;
345 gint cl_caller_state;
346 //gint cl_caller_type;
347 GtkTreeSelection *active_selection;
348 GtkTreeIter gcl_selected;
349// active_liststore_selection = get_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_selection");
350
351 active_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_treeview));
352
353
354 if (gtk_tree_selection_get_selected(active_selection,NULL,&gcl_selected))
355 {
356
357 gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gcl_selected,
358 AL_caller, &cl_caller,
359 AL_caller_id, &caller_id,
360 AL_caller_state, &cl_caller_state,
361 -1);
362
363 caller_selected = cl_caller;
364
365 gtk_widget_show(GTK_WIDGET(get_object("GNUNET_GTK_conversation_active_call_list_buttons" )));
366
367
368 // make global?
369 GtkWidget *b_contact, *b_accept, *b_hangup, *b_suspend, *b_resume;
370 b_contact = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_use_current_button"));
371 b_accept = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_accept_button"));
372 b_hangup = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_hangup_button"));
373 b_suspend = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_suspend_button"));
374 b_resume = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_resume_button"));
375
376 LOG("caller state: %u phone_state: %u",cl_caller_state, phone_state);
377
378 switch (cl_caller_state)
379 {
380 /* buttons:
381 * contact
382 * accept
383 * hangup
384 * suspend
385 * resume
386 *
387 * TODO: check if there is incoming or outgoing call,
388 * disable resume and accept buttons.
389 * or suspend that other call
390 */
391
392 case CT_active:
393 // hangup, pause
394 //LOG("CT_active state: %u ",cl_caller_state);
395 gtk_widget_set_sensitive(b_contact, 1);
396 gtk_widget_set_sensitive(b_accept, 0);
397 gtk_widget_set_sensitive(b_hangup, 1);
398 gtk_widget_set_sensitive(b_suspend, 1);
399 gtk_widget_set_sensitive(b_resume, 0);
400 break;
401 case CT_ringing:
402 // pickup, phonebook
403 //LOG("CT_ring show button");
404 gtk_widget_set_sensitive(b_contact, 1);
405 if (phone_state == PS_LISTEN)
406 {
407 gtk_widget_set_sensitive(b_accept, 1);
408 }else{
409 gtk_widget_set_sensitive(b_accept, 0);
410 }
411
412
413 gtk_widget_set_sensitive(b_hangup, 0);
414 gtk_widget_set_sensitive(b_suspend, 0);
415 gtk_widget_set_sensitive(b_resume, 0);
416 break;
417 case CT_rejected:
418 //add to phonebook
419 //LOG("CT_rejected ");
420 gtk_widget_set_sensitive(b_contact, 1);
421 gtk_widget_set_sensitive(b_accept, 0);
422 gtk_widget_set_sensitive(b_hangup, 0);
423 gtk_widget_set_sensitive(b_suspend, 0);
424 gtk_widget_set_sensitive(b_resume, 0);
425
426 break;
427 case CT_suspended:
428 // resume, hangup
429 //LOG("CT_suspended ");
430 gtk_widget_set_sensitive(b_contact, 1 );
431 gtk_widget_set_sensitive(b_accept, 0);
432 gtk_widget_set_sensitive(b_hangup, 1);
433 gtk_widget_set_sensitive(b_suspend, 0);
434
435 if (phone_state == PS_LISTEN)
436 {
437 LOG("enable resume button");
438 gtk_widget_set_sensitive(b_resume, 1);
439 }else{
440 LOG("disable resume button");
441 gtk_widget_set_sensitive(b_resume, 0);
442 }
443 break;
444 default:
445 GNUNET_break(0);
446 break;
447 }
448 print_call_info();
449 }
450 else
451 {
452
453 LOG("nothing selected");
454
455 gtk_widget_hide(GTK_WIDGET(get_object("GNUNET_GTK_conversation_active_call_list_buttons" )));
456
457 }
458
459} //end function
460
461
462
463/*
464 * @brief executed when selecting a different item in active call list
465 */
466
467void
468GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed()
469{
470 update_active_call_list_buttons();
471}
472
473
296 474
297/** 475/**
298 * update status 476 * update status
@@ -341,11 +519,8 @@ update_status (const gchar * message)
341void 519void
342set_status_icon (const char *icon_name) 520set_status_icon (const char *icon_name)
343{ 521{
344 GtkWindow *main_window;
345 GtkImage *status_icon; 522 GtkImage *status_icon;
346 523
347 main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
348
349 status_icon = GTK_IMAGE (get_object ("GNUNET_GTK_status_icon")); 524 status_icon = GTK_IMAGE (get_object ("GNUNET_GTK_status_icon"));
350 525
351 gtk_image_set_from_icon_name (status_icon, icon_name, GTK_ICON_SIZE_BUTTON); 526 gtk_image_set_from_icon_name (status_icon, icon_name, GTK_ICON_SIZE_BUTTON);
@@ -619,7 +794,7 @@ start_phone ()
619 } 794 }
620 //GNUNET_assert (NULL == phone); 795 //GNUNET_assert (NULL == phone);
621 phone = 796 phone =
622 GNUNET_CONVERSATION_phone_create (cfg, caller_id, &phone_event_handler, 797 GNUNET_CONVERSATION_phone_create (GIG_get_configuration(), caller_id, &phone_event_handler,
623 NULL); 798 NULL);
624 /* FIXME: get record and print full GNS record info later here... */ 799 /* FIXME: get record and print full GNS record info later here... */
625 if (NULL == phone) 800 if (NULL == phone)
@@ -730,7 +905,7 @@ do_call (const char *arg)
730 call_state = CS_RESOLVING; 905 call_state = CS_RESOLVING;
731 GNUNET_assert (NULL == call); 906 GNUNET_assert (NULL == call);
732 call = 907 call =
733 GNUNET_CONVERSATION_call_start (cfg, caller_id, arg, speaker, mic, 908 GNUNET_CONVERSATION_call_start (GIG_get_configuration(), caller_id, arg, speaker, mic,
734 &call_event_handler, NULL); 909 &call_event_handler, NULL);
735 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."), 910 UPDATE_STATUS (_("We are calling `%s', his phone should be ringing."),
736 peer_name); 911 peer_name);
@@ -747,7 +922,7 @@ static void
747do_accept (struct GNUNET_CONVERSATION_Caller *sel_caller) 922do_accept (struct GNUNET_CONVERSATION_Caller *sel_caller)
748{ 923{
749 struct CallList *cl; 924 struct CallList *cl;
750 char buf[32]; 925 //char buf[32];
751 926
752 927
753 if ((NULL != call) && (CS_SUSPENDED != call_state)) 928 if ((NULL != call) && (CS_SUSPENDED != call_state))
@@ -805,6 +980,7 @@ do_accept (struct GNUNET_CONVERSATION_Caller *sel_caller)
805 set_incoming_call_state(sel_caller,CT_active); 980 set_incoming_call_state(sel_caller,CT_active);
806 981
807 982
983 cl = NULL;
808 GNUNET_CONVERSATION_caller_pick_up (sel_caller, &caller_event_handler, cl, 984 GNUNET_CONVERSATION_caller_pick_up (sel_caller, &caller_event_handler, cl,
809 speaker, mic); 985 speaker, mic);
810 986
@@ -955,8 +1131,8 @@ do_suspend (struct GNUNET_CONVERSATION_Caller *sel_caller)
955static void 1131static void
956do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller) 1132do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller)
957{ 1133{
958 struct CallList *cl; 1134 //struct CallList *cl;
959 char buf[32]; 1135 //char buf[32];
960/* 1136/*
961 if (NULL != call) 1137 if (NULL != call)
962 { 1138 {
@@ -1024,8 +1200,8 @@ do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller)
1024static void 1200static void
1025do_reject (struct GNUNET_CONVERSATION_Caller *sel_caller) 1201do_reject (struct GNUNET_CONVERSATION_Caller *sel_caller)
1026{ 1202{
1027 struct CallList *cl; 1203 //struct CallList *cl;
1028 char buf[32]; 1204 //char buf[32];
1029 1205
1030 /* 1206 /*
1031 if (NULL != call) 1207 if (NULL != call)
@@ -1114,9 +1290,9 @@ static void
1114identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, 1290identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
1115 const char *name) 1291 const char *name)
1116{ 1292{
1117 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 1293 // struct GNUNET_CRYPTO_EcdsaPublicKey pk;
1118 char *s; 1294 // char *s;
1119 GtkTreeIter iter; 1295// GtkTreeIter iter;
1120 1296
1121 if (NULL == name) 1297 if (NULL == name)
1122 return; 1298 return;
@@ -1138,7 +1314,9 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
1138 return; 1314 return;
1139 } 1315 }
1140 caller_id = ego; 1316 caller_id = ego;
1141 GNUNET_CONFIGURATION_set_value_number (cfg, "CONVERSATION", "LINE", line); 1317
1318
1319 //GNUNET_CONFIGURATION_set_value_number (GIG_get_configuration(), "CONVERSATION_GTK", "LINE", line);
1142 //zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); 1320 //zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id);
1143 // ns = GNUNET_NAMESTORE_connect (cfg); 1321 // ns = GNUNET_NAMESTORE_connect (cfg);
1144 1322
@@ -1147,17 +1325,6 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx,
1147 start_phone(); 1325 start_phone();
1148} 1326}
1149 1327
1150/**
1151 * Get our configuration.
1152 *
1153 * @return configuration handle
1154 */
1155const struct GNUNET_CONFIGURATION_Handle *
1156GIG_get_configuration ()
1157{
1158 return GNUNET_GTK_main_loop_get_configuration (ml);
1159}
1160
1161 1328
1162 1329
1163 1330
@@ -1268,7 +1435,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1268 /* setup main window */ 1435 /* setup main window */
1269 main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window")); 1436 main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window"));
1270 main_window = 1437 main_window =
1271 GTK_WIDGET (GNUNET_GTK_plug_me 1438 GTK_WINDOW (GNUNET_GTK_plug_me
1272 ("GNUNET_CONVERSATION_GTK_PLUG", GTK_WIDGET (main_window))); 1439 ("GNUNET_CONVERSATION_GTK_PLUG", GTK_WIDGET (main_window)));
1273 gtk_window_set_default_size (main_window, 700, 700); 1440 gtk_window_set_default_size (main_window, 700, 700);
1274 1441
@@ -1278,7 +1445,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1278 active_treeview = 1445 active_treeview =
1279 GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_active_calls_treeview")); 1446 GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_active_calls_treeview"));
1280 1447
1281 GNUNET_CONVERSATION_GTK_history_init(); 1448 GNUNET_CONVERSATION_GTK_CONTACTS_init();
1282 1449
1283//gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE); 1450//gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE);
1284 1451
@@ -1307,7 +1474,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1307 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 1474 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
1308 NULL); 1475 NULL);
1309 1476
1310 cfg = GIG_get_configuration (); 1477 //cfg = GIG_get_configuration ();
1311 1478
1312 speaker = GNUNET_SPEAKER_create_from_hardware (GIG_get_configuration ()); 1479 speaker = GNUNET_SPEAKER_create_from_hardware (GIG_get_configuration ());
1313 mic = GNUNET_MICROPHONE_create_from_hardware (GIG_get_configuration ()); 1480 mic = GNUNET_MICROPHONE_create_from_hardware (GIG_get_configuration ());
@@ -1318,7 +1485,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1318 LOG (_("No ego given, using default: %s "), ego_name); 1485 LOG (_("No ego given, using default: %s "), ego_name);
1319 1486
1320 } 1487 }
1321 id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); 1488 id = GNUNET_IDENTITY_connect (GIG_get_configuration(), &identity_cb, NULL);
1322 1489
1323 GNUNET_CONVERSATION_GTK_CONTACTS_init (); 1490 GNUNET_CONVERSATION_GTK_CONTACTS_init ();
1324} 1491}
@@ -1369,13 +1536,11 @@ main (int argc, char *const *argv)
1369void 1536void
1370GNUNET_CONVERSATION_GTK_on_call_clicked () 1537GNUNET_CONVERSATION_GTK_on_call_clicked ()
1371{ 1538{
1372 char *to_addr;
1373 GtkEntry *address_entry; 1539 GtkEntry *address_entry;
1374 1540
1375 address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address")); 1541 address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address"));
1376 to_addr = gtk_entry_get_text (address_entry);
1377 1542
1378 do_call (to_addr); 1543 do_call (gtk_entry_get_text(address_entry));
1379 //disable_button ("GNUNET_GTK_conversation_accept_button"); 1544 //disable_button ("GNUNET_GTK_conversation_accept_button");
1380 do_status (); 1545 do_status ();
1381// free(to_addr); 1546// free(to_addr);
@@ -1473,8 +1638,8 @@ gnunet_conversation_gtk_outgoing_zone_combobox_changed_cb (GtkComboBox *widget,
1473 GtkTreeIter iter; 1638 GtkTreeIter iter;
1474 struct GNUNET_IDENTITY_Ego *tempEgo; 1639 struct GNUNET_IDENTITY_Ego *tempEgo;
1475 char *tempName; 1640 char *tempName;
1476 struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey; 1641 //struct GNUNET_CRYPTO_EcdsaPrivateKey temp_zone_pkey;
1477 GtkTreeSelection *selection; 1642 //GtkTreeSelection *selection;
1478 1643
1479 1644
1480 gtk_combo_box_get_active_iter(widget, &iter); 1645 gtk_combo_box_get_active_iter(widget, &iter);
@@ -1484,7 +1649,7 @@ gnunet_conversation_gtk_outgoing_zone_combobox_changed_cb (GtkComboBox *widget,
1484 0, &tempName, 1649 0, &tempName,
1485 1, &tempEgo, 1650 1, &tempEgo,
1486 -1); 1651 -1);
1487 LOG(stderr,"outgoing ego: %s", tempName); 1652 //LOG(stderr,"outgoing ego: %s", tempName);
1488 // caller_id = tempEgo; 1653 // caller_id = tempEgo;
1489 /* 1654 /*
1490 if ( NULL != phone) 1655 if ( NULL != phone)
@@ -1497,181 +1662,6 @@ gnunet_conversation_gtk_outgoing_zone_combobox_changed_cb (GtkComboBox *widget,
1497} 1662}
1498 1663
1499/* 1664/*
1500 * @brief print info for currently selected call
1501 */
1502void
1503print_call_info()
1504{
1505 GtkTreeIter gtkiter;
1506 gboolean valid;
1507 gint row_count = 0;
1508
1509 valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), &gtkiter );
1510
1511 if (!valid)
1512 GNUNET_break(0);
1513
1514 while (valid)
1515 {
1516 gchar *str_data;
1517 gint int_data;
1518 gpointer cl_caller;
1519
1520 gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gtkiter,
1521 AL_caller, &cl_caller,
1522 AL_caller_id,&str_data,
1523 AL_caller_num,&int_data,-1);
1524 if (caller_selected == cl_caller)
1525 {
1526 // LOG (_("info for active call:%s number: %u row: %u"), str_data,int_data,row_count);
1527 currentlySelectedCallAddress = str_data;
1528// FPRINTF(stderr,"cal addr: %s\n",currentlySelectedCallAddress);
1529 break ;
1530 }
1531 g_free (str_data);
1532 row_count++;
1533 valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(active_liststore), &gtkiter);
1534 }
1535
1536
1537
1538}
1539
1540/*
1541 * @brief executed when selecting a different item in active call list
1542 */
1543
1544void
1545GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed()
1546{
1547 update_active_call_list_buttons();
1548}
1549
1550/*
1551 * @brief sets caller_selected, and enables or disables the active call list buttons
1552 */
1553void
1554update_active_call_list_buttons()
1555{
1556 gchar *caller_id;
1557 gpointer cl_caller;
1558 gint cl_caller_state;
1559 gint cl_caller_type;
1560 GtkTreeSelection *active_selection;
1561 GtkTreeIter gcl_selected;
1562// active_liststore_selection = get_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_selection");
1563
1564 active_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_treeview));
1565
1566
1567 if (gtk_tree_selection_get_selected(active_selection,NULL,&gcl_selected))
1568 {
1569
1570 gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gcl_selected,
1571 AL_caller, &cl_caller,
1572 AL_caller_id, &caller_id,
1573 AL_caller_state, &cl_caller_state,
1574 -1);
1575
1576 caller_selected = cl_caller;
1577
1578 gtk_widget_show(GTK_WIDGET(get_object("GNUNET_GTK_conversation_active_call_list_buttons" )));
1579
1580
1581 // make global?
1582 GtkWidget *b_contact, *b_accept, *b_hangup, *b_suspend, *b_resume;
1583 b_contact = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_use_current_button"));
1584 b_accept = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_accept_button"));
1585 b_hangup = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_hangup_button"));
1586 b_suspend = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_suspend_button"));
1587 b_resume = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_resume_button"));
1588
1589 LOG("caller state: %u phone_state: %u",cl_caller_state, phone_state);
1590
1591 switch (cl_caller_state)
1592 {
1593 /* buttons:
1594 * contact
1595 * accept
1596 * hangup
1597 * suspend
1598 * resume
1599 *
1600 * TODO: check if there is incoming or outgoing call,
1601 * disable resume and accept buttons.
1602 * or suspend that other call
1603 */
1604
1605 case CT_active:
1606 // hangup, pause
1607 //LOG("CT_active state: %u ",cl_caller_state);
1608 gtk_widget_set_sensitive(b_contact, 1);
1609 gtk_widget_set_sensitive(b_accept, 0);
1610 gtk_widget_set_sensitive(b_hangup, 1);
1611 gtk_widget_set_sensitive(b_suspend, 1);
1612 gtk_widget_set_sensitive(b_resume, 0);
1613 break;
1614 case CT_ringing:
1615 // pickup, phonebook
1616 //LOG("CT_ring show button");
1617 gtk_widget_set_sensitive(b_contact, 1);
1618 if (phone_state == PS_LISTEN)
1619 {
1620 gtk_widget_set_sensitive(b_accept, 1);
1621 }else{
1622 gtk_widget_set_sensitive(b_accept, 0);
1623 }
1624
1625
1626 gtk_widget_set_sensitive(b_hangup, 0);
1627 gtk_widget_set_sensitive(b_suspend, 0);
1628 gtk_widget_set_sensitive(b_resume, 0);
1629 break;
1630 case CT_rejected:
1631 //add to phonebook
1632 //LOG("CT_rejected ");
1633 gtk_widget_set_sensitive(b_contact, 1);
1634 gtk_widget_set_sensitive(b_accept, 0);
1635 gtk_widget_set_sensitive(b_hangup, 0);
1636 gtk_widget_set_sensitive(b_suspend, 0);
1637 gtk_widget_set_sensitive(b_resume, 0);
1638
1639 break;
1640 case CT_suspended:
1641 // resume, hangup
1642 //LOG("CT_suspended ");
1643 gtk_widget_set_sensitive(b_contact, 1 );
1644 gtk_widget_set_sensitive(b_accept, 0);
1645 gtk_widget_set_sensitive(b_hangup, 1);
1646 gtk_widget_set_sensitive(b_suspend, 0);
1647
1648 if (phone_state == PS_LISTEN)
1649 {
1650 LOG("enable resume button");
1651 gtk_widget_set_sensitive(b_resume, 1);
1652 }else{
1653 LOG("disable resume button");
1654 gtk_widget_set_sensitive(b_resume, 0);
1655 }
1656 break;
1657 default:
1658 GNUNET_break(0);
1659 break;
1660 }
1661 print_call_info();
1662 }
1663 else
1664 {
1665
1666 LOG("nothing selected");
1667
1668 gtk_widget_hide(GTK_WIDGET(get_object("GNUNET_GTK_conversation_active_call_list_buttons" )));
1669
1670 }
1671
1672} //end function
1673
1674/*
1675 * @brief active call list type data function 1665 * @brief active call list type data function
1676 */ 1666 */
1677void 1667void
@@ -1744,7 +1734,7 @@ void
1744GNUNET_CONVERSATION_GTK_test_button_two() 1734GNUNET_CONVERSATION_GTK_test_button_two()
1745{ 1735{
1746 GtkTreeViewColumn *column; 1736 GtkTreeViewColumn *column;
1747 GtkCellRenderer *cell; 1737// GtkCellRenderer *cell;
1748 GtkCellRenderer *renderer; 1738 GtkCellRenderer *renderer;
1749 //LOG("test"); 1739 //LOG("test");
1750// treeview = get_object(ml,"gnunet_conversation_gtk_active_calls_treeview"); 1740// treeview = get_object(ml,"gnunet_conversation_gtk_active_calls_treeview");
@@ -1754,7 +1744,7 @@ GNUNET_CONVERSATION_GTK_test_button_two()
1754// cell = get_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_type"); 1744// cell = get_object(ml,"GNUNET_CONVERSATION_GTK_active_calls_type");
1755// gtk_tree_view_column_set_cell_data_func(column, cell, active_calls_type_data_function, NULL, NULL ); 1745// gtk_tree_view_column_set_cell_data_func(column, cell, active_calls_type_data_function, NULL, NULL );
1756 1746
1757 column = get_object("caller_testcolumn"); 1747 column = GTK_TREE_VIEW_COLUMN(get_object("caller_testcolumn"));
1758 gtk_tree_view_column_set_title(column, "test stateC"); 1748 gtk_tree_view_column_set_title(column, "test stateC");
1759 renderer = gtk_cell_renderer_text_new(); 1749 renderer = gtk_cell_renderer_text_new();
1760 1750