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, 32 insertions, 4 deletions
diff --git a/src/fs/gnunet-fs-gtk-event_handler.c b/src/fs/gnunet-fs-gtk-event_handler.c
index 23129eb6..631c3426 100644
--- a/src/fs/gnunet-fs-gtk-event_handler.c
+++ b/src/fs/gnunet-fs-gtk-event_handler.c
@@ -548,6 +548,7 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
548 GtkTreeIter iter; 548 GtkTreeIter iter;
549 GtkTreePath *path; 549 GtkTreePath *path;
550 struct SearchResult *srp; 550 struct SearchResult *srp;
551 gchar *filename_utf8;
551 552
552 if (de == NULL) 553 if (de == NULL)
553 { 554 {
@@ -587,13 +588,15 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde,
587 return de; 588 return de;
588 } 589 }
589 gtk_tree_path_free (path); 590 gtk_tree_path_free (path);
591 filename_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) filename);
590 gtk_tree_store_set (de->ts, &iter, 4, 592 gtk_tree_store_set (de->ts, &iter, 4,
591 (guint) ((size > 593 (guint) ((size >
592 0) ? (100 * completed / 594 0) ? (100 * completed /
593 size) : 100) /* progress */ , 595 size) : 100) /* progress */ ,
594 6, filename /* filename/description */ , 596 6, filename_utf8 /* filename/description */ ,
595 8, "blue" /* status colour: pending */ , 597 8, "blue" /* status colour: pending */ ,
596 -1); 598 -1);
599 GNUNET_free_non_null (filename_utf8);
597 return de; 600 return de;
598} 601}
599 602
@@ -1111,6 +1114,7 @@ setup_search (struct GNUNET_FS_SearchContext *sc,
1111 } 1114 }
1112 else 1115 else
1113 { 1116 {
1117 /* FS_uri functions should produce UTF-8, so let them be */
1114 if (GNUNET_FS_uri_test_ksk (query)) 1118 if (GNUNET_FS_uri_test_ksk (query))
1115 tab->query_txt = GNUNET_FS_uri_ksk_to_string_fancy (query); 1119 tab->query_txt = GNUNET_FS_uri_ksk_to_string_fancy (query);
1116 else 1120 else
@@ -1291,6 +1295,16 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, GtkTreeIter * iter,
1291 -1); 1295 -1);
1292 if (desc == NULL) 1296 if (desc == NULL)
1293 desc = GNUNET_strdup (_("no description supplied")); 1297 desc = GNUNET_strdup (_("no description supplied"));
1298 else
1299 {
1300 char *utf8_desc = NULL;
1301 utf8_desc = GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8, desc, strlen (desc) + 1);
1302 GNUNET_free (desc);
1303 if (utf8_desc != NULL)
1304 desc = utf8_desc;
1305 else
1306 desc = NULL;
1307 }
1294 if (uri == NULL) 1308 if (uri == NULL)
1295 uris = GNUNET_strdup (_("no URI")); 1309 uris = GNUNET_strdup (_("no URI"));
1296 else 1310 else
@@ -1348,7 +1362,7 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab, GtkTreeIter * iter,
1348 if (pixbuf != NULL) 1362 if (pixbuf != NULL)
1349 g_object_unref (pixbuf); 1363 g_object_unref (pixbuf);
1350 GNUNET_free (uris); 1364 GNUNET_free (uris);
1351 GNUNET_free (desc); 1365 GNUNET_free_non_null (desc);
1352 GNUNET_free_non_null (mime); 1366 GNUNET_free_non_null (mime);
1353 tp = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), iter); 1367 tp = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), iter);
1354 sr->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), tp); 1368 sr->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), tp);
@@ -1468,6 +1482,16 @@ update_search_result (struct SearchResult *sr,
1468 -1); 1482 -1);
1469 if (desc == NULL) 1483 if (desc == NULL)
1470 desc = GNUNET_strdup (_("no description supplied")); 1484 desc = GNUNET_strdup (_("no description supplied"));
1485 else
1486 {
1487 char *utf8_desc = NULL;
1488 utf8_desc = GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8, desc, strlen (desc) + 1);
1489 GNUNET_free (desc);
1490 if (utf8_desc != NULL)
1491 desc = utf8_desc;
1492 else
1493 desc = NULL;
1494 }
1471 mime = 1495 mime =
1472 GNUNET_CONTAINER_meta_data_get_first_by_types (meta, 1496 GNUNET_CONTAINER_meta_data_get_first_by_types (meta,
1473 EXTRACTOR_METATYPE_MIMETYPE, 1497 EXTRACTOR_METATYPE_MIMETYPE,
@@ -1497,7 +1521,7 @@ update_search_result (struct SearchResult *sr,
1497 (gint) availability_rank, -1); 1521 (gint) availability_rank, -1);
1498 if (pixbuf != NULL) 1522 if (pixbuf != NULL)
1499 g_object_unref (pixbuf); 1523 g_object_unref (pixbuf);
1500 GNUNET_free (desc); 1524 GNUNET_free_non_null (desc);
1501 GNUNET_free_non_null (mime); 1525 GNUNET_free_non_null (mime);
1502 1526
1503 notebook = 1527 notebook =
@@ -1610,6 +1634,7 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const char *fn,
1610 GtkWidget *close_button; 1634 GtkWidget *close_button;
1611 GtkNotebook *notebook; 1635 GtkNotebook *notebook;
1612 char *size_fancy; 1636 char *size_fancy;
1637 char *fn_utf8 = NULL;
1613 1638
1614 if (NULL == parent) 1639 if (NULL == parent)
1615 { 1640 {
@@ -1676,11 +1701,14 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const char *fn,
1676 ent = GNUNET_malloc (sizeof (struct PublishEntry)); 1701 ent = GNUNET_malloc (sizeof (struct PublishEntry));
1677 ent->is_top = (parent == NULL) ? GNUNET_YES : GNUNET_NO; 1702 ent->is_top = (parent == NULL) ? GNUNET_YES : GNUNET_NO;
1678 ent->tab = publish_tab; 1703 ent->tab = publish_tab;
1679 gtk_tree_store_insert_with_values (publish_tab->ts, &iter, pitrptr, G_MAXINT, 0, fn, 1704 fn_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) fn);
1705 gtk_tree_store_insert_with_values (publish_tab->ts, &iter, pitrptr, G_MAXINT,
1706 0, fn_utf8,
1680 1, size_fancy, 2, "white", 3, 1707 1, size_fancy, 2, "white", 3,
1681 (guint) 0 /* progress */ , 1708 (guint) 0 /* progress */ ,
1682 4, ent, 1709 4, ent,
1683 -1); 1710 -1);
1711 GNUNET_free_non_null (fn_utf8);
1684 path = gtk_tree_model_get_path (GTK_TREE_MODEL (publish_tab->ts), &iter); 1712 path = gtk_tree_model_get_path (GTK_TREE_MODEL (publish_tab->ts), &iter);
1685 GNUNET_assert (NULL != path); 1713 GNUNET_assert (NULL != path);
1686 ent->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (publish_tab->ts), path); 1714 ent->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (publish_tab->ts), path);