diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 51 |
1 files changed, 15 insertions, 36 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index 95a6e280..86153ddc 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -1574,14 +1574,14 @@ change_download_color (struct DownloadEntry *de, | |||
1574 | "Changing download DE=%p color to %s\n", | 1574 | "Changing download DE=%p color to %s\n", |
1575 | de, color); | 1575 | de, color); |
1576 | path = gtk_tree_row_reference_get_path (de->rr); | 1576 | path = gtk_tree_row_reference_get_path (de->rr); |
1577 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) | 1577 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->tab->ts), &iter, path)) |
1578 | { | 1578 | { |
1579 | GNUNET_break (0); | 1579 | GNUNET_break (0); |
1580 | gtk_tree_path_free (path); | 1580 | gtk_tree_path_free (path); |
1581 | return; | 1581 | return; |
1582 | } | 1582 | } |
1583 | gtk_tree_path_free (path); | 1583 | gtk_tree_path_free (path); |
1584 | gtk_tree_store_set (de->ts, &iter, 8, color, -1); | 1584 | gtk_tree_store_set (de->tab->ts, &iter, 8, color, -1); |
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | 1587 | ||
@@ -1594,30 +1594,11 @@ change_download_color (struct DownloadEntry *de, | |||
1594 | static void | 1594 | static void |
1595 | stop_download (struct DownloadEntry *de) | 1595 | stop_download (struct DownloadEntry *de) |
1596 | { | 1596 | { |
1597 | GtkTreeIter iter; | 1597 | if (NULL != de->sr) |
1598 | GtkTreePath *path; | ||
1599 | GtkTreeModel *tm; | ||
1600 | struct SearchResult *search_result; | ||
1601 | |||
1602 | tm = gtk_tree_row_reference_get_model (de->rr); | ||
1603 | path = gtk_tree_row_reference_get_path (de->rr); | ||
1604 | if (! gtk_tree_model_get_iter (tm, &iter, path)) | ||
1605 | { | 1598 | { |
1606 | gtk_tree_path_free (path); | 1599 | GNUNET_assert (de->sr->download == de); |
1607 | GNUNET_break (0); | 1600 | de->sr->download = NULL; |
1608 | return; | ||
1609 | } | 1601 | } |
1610 | gtk_tree_path_free (path); | ||
1611 | gtk_tree_model_get (tm, &iter, 9, &search_result, -1); | ||
1612 | /* FIXME-BUG: 'search_result' can be NULL here, somehow some code fails to setup the record.. */ | ||
1613 | if (NULL == search_result) | ||
1614 | { | ||
1615 | /* FIXME-BUG: this prevents the crash for now, but does not solve the problem */ | ||
1616 | GNUNET_break (0); | ||
1617 | return; | ||
1618 | } | ||
1619 | GNUNET_assert (search_result->download == de); | ||
1620 | search_result->download = NULL; | ||
1621 | change_download_color (de, "white"); | 1602 | change_download_color (de, "white"); |
1622 | gtk_tree_row_reference_free (de->rr); | 1603 | gtk_tree_row_reference_free (de->rr); |
1623 | GNUNET_FS_uri_destroy (de->uri); | 1604 | GNUNET_FS_uri_destroy (de->uri); |
@@ -1755,7 +1736,7 @@ mark_download_progress (struct DownloadEntry *de, uint64_t size, | |||
1755 | de, completed, size, block_size, offset, depth); | 1736 | de, completed, size, block_size, offset, depth); |
1756 | 1737 | ||
1757 | path = gtk_tree_row_reference_get_path (de->rr); | 1738 | path = gtk_tree_row_reference_get_path (de->rr); |
1758 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) | 1739 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->tab->ts), &iter, path)) |
1759 | { | 1740 | { |
1760 | GNUNET_break (0); | 1741 | GNUNET_break (0); |
1761 | gtk_tree_path_free (path); | 1742 | gtk_tree_path_free (path); |
@@ -1766,7 +1747,7 @@ mark_download_progress (struct DownloadEntry *de, uint64_t size, | |||
1766 | 'progress' once the download has started and re-use the | 1747 | 'progress' once the download has started and re-use the |
1767 | space in the display? Probably yes, at least once we have | 1748 | space in the display? Probably yes, at least once we have |
1768 | a custom CellRenderer... */ | 1749 | a custom CellRenderer... */ |
1769 | gtk_tree_store_set (de->ts, &iter, | 1750 | gtk_tree_store_set (de->tab->ts, &iter, |
1770 | 4, (guint) ((size > | 1751 | 4, (guint) ((size > |
1771 | 0) ? (100 * completed / | 1752 | 0) ? (100 * completed / |
1772 | size) : 100) /* progress */, | 1753 | size) : 100) /* progress */, |
@@ -1793,7 +1774,7 @@ mark_download_progress (struct DownloadEntry *de, uint64_t size, | |||
1793 | GNUNET_break (GNUNET_OK == | 1774 | GNUNET_break (GNUNET_OK == |
1794 | GNUNET_CONTAINER_meta_data_delete (de->meta, | 1775 | GNUNET_CONTAINER_meta_data_delete (de->meta, |
1795 | EXTRACTOR_METATYPE_MIMETYPE, NULL, 0)); | 1776 | EXTRACTOR_METATYPE_MIMETYPE, NULL, 0)); |
1796 | gtk_tree_store_set (de->ts, &iter, | 1777 | gtk_tree_store_set (de->tab->ts, &iter, |
1797 | 10, "" /* unknown mime type */, -1); | 1778 | 10, "" /* unknown mime type */, -1); |
1798 | } | 1779 | } |
1799 | } | 1780 | } |
@@ -1939,7 +1920,6 @@ copy_children (GtkTreeModel * src_model, GtkTreeIter * src_iter, | |||
1939 | gtk_tree_path_free (path); | 1920 | gtk_tree_path_free (path); |
1940 | if (search_result->download != NULL) | 1921 | if (search_result->download != NULL) |
1941 | { | 1922 | { |
1942 | search_result->download->ts = GTK_TREE_STORE (dst_model); | ||
1943 | gtk_tree_row_reference_free (search_result->download->rr); | 1923 | gtk_tree_row_reference_free (search_result->download->rr); |
1944 | search_result->download->rr = | 1924 | search_result->download->rr = |
1945 | gtk_tree_row_reference_copy (search_result->rr); | 1925 | gtk_tree_row_reference_copy (search_result->rr); |
@@ -1990,9 +1970,9 @@ download_lost_parent (struct DownloadEntry *de) | |||
1990 | /* first, move the root of the respective 'de'-tree */ | 1970 | /* first, move the root of the respective 'de'-tree */ |
1991 | rr_old = de->rr; | 1971 | rr_old = de->rr; |
1992 | tab = GNUNET_GTK_add_to_uri_tab (&iter, &de->sr, de->meta, de->uri); | 1972 | tab = GNUNET_GTK_add_to_uri_tab (&iter, &de->sr, de->meta, de->uri); |
1973 | de->tab = tab; | ||
1993 | de->sr->download = de; | 1974 | de->sr->download = de; |
1994 | de->ts = tab->ts; | 1975 | model = GTK_TREE_MODEL (de->tab->ts); |
1995 | model = GTK_TREE_MODEL (de->ts); | ||
1996 | path = gtk_tree_model_get_path (model, &iter); | 1976 | path = gtk_tree_model_get_path (model, &iter); |
1997 | de->rr = gtk_tree_row_reference_new (model, path); | 1977 | de->rr = gtk_tree_row_reference_new (model, path); |
1998 | gtk_tree_path_free (path); | 1978 | gtk_tree_path_free (path); |
@@ -2065,7 +2045,6 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
2065 | GNUNET_assert (sr->download == NULL); | 2045 | GNUNET_assert (sr->download == NULL); |
2066 | sr->download = de; | 2046 | sr->download = de; |
2067 | de->rr = gtk_tree_row_reference_copy (sr->rr); | 2047 | de->rr = gtk_tree_row_reference_copy (sr->rr); |
2068 | de->ts = sr->tab->ts; | ||
2069 | de->tab = sr->tab; | 2048 | de->tab = sr->tab; |
2070 | srp = sr; | 2049 | srp = sr; |
2071 | } | 2050 | } |
@@ -2075,21 +2054,21 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
2075 | with the download so far; create a fresh entry for this | 2054 | with the download so far; create a fresh entry for this |
2076 | download in the URI tab */ | 2055 | download in the URI tab */ |
2077 | de->tab = GNUNET_GTK_add_to_uri_tab (&iter, &srp, meta, uri); | 2056 | de->tab = GNUNET_GTK_add_to_uri_tab (&iter, &srp, meta, uri); |
2078 | de->ts = de->tab->ts; | 2057 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (de->tab->ts), &iter); |
2079 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (de->ts), &iter); | 2058 | de->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (de->tab->ts), path); |
2080 | de->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (de->ts), path); | ||
2081 | gtk_tree_path_free (path); | 2059 | gtk_tree_path_free (path); |
2082 | srp->download = de; | 2060 | srp->download = de; |
2083 | } | 2061 | } |
2062 | GNUNET_assert (NULL != de->tab); | ||
2084 | path = gtk_tree_row_reference_get_path (de->rr); | 2063 | path = gtk_tree_row_reference_get_path (de->rr); |
2085 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), &iter, path)) | 2064 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->tab->ts), &iter, path)) |
2086 | { | 2065 | { |
2087 | GNUNET_break (0); | 2066 | GNUNET_break (0); |
2088 | gtk_tree_path_free (path); | 2067 | gtk_tree_path_free (path); |
2089 | return de; | 2068 | return de; |
2090 | } | 2069 | } |
2091 | gtk_tree_path_free (path); | 2070 | gtk_tree_path_free (path); |
2092 | gtk_tree_store_set (de->ts, &iter, | 2071 | gtk_tree_store_set (de->tab->ts, &iter, |
2093 | 4, (guint) ((size > | 2072 | 4, (guint) ((size > |
2094 | 0) ? (100 * completed / | 2073 | 0) ? (100 * completed / |
2095 | size) : 100) /* progress */ , | 2074 | size) : 100) /* progress */ , |