aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-15 20:44:50 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-15 20:44:50 +0000
commiteaea9009834cc2b421c1b654c2500e709cf18dad (patch)
tree2fa56e0f4a0dd3280c138bd3e7eeafa534dc762f
parent8f34ec400be2260012a5a1b603bb06558c30a7aa (diff)
downloadgnunet-gtk-eaea9009834cc2b421c1b654c2500e709cf18dad.tar.gz
gnunet-gtk-eaea9009834cc2b421c1b654c2500e709cf18dad.zip
-DCE
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_file_publish.c83
1 files changed, 0 insertions, 83 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 7106aebe..8b900699 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -274,89 +274,6 @@ update_selectivity (struct MainPublishingDialogContext *ctx)
274 274
275 275
276/** 276/**
277 * Add a file to the tree model.
278 *
279 * @param filename file to add
280 * @param bo block options to use
281 * @param do_index should we index or insert?
282 * @param iter parent entry, or NULL for top-level addition
283 */
284// FIXME: are we keeping this around for a reason?
285/* static */ void
286add_file_at_iter (struct MainPublishingDialogContext *ctx, const char *filename,
287 const struct GNUNET_FS_BlockOptions *bo, int do_index,
288 GtkTreeIter * iter)
289{
290 struct GNUNET_FS_FileInformation *fi;
291 GtkTreeRowReference *row_reference;
292 GtkTreePath *path;
293 uint64_t file_size;
294 const char *short_fn;
295 struct GNUNET_CONTAINER_MetaData *meta;
296 struct GNUNET_FS_Uri *ksk_uri;
297 GtkTreeIter pos;
298 char *file_size_fancy;
299 const char *ss;
300 struct stat sbuf;
301
302 /* TODO: make directory scanner capable of scanning single files and use
303 * it instead
304 */
305
306 if (0 != STAT (filename, &sbuf))
307 return;
308 if (S_ISDIR (sbuf.st_mode))
309 {
310 file_size = 0;
311 }
312 else
313 {
314 if (GNUNET_OK != GNUNET_DISK_file_size (filename, &file_size, GNUNET_YES))
315 {
316 GNUNET_break (0);
317 return;
318 }
319 }
320
321 meta = GNUNET_CONTAINER_meta_data_create ();
322 GNUNET_FS_meta_data_extract_from_file (meta, filename,
323 GNUNET_FS_GTK_get_le_plugins ());
324 GNUNET_CONTAINER_meta_data_delete (meta, EXTRACTOR_METATYPE_FILENAME, NULL,
325 0);
326 short_fn = filename;
327 while (NULL != (ss = strstr (short_fn, DIR_SEPARATOR_STR)))
328 short_fn = 1 + ss;
329 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet-gtk>",
330 EXTRACTOR_METATYPE_FILENAME,
331 EXTRACTOR_METAFORMAT_UTF8, "text/plain",
332 short_fn, strlen (short_fn) + 1);
333 ksk_uri = GNUNET_FS_uri_ksk_create_from_meta_data (meta);
334 gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, iter, NULL);
335 path = gtk_tree_model_get_path (ctx->file_info_treemodel, &pos);
336 row_reference = gtk_tree_row_reference_new (ctx->file_info_treemodel, path);
337 gtk_tree_path_free (path);
338 fi = GNUNET_FS_file_information_create_from_file (GNUNET_FS_GTK_get_fs_handle
339 (), row_reference, filename,
340 ksk_uri, meta, do_index,
341 bo);
342 GNUNET_CONTAINER_meta_data_destroy (meta);
343 GNUNET_FS_uri_destroy (ksk_uri);
344 if (S_ISDIR (sbuf.st_mode))
345 file_size_fancy = GNUNET_strdup (MARKER_DIR_FILE_SIZE);
346 else
347 file_size_fancy = GNUNET_STRINGS_byte_size_fancy (file_size);
348 gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel), &pos, 0, file_size_fancy, 1, (gboolean) do_index, 2,
349 short_fn, 3, (guint) bo->anonymity_level, 4,
350 (guint) bo->content_priority, 5, fi,
351 6, (guint64) bo->expiration_time.abs_value,
352 7, (guint) bo->replication_level,
353 -1);
354 GNUNET_free (file_size_fancy);
355 update_selectivity (ctx);
356}
357
358
359/**
360 * Add an empty directory to the tree model. 277 * Add an empty directory to the tree model.
361 * 278 *
362 * @param name name for the directory 279 * @param name name for the directory