diff options
author | hark <hark@puscii.nl> | 2014-02-13 02:25:58 +0000 |
---|---|---|
committer | hark <hark@puscii.nl> | 2014-02-13 02:25:58 +0000 |
commit | 84eb7489de0186410be146ad16fa812c9dca2d65 (patch) | |
tree | 7b26979f84ed15d6265c8b9696f7c2a36afaacdc | |
parent | 90f695a72ae0e5ae495dbf78bd03baa932b945e0 (diff) | |
download | gnunet-gtk-84eb7489de0186410be146ad16fa812c9dca2d65.tar.gz gnunet-gtk-84eb7489de0186410be146ad16fa812c9dca2d65.zip |
make buttons become insensitive/sensitive
-rw-r--r-- | contrib/gnunet_conversation_gtk_main_window.glade | 42 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 273 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.h | 2 |
3 files changed, 148 insertions, 169 deletions
diff --git a/contrib/gnunet_conversation_gtk_main_window.glade b/contrib/gnunet_conversation_gtk_main_window.glade index 7b6f62d8..23b49322 100644 --- a/contrib/gnunet_conversation_gtk_main_window.glade +++ b/contrib/gnunet_conversation_gtk_main_window.glade | |||
@@ -368,14 +368,15 @@ | |||
368 | </packing> | 368 | </packing> |
369 | </child> | 369 | </child> |
370 | <child> | 370 | <child> |
371 | <object class="GtkButtonBox" id="GNUNET_GTK_conversation_buttons"> | 371 | <object class="GtkButtonBox" id="GNUNET_GTK_conversation_active_call_list_buttons"> |
372 | <property name="visible">True</property> | ||
373 | <property name="can_focus">False</property> | 372 | <property name="can_focus">False</property> |
373 | <property name="border_width">2</property> | ||
374 | <property name="orientation">vertical</property> | 374 | <property name="orientation">vertical</property> |
375 | <property name="layout_style">start</property> | 375 | <property name="layout_style">start</property> |
376 | <child> | 376 | <child> |
377 | <object class="GtkImage" id="GNUNET_GTK_status_icon"> | 377 | <object class="GtkImage" id="GNUNET_GTK_status_icon"> |
378 | <property name="visible">True</property> | 378 | <property name="visible">True</property> |
379 | <property name="sensitive">False</property> | ||
379 | <property name="can_focus">False</property> | 380 | <property name="can_focus">False</property> |
380 | <property name="tooltip_text" translatable="yes">Status indicator</property> | 381 | <property name="tooltip_text" translatable="yes">Status indicator</property> |
381 | <property name="icon_name">bluefish</property> | 382 | <property name="icon_name">bluefish</property> |
@@ -391,6 +392,7 @@ | |||
391 | <property name="label" translatable="yes">import Addr</property> | 392 | <property name="label" translatable="yes">import Addr</property> |
392 | <property name="use_action_appearance">False</property> | 393 | <property name="use_action_appearance">False</property> |
393 | <property name="visible">True</property> | 394 | <property name="visible">True</property> |
395 | <property name="sensitive">False</property> | ||
394 | <property name="can_focus">True</property> | 396 | <property name="can_focus">True</property> |
395 | <property name="receives_default">True</property> | 397 | <property name="receives_default">True</property> |
396 | <property name="use_action_appearance">False</property> | 398 | <property name="use_action_appearance">False</property> |
@@ -408,6 +410,7 @@ | |||
408 | <property name="label" translatable="yes">accept</property> | 410 | <property name="label" translatable="yes">accept</property> |
409 | <property name="use_action_appearance">False</property> | 411 | <property name="use_action_appearance">False</property> |
410 | <property name="visible">True</property> | 412 | <property name="visible">True</property> |
413 | <property name="sensitive">False</property> | ||
411 | <property name="can_focus">True</property> | 414 | <property name="can_focus">True</property> |
412 | <property name="receives_default">True</property> | 415 | <property name="receives_default">True</property> |
413 | <property name="use_action_appearance">False</property> | 416 | <property name="use_action_appearance">False</property> |
@@ -424,6 +427,7 @@ | |||
424 | <property name="label" translatable="yes">hangup</property> | 427 | <property name="label" translatable="yes">hangup</property> |
425 | <property name="use_action_appearance">False</property> | 428 | <property name="use_action_appearance">False</property> |
426 | <property name="visible">True</property> | 429 | <property name="visible">True</property> |
430 | <property name="sensitive">False</property> | ||
427 | <property name="can_focus">True</property> | 431 | <property name="can_focus">True</property> |
428 | <property name="receives_default">True</property> | 432 | <property name="receives_default">True</property> |
429 | <property name="use_action_appearance">False</property> | 433 | <property name="use_action_appearance">False</property> |
@@ -436,10 +440,11 @@ | |||
436 | </packing> | 440 | </packing> |
437 | </child> | 441 | </child> |
438 | <child> | 442 | <child> |
439 | <object class="GtkButton" id="GNUNET_GTK_conversation_pause_button"> | 443 | <object class="GtkButton" id="GNUNET_GTK_conversation_suspend_button"> |
440 | <property name="label" translatable="yes">pause</property> | 444 | <property name="label" translatable="yes">suspend</property> |
441 | <property name="use_action_appearance">False</property> | 445 | <property name="use_action_appearance">False</property> |
442 | <property name="visible">True</property> | 446 | <property name="visible">True</property> |
447 | <property name="sensitive">False</property> | ||
443 | <property name="can_focus">True</property> | 448 | <property name="can_focus">True</property> |
444 | <property name="receives_default">True</property> | 449 | <property name="receives_default">True</property> |
445 | <property name="use_action_appearance">False</property> | 450 | <property name="use_action_appearance">False</property> |
@@ -456,6 +461,7 @@ | |||
456 | <property name="label" translatable="yes">resume</property> | 461 | <property name="label" translatable="yes">resume</property> |
457 | <property name="use_action_appearance">False</property> | 462 | <property name="use_action_appearance">False</property> |
458 | <property name="visible">True</property> | 463 | <property name="visible">True</property> |
464 | <property name="sensitive">False</property> | ||
459 | <property name="can_focus">True</property> | 465 | <property name="can_focus">True</property> |
460 | <property name="receives_default">True</property> | 466 | <property name="receives_default">True</property> |
461 | <property name="use_action_appearance">False</property> | 467 | <property name="use_action_appearance">False</property> |
@@ -841,20 +847,6 @@ | |||
841 | </object> | 847 | </object> |
842 | </child> | 848 | </child> |
843 | </object> | 849 | </object> |
844 | <object class="GtkListStore" id="gnunet_conversation_gtk_active_calls_liststore"> | ||
845 | <columns> | ||
846 | <!-- column-name caller_id --> | ||
847 | <column type="gchararray"/> | ||
848 | <!-- column-name caller --> | ||
849 | <column type="gpointer"/> | ||
850 | <!-- column-name caller_num --> | ||
851 | <column type="gint"/> | ||
852 | <!-- column-name caller_type --> | ||
853 | <column type="gint"/> | ||
854 | <!-- column-name caller_state --> | ||
855 | <column type="gint"/> | ||
856 | </columns> | ||
857 | </object> | ||
858 | <object class="GtkListStore" id="gnunet_conversation_gtk_contacts_liststore"> | 850 | <object class="GtkListStore" id="gnunet_conversation_gtk_contacts_liststore"> |
859 | <columns> | 851 | <columns> |
860 | <!-- column-name contactName --> | 852 | <!-- column-name contactName --> |
@@ -871,6 +863,20 @@ | |||
871 | <column type="gpointer"/> | 863 | <column type="gpointer"/> |
872 | </columns> | 864 | </columns> |
873 | </object> | 865 | </object> |
866 | <object class="GtkListStore" id="gnunet_conversation_gtk_active_calls_liststore"> | ||
867 | <columns> | ||
868 | <!-- column-name caller_id --> | ||
869 | <column type="gchararray"/> | ||
870 | <!-- column-name caller --> | ||
871 | <column type="gpointer"/> | ||
872 | <!-- column-name caller_num --> | ||
873 | <column type="gint"/> | ||
874 | <!-- column-name caller_type --> | ||
875 | <column type="gint"/> | ||
876 | <!-- column-name caller_state --> | ||
877 | <column type="gint"/> | ||
878 | </columns> | ||
879 | </object> | ||
874 | <object class="GtkListStore" id="gnunet_conversation_gtk_history_liststore"> | 880 | <object class="GtkListStore" id="gnunet_conversation_gtk_history_liststore"> |
875 | <columns> | 881 | <columns> |
876 | <!-- column-name logTime --> | 882 | <!-- column-name logTime --> |
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c index c717fa00..f9126097 100644 --- a/src/conversation/gnunet-conversation-gtk.c +++ b/src/conversation/gnunet-conversation-gtk.c | |||
@@ -129,6 +129,8 @@ update_status (const gchar * message) | |||
129 | gtk_statusbar_push (GTK_STATUSBAR (status_bar), | 129 | gtk_statusbar_push (GTK_STATUSBAR (status_bar), |
130 | GPOINTER_TO_INT (status_bar_context), buff); | 130 | GPOINTER_TO_INT (status_bar_context), buff); |
131 | g_free (buff); | 131 | g_free (buff); |
132 | |||
133 | GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed(); | ||
132 | 134 | ||
133 | 135 | ||
134 | } | 136 | } |
@@ -153,8 +155,6 @@ set_status_icon (const char *icon_name) | |||
153 | GtkWindow *main_window; | 155 | GtkWindow *main_window; |
154 | GtkImage *status_icon; | 156 | GtkImage *status_icon; |
155 | 157 | ||
156 | |||
157 | |||
158 | main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window")); | 158 | main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window")); |
159 | 159 | ||
160 | status_icon = GTK_IMAGE (get_object ("GNUNET_GTK_status_icon")); | 160 | status_icon = GTK_IMAGE (get_object ("GNUNET_GTK_status_icon")); |
@@ -163,8 +163,6 @@ set_status_icon (const char *icon_name) | |||
163 | 163 | ||
164 | //LOG (_("Tray icon changed to: `%s' "), icon_name); | 164 | //LOG (_("Tray icon changed to: `%s' "), icon_name); |
165 | 165 | ||
166 | |||
167 | |||
168 | GNUNET_GTK_tray_icon_change (icon_name, "gnunet-conversation-gtk-status"); | 166 | GNUNET_GTK_tray_icon_change (icon_name, "gnunet-conversation-gtk-status"); |
169 | } | 167 | } |
170 | 168 | ||
@@ -267,7 +265,7 @@ set_incoming_call_state(struct GNUNET_CONVERSATION_Caller *caller, int state) | |||
267 | gint valid = 0; | 265 | gint valid = 0; |
268 | //FPRINTF (stderr,"set incoming call state:%u caller: ",state); | 266 | //FPRINTF (stderr,"set incoming call state:%u caller: ",state); |
269 | 267 | ||
270 | LOG (_("set incoming call state:%u caller: "),state); | 268 | // LOG (_("set incoming call state:%u caller: "),state); |
271 | 269 | ||
272 | valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), >kiter ); | 270 | valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), >kiter ); |
273 | 271 | ||
@@ -304,15 +302,14 @@ set_incoming_call_state(struct GNUNET_CONVERSATION_Caller *caller, int state) | |||
304 | switch (state) | 302 | switch (state) |
305 | { | 303 | { |
306 | case CT_hangup: | 304 | case CT_hangup: |
307 | LOG("remove line cause hangup"); | 305 | //LOG("remove line cause hangup"); |
308 | gtk_list_store_remove(active_liststore,>kiter); | 306 | gtk_list_store_remove(active_liststore,>kiter); |
309 | break; | 307 | break; |
310 | 308 | ||
311 | case CT_rejected: | 309 | case CT_rejected: |
312 | LOG("remove line cause rejected"); | 310 | //LOG("remove line cause rejected"); |
313 | gtk_list_store_remove(active_liststore,>kiter); | 311 | gtk_list_store_remove(active_liststore,>kiter); |
314 | break; | 312 | break; |
315 | |||
316 | default: | 313 | default: |
317 | 314 | ||
318 | gtk_list_store_set(active_liststore, >kiter, | 315 | gtk_list_store_set(active_liststore, >kiter, |
@@ -329,6 +326,8 @@ set_incoming_call_state(struct GNUNET_CONVERSATION_Caller *caller, int state) | |||
329 | 326 | ||
330 | }//end while | 327 | }//end while |
331 | 328 | ||
329 | //update statsbar | ||
330 | update_status(""); | ||
332 | 331 | ||
333 | 332 | ||
334 | } | 333 | } |
@@ -386,19 +385,9 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, | |||
386 | ,-1); | 385 | ,-1); |
387 | 386 | ||
388 | 387 | ||
389 | //What is this callername thing? | ||
390 | // strncpy (&callerName, &caller_id, 50); | ||
391 | // callerName[52] = '\0'; | ||
392 | |||
393 | //TODO:new call notification, should be passed a reference to the call | ||
394 | //TODO: rename: quick_message to call_notification(caller); | ||
395 | // quick_message ("der is een beller", caller_id); | ||
396 | // TODO: make sound | ||
397 | |||
398 | break; | 388 | break; |
399 | 389 | ||
400 | case GNUNET_CONVERSATION_EC_PHONE_HUNG_UP: | 390 | case GNUNET_CONVERSATION_EC_PHONE_HUNG_UP: |
401 | //FPRINTF(stderr,"GNUNET_CONVERSATION_EC_PHONE_HUNG_UP:"); | ||
402 | //gtk | 391 | //gtk |
403 | 392 | ||
404 | valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), >kiter1 ); | 393 | valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), >kiter1 ); |
@@ -408,8 +397,7 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, | |||
408 | 397 | ||
409 | while (valid) | 398 | while (valid) |
410 | { | 399 | { |
411 | /* Walk through the list, reading each row */ | 400 | //FPRINTF(stderr,"GNUNET_CONVERSATION_EC_PHONE_HUNG_UP: while valid"); |
412 | //FPRINTF(stderr,"GNUNET_CONVERSATION_EC_PHONE_HUNG_UP: while valid"); | ||
413 | 401 | ||
414 | gchar *str_data; | 402 | gchar *str_data; |
415 | gint int_data; | 403 | gint int_data; |
@@ -432,42 +420,10 @@ phone_event_handler (void *cls, enum GNUNET_CONVERSATION_PhoneEventCode code, | |||
432 | 420 | ||
433 | 421 | ||
434 | 422 | ||
435 | //gcl_active = NULL; | ||
436 | phone_state = PS_LISTEN; | 423 | phone_state = PS_LISTEN; |
437 | //add to call history list | 424 | //add to call history list |
438 | //history_add(CH_HANGUP, cl->caller_id); | 425 | //history_add(CH_HANGUP, cl->caller_id); |
439 | 426 | ||
440 | |||
441 | ///END gtk | ||
442 | |||
443 | //old | ||
444 | /* | ||
445 | for (cl = cl_head; NULL != cl; cl = cl->next) | ||
446 | if (caller == cl->caller) | ||
447 | break; | ||
448 | |||
449 | if (NULL == cl) | ||
450 | { | ||
451 | GNUNET_break (0); | ||
452 | return; | ||
453 | } | ||
454 | |||
455 | LOG (_("Call from `%s' terminated\n"), cl->caller_id); | ||
456 | |||
457 | |||
458 | GNUNET_CONTAINER_DLL_remove (cl_head, cl_tail, cl); | ||
459 | GNUNET_free (cl->caller_id); | ||
460 | |||
461 | // | ||
462 | if (cl == cl_active) | ||
463 | { | ||
464 | cl_active = NULL; | ||
465 | phone_state = PS_LISTEN; | ||
466 | } | ||
467 | GNUNET_free (cl); | ||
468 | */ | ||
469 | //destroy call accept dialog | ||
470 | //gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
471 | break; | 427 | break; |
472 | 428 | ||
473 | } | 429 | } |
@@ -488,12 +444,10 @@ caller_event_handler (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code) | |||
488 | switch (code) | 444 | switch (code) |
489 | { | 445 | { |
490 | case GNUNET_CONVERSATION_EC_CALLER_SUSPEND: | 446 | case GNUNET_CONVERSATION_EC_CALLER_SUSPEND: |
491 | update_state (); | ||
492 | set_incoming_call_state(cls,CT_suspended); | 447 | set_incoming_call_state(cls,CT_suspended); |
493 | LOG (_("Call from `%s' suspended by other user\n"), cl->caller_id); | 448 | LOG (_("Call from `%s' suspended by other user\n"), cl->caller_id); |
494 | break; | 449 | break; |
495 | case GNUNET_CONVERSATION_EC_CALLER_RESUME: | 450 | case GNUNET_CONVERSATION_EC_CALLER_RESUME: |
496 | update_state (); | ||
497 | set_incoming_call_state(cls,CT_active); | 451 | set_incoming_call_state(cls,CT_active); |
498 | LOG (_("Call from `%s' resumed by other user\n"), cl->caller_id); | 452 | LOG (_("Call from `%s' resumed by other user\n"), cl->caller_id); |
499 | break; | 453 | break; |
@@ -791,7 +745,7 @@ do_status () | |||
791 | if (cl == cl_active) | 745 | if (cl == cl_active) |
792 | continue; | 746 | continue; |
793 | //UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id); | 747 | //UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id); |
794 | LOG ("%s", _("Calls waiting:")); | 748 | // LOG ("%s", _("Calls waiting:")); |
795 | } | 749 | } |
796 | } | 750 | } |
797 | } | 751 | } |
@@ -857,7 +811,7 @@ do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller) | |||
857 | { | 811 | { |
858 | struct CallList *cl; | 812 | struct CallList *cl; |
859 | char buf[32]; | 813 | char buf[32]; |
860 | 814 | /* | |
861 | if (NULL != call) | 815 | if (NULL != call) |
862 | { | 816 | { |
863 | switch (call_state) | 817 | switch (call_state) |
@@ -873,6 +827,7 @@ do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller) | |||
873 | return; | 827 | return; |
874 | } | 828 | } |
875 | } | 829 | } |
830 | */ | ||
876 | switch (phone_state) | 831 | switch (phone_state) |
877 | { | 832 | { |
878 | case PS_LOOKUP_EGO: | 833 | case PS_LOOKUP_EGO: |
@@ -880,14 +835,13 @@ do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller) | |||
880 | LOG ("%s", _("There is no call that could be resumed right now.")); | 835 | LOG ("%s", _("There is no call that could be resumed right now.")); |
881 | return; | 836 | return; |
882 | case PS_LISTEN: | 837 | case PS_LISTEN: |
883 | /* expected state, do resume logic */ | ||
884 | break; | 838 | break; |
885 | case PS_ACCEPTED: | 839 | case PS_ACCEPTED: |
886 | LOG (_("Already talking with `%s', cannot resume a call right now."), | 840 | LOG (_("Already talking with `%s', cannot resume a call right now."), |
887 | peer_name); | 841 | peer_name); |
888 | return; | 842 | return; |
889 | } | 843 | } |
890 | 844 | /* | |
891 | GNUNET_assert (NULL == cl_active); | 845 | GNUNET_assert (NULL == cl_active); |
892 | cl = cl_head; | 846 | cl = cl_head; |
893 | if (NULL == cl) | 847 | if (NULL == cl) |
@@ -908,10 +862,10 @@ do_resume (struct GNUNET_CONVERSATION_Caller *sel_caller) | |||
908 | return; | 862 | return; |
909 | } | 863 | } |
910 | cl_active = cl; | 864 | cl_active = cl; |
865 | */ | ||
911 | 866 | ||
912 | set_incoming_call_state(sel_caller,CT_active); | ||
913 | |||
914 | GNUNET_CONVERSATION_caller_resume (sel_caller, speaker, mic); | 867 | GNUNET_CONVERSATION_caller_resume (sel_caller, speaker, mic); |
868 | set_incoming_call_state(sel_caller,CT_active); | ||
915 | phone_state = PS_ACCEPTED; | 869 | phone_state = PS_ACCEPTED; |
916 | } | 870 | } |
917 | 871 | ||
@@ -926,15 +880,15 @@ do_reject (struct GNUNET_CONVERSATION_Caller *sel_caller) | |||
926 | { | 880 | { |
927 | struct CallList *cl; | 881 | struct CallList *cl; |
928 | char buf[32]; | 882 | char buf[32]; |
929 | LOG("do reject"); | ||
930 | // set_incoming_call_state(sel_caller,CT_rejected); | ||
931 | 883 | ||
884 | /* | ||
932 | if (NULL != call) | 885 | if (NULL != call) |
933 | { | 886 | { |
934 | GNUNET_CONVERSATION_call_stop (call); | 887 | GNUNET_CONVERSATION_call_stop (call); |
935 | call = NULL; | 888 | call = NULL; |
936 | return; | 889 | return; |
937 | } | 890 | } |
891 | */ | ||
938 | switch (phone_state) | 892 | switch (phone_state) |
939 | { | 893 | { |
940 | case PS_LOOKUP_EGO: | 894 | case PS_LOOKUP_EGO: |
@@ -990,7 +944,7 @@ do_reject (struct GNUNET_CONVERSATION_Caller *sel_caller) | |||
990 | */ | 944 | */ |
991 | set_incoming_call_state(sel_caller,CT_hangup); | 945 | set_incoming_call_state(sel_caller,CT_hangup); |
992 | GNUNET_CONVERSATION_caller_hang_up(sel_caller); | 946 | GNUNET_CONVERSATION_caller_hang_up(sel_caller); |
993 | cl_active = NULL; | 947 | //cl_active = NULL; |
994 | phone_state = PS_LISTEN; | 948 | phone_state = PS_LISTEN; |
995 | break; | 949 | break; |
996 | } | 950 | } |
@@ -1441,86 +1395,18 @@ main (int argc, char *const *argv) | |||
1441 | // FPRINTF (stderr, "line %i", line); | 1395 | // FPRINTF (stderr, "line %i", line); |
1442 | } | 1396 | } |
1443 | 1397 | ||
1444 | /* gui stuff start */ | ||
1445 | /* | ||
1446 | * Accept call window | ||
1447 | * TODO: rename this | ||
1448 | * | ||
1449 | * @param message message in the dialogbox | ||
1450 | * @param caller_id | ||
1451 | */ | ||
1452 | |||
1453 | /* | ||
1454 | void | ||
1455 | quick_message (gchar * message, const char *caller_id) | ||
1456 | { | ||
1457 | GtkWidget *caller_name, *notification, *content_area; | ||
1458 | GtkWidget *dialog; | ||
1459 | GtkWindow *main_window; | ||
1460 | |||
1461 | main_window = GTK_WINDOW (get_object ("GNUNET_GTK_conversation_window")); | ||
1462 | // Create the widgets | ||
1463 | |||
1464 | |||
1465 | dialog = | ||
1466 | gtk_dialog_new_with_buttons ("Incoming call!", main_window, | ||
1467 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
1468 | _("Accept call"), GTK_RESPONSE_ACCEPT, | ||
1469 | _("Reject call"), GTK_RESPONSE_REJECT, | ||
1470 | _("Decide later"), GTK_RESPONSE_CANCEL, | ||
1471 | NULL); | ||
1472 | content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); | ||
1473 | |||
1474 | |||
1475 | notification = gtk_label_new ("Incoming call from:"); | ||
1476 | caller_name = gtk_label_new (caller_id); | ||
1477 | |||
1478 | // Add the labels, and show everything we've added to the dialog | ||
1479 | gtk_container_add (GTK_CONTAINER (content_area), notification); | ||
1480 | gtk_container_add (GTK_CONTAINER (content_area), caller_name); | ||
1481 | gtk_widget_show_all (GTK_WIDGET (dialog)); | ||
1482 | |||
1483 | switch (gtk_dialog_run (GTK_DIALOG (dialog))) | ||
1484 | { | ||
1485 | case GTK_RESPONSE_ACCEPT: | ||
1486 | do_status (""); | ||
1487 | gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
1488 | // do_accept ("0"); | ||
1489 | break; | ||
1490 | case GTK_RESPONSE_REJECT: | ||
1491 | // do_reject (caller_selected); | ||
1492 | do_status (""); | ||
1493 | gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
1494 | break; | ||
1495 | case GTK_RESPONSE_CANCEL: | ||
1496 | do_status (""); | ||
1497 | gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
1498 | break; | ||
1499 | } | ||
1500 | |||
1501 | |||
1502 | } | ||
1503 | */ | ||
1504 | |||
1505 | |||
1506 | |||
1507 | /** | 1398 | /** |
1508 | * call clicked | 1399 | * call clicked |
1509 | */ | 1400 | */ |
1510 | void | 1401 | void |
1511 | GNUNET_CONVERSATION_GTK_on_call_clicked () | 1402 | GNUNET_CONVERSATION_GTK_on_call_clicked () |
1512 | { | 1403 | { |
1513 | // char *to_addr = malloc((MAX_TO_ADDR+1)*sizeof(char)); | ||
1514 | char *to_addr; | 1404 | char *to_addr; |
1515 | GtkEntry *address_entry; | 1405 | GtkEntry *address_entry; |
1516 | 1406 | ||
1517 | address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address")); | 1407 | address_entry = GTK_ENTRY (get_object ("GNUNET_GTK_conversation_address")); |
1518 | to_addr = gtk_entry_get_text (address_entry); | 1408 | to_addr = gtk_entry_get_text (address_entry); |
1519 | 1409 | ||
1520 | // strncpy(to_addr, gtk_entry_get_text (address_entry), MAX_TO_ADDR); | ||
1521 | // to_addr[strlen(to_addr)+1] = '\0'; | ||
1522 | // FPRINTF (stderr, _("calling: %s \n"), to_addr ); | ||
1523 | |||
1524 | do_call (to_addr); | 1410 | do_call (to_addr); |
1525 | //disable_button ("GNUNET_GTK_conversation_accept_button"); | 1411 | //disable_button ("GNUNET_GTK_conversation_accept_button"); |
1526 | do_status (); | 1412 | do_status (); |
@@ -1566,7 +1452,6 @@ GNUNET_CONVERSATION_GTK_on_accept_clicked () | |||
1566 | void | 1452 | void |
1567 | GNUNET_CONVERSATION_GTK_on_reject_clicked () | 1453 | GNUNET_CONVERSATION_GTK_on_reject_clicked () |
1568 | { | 1454 | { |
1569 | LOG ("reject clicked \n"); | ||
1570 | do_reject (caller_selected); | 1455 | do_reject (caller_selected); |
1571 | } | 1456 | } |
1572 | 1457 | ||
@@ -1576,14 +1461,7 @@ GNUNET_CONVERSATION_GTK_on_reject_clicked () | |||
1576 | void | 1461 | void |
1577 | GNUNET_CONVERSATION_GTK_on_pause_clicked () | 1462 | GNUNET_CONVERSATION_GTK_on_pause_clicked () |
1578 | { | 1463 | { |
1579 | // GtkEntry *entry; | ||
1580 | do_suspend (caller_selected); | 1464 | do_suspend (caller_selected); |
1581 | //FPRINTF (stderr, "pause clicked \n"); | ||
1582 | //do_pause(""); | ||
1583 | // entry = GTK_ENTRY((get_object ("GNUNET_GTK_conversation_address"))); | ||
1584 | //FPRINTF (stderr, gtk_entry_get_text (entry)); | ||
1585 | // gtk_entry_set_text (entry, "testtextje"); | ||
1586 | // show_infobar (); | ||
1587 | } | 1465 | } |
1588 | 1466 | ||
1589 | /** | 1467 | /** |
@@ -1592,7 +1470,6 @@ GNUNET_CONVERSATION_GTK_on_pause_clicked () | |||
1592 | void | 1470 | void |
1593 | GNUNET_CONVERSATION_GTK_on_resume_clicked () | 1471 | GNUNET_CONVERSATION_GTK_on_resume_clicked () |
1594 | { | 1472 | { |
1595 | //FPRINTF (stderr, "reject clicked \n"); | ||
1596 | do_resume (caller_selected); | 1473 | do_resume (caller_selected); |
1597 | } | 1474 | } |
1598 | 1475 | ||
@@ -1602,11 +1479,7 @@ GNUNET_CONVERSATION_GTK_on_resume_clicked () | |||
1602 | void | 1479 | void |
1603 | GNUNET_CONVERSATION_GTK_on_status_clicked () | 1480 | GNUNET_CONVERSATION_GTK_on_status_clicked () |
1604 | { | 1481 | { |
1605 | |||
1606 | |||
1607 | // do_accept("0"); | ||
1608 | do_status (); | 1482 | do_status (); |
1609 | //quick_message('hee blaaat you have a call from blaat'); | ||
1610 | } | 1483 | } |
1611 | 1484 | ||
1612 | 1485 | ||
@@ -1881,7 +1754,7 @@ gnunet_conversation_gtk_contacts_zone_combobox_changed_cb (GtkComboBox *widget, | |||
1881 | 0, &tempName, | 1754 | 0, &tempName, |
1882 | 1, &tempEgo, | 1755 | 1, &tempEgo, |
1883 | -1); | 1756 | -1); |
1884 | FPRINTF(stderr,"blat: %s\n", tempName); | 1757 | // FPRINTF(stderr,"blat: %s\n", tempName); |
1885 | temp_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo); | 1758 | temp_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (tempEgo); |
1886 | gtk_list_store_clear(contacts_liststore); | 1759 | gtk_list_store_clear(contacts_liststore); |
1887 | /* | 1760 | /* |
@@ -1945,7 +1818,6 @@ print_call_info() | |||
1945 | gboolean valid; | 1818 | gboolean valid; |
1946 | gint row_count = 0; | 1819 | gint row_count = 0; |
1947 | 1820 | ||
1948 | //LOG("test"); | ||
1949 | valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), >kiter ); | 1821 | valid = gtk_tree_model_get_iter_first( GTK_TREE_MODEL( active_liststore ), >kiter ); |
1950 | 1822 | ||
1951 | if (!valid) | 1823 | if (!valid) |
@@ -1965,7 +1837,7 @@ print_call_info() | |||
1965 | { | 1837 | { |
1966 | // LOG (_("info for active call:%s number: %u row: %u"), str_data,int_data,row_count); | 1838 | // LOG (_("info for active call:%s number: %u row: %u"), str_data,int_data,row_count); |
1967 | currentlySelectedCallAddress = str_data; | 1839 | currentlySelectedCallAddress = str_data; |
1968 | FPRINTF(stderr,"cal addr: %s\n",currentlySelectedCallAddress); | 1840 | // FPRINTF(stderr,"cal addr: %s\n",currentlySelectedCallAddress); |
1969 | break ; | 1841 | break ; |
1970 | } | 1842 | } |
1971 | g_free (str_data); | 1843 | g_free (str_data); |
@@ -1978,14 +1850,25 @@ print_call_info() | |||
1978 | } | 1850 | } |
1979 | 1851 | ||
1980 | /* | 1852 | /* |
1981 | * @brief executed when selecting a call | 1853 | * @brief executed when selecting a different item in active call list |
1982 | */ | 1854 | */ |
1983 | 1855 | ||
1984 | void | 1856 | void |
1985 | GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed() | 1857 | GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed() |
1986 | { | 1858 | { |
1859 | update_active_call_list_buttons(); | ||
1860 | } | ||
1861 | |||
1862 | /* | ||
1863 | * @brief sets caller_selected, and enables or disables the active call list buttons | ||
1864 | */ | ||
1865 | void | ||
1866 | update_active_call_list_buttons() | ||
1867 | { | ||
1987 | gchar *caller_id; | 1868 | gchar *caller_id; |
1988 | gpointer cl_caller; | 1869 | gpointer cl_caller; |
1870 | gint cl_caller_state; | ||
1871 | gint cl_caller_type; | ||
1989 | GtkTreeSelection *active_selection; | 1872 | GtkTreeSelection *active_selection; |
1990 | GtkTreeIter gcl_selected; | 1873 | GtkTreeIter gcl_selected; |
1991 | // active_liststore_selection = get_object("GNUNET_CONVERSATION_GTK_active_calls_selection"); | 1874 | // active_liststore_selection = get_object("GNUNET_CONVERSATION_GTK_active_calls_selection"); |
@@ -1999,15 +1882,103 @@ GNUNET_CONVERSATION_GTK_on_active_calls_selection_changed() | |||
1999 | gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gcl_selected, | 1882 | gtk_tree_model_get (GTK_TREE_MODEL(active_liststore), &gcl_selected, |
2000 | AL_caller, &cl_caller, | 1883 | AL_caller, &cl_caller, |
2001 | AL_caller_id, &caller_id, | 1884 | AL_caller_id, &caller_id, |
1885 | AL_caller_state, &cl_caller_state, | ||
2002 | -1); | 1886 | -1); |
2003 | 1887 | ||
2004 | caller_selected = cl_caller; | 1888 | caller_selected = cl_caller; |
2005 | 1889 | ||
2006 | //LOG("SELECTION: %s ",caller_id); | 1890 | gtk_widget_show(get_object("GNUNET_GTK_conversation_active_call_list_buttons" )); |
2007 | print_call_info(); | 1891 | |
1892 | |||
1893 | // make global? | ||
1894 | GtkWidget *b_contact, *b_accept, *b_hangup, *b_suspend, *b_resume; | ||
1895 | b_contact = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_use_current_button")); | ||
1896 | b_accept = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_accept_button")); | ||
1897 | b_hangup = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_hangup_button")); | ||
1898 | b_suspend = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_suspend_button")); | ||
1899 | b_resume = GTK_WIDGET (get_object ("GNUNET_GTK_conversation_resume_button")); | ||
1900 | |||
1901 | |||
1902 | switch (cl_caller_state) | ||
1903 | { | ||
1904 | /* buttons: | ||
1905 | * contact | ||
1906 | * accept | ||
1907 | * hangup | ||
1908 | * suspend | ||
1909 | * resume | ||
1910 | * | ||
1911 | * TODO: check if there is incoming or outgoing call, | ||
1912 | * disable resume and accept buttons. | ||
1913 | * or suspend that other call | ||
1914 | */ | ||
1915 | |||
1916 | case CT_active: | ||
1917 | // hangup, pause | ||
1918 | //LOG("CT_active state: %u ",cl_caller_state); | ||
1919 | gtk_widget_set_sensitive(b_contact, 1); | ||
1920 | gtk_widget_set_sensitive(b_accept, 0); | ||
1921 | gtk_widget_set_sensitive(b_hangup, 1); | ||
1922 | gtk_widget_set_sensitive(b_suspend, 1); | ||
1923 | gtk_widget_set_sensitive(b_resume, 0); | ||
1924 | break; | ||
1925 | case CT_ringing: | ||
1926 | // pickup, phonebook | ||
1927 | //LOG("CT_ring show button"); | ||
1928 | gtk_widget_set_sensitive(b_contact, 1); | ||
1929 | if (phone_state == PS_LISTEN) | ||
1930 | { | ||
1931 | gtk_widget_set_sensitive(b_accept, 1); | ||
1932 | }else{ | ||
1933 | gtk_widget_set_sensitive(b_accept, 0); | ||
1934 | } | ||
2008 | 1935 | ||
1936 | |||
1937 | gtk_widget_set_sensitive(b_hangup, 0); | ||
1938 | gtk_widget_set_sensitive(b_suspend, 0); | ||
1939 | gtk_widget_set_sensitive(b_resume, 0); | ||
1940 | break; | ||
1941 | case CT_rejected: | ||
1942 | //add to phonebook | ||
1943 | //LOG("CT_rejected "); | ||
1944 | gtk_widget_set_sensitive(b_contact, 1); | ||
1945 | gtk_widget_set_sensitive(b_accept, 0); | ||
1946 | gtk_widget_set_sensitive(b_hangup, 0); | ||
1947 | gtk_widget_set_sensitive(b_suspend, 0); | ||
1948 | gtk_widget_set_sensitive(b_resume, 0); | ||
1949 | |||
1950 | break; | ||
1951 | case CT_suspended: | ||
1952 | // resume, hangup | ||
1953 | //LOG("CT_suspended "); | ||
1954 | gtk_widget_set_sensitive(b_contact, 1 ); | ||
1955 | gtk_widget_set_sensitive(b_accept, 0); | ||
1956 | gtk_widget_set_sensitive(b_hangup, 1); | ||
1957 | gtk_widget_set_sensitive(b_suspend, 0); | ||
1958 | //gtk_widget_set_sensitive(b_resume, 1); | ||
1959 | if (phone_state == PS_LISTEN) | ||
1960 | { | ||
1961 | gtk_widget_set_sensitive(b_resume, 1); | ||
1962 | }else{ | ||
1963 | gtk_widget_set_sensitive(b_resume, 0); | ||
1964 | } | ||
1965 | break; | ||
1966 | default: | ||
1967 | GNUNET_break(0); | ||
1968 | break; | ||
1969 | } | ||
1970 | print_call_info(); | ||
2009 | } | 1971 | } |
2010 | } | 1972 | else |
1973 | { | ||
1974 | |||
1975 | LOG("nothing selected"); | ||
1976 | |||
1977 | gtk_widget_hide(get_object("GNUNET_GTK_conversation_active_call_list_buttons" )); | ||
1978 | |||
1979 | } | ||
1980 | |||
1981 | } //end function | ||
2011 | /* | 1982 | /* |
2012 | * @brief active call list type data function | 1983 | * @brief active call list type data function |
2013 | */ | 1984 | */ |
diff --git a/src/conversation/gnunet-conversation-gtk.h b/src/conversation/gnunet-conversation-gtk.h index ff3acde1..9230062d 100644 --- a/src/conversation/gnunet-conversation-gtk.h +++ b/src/conversation/gnunet-conversation-gtk.h | |||
@@ -65,6 +65,7 @@ enum { | |||
65 | /** | 65 | /** |
66 | * callerstate (state of incoming call) | 66 | * callerstate (state of incoming call) |
67 | */ | 67 | */ |
68 | |||
68 | enum { | 69 | enum { |
69 | CT_active, | 70 | CT_active, |
70 | CT_suspended, | 71 | CT_suspended, |
@@ -73,6 +74,7 @@ enum { | |||
73 | CT_hangup, | 74 | CT_hangup, |
74 | CT_rejected | 75 | CT_rejected |
75 | }; | 76 | }; |
77 | |||
76 | /** | 78 | /** |
77 | * type of call | 79 | * type of call |
78 | */ | 80 | */ |