diff options
author | yids <yids@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-01-27 20:44:50 +0000 |
---|---|---|
committer | yids <yids@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-01-27 20:44:50 +0000 |
commit | 9889ef34fb63280180210d76754c7bbce93cf160 (patch) | |
tree | ca0674f644633f51f37601243afe796c9fa30111 | |
parent | 51576b537875e87c3be7bf3fc5d4f6c501f6f83e (diff) | |
download | gnunet-gtk-9889ef34fb63280180210d76754c7bbce93cf160.tar.gz gnunet-gtk-9889ef34fb63280180210d76754c7bbce93cf160.zip |
Removing contacts works now
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 56 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.h | 5 |
2 files changed, 61 insertions, 0 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c index 8a036cae..c20a97b2 100644 --- a/src/conversation/gnunet-conversation-gtk.c +++ b/src/conversation/gnunet-conversation-gtk.c | |||
@@ -893,6 +893,40 @@ add_continuation (void *cls, int32_t success, const char *emsg) | |||
893 | //test_finished (); | 893 | //test_finished (); |
894 | } | 894 | } |
895 | 895 | ||
896 | /** | ||
897 | * Continuation called to notify client about result of the | ||
898 | * operation. | ||
899 | * | ||
900 | * @param cls closure, unused | ||
901 | * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) | ||
902 | * #GNUNET_NO if content was already there | ||
903 | * #GNUNET_YES (or other positive value) on success | ||
904 | * @param emsg NULL on success, otherwise an error message | ||
905 | */ | ||
906 | static void | ||
907 | del_continuation (void *cls, | ||
908 | int32_t success, | ||
909 | const char *emsg) | ||
910 | { | ||
911 | del_qe = NULL; | ||
912 | if (GNUNET_NO == success) | ||
913 | { | ||
914 | fprintf (stderr, | ||
915 | _("Deleting record failed, record does not exist%s%s\n"), | ||
916 | (NULL != emsg) ? ": " : "", | ||
917 | (NULL != emsg) ? emsg : ""); | ||
918 | } | ||
919 | if (GNUNET_SYSERR == success) | ||
920 | { | ||
921 | fprintf (stderr, | ||
922 | _("Deleting record failed%s%s\n"), | ||
923 | (NULL != emsg) ? ": " : "", | ||
924 | (NULL != emsg) ? emsg : ""); | ||
925 | } | ||
926 | // test_finished (); | ||
927 | } | ||
928 | |||
929 | |||
896 | /** | 930 | /** |
897 | * Function called by identity service with information about egos. | 931 | * Function called by identity service with information about egos. |
898 | * | 932 | * |
@@ -1484,6 +1518,28 @@ GNUNET_CONVERSATION_GTK_on_remove_clicked (GtkButton * button, | |||
1484 | gpointer * user_data) | 1518 | gpointer * user_data) |
1485 | { | 1519 | { |
1486 | FPRINTF (stderr, "remove clicked \n"); | 1520 | FPRINTF (stderr, "remove clicked \n"); |
1521 | GtkTreeSelection *selection; | ||
1522 | GtkTreeModel *model; | ||
1523 | GtkTreeIter iter; | ||
1524 | |||
1525 | selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(contacts_treeview)); | ||
1526 | if (gtk_tree_selection_get_selected(selection, &model, &iter)) | ||
1527 | { | ||
1528 | gtk_tree_model_get (model, &iter, 0, &name, -1); | ||
1529 | |||
1530 | } | ||
1531 | else | ||
1532 | { | ||
1533 | g_print ("no row selected.\n"); | ||
1534 | } | ||
1535 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (caller_id); | ||
1536 | del_qe = GNUNET_NAMESTORE_records_store (ns, | ||
1537 | &zone_pkey, | ||
1538 | name, | ||
1539 | 0, NULL, | ||
1540 | &del_continuation, | ||
1541 | NULL); | ||
1542 | gtk_list_store_remove(contacts_liststore, &iter); | ||
1487 | } | 1543 | } |
1488 | 1544 | ||
1489 | 1545 | ||
diff --git a/src/conversation/gnunet-conversation-gtk.h b/src/conversation/gnunet-conversation-gtk.h index 112a05a7..37c9b076 100644 --- a/src/conversation/gnunet-conversation-gtk.h +++ b/src/conversation/gnunet-conversation-gtk.h | |||
@@ -356,6 +356,11 @@ char *peer_id; | |||
356 | static struct GNUNET_NAMESTORE_QueueEntry *add_qe; | 356 | static struct GNUNET_NAMESTORE_QueueEntry *add_qe; |
357 | 357 | ||
358 | /** | 358 | /** |
359 | * Queue entry for the 'del' operation. | ||
360 | */ | ||
361 | static struct GNUNET_NAMESTORE_QueueEntry *del_qe; | ||
362 | |||
363 | /** | ||
359 | * Global return value | 364 | * Global return value |
360 | */ | 365 | */ |
361 | static int ret; | 366 | static int ret; |