diff options
author | yids <yids@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-02-04 17:22:05 +0000 |
---|---|---|
committer | yids <yids@140774ce-b5e7-0310-ab8b-a85725594a96> | 2014-02-04 17:22:05 +0000 |
commit | 02ed77f5d3cdcaadd57d43149a6c56b12ab96768 (patch) | |
tree | 60b8cbf04f06db45d29c60273eb28527edac8bec | |
parent | ea0fc197ef33dba100cdc427f7f8da63567635e0 (diff) | |
download | gnunet-gtk-02ed77f5d3cdcaadd57d43149a6c56b12ab96768.tar.gz gnunet-gtk-02ed77f5d3cdcaadd57d43149a6c56b12ab96768.zip |
- various fixes
- some work on contacts zone selection (no working yet)
-rw-r--r-- | contrib/gnunet_conversation_gtk_main_window.glade | 66 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.c | 109 | ||||
-rw-r--r-- | src/conversation/gnunet-conversation-gtk.h | 218 |
3 files changed, 220 insertions, 173 deletions
diff --git a/contrib/gnunet_conversation_gtk_main_window.glade b/contrib/gnunet_conversation_gtk_main_window.glade index 47a3af0d..d0ae9050 100644 --- a/contrib/gnunet_conversation_gtk_main_window.glade +++ b/contrib/gnunet_conversation_gtk_main_window.glade | |||
@@ -588,6 +588,7 @@ | |||
588 | <property name="can_focus">False</property> | 588 | <property name="can_focus">False</property> |
589 | <property name="model">gnunet_conversation_gtk_contacts_zone_liststore</property> | 589 | <property name="model">gnunet_conversation_gtk_contacts_zone_liststore</property> |
590 | <property name="tearoff_title">Phonebook:</property> | 590 | <property name="tearoff_title">Phonebook:</property> |
591 | <signal name="changed" handler="gnunet_conversation_gtk_zone_combobox_changed_cb" swapped="no"/> | ||
591 | <child> | 592 | <child> |
592 | <object class="GtkCellRendererText" id="gnunet_conversation_gtk_contacts_zone_ego_name_cellrenderertext"/> | 593 | <object class="GtkCellRendererText" id="gnunet_conversation_gtk_contacts_zone_ego_name_cellrenderertext"/> |
593 | <attributes> | 594 | <attributes> |
@@ -605,21 +606,6 @@ | |||
605 | <child> | 606 | <child> |
606 | <placeholder/> | 607 | <placeholder/> |
607 | </child> | 608 | </child> |
608 | <child> | ||
609 | <placeholder/> | ||
610 | </child> | ||
611 | <child> | ||
612 | <placeholder/> | ||
613 | </child> | ||
614 | <child> | ||
615 | <placeholder/> | ||
616 | </child> | ||
617 | <child> | ||
618 | <placeholder/> | ||
619 | </child> | ||
620 | <child> | ||
621 | <placeholder/> | ||
622 | </child> | ||
623 | </object> | 609 | </object> |
624 | <packing> | 610 | <packing> |
625 | <property name="expand">False</property> | 611 | <property name="expand">False</property> |
@@ -769,6 +755,20 @@ | |||
769 | <property name="position">1</property> | 755 | <property name="position">1</property> |
770 | </packing> | 756 | </packing> |
771 | </child> | 757 | </child> |
758 | <child> | ||
759 | <object class="GtkStatusbar" id="GNUNET_GTK_conversation_statusbar"> | ||
760 | <property name="visible">True</property> | ||
761 | <property name="can_focus">False</property> | ||
762 | <property name="orientation">vertical</property> | ||
763 | <property name="spacing">8</property> | ||
764 | </object> | ||
765 | <packing> | ||
766 | <property name="expand">False</property> | ||
767 | <property name="fill">True</property> | ||
768 | <property name="pack_type">end</property> | ||
769 | <property name="position">2</property> | ||
770 | </packing> | ||
771 | </child> | ||
772 | </object> | 772 | </object> |
773 | </child> | 773 | </child> |
774 | </object> | 774 | </object> |
@@ -833,36 +833,10 @@ | |||
833 | </row> | 833 | </row> |
834 | </data> | 834 | </data> |
835 | </object> | 835 | </object> |
836 | <object class="GtkWindow" id="window1"> | 836 | <object class="GtkTreeStore" id="gnunet_conversation_gtk_zone_treestore"> |
837 | <property name="can_focus">False</property> | 837 | <columns> |
838 | <child> | 838 | <!-- column-name zone --> |
839 | <object class="GtkVBox" id="GNUNET_GTK_conversationvbox"> | 839 | <column type="gchararray"/> |
840 | <property name="visible">True</property> | 840 | </columns> |
841 | <property name="can_focus">False</property> | ||
842 | <child> | ||
843 | <placeholder/> | ||
844 | </child> | ||
845 | <child> | ||
846 | <placeholder/> | ||
847 | </child> | ||
848 | <child> | ||
849 | <placeholder/> | ||
850 | </child> | ||
851 | <child> | ||
852 | <object class="GtkStatusbar" id="GNUNET_GTK_conversation_statusbar"> | ||
853 | <property name="visible">True</property> | ||
854 | <property name="can_focus">False</property> | ||
855 | <property name="orientation">vertical</property> | ||
856 | <property name="spacing">8</property> | ||
857 | </object> | ||
858 | <packing> | ||
859 | <property name="expand">False</property> | ||
860 | <property name="fill">True</property> | ||
861 | <property name="pack_type">end</property> | ||
862 | <property name="position">3</property> | ||
863 | </packing> | ||
864 | </child> | ||
865 | </object> | ||
866 | </child> | ||
867 | </object> | 841 | </object> |
868 | </interface> | 842 | </interface> |
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 | } | ||
diff --git a/src/conversation/gnunet-conversation-gtk.h b/src/conversation/gnunet-conversation-gtk.h index e4e007e0..665d4614 100644 --- a/src/conversation/gnunet-conversation-gtk.h +++ b/src/conversation/gnunet-conversation-gtk.h | |||
@@ -316,7 +316,7 @@ static GtkTreeView *active_treeview; | |||
316 | 316 | ||
317 | 317 | ||
318 | /** | 318 | /** |
319 | * List of all known zones/egos. | 319 | * List of contacts (records). |
320 | */ | 320 | */ |
321 | static GtkListStore *contacts_liststore; | 321 | static GtkListStore *contacts_liststore; |
322 | 322 | ||
@@ -358,6 +358,26 @@ static GtkTreeView *history_treeview; | |||
358 | static GtkTreeModel *history_treemodel; | 358 | static GtkTreeModel *history_treemodel; |
359 | 359 | ||
360 | 360 | ||
361 | /** | ||
362 | * list of zones | ||
363 | */ | ||
364 | static GtkListStore *zone_liststore; | ||
365 | |||
366 | /** | ||
367 | * zone treestore | ||
368 | */ | ||
369 | static GtkTreeStore *zone_treestore; | ||
370 | |||
371 | /** | ||
372 | * zone treeview | ||
373 | */ | ||
374 | static GtkTreeView *zone_treeview; | ||
375 | |||
376 | /** | ||
377 | * zone tree model | ||
378 | */ | ||
379 | static GtkTreeModel *zone_treemodel; | ||
380 | |||
361 | /** | 381 | /** |
362 | * Current state of iterating elements for the client. | 382 | * Current state of iterating elements for the client. |
363 | * NULL if we are not currently iterating. | 383 | * NULL if we are not currently iterating. |
@@ -394,109 +414,107 @@ static int ret; | |||
394 | */ | 414 | */ |
395 | GtkDialog *dialog; | 415 | GtkDialog *dialog; |
396 | 416 | ||
397 | |||
398 | |||
399 | /** | 417 | /** |
400 | * Context for edit operations and environment for plugins. | 418 | * Context for edit operations and environment for plugins. |
401 | * Typical plugins will only use the @e check_validity callback. | 419 | * Typical plugins will only use the @e check_validity callback. |
402 | */ | 420 | */ |
403 | //struct GNUNET_GTK_NAMESTORE_PluginEnvironment | 421 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment |
404 | //{ | 422 | { |
405 | // | 423 | |
406 | // /** | 424 | /** |
407 | // * Function that should be called by the plugin whenever values in | 425 | * Function that should be called by the plugin whenever values in |
408 | // * the dialog were edited. It will check the validity of the dialog | 426 | * the dialog were edited. It will check the validity of the dialog |
409 | // * and update the "save" button accordingly. | 427 | * and update the "save" button accordingly. |
410 | // */ | 428 | */ |
411 | // void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc); | 429 | void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc); |
412 | // | 430 | |
413 | // /** | 431 | /** |
414 | // * Builder for the dialog. | 432 | * Builder for the dialog. |
415 | // */ | 433 | */ |
416 | // GtkBuilder *builder; | 434 | GtkBuilder *builder; |
417 | // | 435 | |
418 | // /** | 436 | /** |
419 | // * Main dialog window. | 437 | * Main dialog window. |
420 | // */ | 438 | */ |
421 | // GtkDialog *dialog; | 439 | GtkDialog *dialog; |
422 | // | 440 | |
423 | // /** | 441 | /** |
424 | // * Where in the tree view are we editing? | 442 | * Where in the tree view are we editing? |
425 | // */ | 443 | */ |
426 | // struct RecordInfo *ri; | 444 | struct RecordInfo *ri; |
427 | // | 445 | |
428 | // /** | 446 | /** |
429 | // * Name of the record. | 447 | * Name of the record. |
430 | // */ | 448 | */ |
431 | // gchar *name; | 449 | gchar *name; |
432 | // | 450 | |
433 | // /** | 451 | /** |
434 | // * Value of the record in string format. | 452 | * Value of the record in string format. |
435 | // */ | 453 | */ |
436 | // gchar *n_value; | 454 | gchar *n_value; |
437 | // | 455 | |
438 | // /** | 456 | /** |
439 | // * Name of the zone into which the record should be placed. | 457 | * Name of the zone into which the record should be placed. |
440 | // */ | 458 | */ |
441 | // gchar *new_zone_option; | 459 | gchar *new_zone_option; |
442 | // | 460 | |
443 | // /** | 461 | /** |
444 | // * Ego of the zone into which the record should be placed. | 462 | * Ego of the zone into which the record should be placed. |
445 | // */ | 463 | */ |
446 | // struct GNUNET_IDENTITY_Ego *ego; | 464 | struct GNUNET_IDENTITY_Ego *ego; |
447 | // | 465 | |
448 | // /** | 466 | /** |
449 | // * List of all zones. | 467 | * List of all zones. |
450 | // */ | 468 | */ |
451 | // GtkListStore *zone_liststore; | 469 | GtkListStore *zone_liststore; |
452 | // | 470 | |
453 | // /** | 471 | /** |
454 | // * The plugin we used to edit the value. | 472 | * The plugin we used to edit the value. |
455 | // */ | 473 | */ |
456 | // struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; | 474 | struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin; |
457 | // | 475 | |
458 | // /** | 476 | /** |
459 | // * Name of the plugin library. | 477 | * Name of the plugin library. |
460 | // */ | 478 | */ |
461 | // char *liblow; | 479 | char *liblow; |
462 | // | 480 | |
463 | // /** | 481 | /** |
464 | // * Expiration time value (absolute or relative). | 482 | * Expiration time value (absolute or relative). |
465 | // */ | 483 | */ |
466 | // guint64 n_exp_time; | 484 | guint64 n_exp_time; |
467 | // | 485 | |
468 | // /** | 486 | /** |
469 | // * Offset of the record we are editing in the 'rd' list of 'ri'. | 487 | * Offset of the record we are editing in the 'rd' list of 'ri'. |
470 | // */ | 488 | */ |
471 | // unsigned int off; | 489 | unsigned int off; |
472 | // | 490 | |
473 | // /** | 491 | /** |
474 | // * Flag indicating if the old record was in the namestore. | 492 | * Flag indicating if the old record was in the namestore. |
475 | // */ | 493 | */ |
476 | // int old_record_in_namestore; | 494 | int old_record_in_namestore; |
477 | // | 495 | |
478 | // /** | 496 | /** |
479 | // * Type of the record. | 497 | * Type of the record. |
480 | // */ | 498 | */ |
481 | // uint32_t record_type; | 499 | uint32_t record_type; |
482 | // | 500 | |
483 | // /** | 501 | /** |
484 | // * Is this record 'public'? | 502 | * Is this record 'public'? |
485 | // */ | 503 | */ |
486 | // gboolean n_public; | 504 | gboolean n_public; |
487 | // | 505 | |
488 | // /** | 506 | /** |
489 | // * Is the expiration time relative? | 507 | * Is the expiration time relative? |
490 | // */ | 508 | */ |
491 | // gboolean n_is_relative; | 509 | gboolean n_is_relative; |
492 | // | 510 | |
493 | // /** | 511 | /** |
494 | // * Is this record a shadow record? | 512 | * Is this record a shadow record? |
495 | // */ | 513 | */ |
496 | // gboolean n_is_shadow; | 514 | gboolean n_is_shadow; |
497 | // | 515 | |
498 | //}; | 516 | }; |
499 | // | 517 | |
500 | 518 | ||
501 | 519 | ||
502 | #endif | 520 | #endif |