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.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c
index a7aef9ba..32fc4e88 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -24,6 +24,7 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "gnunet-fs-gtk.h" 26#include "gnunet-fs-gtk.h"
27#include "gnunet-fs-gtk_common.h"
27#include "gnunet-fs-gtk_download-save-as.h" 28#include "gnunet-fs-gtk_download-save-as.h"
28#include "gnunet-fs-gtk_event-handler.h" 29#include "gnunet-fs-gtk_event-handler.h"
29 30
@@ -424,6 +425,10 @@ start_download (GtkTreeView *tree_view,
424 dc->anonymity = anonymity; 425 dc->anonymity = anonymity;
425 dc->is_recursive = is_recursive; 426 dc->is_recursive = is_recursive;
426 dc->tab = tab; 427 dc->tab = tab;
428 fprintf (stderr,
429 "lp %d, have-sug: %d\n",
430 local_parents,
431 have_a_suggestion);
427 if ( (GNUNET_YES == local_parents) && 432 if ( (GNUNET_YES == local_parents) &&
428 (GNUNET_YES == have_a_suggestion) ) 433 (GNUNET_YES == have_a_suggestion) )
429 /* Skip the dialog, call directly */ 434 /* Skip the dialog, call directly */
@@ -1099,44 +1104,6 @@ handle_search_error (struct SearchTab *tab,
1099 1104
1100 1105
1101/** 1106/**
1102 * Obtain the string we will use to describe a search result from
1103 * the respective meta data.
1104 *
1105 * @param meta meta data to inspect
1106 * @return description of the result in utf-8, never NULL
1107 */
1108static char *
1109get_description_from_metadata (const struct GNUNET_CONTAINER_MetaData *meta)
1110{
1111 char *desc;
1112 char *utf8_desc;
1113
1114 desc =
1115 GNUNET_CONTAINER_meta_data_get_first_by_types (meta,
1116 EXTRACTOR_METATYPE_PACKAGE_NAME,
1117 EXTRACTOR_METATYPE_TITLE,
1118 EXTRACTOR_METATYPE_BOOK_TITLE,
1119 EXTRACTOR_METATYPE_FILENAME,
1120 EXTRACTOR_METATYPE_DESCRIPTION,
1121 EXTRACTOR_METATYPE_SUMMARY,
1122 EXTRACTOR_METATYPE_ALBUM,
1123 EXTRACTOR_METATYPE_COMMENT,
1124 EXTRACTOR_METATYPE_SUBJECT,
1125 EXTRACTOR_METATYPE_KEYWORDS,
1126 -1);
1127 if (desc == NULL)
1128 return GNUNET_strdup (_("no description supplied"));
1129 utf8_desc =
1130 GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8, desc,
1131 strlen (desc) + 1);
1132 GNUNET_free (desc);
1133 if (utf8_desc == NULL)
1134 return GNUNET_strdup (_("no description supplied"));
1135 return utf8_desc;
1136}
1137
1138
1139/**
1140 * Obtain the mime type (or format description) will use to describe a search result from 1107 * Obtain the mime type (or format description) will use to describe a search result from
1141 * the respective meta data. 1108 * the respective meta data.
1142 * 1109 *
@@ -1192,7 +1159,7 @@ update_search_result (struct SearchResult *sr,
1192 "Updating search result SR=%p with %d, %u, %u\n", 1159 "Updating search result SR=%p with %d, %u, %u\n",
1193 sr, availability_rank, 1160 sr, availability_rank,
1194 availability_certainty, applicability_rank); 1161 availability_certainty, applicability_rank);
1195 desc = get_description_from_metadata (meta); 1162 desc = GNUNET_FS_GTK_get_description_from_metadata (meta);
1196 mime = get_mimetype_from_metadata (meta); 1163 mime = get_mimetype_from_metadata (meta);
1197 pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); 1164 pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
1198 tp = gtk_tree_row_reference_get_path (sr->rr); 1165 tp = gtk_tree_row_reference_get_path (sr->rr);
@@ -1304,7 +1271,7 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
1304 } 1271 }
1305 uris = GNUNET_FS_uri_to_string (uri); 1272 uris = GNUNET_FS_uri_to_string (uri);
1306 } 1273 }
1307 desc = get_description_from_metadata (meta); 1274 desc = GNUNET_FS_GTK_get_description_from_metadata (meta);
1308 pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); 1275 pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
1309 1276
1310 sr = GNUNET_malloc (sizeof (struct SearchResult)); 1277 sr = GNUNET_malloc (sizeof (struct SearchResult));