aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk-main_window_file_publish.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk-main_window_file_publish.c')
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_file_publish.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
index 2d93e722..16df7b93 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -205,7 +205,6 @@ add_file_at_iter (gpointer data, const char *filename,
205 GtkTreePath *path; 205 GtkTreePath *path;
206 uint64_t file_size; 206 uint64_t file_size;
207 const char *short_fn; 207 const char *short_fn;
208 char *short_fn_utf8;
209 struct GNUNET_CONTAINER_MetaData *meta; 208 struct GNUNET_CONTAINER_MetaData *meta;
210 struct GNUNET_FS_Uri *ksk_uri; 209 struct GNUNET_FS_Uri *ksk_uri;
211 GtkTreeStore *ts; 210 GtkTreeStore *ts;
@@ -243,11 +242,10 @@ add_file_at_iter (gpointer data, const char *filename,
243 short_fn = filename; 242 short_fn = filename;
244 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR))) 243 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)))
245 short_fn = 1 + ss; 244 short_fn = 1 + ss;
246 short_fn_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) short_fn);
247 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet-gtk>", 245 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet-gtk>",
248 EXTRACTOR_METATYPE_FILENAME, 246 EXTRACTOR_METATYPE_FILENAME,
249 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 247 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
250 short_fn_utf8, strlen (short_fn_utf8) + 1); 248 short_fn, strlen (short_fn) + 1);
251 ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (meta); 249 ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (meta);
252 gtk_tree_store_insert_before (ts, &pos, iter, NULL); 250 gtk_tree_store_insert_before (ts, &pos, iter, NULL);
253 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &pos); 251 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &pos);
@@ -264,9 +262,8 @@ add_file_at_iter (gpointer data, const char *filename,
264 else 262 else
265 file_size_fancy = GNUNET_STRINGS_byte_size_fancy (file_size); 263 file_size_fancy = GNUNET_STRINGS_byte_size_fancy (file_size);
266 gtk_tree_store_set (ts, &pos, 0, file_size_fancy, 1, (gboolean) do_index, 2, 264 gtk_tree_store_set (ts, &pos, 0, file_size_fancy, 1, (gboolean) do_index, 2,
267 short_fn_utf8, 3, (guint) bo->anonymity_level, 4, 265 short_fn, 3, (guint) bo->anonymity_level, 4,
268 (guint) bo->content_priority, 5, fi, -1); 266 (guint) bo->content_priority, 5, fi, -1);
269 GNUNET_free_non_null (short_fn_utf8);
270 GNUNET_free (file_size_fancy); 267 GNUNET_free (file_size_fancy);
271 update_selectivity (data); 268 update_selectivity (data);
272} 269}
@@ -503,7 +500,6 @@ extract_file (struct AddDirContext *adc, const char *filename)
503 GNUNET_HashCode hc; 500 GNUNET_HashCode hc;
504 const char *short_fn; 501 const char *short_fn;
505 const char *ss; 502 const char *ss;
506 char *short_fn_utf8;
507 503
508 adc->dir_entry_count++; 504 adc->dir_entry_count++;
509 pd = GNUNET_malloc (sizeof (struct PublishData)); 505 pd = GNUNET_malloc (sizeof (struct PublishData));
@@ -515,12 +511,10 @@ extract_file (struct AddDirContext *adc, const char *filename)
515 short_fn = filename; 511 short_fn = filename;
516 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR))) 512 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)))
517 short_fn = 1 + ss; 513 short_fn = 1 + ss;
518 short_fn_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) short_fn);
519 GNUNET_CONTAINER_meta_data_insert (pd->meta, "<gnunet-gtk>", 514 GNUNET_CONTAINER_meta_data_insert (pd->meta, "<gnunet-gtk>",
520 EXTRACTOR_METATYPE_FILENAME, 515 EXTRACTOR_METATYPE_FILENAME,
521 EXTRACTOR_METAFORMAT_UTF8, "text/plain", 516 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
522 short_fn, strlen (short_fn_utf8) + 1); 517 short_fn, strlen (short_fn) + 1);
523 GNUNET_free_non_null (short_fn_utf8);
524 518
525 gtk_tree_store_insert_before (adc->ts, &pd->iter, adc->parent, NULL); 519 gtk_tree_store_insert_before (adc->ts, &pd->iter, adc->parent, NULL);
526 GNUNET_CRYPTO_hash (filename, strlen (filename), &hc); 520 GNUNET_CRYPTO_hash (filename, strlen (filename), &hc);
@@ -578,7 +572,6 @@ add_entry_to_ts (GtkTreeStore * ts, GtkTreeIter * iter, const char *filename,
578 struct GNUNET_FS_Uri *kill_ksk; 572 struct GNUNET_FS_Uri *kill_ksk;
579 const char *ss; 573 const char *ss;
580 const char *short_fn; 574 const char *short_fn;
581 char *short_fn_utf8;
582 struct stat sbuf; 575 struct stat sbuf;
583 576
584 if (0 != STAT (filename, &sbuf)) 577 if (0 != STAT (filename, &sbuf))
@@ -630,11 +623,9 @@ add_entry_to_ts (GtkTreeStore * ts, GtkTreeIter * iter, const char *filename,
630 short_fn = filename; 623 short_fn = filename;
631 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR))) 624 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)))
632 short_fn = 1 + ss; 625 short_fn = 1 + ss;
633 short_fn_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) short_fn);
634 gtk_tree_store_set (ts, iter, 0, file_size_fancy, 1, (gboolean) do_index, 2, 626 gtk_tree_store_set (ts, iter, 0, file_size_fancy, 1, (gboolean) do_index, 2,
635 short_fn_utf8, 3, (guint) bo->anonymity_level, 4, 627 short_fn, 3, (guint) bo->anonymity_level, 4,
636 (guint) bo->content_priority, 5, fi, -1); 628 (guint) bo->content_priority, 5, fi, -1);
637 GNUNET_free_non_null (short_fn_utf8);
638 GNUNET_free (file_size_fancy); 629 GNUNET_free (file_size_fancy);
639} 630}
640 631
@@ -1397,7 +1388,7 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog,
1397 (builder, "GNUNET_GTK_publish_directory_dialog")); 1388 (builder, "GNUNET_GTK_publish_directory_dialog"));
1398 if (response_id == -5) 1389 if (response_id == -5)
1399 { 1390 {
1400 filename = GNUNET_GTK_filechooser_get_filename_loc (GTK_FILE_CHOOSER (ad)); 1391 filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (ad));
1401 sb = GTK_SPIN_BUTTON (gtk_builder_get_object 1392 sb = GTK_SPIN_BUTTON (gtk_builder_get_object
1402 (builder, 1393 (builder,
1403 "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button")); 1394 "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
@@ -1621,15 +1612,13 @@ add_namespace_to_ts (void *cls, const char *name, const GNUNET_HashCode * id)
1621 GtkTreeStore *ts = cls; 1612 GtkTreeStore *ts = cls;
1622 struct UpdateableContext uc; 1613 struct UpdateableContext uc;
1623 GtkTreeIter iter; 1614 GtkTreeIter iter;
1624 gchar *name_utf8;
1625 1615
1626 uc.parent = &iter; 1616 uc.parent = &iter;
1627 uc.namespace_name = name; 1617 uc.namespace_name = name;
1628 uc.ts = ts; 1618 uc.ts = ts;
1629 uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); 1619 uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name);
1630 uc.update_called = GNUNET_NO; 1620 uc.update_called = GNUNET_NO;
1631 name_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) name); 1621 gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, 0, name, 1,
1632 gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, 0, name_utf8, 1,
1633 uc.ns, 2, NULL /* last-id */ , 1622 uc.ns, 2, NULL /* last-id */ ,
1634 3, NULL /* last-uri (as string!) */ , 1623 3, NULL /* last-uri (as string!) */ ,
1635 4, NULL /* meta */ , 1624 4, NULL /* meta */ ,
@@ -1638,7 +1627,6 @@ add_namespace_to_ts (void *cls, const char *name, const GNUNET_HashCode * id)
1638 7, TRUE /* update editable */ , 1627 7, TRUE /* update editable */ ,
1639 8, TRUE /* current editable */ , 1628 8, TRUE /* current editable */ ,
1640 -1); 1629 -1);
1641 GNUNET_free_non_null (name_utf8);
1642 uc.seen = GNUNET_CONTAINER_multihashmap_create (128); 1630 uc.seen = GNUNET_CONTAINER_multihashmap_create (128);
1643 GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc); 1631 GNUNET_FS_namespace_list_updateable (uc.ns, NULL, &add_updateable_to_ts, &uc);
1644 GNUNET_CONTAINER_multihashmap_destroy (uc.seen); 1632 GNUNET_CONTAINER_multihashmap_destroy (uc.seen);
@@ -1861,7 +1849,7 @@ GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog * dialog,
1861 (builder, 1849 (builder,
1862 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton"))); 1850 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
1863 1851
1864 filename = GNUNET_GTK_filechooser_get_filename_loc (GTK_FILE_CHOOSER (ad)); 1852 filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (ad));
1865 add_file_at_iter (user_data, filename, &bo, do_index, NULL); 1853 add_file_at_iter (user_data, filename, &bo, do_index, NULL);
1866 g_free (filename); 1854 g_free (filename);
1867 update_selectivity (user_data); 1855 update_selectivity (user_data);