diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk-event_handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk-event_handler.c | 252 |
1 files changed, 126 insertions, 126 deletions
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c index 78fc5cef..52f89dd8 100644 --- a/src/fs/gnunet-fs-gtk-event_handler.c +++ b/src/fs/gnunet-fs-gtk-event_handler.c | |||
@@ -546,7 +546,7 @@ copy_uri_to_clipboard_ctx_menu (GtkMenuItem *item, gpointer user_data) | |||
546 | char *uris; | 546 | char *uris; |
547 | GtkClipboard *cb; | 547 | GtkClipboard *cb; |
548 | 548 | ||
549 | if (current_context_row_reference == NULL) | 549 | if (NULL == current_context_row_reference) |
550 | { | 550 | { |
551 | GNUNET_break (0); | 551 | GNUNET_break (0); |
552 | return; | 552 | return; |
@@ -558,7 +558,7 @@ copy_uri_to_clipboard_ctx_menu (GtkMenuItem *item, gpointer user_data) | |||
558 | (current_context_search_tab->builder, | 558 | (current_context_search_tab->builder, |
559 | "_search_result_frame")); | 559 | "_search_result_frame")); |
560 | tm = gtk_tree_view_get_model (tv); | 560 | tm = gtk_tree_view_get_model (tv); |
561 | if (TRUE != gtk_tree_model_get_iter (tm, &iter, path)) | 561 | if (! gtk_tree_model_get_iter (tm, &iter, path)) |
562 | { | 562 | { |
563 | GNUNET_break (0); | 563 | GNUNET_break (0); |
564 | gtk_tree_path_free (path); | 564 | gtk_tree_path_free (path); |
@@ -1391,13 +1391,13 @@ process_search_result (struct SearchTab *tab, | |||
1391 | /** | 1391 | /** |
1392 | * Setup a new search tab. | 1392 | * Setup a new search tab. |
1393 | * | 1393 | * |
1394 | * @param sc context with FS for the search | 1394 | * @param sc context with FS for the search, NULL for none (open-URI/orphan tab) |
1395 | * @param query the query | 1395 | * @param query the query, NULL for none (open-URI/orphan tab) |
1396 | * @param anonymity anonymity level | 1396 | * @return search tab handle |
1397 | */ | 1397 | */ |
1398 | static struct SearchTab * | 1398 | static struct SearchTab * |
1399 | setup_search (struct GNUNET_FS_SearchContext *sc, | 1399 | setup_search_tab (struct GNUNET_FS_SearchContext *sc, |
1400 | const struct GNUNET_FS_Uri *query) | 1400 | const struct GNUNET_FS_Uri *query) |
1401 | { | 1401 | { |
1402 | struct SearchTab *tab; | 1402 | struct SearchTab *tab; |
1403 | GtkTreeView *tv; | 1403 | GtkTreeView *tv; |
@@ -1405,16 +1405,12 @@ setup_search (struct GNUNET_FS_SearchContext *sc, | |||
1405 | GtkWindow *sf; | 1405 | GtkWindow *sf; |
1406 | gint pages; | 1406 | gint pages; |
1407 | 1407 | ||
1408 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1409 | "Setting up a search for %p\n", sc); | ||
1410 | |||
1411 | tab = GNUNET_malloc (sizeof (struct SearchTab)); | 1408 | tab = GNUNET_malloc (sizeof (struct SearchTab)); |
1412 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1413 | "Allocated a tab %p\n", tab); | ||
1414 | GNUNET_CONTAINER_DLL_insert (search_tab_head, search_tab_tail, tab); | 1409 | GNUNET_CONTAINER_DLL_insert (search_tab_head, search_tab_tail, tab); |
1415 | tab->sc = sc; | 1410 | tab->sc = sc; |
1416 | if (query == NULL) | 1411 | if (query == NULL) |
1417 | { | 1412 | { |
1413 | /* no real query, tab is for non-queries, use special label */ | ||
1418 | tab->query_txt = GNUNET_strdup ("*"); | 1414 | tab->query_txt = GNUNET_strdup ("*"); |
1419 | } | 1415 | } |
1420 | else | 1416 | else |
@@ -1547,20 +1543,18 @@ setup_inner_search (struct GNUNET_FS_SearchContext *sc, | |||
1547 | } | 1543 | } |
1548 | 1544 | ||
1549 | 1545 | ||
1550 | |||
1551 | |||
1552 | /** | 1546 | /** |
1553 | * Setup a new top-level entry in the URI tab. If necessary, create | 1547 | * Setup a new top-level entry in the URI/orphan tab. If necessary, create |
1554 | * the URI tab first. | 1548 | * the URI tab first. |
1555 | * | 1549 | * |
1556 | * @param iter set to the new entry | 1550 | * @param iter set to the new entry (OUT only) |
1557 | * @param srp set to search result | 1551 | * @param srp set to search result (can be NULL) |
1558 | * @param meta metadata for the new entry | 1552 | * @param meta metadata for the new entry |
1559 | * @param uri URI for the new entry | 1553 | * @param uri URI for the new entry |
1560 | * @return NULL on error, otherwise tree store matching iter | 1554 | * @return the 'uri_tab' the result was added to |
1561 | */ | 1555 | */ |
1562 | struct SearchTab * | 1556 | struct SearchTab * |
1563 | GNUNET_GTK_add_to_uri_tab (GtkTreeIter * iter, struct SearchResult **srp, | 1557 | GNUNET_GTK_add_to_uri_tab (GtkTreeIter *iter, struct SearchResult **srp, |
1564 | const struct GNUNET_CONTAINER_MetaData *meta, | 1558 | const struct GNUNET_CONTAINER_MetaData *meta, |
1565 | const struct GNUNET_FS_Uri *uri) | 1559 | const struct GNUNET_FS_Uri *uri) |
1566 | { | 1560 | { |
@@ -1568,27 +1562,23 @@ GNUNET_GTK_add_to_uri_tab (GtkTreeIter * iter, struct SearchResult **srp, | |||
1568 | GtkNotebook *notebook; | 1562 | GtkNotebook *notebook; |
1569 | gint page; | 1563 | gint page; |
1570 | 1564 | ||
1571 | if (uri_tab == NULL) | 1565 | if (NULL == uri_tab) |
1572 | { | 1566 | { |
1573 | uri_tab = setup_search (NULL, NULL); | 1567 | uri_tab = setup_search_tab (NULL, NULL); |
1574 | gtk_widget_set_visible (uri_tab->close_button, FALSE); | 1568 | gtk_widget_set_visible (uri_tab->close_button, FALSE); |
1575 | gtk_widget_set_visible (uri_tab->pause_button, FALSE); | 1569 | gtk_widget_set_visible (uri_tab->pause_button, FALSE); |
1576 | } | 1570 | } |
1577 | else | 1571 | /* make 'uri_tab' the current page */ |
1578 | { | 1572 | notebook = |
1579 | /* make 'utab' the current page */ | 1573 | GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object |
1580 | notebook = | 1574 | ("GNUNET_GTK_main_window_notebook")); |
1581 | GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object | 1575 | for (page = 0; page < gtk_notebook_get_n_pages (notebook); page++) |
1582 | ("GNUNET_GTK_main_window_notebook")); | 1576 | if (uri_tab->frame == gtk_notebook_get_nth_page (notebook, page)) |
1583 | for (page = 0; page < gtk_notebook_get_n_pages (notebook); page++) | 1577 | { |
1584 | if (uri_tab->frame == gtk_notebook_get_nth_page (notebook, page)) | 1578 | gtk_notebook_set_current_page (notebook, page); |
1585 | { | 1579 | break; |
1586 | gtk_notebook_set_current_page (notebook, page); | 1580 | } |
1587 | break; | ||
1588 | } | ||
1589 | } | ||
1590 | sr = GNUNET_GTK_add_search_result (uri_tab, iter, NULL, uri, meta, NULL, 0); | 1581 | sr = GNUNET_GTK_add_search_result (uri_tab, iter, NULL, uri, meta, NULL, 0); |
1591 | |||
1592 | if (NULL != srp) | 1582 | if (NULL != srp) |
1593 | *srp = sr; | 1583 | *srp = sr; |
1594 | return uri_tab; | 1584 | return uri_tab; |
@@ -1596,12 +1586,10 @@ GNUNET_GTK_add_to_uri_tab (GtkTreeIter * iter, struct SearchResult **srp, | |||
1596 | 1586 | ||
1597 | 1587 | ||
1598 | 1588 | ||
1599 | |||
1600 | |||
1601 | |||
1602 | /* ***************** Download event handling ****************** */ | 1589 | /* ***************** Download event handling ****************** */ |
1603 | 1590 | ||
1604 | 1591 | ||
1592 | |||
1605 | /** | 1593 | /** |
1606 | * Change the (background) color of the given download entry. | 1594 | * Change the (background) color of the given download entry. |
1607 | * | 1595 | * |
@@ -1619,12 +1607,6 @@ change_download_color (struct DownloadEntry *de, | |||
1619 | "Changing download DE=%p color to %s\n", | 1607 | "Changing download DE=%p color to %s\n", |
1620 | de, color); | 1608 | de, color); |
1621 | path = gtk_tree_row_reference_get_path (de->rr); | 1609 | path = gtk_tree_row_reference_get_path (de->rr); |
1622 | if (NULL == path) | ||
1623 | { | ||
1624 | GNUNET_break (0); | ||
1625 | gtk_tree_path_free (path); | ||
1626 | return; | ||
1627 | } | ||
1628 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) | 1610 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) |
1629 | { | 1611 | { |
1630 | GNUNET_break (0); | 1612 | GNUNET_break (0); |
@@ -1650,23 +1632,19 @@ stop_download (struct DownloadEntry *de) | |||
1650 | GtkTreeModel *tm; | 1632 | GtkTreeModel *tm; |
1651 | struct SearchResult *search_result; | 1633 | struct SearchResult *search_result; |
1652 | 1634 | ||
1653 | path = gtk_tree_row_reference_get_path (de->rr); | ||
1654 | tm = gtk_tree_row_reference_get_model (de->rr); | 1635 | tm = gtk_tree_row_reference_get_model (de->rr); |
1655 | if (path != NULL) | 1636 | path = gtk_tree_row_reference_get_path (de->rr); |
1637 | if (! gtk_tree_model_get_iter (tm, &iter, path)) | ||
1656 | { | 1638 | { |
1657 | if (! gtk_tree_model_get_iter (tm, &iter, path)) | ||
1658 | { | ||
1659 | GNUNET_break (0); | ||
1660 | } | ||
1661 | else | ||
1662 | { | ||
1663 | gtk_tree_model_get (tm, &iter, 9, &search_result, -1); | ||
1664 | GNUNET_assert (search_result->download == de); | ||
1665 | search_result->download = NULL; | ||
1666 | change_download_color (de, "white"); | ||
1667 | } | ||
1668 | gtk_tree_path_free (path); | 1639 | gtk_tree_path_free (path); |
1640 | GNUNET_break (0); | ||
1641 | return; | ||
1669 | } | 1642 | } |
1643 | gtk_tree_path_free (path); | ||
1644 | gtk_tree_model_get (tm, &iter, 9, &search_result, -1); | ||
1645 | GNUNET_assert (search_result->download == de); | ||
1646 | search_result->download = NULL; | ||
1647 | change_download_color (de, "white"); | ||
1670 | gtk_tree_row_reference_free (de->rr); | 1648 | gtk_tree_row_reference_free (de->rr); |
1671 | GNUNET_FS_uri_destroy (de->uri); | 1649 | GNUNET_FS_uri_destroy (de->uri); |
1672 | GNUNET_CONTAINER_meta_data_destroy (de->meta); | 1650 | GNUNET_CONTAINER_meta_data_destroy (de->meta); |
@@ -1674,7 +1652,6 @@ stop_download (struct DownloadEntry *de) | |||
1674 | } | 1652 | } |
1675 | 1653 | ||
1676 | 1654 | ||
1677 | |||
1678 | /** | 1655 | /** |
1679 | * Closure for 'add_directory_entry'. | 1656 | * Closure for 'add_directory_entry'. |
1680 | */ | 1657 | */ |
@@ -1682,9 +1659,9 @@ struct AddDirectoryEntryContext | |||
1682 | { | 1659 | { |
1683 | 1660 | ||
1684 | /** | 1661 | /** |
1685 | * FIXME | 1662 | * Search tab where we need to expand the result list. |
1686 | */ | 1663 | */ |
1687 | struct DownloadEntry *de; | 1664 | struct SearchTab *tab; |
1688 | 1665 | ||
1689 | /** | 1666 | /** |
1690 | * Row reference of parent (the directory). | 1667 | * Row reference of parent (the directory). |
@@ -1704,11 +1681,19 @@ struct AddDirectoryEntryContext | |||
1704 | 1681 | ||
1705 | 1682 | ||
1706 | /** | 1683 | /** |
1707 | * Function used to process entries in a directory. | 1684 | * Function used to process entries in a directory. Whenever we |
1685 | * download a directory, this function is called on the entries in the | ||
1686 | * directory to add them to the search tab. Note that the function | ||
1687 | * maybe called twice for the same entry, once during incremental | ||
1688 | * processing and later once more when we have the complete directory. | ||
1689 | * | ||
1690 | * For the second round, the 'check_duplicates' flag will be set in | ||
1691 | * the closure. If called on an entry that already exists, the | ||
1692 | * function should simply do nothing. | ||
1708 | * | 1693 | * |
1709 | * @param cls closure, our 'struct AddDirectoryEntryContext*' | 1694 | * @param cls closure, our 'struct AddDirectoryEntryContext*' |
1710 | * @param filename name of the file in the directory | 1695 | * @param filename name of the file in the directory |
1711 | * @param uri URI of the file | 1696 | * @param uri URI of the file, NULL for the directory itself |
1712 | * @param metadata metadata for the file; metadata for | 1697 | * @param metadata metadata for the file; metadata for |
1713 | * the directory if everything else is NULL/zero | 1698 | * the directory if everything else is NULL/zero |
1714 | * @param length length of the available data for the file | 1699 | * @param length length of the available data for the file |
@@ -1730,19 +1715,23 @@ add_directory_entry (void *cls, const char *filename, | |||
1730 | GtkTreePath *path; | 1715 | GtkTreePath *path; |
1731 | GtkTreeModel *tm; | 1716 | GtkTreeModel *tm; |
1732 | struct GNUNET_FS_Uri *xuri; | 1717 | struct GNUNET_FS_Uri *xuri; |
1733 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding directory entry `%s'\n", filename); | ||
1734 | 1718 | ||
1735 | if (uri == NULL) | 1719 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1720 | "Adding directory entry `%s'\n", | ||
1721 | filename); | ||
1722 | |||
1723 | if (NULL == uri) | ||
1736 | { | 1724 | { |
1737 | /* directory meta data itself */ | 1725 | /* directory meta data itself */ |
1738 | /* FIXME: consider merging it in... */ | 1726 | /* FIXME: consider merging it with the meta data from |
1727 | the original search result... */ | ||
1739 | return; | 1728 | return; |
1740 | } | 1729 | } |
1741 | if (ade->check_duplicates == GNUNET_YES) | 1730 | if (ade->check_duplicates == GNUNET_YES) |
1742 | { | 1731 | { |
1743 | path = gtk_tree_row_reference_get_path (ade->prr); | ||
1744 | tm = gtk_tree_row_reference_get_model (ade->prr); | 1732 | tm = gtk_tree_row_reference_get_model (ade->prr); |
1745 | if (TRUE != gtk_tree_model_get_iter (tm, &piter, path)) | 1733 | path = gtk_tree_row_reference_get_path (ade->prr); |
1734 | if (! gtk_tree_model_get_iter (tm, &piter, path)) | ||
1746 | { | 1735 | { |
1747 | GNUNET_break (0); | 1736 | GNUNET_break (0); |
1748 | gtk_tree_path_free (path); | 1737 | gtk_tree_path_free (path); |
@@ -1760,12 +1749,25 @@ add_directory_entry (void *cls, const char *filename, | |||
1760 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); | 1749 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); |
1761 | } | 1750 | } |
1762 | } | 1751 | } |
1763 | GNUNET_GTK_add_search_result (ade->de->tab, &iter, ade->prr, uri, meta, NULL, | 1752 | GNUNET_GTK_add_search_result (ade->tab, &iter, ade->prr, uri, meta, NULL, |
1764 | 0); | 1753 | 0); |
1765 | } | 1754 | } |
1766 | 1755 | ||
1767 | 1756 | ||
1768 | static struct DownloadEntry * | 1757 | /** |
1758 | * We got an event that some download is progressing. Update the tree | ||
1759 | * model accordingly. If the download is a directory, try to display | ||
1760 | * the contents. | ||
1761 | * | ||
1762 | * @param de download entry that is progressing | ||
1763 | * @param size overall size of the download | ||
1764 | * @param completed number of bytes we have completed | ||
1765 | * @param block_data current block we've downloaded | ||
1766 | * @param offset offset of block_data in the overall file | ||
1767 | * @param block_size number of bytes in block_data | ||
1768 | * @param depth depth of the block in the ECRS tree | ||
1769 | */ | ||
1770 | static void | ||
1769 | mark_download_progress (struct DownloadEntry *de, uint64_t size, | 1771 | mark_download_progress (struct DownloadEntry *de, uint64_t size, |
1770 | uint64_t completed, const void *block_data, | 1772 | uint64_t completed, const void *block_data, |
1771 | uint64_t offset, uint64_t block_size, | 1773 | uint64_t offset, uint64_t block_size, |
@@ -1775,65 +1777,74 @@ mark_download_progress (struct DownloadEntry *de, uint64_t size, | |||
1775 | GtkTreePath *path; | 1777 | GtkTreePath *path; |
1776 | 1778 | ||
1777 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1779 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1778 | "Marking download progress for DE=%p, %llu/%llu, %llu@%llu depth=%u\n", | 1780 | "Marking download progress for DE=%p, %llu/%llu, %llu@%llu depth=%u\n", |
1779 | de, completed, size, block_size, offset, depth); | 1781 | de, completed, size, block_size, offset, depth); |
1780 | |||
1781 | 1782 | ||
1782 | path = gtk_tree_row_reference_get_path (de->rr); | 1783 | path = gtk_tree_row_reference_get_path (de->rr); |
1783 | if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) | 1784 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) |
1784 | { | 1785 | { |
1785 | GNUNET_break (0); | 1786 | GNUNET_break (0); |
1786 | gtk_tree_path_free (path); | 1787 | gtk_tree_path_free (path); |
1787 | return de; | 1788 | return; |
1788 | } | 1789 | } |
1789 | gtk_tree_path_free (path); | 1790 | gtk_tree_path_free (path); |
1790 | gtk_tree_store_set (de->ts, &iter, 4, | 1791 | /* FIXME: update availability-score here as well! */ |
1791 | (guint) ((size > | 1792 | gtk_tree_store_set (de->ts, &iter, |
1792 | 0) ? (100 * completed / | 1793 | 4, (guint) ((size > |
1793 | size) : 100) /* progress */ , | 1794 | 0) ? (100 * completed / |
1794 | 14, completed, -1); | 1795 | size) : 100) /* progress */ , |
1795 | if ((depth == 0) && (block_size > 0) && | 1796 | 14, completed, |
1796 | (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta))) | 1797 | -1); |
1798 | if ( (depth == 0) && | ||
1799 | (block_size > 0) && | ||
1800 | (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta)) ) | ||
1797 | { | 1801 | { |
1802 | /* got a data block of a directory, list its contents */ | ||
1798 | struct AddDirectoryEntryContext ade; | 1803 | struct AddDirectoryEntryContext ade; |
1799 | ade.de = de; | 1804 | |
1805 | ade.tab = de->tab; | ||
1800 | ade.prr = de->rr; | 1806 | ade.prr = de->rr; |
1801 | ade.check_duplicates = GNUNET_NO; | 1807 | ade.check_duplicates = GNUNET_NO; |
1802 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "It is a directory, list its contents\n"); | ||
1803 | if (GNUNET_SYSERR == | 1808 | if (GNUNET_SYSERR == |
1804 | GNUNET_FS_directory_list_contents ((size_t) block_size, block_data, | 1809 | GNUNET_FS_directory_list_contents ((size_t) block_size, block_data, |
1805 | offset, &add_directory_entry, &ade)) | 1810 | offset, &add_directory_entry, &ade)) |
1806 | { | 1811 | { |
1807 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1812 | /* Mime type was wrong, this is not a directory, update model! */ |
1808 | _ | 1813 | GNUNET_break (GNUNET_OK == |
1809 | ("Metadata wrongly claims that this is a GNUnet directory!\n")); | 1814 | GNUNET_CONTAINER_meta_data_delete (de->meta, |
1815 | EXTRACTOR_METATYPE_MIMETYPE, NULL, 0)); | ||
1816 | gtk_tree_store_set (de->ts, &iter, | ||
1817 | 10, "" /* unknown mime type */, -1); | ||
1810 | } | 1818 | } |
1811 | } | 1819 | } |
1812 | return de; | ||
1813 | } | 1820 | } |
1814 | 1821 | ||
1815 | 1822 | ||
1816 | static struct DownloadEntry * | 1823 | /** |
1817 | mark_download_error (struct DownloadEntry *de, const char *emsg) | 1824 | * FS-API encountered an error downloading a file. Update the |
1825 | * view accordingly. | ||
1826 | * | ||
1827 | * @param de download that had an error | ||
1828 | * @param emsg error message to display | ||
1829 | */ | ||
1830 | static void | ||
1831 | mark_download_error (struct DownloadEntry *de, | ||
1832 | const char *emsg) | ||
1818 | { | 1833 | { |
1819 | GtkTreeIter iter; | 1834 | GtkTreeIter iter; |
1820 | GtkTreePath *path; | 1835 | GtkTreePath *path; |
1821 | 1836 | ||
1822 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1823 | "Marking download error for DE=%p: %s\n", de, emsg); | ||
1824 | change_download_color (de, "red"); | 1837 | change_download_color (de, "red"); |
1825 | de->is_done = GNUNET_YES; | 1838 | de->is_done = GNUNET_YES; |
1826 | path = gtk_tree_row_reference_get_path (de->rr); | 1839 | path = gtk_tree_row_reference_get_path (de->rr); |
1827 | if (TRUE != | 1840 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->tab->ts), &iter, path)) |
1828 | gtk_tree_model_get_iter (GTK_TREE_MODEL (de->tab->ts), &iter, path)) | ||
1829 | { | 1841 | { |
1830 | GNUNET_break (0); | 1842 | GNUNET_break (0); |
1831 | gtk_tree_path_free (path); | 1843 | gtk_tree_path_free (path); |
1832 | return de; | 1844 | return; |
1833 | } | 1845 | } |
1834 | gtk_tree_path_free (path); | 1846 | gtk_tree_path_free (path); |
1835 | gtk_tree_store_set (de->tab->ts, &iter, 4, 0, 7, emsg, -1); | 1847 | gtk_tree_store_set (de->tab->ts, &iter, 4, 0, 7, emsg, -1); |
1836 | return de; | ||
1837 | } | 1848 | } |
1838 | 1849 | ||
1839 | 1850 | ||
@@ -1848,11 +1859,11 @@ mark_download_completed (struct DownloadEntry *de, uint64_t size, | |||
1848 | de, size, filename); | 1859 | de, size, filename); |
1849 | 1860 | ||
1850 | de->is_done = GNUNET_YES; | 1861 | de->is_done = GNUNET_YES; |
1851 | (void) mark_download_progress (de, size, size, NULL, 0, 0, 0); | 1862 | mark_download_progress (de, size, size, NULL, 0, 0, 0); |
1852 | if ((GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta)) && | 1863 | if ((GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta)) && |
1853 | (filename != NULL)) | 1864 | (filename != NULL)) |
1854 | { | 1865 | { |
1855 | ade.de = de; | 1866 | ade.tab = de->tab; |
1856 | ade.prr = de->rr; | 1867 | ade.prr = de->rr; |
1857 | ade.check_duplicates = GNUNET_YES; | 1868 | ade.check_duplicates = GNUNET_YES; |
1858 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "It is a directory, scan its contents\n"); | 1869 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "It is a directory, scan its contents\n"); |
@@ -1995,11 +2006,6 @@ download_lost_parent (struct DownloadEntry *de, uint64_t size, | |||
1995 | tm_old = gtk_tree_row_reference_get_model (rr_old); | 2006 | tm_old = gtk_tree_row_reference_get_model (rr_old); |
1996 | path = gtk_tree_row_reference_get_path (rr_old); | 2007 | path = gtk_tree_row_reference_get_path (rr_old); |
1997 | gtk_tree_row_reference_free (rr_old); | 2008 | gtk_tree_row_reference_free (rr_old); |
1998 | if (NULL == path) | ||
1999 | { | ||
2000 | GNUNET_break (0); | ||
2001 | return NULL; | ||
2002 | } | ||
2003 | if (TRUE != gtk_tree_model_get_iter (tm_old, &iter_old, path)) | 2009 | if (TRUE != gtk_tree_model_get_iter (tm_old, &iter_old, path)) |
2004 | { | 2010 | { |
2005 | GNUNET_break (0); | 2011 | GNUNET_break (0); |
@@ -2146,11 +2152,6 @@ change_publish_color (struct PublishEntry *pe, | |||
2146 | "Changing publish PE=%p color to %s\n", | 2152 | "Changing publish PE=%p color to %s\n", |
2147 | pe, color); | 2153 | pe, color); |
2148 | path = gtk_tree_row_reference_get_path (pe->rr); | 2154 | path = gtk_tree_row_reference_get_path (pe->rr); |
2149 | if (NULL == path) | ||
2150 | { | ||
2151 | GNUNET_break (0); | ||
2152 | return; | ||
2153 | } | ||
2154 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (pe->tab->ts), &iter, path)) | 2155 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (pe->tab->ts), &iter, path)) |
2155 | { | 2156 | { |
2156 | GNUNET_break (0); | 2157 | GNUNET_break (0); |
@@ -2494,29 +2495,28 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
2494 | info->value.download.size, | 2495 | info->value.download.size, |
2495 | info->value.download.completed); | 2496 | info->value.download.completed); |
2496 | if (info->value.download.specifics.resume.message != NULL) | 2497 | if (info->value.download.specifics.resume.message != NULL) |
2497 | { | 2498 | mark_download_error (ret, |
2498 | ret = | 2499 | info->value.download.specifics.resume.message); |
2499 | mark_download_error (ret, | ||
2500 | info->value.download.specifics.resume.message); | ||
2501 | } | ||
2502 | return ret; | 2500 | return ret; |
2503 | case GNUNET_FS_STATUS_DOWNLOAD_SUSPEND: | 2501 | case GNUNET_FS_STATUS_DOWNLOAD_SUSPEND: |
2504 | stop_download (info->value.download.cctx); | 2502 | stop_download (info->value.download.cctx); |
2505 | return NULL; | 2503 | return NULL; |
2506 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: | 2504 | case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS: |
2507 | return mark_download_progress (info->value.download.cctx, | 2505 | mark_download_progress (info->value.download.cctx, |
2508 | info->value.download.size, | 2506 | info->value.download.size, |
2509 | info->value.download.completed, | 2507 | info->value.download.completed, |
2510 | info->value.download.specifics.progress.data, | 2508 | info->value.download.specifics.progress.data, |
2511 | info->value.download.specifics.progress. | 2509 | info->value.download.specifics.progress. |
2512 | offset, | 2510 | offset, |
2513 | info->value.download.specifics.progress. | 2511 | info->value.download.specifics.progress. |
2514 | data_len, | 2512 | data_len, |
2515 | info->value.download.specifics.progress. | 2513 | info->value.download.specifics.progress. |
2516 | depth); | 2514 | depth); |
2515 | return info->value.download.cctx; | ||
2517 | case GNUNET_FS_STATUS_DOWNLOAD_ERROR: | 2516 | case GNUNET_FS_STATUS_DOWNLOAD_ERROR: |
2518 | return mark_download_error (info->value.download.cctx, | 2517 | mark_download_error (info->value.download.cctx, |
2519 | info->value.download.specifics.error.message); | 2518 | info->value.download.specifics.error.message); |
2519 | return info->value.download.cctx; | ||
2520 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: | 2520 | case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED: |
2521 | return mark_download_completed (info->value.download.cctx, | 2521 | return mark_download_completed (info->value.download.cctx, |
2522 | info->value.download.size, | 2522 | info->value.download.size, |
@@ -2539,9 +2539,9 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
2539 | if (info->value.search.pctx != NULL) | 2539 | if (info->value.search.pctx != NULL) |
2540 | return setup_inner_search (info->value.search.sc, | 2540 | return setup_inner_search (info->value.search.sc, |
2541 | info->value.search.pctx); | 2541 | info->value.search.pctx); |
2542 | return setup_search (info->value.search.sc, info->value.search.query); | 2542 | return setup_search_tab (info->value.search.sc, info->value.search.query); |
2543 | case GNUNET_FS_STATUS_SEARCH_RESUME: | 2543 | case GNUNET_FS_STATUS_SEARCH_RESUME: |
2544 | ret = setup_search (info->value.search.sc, info->value.search.query); | 2544 | ret = setup_search_tab (info->value.search.sc, info->value.search.query); |
2545 | if (info->value.search.specifics.resume.message) | 2545 | if (info->value.search.specifics.resume.message) |
2546 | handle_search_error (ret, | 2546 | handle_search_error (ret, |
2547 | info->value.search.specifics.resume.message); | 2547 | info->value.search.specifics.resume.message); |