aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_event-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r--src/fs/gnunet-fs-gtk_event-handler.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c
index ae0ab3db..376fba44 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -1180,7 +1180,6 @@ update_search_result (struct SearchResult *sr,
1180 * are being opened and if the user manually enters a URI. 1180 * are being opened and if the user manually enters a URI.
1181 * 1181 *
1182 * @param tab search tab to extend, never NULL 1182 * @param tab search tab to extend, never NULL
1183 * @param iter set to position where search result is added (OUT only)
1184 * @param parent_rr reference to parent entry in search tab, NULL for normal 1183 * @param parent_rr reference to parent entry in search tab, NULL for normal
1185 * search results, 1184 * search results,
1186 * @param uri uri to add, can be NULL for top-level entry of a directory opened from disk 1185 * @param uri uri to add, can be NULL for top-level entry of a directory opened from disk
@@ -1195,7 +1194,6 @@ update_search_result (struct SearchResult *sr,
1195 */ 1194 */
1196struct SearchResult * 1195struct SearchResult *
1197GNUNET_GTK_add_search_result (struct SearchTab *tab, 1196GNUNET_GTK_add_search_result (struct SearchTab *tab,
1198 GtkTreeIter *iter,
1199 GtkTreeRowReference *parent_rr, 1197 GtkTreeRowReference *parent_rr,
1200 const struct GNUNET_FS_Uri *uri, 1198 const struct GNUNET_FS_Uri *uri,
1201 const struct GNUNET_CONTAINER_MetaData *meta, 1199 const struct GNUNET_CONTAINER_MetaData *meta,
@@ -1209,6 +1207,7 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
1209 char *mime; 1207 char *mime;
1210 char *uris; 1208 char *uris;
1211 GdkPixbuf *pixbuf; 1209 GdkPixbuf *pixbuf;
1210 GtkTreeIter iter;
1212 GtkTreeIter *pitr; 1211 GtkTreeIter *pitr;
1213 GtkTreeIter pmem; 1212 GtkTreeIter pmem;
1214 GtkTreePath *path; 1213 GtkTreePath *path;
@@ -1276,7 +1275,7 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
1276 pitr = NULL; 1275 pitr = NULL;
1277 ts = tab->ts; 1276 ts = tab->ts;
1278 } 1277 }
1279 gtk_tree_store_insert_with_values (ts, iter, pitr, G_MAXINT, 1278 gtk_tree_store_insert_with_values (ts, &iter, pitr, G_MAXINT,
1280 0, GNUNET_CONTAINER_meta_data_duplicate (meta), 1279 0, GNUNET_CONTAINER_meta_data_duplicate (meta),
1281 1, (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri), 1280 1, (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri),
1282 2, fsize, 1281 2, fsize,
@@ -1302,7 +1301,7 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
1302 GNUNET_free_non_null (mime); 1301 GNUNET_free_non_null (mime);
1303 1302
1304 /* remember in 'sr' where we added the result */ 1303 /* remember in 'sr' where we added the result */
1305 tp = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), iter); 1304 tp = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &iter);
1306 sr->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), tp); 1305 sr->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), tp);
1307 gtk_tree_path_free (tp); 1306 gtk_tree_path_free (tp);
1308 1307
@@ -1341,9 +1340,8 @@ process_search_result (struct SearchTab *tab,
1341 uint32_t applicability_rank) 1340 uint32_t applicability_rank)
1342{ 1341{
1343 struct SearchResult *sr; 1342 struct SearchResult *sr;
1344 GtkTreeIter iter;
1345 1343
1346 sr = GNUNET_GTK_add_search_result (tab, &iter, 1344 sr = GNUNET_GTK_add_search_result (tab,
1347 (parent != NULL) ? parent->rr : NULL, 1345 (parent != NULL) ? parent->rr : NULL,
1348 uri, 1346 uri,
1349 meta, result, applicability_rank); 1347 meta, result, applicability_rank);
@@ -1483,14 +1481,12 @@ setup_inner_search (struct GNUNET_FS_SearchContext *sc,
1483 * Setup a new top-level entry in the URI/orphan tab. If necessary, create 1481 * Setup a new top-level entry in the URI/orphan tab. If necessary, create
1484 * the URI tab first. 1482 * the URI tab first.
1485 * 1483 *
1486 * @param iter set to the new entry (OUT only) -- FIXME: remove, obtainable as 'RETVAL->rr'
1487 * @param meta metadata for the new entry 1484 * @param meta metadata for the new entry
1488 * @param uri URI for the new entry 1485 * @param uri URI for the new entry
1489 * @return the search result that was set up 1486 * @return the search result that was set up
1490 */ 1487 */
1491struct SearchResult * 1488struct SearchResult *
1492GNUNET_GTK_add_to_uri_tab (GtkTreeIter *iter, 1489GNUNET_GTK_add_to_uri_tab (const struct GNUNET_CONTAINER_MetaData *meta,
1493 const struct GNUNET_CONTAINER_MetaData *meta,
1494 const struct GNUNET_FS_Uri *uri) 1490 const struct GNUNET_FS_Uri *uri)
1495{ 1491{
1496 GtkNotebook *notebook; 1492 GtkNotebook *notebook;
@@ -1512,7 +1508,7 @@ GNUNET_GTK_add_to_uri_tab (GtkTreeIter *iter,
1512 gtk_notebook_set_current_page (notebook, page); 1508 gtk_notebook_set_current_page (notebook, page);
1513 break; 1509 break;
1514 } 1510 }
1515 return GNUNET_GTK_add_search_result (uri_tab, iter, NULL, uri, meta, NULL, 0); 1511 return GNUNET_GTK_add_search_result (uri_tab, NULL, uri, meta, NULL, 0);
1516} 1512}
1517 1513
1518 1514
@@ -1660,7 +1656,7 @@ add_directory_entry (void *cls, const char *filename,
1660 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 1656 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
1661 } 1657 }
1662 } 1658 }
1663 GNUNET_GTK_add_search_result (ade->tab, &iter, ade->prr, uri, meta, NULL, 1659 GNUNET_GTK_add_search_result (ade->tab, ade->prr, uri, meta, NULL,
1664 0); 1660 0);
1665} 1661}
1666 1662
@@ -1918,15 +1914,13 @@ download_lost_parent (struct DownloadEntry *de)
1918 1914
1919 /* first, move the root of the respective 'de'-tree */ 1915 /* first, move the root of the respective 'de'-tree */
1920 rr_old = de->sr->rr; 1916 rr_old = de->sr->rr;
1921 de->sr = GNUNET_GTK_add_to_uri_tab (&iter, de->meta, de->uri); 1917 de->sr = GNUNET_GTK_add_to_uri_tab (de->meta, de->uri);
1922 de->sr->download = de; 1918 de->sr->download = de;
1923 1919
1924 model = GTK_TREE_MODEL (de->sr->tab->ts);
1925 1920
1926 tm_old = gtk_tree_row_reference_get_model (rr_old); 1921 tm_old = gtk_tree_row_reference_get_model (rr_old);
1927 path = gtk_tree_row_reference_get_path (rr_old); 1922 path = gtk_tree_row_reference_get_path (rr_old);
1928 gtk_tree_row_reference_free (rr_old); 1923 gtk_tree_row_reference_free (rr_old);
1929
1930 if (! gtk_tree_model_get_iter (tm_old, &iter_old, path)) 1924 if (! gtk_tree_model_get_iter (tm_old, &iter_old, path))
1931 { 1925 {
1932 GNUNET_break (0); 1926 GNUNET_break (0);
@@ -1935,6 +1929,16 @@ download_lost_parent (struct DownloadEntry *de)
1935 } 1929 }
1936 gtk_tree_path_free (path); 1930 gtk_tree_path_free (path);
1937 1931
1932 model = GTK_TREE_MODEL (de->sr->tab->ts);
1933 path = gtk_tree_row_reference_get_path (de->sr->rr);
1934 if (! gtk_tree_model_get_iter (model, &iter, path))
1935 {
1936 GNUNET_break (0);
1937 gtk_tree_path_free (path);
1938 return;
1939 }
1940 gtk_tree_path_free (path);
1941
1938 /* finally, move all children over as well */ 1942 /* finally, move all children over as well */
1939 copy_children (tm_old, &iter_old, model, &iter); 1943 copy_children (tm_old, &iter_old, model, &iter);
1940 while (gtk_tree_model_iter_children (model, &child, &iter)) 1944 while (gtk_tree_model_iter_children (model, &child, &iter))
@@ -2003,7 +2007,7 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
2003 /* Stand-alone download with no 'row'/search result affiliated 2007 /* Stand-alone download with no 'row'/search result affiliated
2004 with the download so far; create a fresh entry for this 2008 with the download so far; create a fresh entry for this
2005 download in the URI tab */ 2009 download in the URI tab */
2006 de->sr = GNUNET_GTK_add_to_uri_tab (&iter, meta, uri); 2010 de->sr = GNUNET_GTK_add_to_uri_tab (meta, uri);
2007 de->sr->download = de; 2011 de->sr->download = de;
2008 } 2012 }
2009 path = gtk_tree_row_reference_get_path (de->sr->rr); 2013 path = gtk_tree_row_reference_get_path (de->sr->rr);
@@ -2020,7 +2024,7 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
2020 size) : 100) /* progress */ , 2024 size) : 100) /* progress */ ,
2021 6, filename /* filename/description */ , 2025 6, filename /* filename/description */ ,
2022 8, "blue" /* status colour: pending */ , 2026 8, "blue" /* status colour: pending */ ,
2023 9, de->sr, 2027 9, de->sr,
2024 14, completed, 2028 14, completed,
2025 15, de->filename, 2029 15, de->filename,
2026 16, de->anonymity, 2030 16, de->anonymity,