diff options
Diffstat (limited to 'src/conversation/gnunet-conversation-gtk.c')
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 109 |
1 files changed, 82 insertions, 27 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c index a475a964..fd19f33d 100644 --- a/src/conversation/gnunet-conversation-gtk.c +++ b/src/conversation/gnunet-conversation-gtk.c | |||
@@ -891,7 +891,7 @@ display_record (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | |||
891 | type = "PHONE"; | 891 | type = "PHONE"; |
892 | } | 892 | } |
893 | // FPRINTF (stdout, "%s", rname); | 893 | // FPRINTF (stdout, "%s", rname); |
894 | if (rd[i].record_type == 65536 || rd[i].record_type == 65536) | 894 | if (rd[i].record_type == 65536 || rd[i].record_type == 65542) |
895 | { | 895 | { |
896 | gtk_list_store_append (contacts_liststore, &iter); | 896 | gtk_list_store_append (contacts_liststore, &iter); |
897 | gtk_list_store_set (contacts_liststore, &iter, 1, type, 0, rname, -1); | 897 | gtk_list_store_set (contacts_liststore, &iter, 1, type, 0, rname, -1); |
@@ -981,9 +981,19 @@ static void | |||
981 | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, | 981 | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, |
982 | const char *name) | 982 | const char *name) |
983 | { | 983 | { |
984 | 984 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | |
985 | // FPRINTF (stderr, _("identity_cb name: `%s' caller_id: `%s' \n"), name, | 985 | char *s; |
986 | // caller_id); | 986 | |
987 | if (NULL != ego) | ||
988 | { | ||
989 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | ||
990 | s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | ||
991 | fprintf (stdout, "%s \n", name); | ||
992 | gtk_list_store_insert_with_values (zone_liststore, | ||
993 | &iter, -1, | ||
994 | 0, name, | ||
995 | -1); | ||
996 | } | ||
987 | 997 | ||
988 | if (NULL == name) | 998 | if (NULL == name) |
989 | return; | 999 | return; |
@@ -1172,6 +1182,15 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1172 | GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_history_treestore")); | 1182 | GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_history_treestore")); |
1173 | history_treemodel = GTK_TREE_MODEL (history_treestore); | 1183 | history_treemodel = GTK_TREE_MODEL (history_treestore); |
1174 | 1184 | ||
1185 | // zone list | ||
1186 | zone_liststore = | ||
1187 | GTK_LIST_STORE (get_object ("gnunet_conversation_gtk_zone_liststore")); | ||
1188 | zone_treeview = | ||
1189 | GTK_TREE_VIEW (get_object ("gnunet_conversation_gtk_zone_treeview")); | ||
1190 | zone_treestore = | ||
1191 | GTK_TREE_STORE (get_object ("gnunet_conversation_gtk_zone_treestore")); | ||
1192 | zone_treemodel = GTK_TREE_MODEL (zone_treestore); | ||
1193 | |||
1175 | //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE); | 1194 | //gtk_tree_view_set_activate_on_single_click(contacts_treeview, TRUE); |
1176 | 1195 | ||
1177 | GNUNET_assert (NULL != contacts_liststore); | 1196 | GNUNET_assert (NULL != contacts_liststore); |
@@ -1626,21 +1645,37 @@ set_status_icon (const char *icon_name) | |||
1626 | GNUNET_GTK_tray_icon_change (icon_name, "gnunet-conversation-gtk-status"); | 1645 | GNUNET_GTK_tray_icon_change (icon_name, "gnunet-conversation-gtk-status"); |
1627 | } | 1646 | } |
1628 | 1647 | ||
1648 | static void | ||
1649 | print_ego (void *cls, | ||
1650 | struct GNUNET_IDENTITY_Ego *ego, | ||
1651 | void **ctx, | ||
1652 | const char *identifier) | ||
1653 | { | ||
1654 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | ||
1655 | char *s; | ||
1656 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | ||
1657 | s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | ||
1658 | fprintf (stdout, "%s \n", identifier); | ||
1659 | // GNUNET_free (s); | ||
1660 | } | ||
1661 | |||
1629 | 1662 | ||
1630 | /* end of gnunet-conversation-gtk.c */ | 1663 | /* end of gnunet-conversation-gtk.c */ |
1631 | void | 1664 | void |
1632 | GNUNET_contact_test () | 1665 | GNUNET_contact_test () |
1633 | { | 1666 | { |
1634 | 1667 | /* | |
1635 | history_add (0, "test"); | 1668 | history_add (0, "test"); |
1636 | history_add (1, "test"); | 1669 | history_add (1, "test"); |
1637 | history_add (2, "test"); | 1670 | history_add (2, "test"); |
1638 | history_add (3, "test"); | 1671 | history_add (3, "test"); |
1639 | history_add (4, "test"); | 1672 | history_add (4, "test"); |
1640 | 1673 | // struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc; | |
1641 | GtkTreeIter iter; | 1674 | // edc = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginEnvironment); |
1642 | char *caller_id = "testje"; | 1675 | */ |
1643 | int caller_num = 10; | 1676 | // GtkTreeIter iter; |
1677 | // char *caller_id = "testje"; | ||
1678 | // int caller_num = 10; | ||
1644 | 1679 | ||
1645 | /* | 1680 | /* |
1646 | * active_liststore: | 1681 | * active_liststore: |
@@ -1648,32 +1683,52 @@ GNUNET_contact_test () | |||
1648 | * 1: pointer caller | 1683 | * 1: pointer caller |
1649 | * 2: gint caller_num | 1684 | * 2: gint caller_num |
1650 | */ | 1685 | */ |
1651 | 1686 | /* | |
1652 | gtk_list_store_append (active_liststore, &iter); | 1687 | gtk_list_store_append (active_liststore, &iter); |
1653 | 1688 | ||
1654 | gtk_list_store_set (active_liststore, &iter, 2, caller_num, 0, caller_id, -1); | 1689 | gtk_list_store_set (active_liststore, &iter, 2, caller_num, 0, caller_id, -1); |
1655 | 1690 | ||
1656 | 1691 | gtk_list_store_insert_with_values (zone_liststore, | |
1692 | &iter, -1, | ||
1693 | 0, "test", | ||
1694 | -1); | ||
1695 | */ | ||
1696 | // static struct GNUNET_IDENTITY_Handle *sh; | ||
1697 | // GNUNET_IDENTITY_disconnect (id); | ||
1698 | // &print_ego; | ||
1699 | //sh = GNUNET_IDENTITY_connect (cfg, &print_ego, NULL); | ||
1657 | 1700 | ||
1658 | } | 1701 | } |
1659 | 1702 | ||
1703 | /** | ||
1704 | * A different zone was selected in the zone toggle bar. Load the | ||
1705 | * appropriate zone. | ||
1706 | * | ||
1707 | * @param widget button that was toggled (could be to "on" or "off", we only react to "on") | ||
1708 | * @param user_data builder, unused | ||
1709 | */ | ||
1660 | void | 1710 | void |
1661 | test_button_clicked() | 1711 | gnunet_conversation_gtk_zone_combobox_changed_cb (GtkComboBox *widget, |
1712 | gpointer user_data) | ||
1662 | { | 1713 | { |
1663 | FPRINTF(stderr,"testbt click \n"); | 1714 | GtkTreeIter iter; |
1664 | GtkTreeIter iter; | 1715 | struct GNUNET_IDENTITY_Ego *ego; |
1665 | char *caller_id = "testje"; | 1716 | // char *name; |
1666 | int caller_num = 10; | 1717 | |
1667 | 1718 | // if (! gtk_combo_box_get_active_iter (widget, | |
1668 | /* | 1719 | // &iter)) |
1669 | * active_liststore: | 1720 | // { |
1670 | * 0: *gchar caller_id | 1721 | // load_zone (NULL, NULL); |
1671 | * 1: pointer caller | 1722 | // return; |
1672 | * 2: gint caller_num | 1723 | // } |
1673 | */ | 1724 | gtk_tree_model_get (zone_liststore, |
1674 | 1725 | &iter, | |
1675 | gtk_list_store_append (active_liststore, &iter); | 1726 | 0, name, |
1727 | -1); | ||
1728 | GNUNET_IDENTITY_disconnect (id); | ||
1729 | // ego_name = name; | ||
1730 | id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); | ||
1731 | // load_zone (name, ego); | ||
1732 | } | ||
1676 | 1733 | ||
1677 | gtk_list_store_set (active_liststore, &iter, 2, caller_num, 0, caller_id, -1); | ||
1678 | 1734 | ||
1679 | } | ||