diff options
author | yids <yids@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-01-29 11:36:08 +0000 |
---|---|---|
committer | yids <yids@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-01-29 11:36:08 +0000 |
commit | 8304d91d87d037a534bd440d80d2a0350d631beb (patch) | |
tree | e1813893ce5a0eca2edb1d178a0be88d425bbd8d | |
parent | 17eebbd5f756455a3c760c2c5e554328776c5878 (diff) | |
download | gnunet-gtk-8304d91d87d037a534bd440d80d2a0350d631beb.tar.gz gnunet-gtk-8304d91d87d037a534bd440d80d2a0350d631beb.zip |
Added confirmation dialog for removing a contact
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c index d8c38a40..b07230db 100644 --- a/src/conversation/gnunet-conversation-gtk.c +++ b/src/conversation/gnunet-conversation-gtk.c | |||
@@ -614,12 +614,13 @@ do_status (const char *args) | |||
614 | } | 614 | } |
615 | if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail))) | 615 | if ((NULL != cl_head) && ((cl_head != cl_active) || (cl_head != cl_tail))) |
616 | { | 616 | { |
617 | LOG ("%s", _("Calls waiting:")); | 617 | |
618 | for (cl = cl_head; NULL != cl; cl = cl->next) | 618 | for (cl = cl_head; NULL != cl; cl = cl->next) |
619 | { | 619 | { |
620 | if (cl == cl_active) | 620 | if (cl == cl_active) |
621 | continue; | 621 | continue; |
622 | UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id); | 622 | //UPDATE_STATUS (_("#%u: `%s'"), cl->caller_num, cl->caller_id); |
623 | LOG ("%s", _("Calls waiting:")); | ||
623 | } | 624 | } |
624 | } | 625 | } |
625 | } | 626 | } |
@@ -790,7 +791,8 @@ do_reject (const char *args) | |||
790 | /* expected state, do rejection logic */ | 791 | /* expected state, do rejection logic */ |
791 | GNUNET_assert (NULL != cl_active); | 792 | GNUNET_assert (NULL != cl_active); |
792 | GNUNET_CONVERSATION_caller_hang_up (cl_active->caller); | 793 | GNUNET_CONVERSATION_caller_hang_up (cl_active->caller); |
793 | cl_active = NULL; | 794 | GNUNET_free (cl_active); |
795 | // cl_active = NULL; | ||
794 | phone_state = PS_LISTEN; | 796 | phone_state = PS_LISTEN; |
795 | break; | 797 | break; |
796 | } | 798 | } |
@@ -1321,7 +1323,7 @@ GNUNET_CONVERSATION_GTK_on_hangup_clicked () | |||
1321 | //FPRINTF (stderr, "hangup clicked \n"); | 1323 | //FPRINTF (stderr, "hangup clicked \n"); |
1322 | do_reject (NULL); | 1324 | do_reject (NULL); |
1323 | do_status (""); | 1325 | do_status (""); |
1324 | history_add(3,peer_name); | 1326 | //history_add(3,peer_name); |
1325 | } | 1327 | } |
1326 | 1328 | ||
1327 | /** | 1329 | /** |
@@ -1548,31 +1550,52 @@ GNUNET_CONVERSATION_GTK_on_add_clicked (GtkButton * button, | |||
1548 | 1550 | ||
1549 | void | 1551 | void |
1550 | GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button, | 1552 | GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button, |
1551 | gpointer * user_data) | 1553 | gpointer * user_data) |
1552 | { | 1554 | { |
1553 | FPRINTF (stderr, "remove clicked \n"); | 1555 | FPRINTF (stderr, "remove clicked \n"); |
1554 | GtkTreeSelection *selection; | 1556 | GtkTreeSelection *selection; |
1555 | GtkTreeModel *model; | 1557 | GtkTreeModel *model; |
1556 | GtkTreeIter iter; | 1558 | GtkTreeIter iter; |
1559 | GtkDialog *confirm; | ||
1560 | GtkWindow *main_window; | ||
1561 | GtkLabel *notification; | ||
1562 | GtkHBox *content_area; | ||
1557 | 1563 | ||
1558 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(contacts_treeview)); | 1564 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(contacts_treeview)); |
1559 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) | 1565 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) |
1560 | { | 1566 | { |
1561 | gtk_tree_model_get (model, &iter, 0, &name, -1); | 1567 | gtk_tree_model_get (model, &iter, 0, &name, -1); |
1562 | 1568 | FPRINTF(stderr, "selected %s \n", name); | |
1563 | } | 1569 | main_window = get_object ("GNUNET_GTK_conversation_window"); |
1564 | else | 1570 | confirm = |
1565 | { | 1571 | gtk_dialog_new_with_buttons ("Removing contact", main_window, |
1566 | g_print ("no row selected.\n"); | 1572 | GTK_DIALOG_DESTROY_WITH_PARENT, |
1567 | } | 1573 | _("Yes"), GTK_RESPONSE_ACCEPT, |
1568 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); | 1574 | _("No"), GTK_RESPONSE_CANCEL, NULL); |
1569 | del_qe = GNUNET_NAMESTORE_records_store (ns, | 1575 | content_area = gtk_dialog_get_content_area (GTK_DIALOG (confirm)); |
1570 | &zone_pkey, | 1576 | notification = gtk_label_new ("Do you really want to remove this contact?"); |
1571 | name, | 1577 | gtk_container_add (GTK_CONTAINER (content_area), GTK_WIDGET(notification)); |
1572 | 0, NULL, | 1578 | gtk_widget_show_all (GTK_WIDGET(confirm)); |
1573 | &del_continuation, | 1579 | switch (gtk_dialog_run(confirm)) |
1574 | NULL); | 1580 | { |
1575 | gtk_list_store_remove(contacts_liststore, &iter); | 1581 | case GTK_RESPONSE_ACCEPT: |
1582 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); | ||
1583 | del_qe = GNUNET_NAMESTORE_records_store (ns, | ||
1584 | &zone_pkey, | ||
1585 | name, | ||
1586 | 0, NULL, | ||
1587 | &del_continuation, | ||
1588 | NULL); | ||
1589 | gtk_list_store_remove(contacts_liststore, &iter); | ||
1590 | gtk_widget_destroy (GTK_WIDGET(confirm)); | ||
1591 | break; | ||
1592 | case GTK_RESPONSE_CANCEL: | ||
1593 | FPRINTF(stderr, "not removing \n"); | ||
1594 | gtk_widget_destroy (GTK_WIDGET(confirm)); | ||
1595 | break; | ||
1596 | } | ||
1597 | |||
1598 | } | ||
1576 | } | 1599 | } |
1577 | 1600 | ||
1578 | 1601 | ||