diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_publish-dialog.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-dialog.c | 274 |
1 files changed, 186 insertions, 88 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index 1e1ec7fa..db86cd26 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c | |||
@@ -431,6 +431,7 @@ gtk_tree_iter_equals (GtkTreeModel *tm, GtkTreeIter *i1, GtkTreeIter *i2) | |||
431 | return (0 == ret) ? GNUNET_YES : GNUNET_NO; | 431 | return (0 == ret) ? GNUNET_YES : GNUNET_NO; |
432 | } | 432 | } |
433 | 433 | ||
434 | |||
434 | /** | 435 | /** |
435 | * Update selectivity of execute/cancel buttons in the master dialog. | 436 | * Update selectivity of execute/cancel buttons in the master dialog. |
436 | * | 437 | * |
@@ -474,6 +475,7 @@ update_selectivity_execute_cancel (struct MainPublishingDialogContext *ctx) | |||
474 | gtk_widget_set_sensitive (ctx->cancel_button, FALSE); | 475 | gtk_widget_set_sensitive (ctx->cancel_button, FALSE); |
475 | } | 476 | } |
476 | 477 | ||
478 | |||
477 | /** | 479 | /** |
478 | * Update selectivity of up/down/left/right buttons in the master dialog. | 480 | * Update selectivity of up/down/left/right buttons in the master dialog. |
479 | * | 481 | * |
@@ -546,6 +548,7 @@ update_selectivity_edit (struct MainPublishingDialogContext *ctx) | |||
546 | gtk_widget_set_sensitive (ctx->up_button, FALSE); | 548 | gtk_widget_set_sensitive (ctx->up_button, FALSE); |
547 | } | 549 | } |
548 | 550 | ||
551 | |||
549 | /** | 552 | /** |
550 | * The selection in the file list tree view changed; update the button | 553 | * The selection in the file list tree view changed; update the button |
551 | * sensitivity. | 554 | * sensitivity. |
@@ -563,6 +566,7 @@ GNUNET_GTK_master_publish_dialog_file_informatino_treeview_selection_changed_cb | |||
563 | update_selectivity_edit (ctx); | 566 | update_selectivity_edit (ctx); |
564 | } | 567 | } |
565 | 568 | ||
569 | |||
566 | /** | 570 | /** |
567 | * Add an empty directory to the tree model. | 571 | * Add an empty directory to the tree model. |
568 | * | 572 | * |
@@ -631,6 +635,7 @@ create_dir_at_iter (struct MainPublishingDialogContext *ctx, | |||
631 | update_selectivity_execute_cancel (ctx); | 635 | update_selectivity_execute_cancel (ctx); |
632 | } | 636 | } |
633 | 637 | ||
638 | |||
634 | /** | 639 | /** |
635 | * Copy an entry in the tree from the 'old' position to the 'new' | 640 | * Copy an entry in the tree from the 'old' position to the 'new' |
636 | * position. All of the fields are copied, plain pointers will be | 641 | * position. All of the fields are copied, plain pointers will be |
@@ -758,6 +763,7 @@ copy_entry (struct MainPublishingDialogContext *ctx, | |||
758 | } | 763 | } |
759 | } | 764 | } |
760 | 765 | ||
766 | |||
761 | /** | 767 | /** |
762 | * Called when global ns publication checkbox is toggled. | 768 | * Called when global ns publication checkbox is toggled. |
763 | * Adjusts execute/cancel button sensitivity. | 769 | * Adjusts execute/cancel button sensitivity. |
@@ -773,6 +779,7 @@ GNUNET_GTK_master_publish_dialog_global_checkbox_toggled_cb ( | |||
773 | update_selectivity_execute_cancel (user_data); | 779 | update_selectivity_execute_cancel (user_data); |
774 | } | 780 | } |
775 | 781 | ||
782 | |||
776 | /** | 783 | /** |
777 | * Called when private ns publication checkbox is toggled. | 784 | * Called when private ns publication checkbox is toggled. |
778 | * Adjusts execute/cancel button sensitivity. | 785 | * Adjusts execute/cancel button sensitivity. |
@@ -788,6 +795,7 @@ GNUNET_GTK_master_publish_dialog_own_checkbox_toggled_cb ( | |||
788 | update_selectivity_execute_cancel (user_data); | 795 | update_selectivity_execute_cancel (user_data); |
789 | } | 796 | } |
790 | 797 | ||
798 | |||
791 | /** | 799 | /** |
792 | * Called when updateability checkbox is toggled. | 800 | * Called when updateability checkbox is toggled. |
793 | * Adjusts execute/cancel button sensitivity. | 801 | * Adjusts execute/cancel button sensitivity. |
@@ -803,6 +811,7 @@ GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb ( | |||
803 | update_selectivity_execute_cancel (user_data); | 811 | update_selectivity_execute_cancel (user_data); |
804 | } | 812 | } |
805 | 813 | ||
814 | |||
806 | /** | 815 | /** |
807 | * Generates an update id from a new id. | 816 | * Generates an update id from a new id. |
808 | * | 817 | * |
@@ -840,6 +849,7 @@ generate_update_id (const gchar *new_text) | |||
840 | return new_update_id; | 849 | return new_update_id; |
841 | } | 850 | } |
842 | 851 | ||
852 | |||
843 | /** | 853 | /** |
844 | * Checks whether existing update id was generated or not. | 854 | * Checks whether existing update id was generated or not. |
845 | * Generates an update id from the previous id, then checks if | 855 | * Generates an update id from the previous id, then checks if |
@@ -867,6 +877,7 @@ update_id_is_autofilled (const gchar *existing_update_id, | |||
867 | return result; | 877 | return result; |
868 | } | 878 | } |
869 | 879 | ||
880 | |||
870 | /** | 881 | /** |
871 | * Generates a new update id and fills the entry, if necessary. | 882 | * Generates a new update id and fills the entry, if necessary. |
872 | * Stores new identifier as previous_id in the context struct. | 883 | * Stores new identifier as previous_id in the context struct. |
@@ -897,6 +908,7 @@ maybe_change_update_id (struct MainPublishingDialogContext *ctx, | |||
897 | ctx->previous_id = g_strdup (new_text); | 908 | ctx->previous_id = g_strdup (new_text); |
898 | } | 909 | } |
899 | 910 | ||
911 | |||
900 | /** | 912 | /** |
901 | * Called when identifier entry contents are changed by anything. | 913 | * Called when identifier entry contents are changed by anything. |
902 | * Generates a new update id and fills the entry, if necessary. | 914 | * Generates a new update id and fills the entry, if necessary. |
@@ -920,6 +932,7 @@ GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb ( | |||
920 | update_selectivity_execute_cancel (ctx); | 932 | update_selectivity_execute_cancel (ctx); |
921 | } | 933 | } |
922 | 934 | ||
935 | |||
923 | /** | 936 | /** |
924 | * The selection in the identifier tree view changed. | 937 | * The selection in the identifier tree view changed. |
925 | * Copy text into identifier entry, or | 938 | * Copy text into identifier entry, or |
@@ -961,6 +974,7 @@ GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_selection_changed | |||
961 | g_free (new_text); | 974 | g_free (new_text); |
962 | } | 975 | } |
963 | 976 | ||
977 | |||
964 | /** | 978 | /** |
965 | * User has clicked on the 'right' button to move files in the master | 979 | * User has clicked on the 'right' button to move files in the master |
966 | * edit dialog tree view. Execute the move. | 980 | * edit dialog tree view. Execute the move. |
@@ -1015,6 +1029,7 @@ GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget *dummy, | |||
1015 | &iter); | 1029 | &iter); |
1016 | } | 1030 | } |
1017 | 1031 | ||
1032 | |||
1018 | /** | 1033 | /** |
1019 | * User has clicked on the 'left' button to move files in the master | 1034 | * User has clicked on the 'left' button to move files in the master |
1020 | * edit dialog tree view. Execute the move. | 1035 | * edit dialog tree view. Execute the move. |
@@ -1056,6 +1071,7 @@ GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget *dummy, | |||
1056 | &iter); | 1071 | &iter); |
1057 | } | 1072 | } |
1058 | 1073 | ||
1074 | |||
1059 | /** | 1075 | /** |
1060 | * User has clicked on the 'up' button to move files in the master | 1076 | * User has clicked on the 'up' button to move files in the master |
1061 | * edit dialog tree view. Execute the move. | 1077 | * edit dialog tree view. Execute the move. |
@@ -1116,6 +1132,7 @@ GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget *dummy, | |||
1116 | &iter); | 1132 | &iter); |
1117 | } | 1133 | } |
1118 | 1134 | ||
1135 | |||
1119 | /** | 1136 | /** |
1120 | * User has clicked on the 'down' button to move files in the master | 1137 | * User has clicked on the 'down' button to move files in the master |
1121 | * edit dialog tree view. Execute the move. | 1138 | * edit dialog tree view. Execute the move. |
@@ -1158,6 +1175,7 @@ GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget *dummy, | |||
1158 | &iter); | 1175 | &iter); |
1159 | } | 1176 | } |
1160 | 1177 | ||
1178 | |||
1161 | /** | 1179 | /** |
1162 | * User has clicked on the 'new' button to add an empty directory in the master | 1180 | * User has clicked on the 'new' button to add an empty directory in the master |
1163 | * edit dialog tree view. Add an empty directory. | 1181 | * edit dialog tree view. Add an empty directory. |
@@ -1189,6 +1207,7 @@ GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget *dummy, | |||
1189 | create_dir_at_iter (ctx, "unnamed/", &bo, &iter, &pos); | 1207 | create_dir_at_iter (ctx, "unnamed/", &bo, &iter, &pos); |
1190 | } | 1208 | } |
1191 | 1209 | ||
1210 | |||
1192 | /** | 1211 | /** |
1193 | * Free row reference stored in the file information's | 1212 | * Free row reference stored in the file information's |
1194 | * client-info pointer. | 1213 | * client-info pointer. |
@@ -1225,6 +1244,7 @@ free_fi_row_reference (void *cls, | |||
1225 | return GNUNET_OK; | 1244 | return GNUNET_OK; |
1226 | } | 1245 | } |
1227 | 1246 | ||
1247 | |||
1228 | /** | 1248 | /** |
1229 | * User has clicked on the 'delete' button to delete a file or directory in the | 1249 | * User has clicked on the 'delete' button to delete a file or directory in the |
1230 | * master edit dialog tree view. Delete the selected entry. | 1250 | * master edit dialog tree view. Delete the selected entry. |
@@ -1302,6 +1322,7 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget *dummy, | |||
1302 | update_selectivity_edit (ctx); | 1322 | update_selectivity_edit (ctx); |
1303 | } | 1323 | } |
1304 | 1324 | ||
1325 | |||
1305 | /* ******************** progress dialog / import of directories ************* */ | 1326 | /* ******************** progress dialog / import of directories ************* */ |
1306 | 1327 | ||
1307 | /** | 1328 | /** |
@@ -1329,6 +1350,7 @@ destroy_progress_dialog (struct AddDirClientContext *adcc) | |||
1329 | GNUNET_free (adcc); | 1350 | GNUNET_free (adcc); |
1330 | } | 1351 | } |
1331 | 1352 | ||
1353 | |||
1332 | /** | 1354 | /** |
1333 | * User clicked on the 'cancel' button of the progress dialog. | 1355 | * User clicked on the 'cancel' button of the progress dialog. |
1334 | * Cancel the operation. | 1356 | * Cancel the operation. |
@@ -1351,6 +1373,7 @@ GNUNET_FS_GTK_progress_dialog_cancel_button_clicked_cb (GtkButton *button, | |||
1351 | destroy_progress_dialog (adcc); | 1373 | destroy_progress_dialog (adcc); |
1352 | } | 1374 | } |
1353 | 1375 | ||
1376 | |||
1354 | /** | 1377 | /** |
1355 | * User attempted to close the progress dialog. Refuse. | 1378 | * User attempted to close the progress dialog. Refuse. |
1356 | * | 1379 | * |
@@ -1368,6 +1391,7 @@ GNUNET_FS_GTK_progress_dialog_delete_event_cb (GtkWidget *widget, | |||
1368 | return TRUE; | 1391 | return TRUE; |
1369 | } | 1392 | } |
1370 | 1393 | ||
1394 | |||
1371 | /** | 1395 | /** |
1372 | * Display some additional information in the text area of the | 1396 | * Display some additional information in the text area of the |
1373 | * progress dialog. | 1397 | * progress dialog. |
@@ -1385,6 +1409,7 @@ insert_progress_dialog_text (struct AddDirClientContext *adcc, const char *text) | |||
1385 | adcc->textview_vertical_adjustment)); | 1409 | adcc->textview_vertical_adjustment)); |
1386 | } | 1410 | } |
1387 | 1411 | ||
1412 | |||
1388 | /** | 1413 | /** |
1389 | * Convert a single item from the scan to an entry in the tree view. | 1414 | * Convert a single item from the scan to an entry in the tree view. |
1390 | * | 1415 | * |
@@ -1448,14 +1473,15 @@ add_item (struct AddDirClientContext *adcc, | |||
1448 | else | 1473 | else |
1449 | { | 1474 | { |
1450 | fi = | 1475 | fi = |
1451 | GNUNET_FS_file_information_create_from_file (GNUNET_FS_GTK_get_fs_handle (), | 1476 | GNUNET_FS_file_information_create_from_file ( |
1452 | row_reference, | 1477 | GNUNET_FS_GTK_get_fs_handle (), |
1453 | item->filename, | 1478 | row_reference, |
1454 | item->ksk_uri, | 1479 | item->filename, |
1455 | item->meta, | 1480 | item->ksk_uri, |
1456 | adcc | 1481 | item->meta, |
1457 | ->directory_scan_do_index, | 1482 | adcc |
1458 | &adcc->directory_scan_bo); | 1483 | ->directory_scan_do_index, |
1484 | &adcc->directory_scan_bo); | ||
1459 | file_size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize); | 1485 | file_size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize); |
1460 | } | 1486 | } |
1461 | gtk_tree_store_set (ts, | 1487 | gtk_tree_store_set (ts, |
@@ -1474,13 +1500,14 @@ add_item (struct AddDirClientContext *adcc, | |||
1474 | fi, | 1500 | fi, |
1475 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, | 1501 | PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, |
1476 | (guint64) | 1502 | (guint64) |
1477 | adcc->directory_scan_bo.expiration_time.abs_value_us, | 1503 | adcc->directory_scan_bo.expiration_time.abs_value_us, |
1478 | PUBLISH_MC_REPLICATION_LEVEL, | 1504 | PUBLISH_MC_REPLICATION_LEVEL, |
1479 | (guint) adcc->directory_scan_bo.replication_level, | 1505 | (guint) adcc->directory_scan_bo.replication_level, |
1480 | -1); | 1506 | -1); |
1481 | GNUNET_free (file_size_fancy); | 1507 | GNUNET_free (file_size_fancy); |
1482 | } | 1508 | } |
1483 | 1509 | ||
1510 | |||
1484 | /** | 1511 | /** |
1485 | * Recursively traverse the share tree and add it to the tree store | 1512 | * Recursively traverse the share tree and add it to the tree store |
1486 | * | 1513 | * |
@@ -1509,6 +1536,7 @@ add_share_items_to_treestore (struct AddDirClientContext *adcc, | |||
1509 | } | 1536 | } |
1510 | } | 1537 | } |
1511 | 1538 | ||
1539 | |||
1512 | /** | 1540 | /** |
1513 | * Function called when the scanner had some trouble and we | 1541 | * Function called when the scanner had some trouble and we |
1514 | * need to abort the scanning process (which we need to do | 1542 | * need to abort the scanning process (which we need to do |
@@ -1529,6 +1557,7 @@ stop_scanner_task (void *cls) | |||
1529 | } | 1557 | } |
1530 | } | 1558 | } |
1531 | 1559 | ||
1560 | |||
1532 | /** | 1561 | /** |
1533 | * Progress callback called from the directory scanner with | 1562 | * Progress callback called from the directory scanner with |
1534 | * information about our progress scanning the hierarchy. | 1563 | * information about our progress scanning the hierarchy. |
@@ -1580,8 +1609,8 @@ directory_scan_cb (void *cls, | |||
1580 | filename); | 1609 | filename); |
1581 | #if ! VERBOSE_PROGRESS | 1610 | #if ! VERBOSE_PROGRESS |
1582 | gtk_widget_show (GTK_WIDGET ( | 1611 | gtk_widget_show (GTK_WIDGET ( |
1583 | gtk_builder_get_object (adcc->progress_dialog_builder, | 1612 | gtk_builder_get_object (adcc->progress_dialog_builder, |
1584 | "GNUNET_FS_GTK_progress_dialog_scrolled_window"))); | 1613 | "GNUNET_FS_GTK_progress_dialog_scrolled_window"))); |
1585 | #endif | 1614 | #endif |
1586 | insert_progress_dialog_text (adcc, s); | 1615 | insert_progress_dialog_text (adcc, s); |
1587 | GNUNET_free (s); | 1616 | GNUNET_free (s); |
@@ -1625,23 +1654,24 @@ directory_scan_cb (void *cls, | |||
1625 | } | 1654 | } |
1626 | break; | 1655 | break; |
1627 | case GNUNET_FS_DIRSCANNER_FINISHED: { | 1656 | case GNUNET_FS_DIRSCANNER_FINISHED: { |
1628 | struct GNUNET_FS_ShareTreeItem *directory_scan_result; | 1657 | struct GNUNET_FS_ShareTreeItem *directory_scan_result; |
1629 | 1658 | ||
1630 | insert_progress_dialog_text (adcc, _ ("Scanner has finished.\n")); | 1659 | insert_progress_dialog_text (adcc, _ ("Scanner has finished.\n")); |
1631 | directory_scan_result = GNUNET_FS_directory_scan_get_result (adcc->ds); | 1660 | directory_scan_result = GNUNET_FS_directory_scan_get_result (adcc->ds); |
1632 | adcc->ds = NULL; | 1661 | adcc->ds = NULL; |
1633 | GNUNET_FS_share_tree_trim (directory_scan_result); | 1662 | GNUNET_FS_share_tree_trim (directory_scan_result); |
1634 | add_share_items_to_treestore (adcc, directory_scan_result, NULL); | 1663 | add_share_items_to_treestore (adcc, directory_scan_result, NULL); |
1635 | GNUNET_FS_share_tree_free (directory_scan_result); | 1664 | GNUNET_FS_share_tree_free (directory_scan_result); |
1636 | destroy_progress_dialog (adcc); | 1665 | destroy_progress_dialog (adcc); |
1637 | } | 1666 | } |
1638 | break; | 1667 | break; |
1639 | default: | 1668 | default: |
1640 | GNUNET_break (0); | 1669 | GNUNET_break (0); |
1641 | break; | 1670 | break; |
1642 | } | 1671 | } |
1643 | } | 1672 | } |
1644 | 1673 | ||
1674 | |||
1645 | /** | 1675 | /** |
1646 | * Setup the context and progress dialog for scanning a file or | 1676 | * Setup the context and progress dialog for scanning a file or |
1647 | * directory structure (for meta data) and importing it into | 1677 | * directory structure (for meta data) and importing it into |
@@ -1679,8 +1709,9 @@ scan_file_or_directory (struct MainPublishingDialogContext *ctx, | |||
1679 | gtk_builder_get_object (adcc->progress_dialog_builder, | 1709 | gtk_builder_get_object (adcc->progress_dialog_builder, |
1680 | "GNUNET_FS_GTK_progress_dialog_textview")); | 1710 | "GNUNET_FS_GTK_progress_dialog_textview")); |
1681 | adcc->textview_vertical_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object ( | 1711 | adcc->textview_vertical_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object ( |
1682 | adcc->progress_dialog_builder, | 1712 | adcc-> |
1683 | "GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment")); | 1713 | progress_dialog_builder, |
1714 | "GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment")); | ||
1684 | adcc->progress_dialog_textbuffer = GTK_TEXT_BUFFER ( | 1715 | adcc->progress_dialog_textbuffer = GTK_TEXT_BUFFER ( |
1685 | gtk_builder_get_object (adcc->progress_dialog_builder, | 1716 | gtk_builder_get_object (adcc->progress_dialog_builder, |
1686 | "GNUNET_FS_GTK_progress_dialog_textbuffer")); | 1717 | "GNUNET_FS_GTK_progress_dialog_textbuffer")); |
@@ -1702,6 +1733,7 @@ scan_file_or_directory (struct MainPublishingDialogContext *ctx, | |||
1702 | update_selectivity_execute_cancel (ctx); | 1733 | update_selectivity_execute_cancel (ctx); |
1703 | } | 1734 | } |
1704 | 1735 | ||
1736 | |||
1705 | /** | 1737 | /** |
1706 | * Function called when the "open" (directory) dialog was closed. | 1738 | * Function called when the "open" (directory) dialog was closed. |
1707 | * | 1739 | * |
@@ -1734,24 +1766,25 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog *dialog, | |||
1734 | } | 1766 | } |
1735 | bo.content_priority = | 1767 | bo.content_priority = |
1736 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1768 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1737 | ctx->open_directory_builder, | 1769 | ctx->open_directory_builder, |
1738 | "GNUNET_GTK_publish_directory_dialog_priority_spin_button"))); | 1770 | "GNUNET_GTK_publish_directory_dialog_priority_spin_button"))); |
1739 | bo.replication_level = | 1771 | bo.replication_level = |
1740 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1772 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1741 | ctx->open_directory_builder, | 1773 | ctx->open_directory_builder, |
1742 | "GNUNET_GTK_publish_directory_dialog_replication_spin_button"))); | 1774 | "GNUNET_GTK_publish_directory_dialog_replication_spin_button"))); |
1743 | { | 1775 | { |
1744 | GtkSpinButton *sb; | 1776 | GtkSpinButton *sb; |
1745 | 1777 | ||
1746 | sb = GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1778 | sb = GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1747 | ctx->open_directory_builder, | 1779 | ctx->open_directory_builder, |
1748 | "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button")); | 1780 | "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button")); |
1749 | bo.expiration_time = GNUNET_GTK_get_expiration_time (sb); | 1781 | bo.expiration_time = GNUNET_GTK_get_expiration_time (sb); |
1750 | } | 1782 | } |
1751 | do_index = | 1783 | do_index = |
1752 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object ( | 1784 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object ( |
1753 | ctx->open_directory_builder, | 1785 | ctx-> |
1754 | "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton"))); | 1786 | open_directory_builder, |
1787 | "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton"))); | ||
1755 | scan_file_or_directory (ctx, filename, &bo, do_index); | 1788 | scan_file_or_directory (ctx, filename, &bo, do_index); |
1756 | g_free (filename); | 1789 | g_free (filename); |
1757 | } | 1790 | } |
@@ -1760,6 +1793,7 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog *dialog, | |||
1760 | ctx->open_directory_builder = NULL; | 1793 | ctx->open_directory_builder = NULL; |
1761 | } | 1794 | } |
1762 | 1795 | ||
1796 | |||
1763 | /** | 1797 | /** |
1764 | * Function called when the "open" (file) dialog was closed. | 1798 | * Function called when the "open" (file) dialog was closed. |
1765 | * | 1799 | * |
@@ -1792,24 +1826,24 @@ GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog *dialog, | |||
1792 | } | 1826 | } |
1793 | bo.content_priority = | 1827 | bo.content_priority = |
1794 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1828 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1795 | ctx->open_file_builder, | 1829 | ctx->open_file_builder, |
1796 | "GNUNET_GTK_publish_file_dialog_priority_spin_button"))); | 1830 | "GNUNET_GTK_publish_file_dialog_priority_spin_button"))); |
1797 | { | 1831 | { |
1798 | GtkSpinButton *sb; | 1832 | GtkSpinButton *sb; |
1799 | 1833 | ||
1800 | sb = GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1834 | sb = GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1801 | ctx->open_file_builder, | 1835 | ctx->open_file_builder, |
1802 | "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button")); | 1836 | "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button")); |
1803 | bo.expiration_time = GNUNET_GTK_get_expiration_time (sb); | 1837 | bo.expiration_time = GNUNET_GTK_get_expiration_time (sb); |
1804 | } | 1838 | } |
1805 | bo.replication_level = | 1839 | bo.replication_level = |
1806 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1840 | gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1807 | ctx->open_file_builder, | 1841 | ctx->open_file_builder, |
1808 | "GNUNET_GTK_publish_file_dialog_replication_spin_button"))); | 1842 | "GNUNET_GTK_publish_file_dialog_replication_spin_button"))); |
1809 | do_index = | 1843 | do_index = |
1810 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object ( | 1844 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object ( |
1811 | ctx->open_file_builder, | 1845 | ctx->open_file_builder, |
1812 | "GNUNET_GTK_publish_file_dialog_do_index_checkbutton"))); | 1846 | "GNUNET_GTK_publish_file_dialog_do_index_checkbutton"))); |
1813 | 1847 | ||
1814 | scan_file_or_directory (ctx, filename, &bo, do_index); | 1848 | scan_file_or_directory (ctx, filename, &bo, do_index); |
1815 | g_free (filename); | 1849 | g_free (filename); |
@@ -1819,6 +1853,7 @@ GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog *dialog, | |||
1819 | ctx->open_file_builder = NULL; | 1853 | ctx->open_file_builder = NULL; |
1820 | } | 1854 | } |
1821 | 1855 | ||
1856 | |||
1822 | /** | 1857 | /** |
1823 | * User clicked on the 'add' button in the master publish dialog. | 1858 | * User clicked on the 'add' button in the master publish dialog. |
1824 | * Create the dialog to allow the user to select a file to add. | 1859 | * Create the dialog to allow the user to select a file to add. |
@@ -1842,18 +1877,18 @@ GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget *dummy, | |||
1842 | * TRUE */ | 1877 | * TRUE */ |
1843 | gtk_spin_button_set_value ( | 1878 | gtk_spin_button_set_value ( |
1844 | GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1879 | GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1845 | ctx->open_file_builder, | 1880 | ctx->open_file_builder, |
1846 | "GNUNET_GTK_publish_file_dialog_priority_spin_button")), | 1881 | "GNUNET_GTK_publish_file_dialog_priority_spin_button")), |
1847 | 1000); | 1882 | 1000); |
1848 | gtk_spin_button_set_value ( | 1883 | gtk_spin_button_set_value ( |
1849 | GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1884 | GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1850 | ctx->open_file_builder, | 1885 | ctx->open_file_builder, |
1851 | "GNUNET_GTK_publish_file_dialog_replication_spin_button")), | 1886 | "GNUNET_GTK_publish_file_dialog_replication_spin_button")), |
1852 | 0); | 1887 | 0); |
1853 | gtk_toggle_button_set_active ( | 1888 | gtk_toggle_button_set_active ( |
1854 | GTK_TOGGLE_BUTTON (gtk_builder_get_object ( | 1889 | GTK_TOGGLE_BUTTON (gtk_builder_get_object ( |
1855 | ctx->open_file_builder, | 1890 | ctx->open_file_builder, |
1856 | "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")), | 1891 | "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")), |
1857 | TRUE); | 1892 | TRUE); |
1858 | 1893 | ||
1859 | { | 1894 | { |
@@ -1877,6 +1912,7 @@ GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget *dummy, | |||
1877 | } | 1912 | } |
1878 | } | 1913 | } |
1879 | 1914 | ||
1915 | |||
1880 | /** | 1916 | /** |
1881 | * User clicked on the 'open' button in the master publish dialog. | 1917 | * User clicked on the 'open' button in the master publish dialog. |
1882 | * Create the dialog to allow the user to select a directory. | 1918 | * Create the dialog to allow the user to select a directory. |
@@ -1901,26 +1937,26 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget *dummy, | |||
1901 | * TRUE */ | 1937 | * TRUE */ |
1902 | gtk_spin_button_set_value ( | 1938 | gtk_spin_button_set_value ( |
1903 | GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1939 | GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1904 | ctx->open_directory_builder, | 1940 | ctx->open_directory_builder, |
1905 | "GNUNET_GTK_publish_directory_dialog_priority_spin_button")), | 1941 | "GNUNET_GTK_publish_directory_dialog_priority_spin_button")), |
1906 | 1000); | 1942 | 1000); |
1907 | gtk_spin_button_set_value ( | 1943 | gtk_spin_button_set_value ( |
1908 | GTK_SPIN_BUTTON (gtk_builder_get_object ( | 1944 | GTK_SPIN_BUTTON (gtk_builder_get_object ( |
1909 | ctx->open_directory_builder, | 1945 | ctx->open_directory_builder, |
1910 | "GNUNET_GTK_publish_directory_dialog_replication_spin_button")), | 1946 | "GNUNET_GTK_publish_directory_dialog_replication_spin_button")), |
1911 | 0); | 1947 | 0); |
1912 | gtk_toggle_button_set_active ( | 1948 | gtk_toggle_button_set_active ( |
1913 | GTK_TOGGLE_BUTTON (gtk_builder_get_object ( | 1949 | GTK_TOGGLE_BUTTON (gtk_builder_get_object ( |
1914 | ctx->open_directory_builder, | 1950 | ctx->open_directory_builder, |
1915 | "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")), | 1951 | "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")), |
1916 | TRUE); | 1952 | TRUE); |
1917 | 1953 | ||
1918 | { | 1954 | { |
1919 | GtkComboBox *combo; | 1955 | GtkComboBox *combo; |
1920 | 1956 | ||
1921 | combo = GTK_COMBO_BOX (gtk_builder_get_object ( | 1957 | combo = GTK_COMBO_BOX (gtk_builder_get_object ( |
1922 | ctx->open_directory_builder, | 1958 | ctx->open_directory_builder, |
1923 | "GNUNET_GTK_publish_directory_dialog_anonymity_combobox")); | 1959 | "GNUNET_GTK_publish_directory_dialog_anonymity_combobox")); |
1924 | gtk_combo_box_set_model (combo, | 1960 | gtk_combo_box_set_model (combo, |
1925 | GNUNET_FS_GTK_get_anonymity_level_list_store ()); | 1961 | GNUNET_FS_GTK_get_anonymity_level_list_store ()); |
1926 | } | 1962 | } |
@@ -1937,6 +1973,7 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget *dummy, | |||
1937 | } | 1973 | } |
1938 | } | 1974 | } |
1939 | 1975 | ||
1976 | |||
1940 | /* ********************************* editing sub-dialog ********************* */ | 1977 | /* ********************************* editing sub-dialog ********************* */ |
1941 | 1978 | ||
1942 | /** | 1979 | /** |
@@ -2013,6 +2050,7 @@ update_treeview_after_edit (void *cls, | |||
2013 | return GNUNET_SYSERR; | 2050 | return GNUNET_SYSERR; |
2014 | } | 2051 | } |
2015 | 2052 | ||
2053 | |||
2016 | /** | 2054 | /** |
2017 | * Function called when the edit publish dialog has been closed. | 2055 | * Function called when the edit publish dialog has been closed. |
2018 | * | 2056 | * |
@@ -2032,6 +2070,7 @@ master_publish_edit_publish_dialog_cb (gpointer cls, gint ret, const char *root) | |||
2032 | GNUNET_free (epc); | 2070 | GNUNET_free (epc); |
2033 | } | 2071 | } |
2034 | 2072 | ||
2073 | |||
2035 | /** | 2074 | /** |
2036 | * The user clicked on the "edit" button in the master dialog. Edit | 2075 | * The user clicked on the "edit" button in the master dialog. Edit |
2037 | * the selected tree item. | 2076 | * the selected tree item. |
@@ -2068,6 +2107,7 @@ GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget *dummy, | |||
2068 | epc); | 2107 | epc); |
2069 | } | 2108 | } |
2070 | 2109 | ||
2110 | |||
2071 | /* ******************** master edit dialog shutdown *********************** */ | 2111 | /* ******************** master edit dialog shutdown *********************** */ |
2072 | 2112 | ||
2073 | /** | 2113 | /** |
@@ -2105,6 +2145,7 @@ get_file_information (GtkTreeModel *tm, GtkTreeIter *iter) | |||
2105 | return fi; | 2145 | return fi; |
2106 | } | 2146 | } |
2107 | 2147 | ||
2148 | |||
2108 | /** | 2149 | /** |
2109 | * Recursively clean up the tree store with the file information in it. | 2150 | * Recursively clean up the tree store with the file information in it. |
2110 | * | 2151 | * |
@@ -2130,6 +2171,7 @@ free_file_information_tree_store (GtkTreeModel *tm, GtkTreeIter *iter) | |||
2130 | } | 2171 | } |
2131 | } | 2172 | } |
2132 | 2173 | ||
2174 | |||
2133 | /** | 2175 | /** |
2134 | * Close the master publish dialog. If the response code was OK, starts | 2176 | * Close the master publish dialog. If the response code was OK, starts |
2135 | * the publishing operation. Otherwise, this function just cleans up the | 2177 | * the publishing operation. Otherwise, this function just cleans up the |
@@ -2167,6 +2209,7 @@ close_master_publish_dialog (struct MainPublishingDialogContext *ctx) | |||
2167 | return GNUNET_YES; | 2209 | return GNUNET_YES; |
2168 | } | 2210 | } |
2169 | 2211 | ||
2212 | |||
2170 | /** | 2213 | /** |
2171 | * Insert namespace advertisement into metadata when | 2214 | * Insert namespace advertisement into metadata when |
2172 | * publishing in both private namespace and global namespace. | 2215 | * publishing in both private namespace and global namespace. |
@@ -2203,7 +2246,13 @@ insert_advertisement (void *cls, | |||
2203 | if (NULL == ctx->ns) | 2246 | if (NULL == ctx->ns) |
2204 | return GNUNET_SYSERR; | 2247 | return GNUNET_SYSERR; |
2205 | GNUNET_IDENTITY_ego_get_public_key (ctx->ns, &pub); | 2248 | GNUNET_IDENTITY_ego_get_public_key (ctx->ns, &pub); |
2206 | sks_uri = GNUNET_FS_uri_sks_create (&pub, "/"); | 2249 | if (GNUNET_IDENTITY_TYPE_ECDSA != pub.type) |
2250 | { | ||
2251 | GNUNET_break (0); /* FIXME: EDDSA keys not yet | ||
2252 | supported for file-sharing! */ | ||
2253 | return GNUNET_SYSERR; | ||
2254 | } | ||
2255 | sks_uri = GNUNET_FS_uri_sks_create (&pub.ecdsa_key, "/"); | ||
2207 | sks_uri_string = GNUNET_FS_uri_to_string (sks_uri); | 2256 | sks_uri_string = GNUNET_FS_uri_to_string (sks_uri); |
2208 | GNUNET_FS_uri_destroy (sks_uri); | 2257 | GNUNET_FS_uri_destroy (sks_uri); |
2209 | if (NULL == sks_uri_string) | 2258 | if (NULL == sks_uri_string) |
@@ -2220,6 +2269,7 @@ insert_advertisement (void *cls, | |||
2220 | return GNUNET_SYSERR; | 2269 | return GNUNET_SYSERR; |
2221 | } | 2270 | } |
2222 | 2271 | ||
2272 | |||
2223 | /** | 2273 | /** |
2224 | * The user pushed the 'execute' button. Start the publishing | 2274 | * The user pushed the 'execute' button. Start the publishing |
2225 | * operation and clean up the memory and the window itself. | 2275 | * operation and clean up the memory and the window itself. |
@@ -2308,14 +2358,29 @@ GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton *button, | |||
2308 | clear_keywords_from_tm (ctx); | 2358 | clear_keywords_from_tm (ctx); |
2309 | do | 2359 | do |
2310 | { | 2360 | { |
2361 | const struct GNUNET_IDENTITY_PrivateKey *pk; | ||
2362 | |||
2363 | if (NULL != ns) | ||
2364 | { | ||
2365 | pk = GNUNET_IDENTITY_ego_get_private_key (ns); | ||
2366 | if (GNUNET_IDENTITY_TYPE_ECDSA != pk->type) | ||
2367 | { | ||
2368 | GNUNET_break (0); /* FIXME: EDDSA keys not yet supported by FS */ | ||
2369 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox), | ||
2370 | FALSE); | ||
2371 | return; | ||
2372 | } | ||
2373 | } | ||
2374 | else | ||
2375 | { | ||
2376 | pk = NULL; | ||
2377 | } | ||
2311 | fi = get_file_information (ctx->file_info_treemodel, &iter); | 2378 | fi = get_file_information (ctx->file_info_treemodel, &iter); |
2312 | if (do_global && do_own && ! disable_ads_insertion) | 2379 | if (do_global && do_own && ! disable_ads_insertion) |
2313 | GNUNET_FS_file_information_inspect (fi, insert_advertisement, ctx); | 2380 | GNUNET_FS_file_information_inspect (fi, insert_advertisement, ctx); |
2314 | GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), | 2381 | GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), |
2315 | fi, | 2382 | fi, |
2316 | (NULL == ns) | 2383 | (NULL == pk) ? NULL : &pk->ecdsa_key, |
2317 | ? NULL | ||
2318 | : GNUNET_IDENTITY_ego_get_private_key (ns), | ||
2319 | namespace_id, | 2384 | namespace_id, |
2320 | namespace_uid, | 2385 | namespace_uid, |
2321 | GNUNET_FS_PUBLISH_OPTION_NONE); | 2386 | GNUNET_FS_PUBLISH_OPTION_NONE); |
@@ -2330,6 +2395,7 @@ GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton *button, | |||
2330 | GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx)); | 2395 | GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx)); |
2331 | } | 2396 | } |
2332 | 2397 | ||
2398 | |||
2333 | /** | 2399 | /** |
2334 | * Function called on entries in a `struct GNUNET_FS_FileInformation` for | 2400 | * Function called on entries in a `struct GNUNET_FS_FileInformation` for |
2335 | * publishing. | 2401 | * publishing. |
@@ -2363,6 +2429,7 @@ clear_keywords_in_file_information (void *cls, | |||
2363 | return GNUNET_OK; | 2429 | return GNUNET_OK; |
2364 | } | 2430 | } |
2365 | 2431 | ||
2432 | |||
2366 | /** | 2433 | /** |
2367 | * Remove all of the keywords from the file information item in the tree store | 2434 | * Remove all of the keywords from the file information item in the tree store |
2368 | * | 2435 | * |
@@ -2393,6 +2460,7 @@ clear_keywords_from_file_information_in_tree_store (GtkTreeModel *tm, | |||
2393 | } | 2460 | } |
2394 | } | 2461 | } |
2395 | 2462 | ||
2463 | |||
2396 | /** | 2464 | /** |
2397 | * Remove all of the keywords from all file information structs in the tree | 2465 | * Remove all of the keywords from all file information structs in the tree |
2398 | * store | 2466 | * store |
@@ -2409,11 +2477,12 @@ clear_keywords_from_tm (struct MainPublishingDialogContext *ctx) | |||
2409 | do | 2477 | do |
2410 | { | 2478 | { |
2411 | clear_keywords_from_file_information_in_tree_store (ctx | 2479 | clear_keywords_from_file_information_in_tree_store (ctx |
2412 | ->file_info_treemodel, | 2480 | ->file_info_treemodel, |
2413 | &iter); | 2481 | &iter); |
2414 | } while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter)); | 2482 | } while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter)); |
2415 | } | 2483 | } |
2416 | 2484 | ||
2485 | |||
2417 | /** | 2486 | /** |
2418 | * The user pushed the 'clear' button. Remove all keywords. | 2487 | * The user pushed the 'clear' button. Remove all keywords. |
2419 | * | 2488 | * |
@@ -2427,6 +2496,7 @@ GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb (GtkButton *button, | |||
2427 | clear_keywords_from_tm (user_data); | 2496 | clear_keywords_from_tm (user_data); |
2428 | } | 2497 | } |
2429 | 2498 | ||
2499 | |||
2430 | /** | 2500 | /** |
2431 | * The user pushed the 'cancel' button. Close the master publish dialog. | 2501 | * The user pushed the 'cancel' button. Close the master publish dialog. |
2432 | * | 2502 | * |
@@ -2442,6 +2512,7 @@ GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb (GtkButton *button, | |||
2442 | GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx)); | 2512 | GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx)); |
2443 | } | 2513 | } |
2444 | 2514 | ||
2515 | |||
2445 | /** | 2516 | /** |
2446 | * The user attempted to close the publish window. Check if this is | 2517 | * The user attempted to close the publish window. Check if this is |
2447 | * allowed and if so, close it. | 2518 | * allowed and if so, close it. |
@@ -2464,6 +2535,7 @@ GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget *widget, | |||
2464 | return FALSE; | 2535 | return FALSE; |
2465 | } | 2536 | } |
2466 | 2537 | ||
2538 | |||
2467 | /** | 2539 | /** |
2468 | * Called when expander changes its state (expanded/hidden). | 2540 | * Called when expander changes its state (expanded/hidden). |
2469 | * Hides the widget, adjusts the paned position to compensate, | 2541 | * Hides the widget, adjusts the paned position to compensate, |
@@ -2501,6 +2573,7 @@ expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data) | |||
2501 | gtk_paned_set_position (GTK_PANED (ctx->vpaned), paned_pos); | 2573 | gtk_paned_set_position (GTK_PANED (ctx->vpaned), paned_pos); |
2502 | } | 2574 | } |
2503 | 2575 | ||
2576 | |||
2504 | /* ******************** master edit dialog initialization ******************* */ | 2577 | /* ******************** master edit dialog initialization ******************* */ |
2505 | 2578 | ||
2506 | /** | 2579 | /** |
@@ -2676,7 +2749,8 @@ add_updateable_to_ts (void *cls, | |||
2676 | } | 2749 | } |
2677 | g_free (displaytext); | 2750 | g_free (displaytext); |
2678 | 2751 | ||
2679 | if (NULL == spath) | 2752 | if (NULL != spath) |
2753 | return; | ||
2680 | { | 2754 | { |
2681 | GtkTreePath *path; | 2755 | GtkTreePath *path; |
2682 | char *gspath; | 2756 | char *gspath; |
@@ -2687,26 +2761,33 @@ add_updateable_to_ts (void *cls, | |||
2687 | * map */ | 2761 | * map */ |
2688 | gspath = GNUNET_strdup (spath); | 2762 | gspath = GNUNET_strdup (spath); |
2689 | if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put ( | 2763 | if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put ( |
2690 | uc->seen, | 2764 | uc->seen, |
2691 | &hc, | 2765 | &hc, |
2692 | gspath, | 2766 | gspath, |
2693 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 2767 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
2694 | GNUNET_free (gspath); | 2768 | GNUNET_free (gspath); |
2695 | } | 2769 | } |
2696 | else | ||
2697 | return; | ||
2698 | 2770 | ||
2699 | sc.parent = &iter; | 2771 | sc.parent = &iter; |
2700 | sc.ts = uc->ts; | 2772 | sc.ts = uc->ts; |
2701 | sc.ns = uc->ns; | 2773 | sc.ns = uc->ns; |
2702 | sc.seen = uc->seen; | 2774 | sc.seen = uc->seen; |
2703 | sc.update_called = GNUNET_NO; | 2775 | sc.update_called = GNUNET_NO; |
2704 | GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (), | 2776 | { |
2705 | GNUNET_IDENTITY_ego_get_private_key ( | 2777 | const struct GNUNET_IDENTITY_PrivateKey *pk; |
2706 | uc->ns), | 2778 | |
2707 | next_id, | 2779 | pk = GNUNET_IDENTITY_ego_get_private_key (uc->ns); |
2708 | &add_updateable_to_ts, | 2780 | if (GNUNET_IDENTITY_TYPE_ECDSA != pk->type) |
2709 | &sc); | 2781 | { |
2782 | GNUNET_break (0); | ||
2783 | return; | ||
2784 | } | ||
2785 | GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (), | ||
2786 | &pk->ecdsa_key, | ||
2787 | next_id, | ||
2788 | &add_updateable_to_ts, | ||
2789 | &sc); | ||
2790 | } | ||
2710 | if ((sc.update_called == GNUNET_NO) && (NULL != next_id) && | 2791 | if ((sc.update_called == GNUNET_NO) && (NULL != next_id) && |
2711 | (strlen (next_id) > 0)) | 2792 | (strlen (next_id) > 0)) |
2712 | { | 2793 | { |
@@ -2731,6 +2812,7 @@ add_updateable_to_ts (void *cls, | |||
2731 | } | 2812 | } |
2732 | } | 2813 | } |
2733 | 2814 | ||
2815 | |||
2734 | /** | 2816 | /** |
2735 | * Called by a hashmap iterator. | 2817 | * Called by a hashmap iterator. |
2736 | * Frees its argument with GNUNET_free(). | 2818 | * Frees its argument with GNUNET_free(). |
@@ -2747,6 +2829,7 @@ free_seen_paths (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
2747 | return GNUNET_YES; | 2829 | return GNUNET_YES; |
2748 | } | 2830 | } |
2749 | 2831 | ||
2832 | |||
2750 | /** | 2833 | /** |
2751 | * User changed the selected namespace. Check if it is valid, | 2834 | * User changed the selected namespace. Check if it is valid, |
2752 | * and if so, update the rest of the dialog accordingly. | 2835 | * and if so, update the rest of the dialog accordingly. |
@@ -2798,13 +2881,25 @@ GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb (GtkComboBox *combo, | |||
2798 | uc.ns = ego; | 2881 | uc.ns = ego; |
2799 | uc.update_called = GNUNET_NO; | 2882 | uc.update_called = GNUNET_NO; |
2800 | uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); | 2883 | uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); |
2884 | { | ||
2885 | const struct GNUNET_IDENTITY_PrivateKey *pk; | ||
2801 | 2886 | ||
2802 | GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (), | 2887 | pk = GNUNET_IDENTITY_ego_get_private_key (ego); |
2803 | GNUNET_IDENTITY_ego_get_private_key ( | 2888 | if (GNUNET_IDENTITY_TYPE_ECDSA != pk->type) |
2804 | ego), | 2889 | { |
2805 | NULL, | 2890 | GNUNET_break (0); |
2806 | &add_updateable_to_ts, | 2891 | gtk_widget_set_sensitive (ctx->identifier_entry, FALSE); |
2807 | &uc); | 2892 | gtk_widget_set_sensitive (ctx->updateable_checkbox, FALSE); |
2893 | gtk_widget_set_sensitive (ctx->update_id_entry, FALSE); | ||
2894 | update_selectivity_execute_cancel (ctx); | ||
2895 | return; | ||
2896 | } | ||
2897 | GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (), | ||
2898 | &pk->ecdsa_key, | ||
2899 | NULL, | ||
2900 | &add_updateable_to_ts, | ||
2901 | &uc); | ||
2902 | } | ||
2808 | GNUNET_CONTAINER_multihashmap_iterate (uc.seen, &free_seen_paths, NULL); | 2903 | GNUNET_CONTAINER_multihashmap_iterate (uc.seen, &free_seen_paths, NULL); |
2809 | GNUNET_CONTAINER_multihashmap_destroy (uc.seen); | 2904 | GNUNET_CONTAINER_multihashmap_destroy (uc.seen); |
2810 | gtk_widget_set_sensitive (ctx->identifier_entry, TRUE); | 2905 | gtk_widget_set_sensitive (ctx->identifier_entry, TRUE); |
@@ -2813,6 +2908,7 @@ GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb (GtkComboBox *combo, | |||
2813 | update_selectivity_execute_cancel (ctx); | 2908 | update_selectivity_execute_cancel (ctx); |
2814 | } | 2909 | } |
2815 | 2910 | ||
2911 | |||
2816 | /** | 2912 | /** |
2817 | * Add all updateable entries of the current namespace to the | 2913 | * Add all updateable entries of the current namespace to the |
2818 | * tree store. | 2914 | * tree store. |
@@ -2883,6 +2979,7 @@ add_namespace_to_ts (void *cls, | |||
2883 | gtk_widget_set_sensitive (ctx->update_id_entry, have_ns); | 2979 | gtk_widget_set_sensitive (ctx->update_id_entry, have_ns); |
2884 | } | 2980 | } |
2885 | 2981 | ||
2982 | |||
2886 | /** | 2983 | /** |
2887 | * Run the file-publishing operation (by opening the master publishing dialog). | 2984 | * Run the file-publishing operation (by opening the master publishing dialog). |
2888 | * | 2985 | * |
@@ -2936,8 +3033,8 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget *dummy, | |||
2936 | gtk_builder_get_object (ctx->builder, | 3033 | gtk_builder_get_object (ctx->builder, |
2937 | "GNUNET_GTK_master_publish_dialog_cancel_button")); | 3034 | "GNUNET_GTK_master_publish_dialog_cancel_button")); |
2938 | ctx->file_info_treeview = GTK_TREE_VIEW (gtk_builder_get_object ( | 3035 | ctx->file_info_treeview = GTK_TREE_VIEW (gtk_builder_get_object ( |
2939 | ctx->builder, | 3036 | ctx->builder, |
2940 | "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); | 3037 | "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); |
2941 | ctx->file_info_selection = | 3038 | ctx->file_info_selection = |
2942 | gtk_tree_view_get_selection (ctx->file_info_treeview); | 3039 | gtk_tree_view_get_selection (ctx->file_info_treeview); |
2943 | ctx->file_info_treemodel = gtk_tree_view_get_model (ctx->file_info_treeview); | 3040 | ctx->file_info_treemodel = gtk_tree_view_get_model (ctx->file_info_treeview); |
@@ -2951,8 +3048,8 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget *dummy, | |||
2951 | gtk_builder_get_object (ctx->builder, | 3048 | gtk_builder_get_object (ctx->builder, |
2952 | "GNUNET_GTK_master_publish_dialog_own_checkbox")); | 3049 | "GNUNET_GTK_master_publish_dialog_own_checkbox")); |
2953 | ctx->updateable_checkbox = GTK_WIDGET (gtk_builder_get_object ( | 3050 | ctx->updateable_checkbox = GTK_WIDGET (gtk_builder_get_object ( |
2954 | ctx->builder, | 3051 | ctx->builder, |
2955 | "GNUNET_GTK_master_publish_dialog_updateable_checkbox")); | 3052 | "GNUNET_GTK_master_publish_dialog_updateable_checkbox")); |
2956 | ctx->update_id_entry = GTK_WIDGET ( | 3053 | ctx->update_id_entry = GTK_WIDGET ( |
2957 | gtk_builder_get_object (ctx->builder, | 3054 | gtk_builder_get_object (ctx->builder, |
2958 | "GNUNET_GTK_master_publish_dialog_update_id_entry")); | 3055 | "GNUNET_GTK_master_publish_dialog_update_id_entry")); |
@@ -2965,8 +3062,8 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget *dummy, | |||
2965 | "GNUNET_GTK_master_publish_dialog_update_id_hbox")); | 3062 | "GNUNET_GTK_master_publish_dialog_update_id_hbox")); |
2966 | 3063 | ||
2967 | ctx->identifiers_expander = GTK_WIDGET (gtk_builder_get_object ( | 3064 | ctx->identifiers_expander = GTK_WIDGET (gtk_builder_get_object ( |
2968 | ctx->builder, | 3065 | ctx->builder, |
2969 | "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander")); | 3066 | "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander")); |
2970 | ctx->vpaned = GTK_WIDGET ( | 3067 | ctx->vpaned = GTK_WIDGET ( |
2971 | gtk_builder_get_object (ctx->builder, | 3068 | gtk_builder_get_object (ctx->builder, |
2972 | "GNUNET_GTK_master_publish_dialog_vpaned")); | 3069 | "GNUNET_GTK_master_publish_dialog_vpaned")); |
@@ -2978,11 +3075,11 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget *dummy, | |||
2978 | gtk_builder_get_object (ctx->builder, | 3075 | gtk_builder_get_object (ctx->builder, |
2979 | "GNUNET_GTK_master_publish_dialog_identifier_entry")); | 3076 | "GNUNET_GTK_master_publish_dialog_identifier_entry")); |
2980 | ctx->identifiers_scrolled = GTK_WIDGET (gtk_builder_get_object ( | 3077 | ctx->identifiers_scrolled = GTK_WIDGET (gtk_builder_get_object ( |
2981 | ctx->builder, | 3078 | ctx->builder, |
2982 | "GNUNET_GTK_master_publish_dialog_previous_identifiers_scrolled")); | 3079 | "GNUNET_GTK_master_publish_dialog_previous_identifiers_scrolled")); |
2983 | ctx->identifiers_treeview = GTK_TREE_VIEW (gtk_builder_get_object ( | 3080 | ctx->identifiers_treeview = GTK_TREE_VIEW (gtk_builder_get_object ( |
2984 | ctx->builder, | 3081 | ctx->builder, |
2985 | "GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview")); | 3082 | "GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview")); |
2986 | ctx->identifiers_treemodel = | 3083 | ctx->identifiers_treemodel = |
2987 | gtk_tree_view_get_model (ctx->identifiers_treeview); | 3084 | gtk_tree_view_get_model (ctx->identifiers_treeview); |
2988 | ctx->identifiers_selection = | 3085 | ctx->identifiers_selection = |
@@ -3033,4 +3130,5 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget *dummy, | |||
3033 | gtk_window_present (GTK_WINDOW (ctx->master_pubdialog)); | 3130 | gtk_window_present (GTK_WINDOW (ctx->master_pubdialog)); |
3034 | } | 3131 | } |
3035 | 3132 | ||
3133 | |||
3036 | /* end of gnunet-fs-gtk_publish-dialog.c */ | 3134 | /* end of gnunet-fs-gtk_publish-dialog.c */ |