[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20041 - gnunet-gtk/src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20041 - gnunet-gtk/src/fs |
Date: |
Sun, 26 Feb 2012 16:25:30 +0100 |
Author: grothoff
Date: 2012-02-26 16:25:29 +0100 (Sun, 26 Feb 2012)
New Revision: 20041
Modified:
gnunet-gtk/src/fs/gnunet-fs-gtk_common.c
gnunet-gtk/src/fs/gnunet-fs-gtk_common.h
gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
Log:
LRN: Adds a way for GNUNET_FS_GTK_get_description_from_metadata() to
convey to you the fact that the description it returned is a
placeholder, and that metadata didn't really have any description.
This capability is not used at the moment (the code that used it was
only present in early namespace manager draft).
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_common.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_common.c 2012-02-26 15:23:40 UTC (rev
20040)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_common.c 2012-02-26 15:25:29 UTC (rev
20041)
@@ -253,10 +253,13 @@
* the respective meta data.
*
* @param meta meta data to inspect
+ * @param is_a_dup is set to GNUNET_YES if the result is a dup, and there was
+ * no description to be found. GNUNET_NO otherwise.
* @return description of the result in utf-8, never NULL
*/
char *
-GNUNET_FS_GTK_get_description_from_metadata (const struct
GNUNET_CONTAINER_MetaData *meta)
+GNUNET_FS_GTK_get_description_from_metadata (
+ const struct GNUNET_CONTAINER_MetaData *meta, int *is_a_dup)
{
char *desc;
char *utf8_desc;
@@ -276,13 +279,20 @@
EXTRACTOR_METATYPE_KEYWORDS,
-1);
if (desc == NULL)
+ {
+ *is_a_dup = GNUNET_YES;
return GNUNET_strdup (_("no description supplied"));
+ }
utf8_desc =
GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8, desc,
strlen (desc) + 1);
GNUNET_free (desc);
if (utf8_desc == NULL)
+ {
+ *is_a_dup = GNUNET_YES;
return GNUNET_strdup (_("no description supplied"));
+ }
+ *is_a_dup = GNUNET_NO;
return utf8_desc;
}
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_common.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_common.h 2012-02-26 15:23:40 UTC (rev
20040)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_common.h 2012-02-26 15:25:29 UTC (rev
20041)
@@ -129,10 +129,13 @@
* the respective meta data.
*
* @param meta meta data to inspect
+ * @param is_a_dup is set to GNUNET_YES if the result is a dup, and there was
+ * no description to be found. GNUNET_NO otherwise.
* @return description of the result in utf-8, never NULL
*/
char *
-GNUNET_FS_GTK_get_description_from_metadata (const struct
GNUNET_CONTAINER_MetaData *meta);
+GNUNET_FS_GTK_get_description_from_metadata (
+ const struct GNUNET_CONTAINER_MetaData *meta, int *is_a_dup);
/**
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c 2012-02-26 15:23:40 UTC
(rev 20040)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c 2012-02-26 15:25:29 UTC
(rev 20041)
@@ -1456,6 +1456,7 @@
guint percent_avail;
GtkNotebook *notebook;
gint page;
+ int desc_is_a_dup;
if (sr == NULL)
{
@@ -1466,7 +1467,7 @@
"Updating search result SR=%p with %d, %u, %u\n",
sr, availability_rank,
availability_certainty, applicability_rank);
- desc = GNUNET_FS_GTK_get_description_from_metadata (meta);
+ desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup);
mime = get_mimetype_from_metadata (meta);
pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
tp = gtk_tree_row_reference_get_path (sr->rr);
@@ -1549,6 +1550,7 @@
GtkTreeModel *tm;
GtkTreeStore *ts;
uint64_t fsize;
+ int desc_is_a_dup;
if (NULL == uri)
{
@@ -1577,7 +1579,7 @@
}
uris = GNUNET_FS_uri_to_string (uri);
}
- desc = GNUNET_FS_GTK_get_description_from_metadata (meta);
+ desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup);
pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
sr = GNUNET_malloc (sizeof (struct SearchResult));
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
2012-02-26 15:23:40 UTC (rev 20040)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_main-window-namespace-dropdown.c
2012-02-26 15:25:29 UTC (rev 20041)
@@ -329,6 +329,7 @@
char *ns_name;
GNUNET_HashCode *nsid;
char *description;
+ int desc_is_a_dup;
char *uris;
char *emsg;
struct GNUNET_FS_Uri *uri;
@@ -350,32 +351,7 @@
root = GNUNET_FS_uri_sks_get_content_id (uri);
GNUNET_FS_uri_destroy (uri);
}
- description =
- GNUNET_CONTAINER_meta_data_get_first_by_types (md,
- EXTRACTOR_METATYPE_TITLE,
-
EXTRACTOR_METATYPE_BOOK_TITLE,
-
EXTRACTOR_METATYPE_DESCRIPTION,
-
EXTRACTOR_METATYPE_SUMMARY,
- EXTRACTOR_METATYPE_ALBUM,
-
EXTRACTOR_METATYPE_COMMENT,
-
EXTRACTOR_METATYPE_SUBJECT,
-
EXTRACTOR_METATYPE_KEYWORDS,
- -1);
- if (description == NULL)
- description = GNUNET_strdup (_("no description supplied"));
- else
- {
- char *utf8_desc = NULL;
-
- utf8_desc =
- GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8,
- description, strlen (description));
- GNUNET_free (description);
- if (utf8_desc != NULL)
- description = utf8_desc;
- else
- description = NULL;
- }
+ description = GNUNET_FS_GTK_get_description_from_metadata (md,
&desc_is_a_dup);
gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT,
0, ns_name,
1, nsid,
@@ -384,7 +360,7 @@
-1);
GNUNET_free (ns_name);
GNUNET_free_non_null (root);
- GNUNET_free_non_null (description);
+ GNUNET_free (description);
return GNUNET_OK;
}
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c 2012-02-26 15:23:40 UTC
(rev 20040)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c 2012-02-26 15:25:29 UTC
(rev 20041)
@@ -1903,6 +1903,7 @@
GtkTreeIter iter;
GtkTreeIter titer;
char *desc;
+ int desc_is_a_dup;
GNUNET_HashCode hc;
uc->update_called = GNUNET_YES;
@@ -1912,7 +1913,7 @@
GNUNET_CONTAINER_multihashmap_put (uc->seen, &hc, "dummy",
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
/* FIXME-BUG-MAYBE: what if this put fails? Not convinced it cannot... */
- desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta);
+ desc = GNUNET_FS_GTK_get_description_from_metadata (last_meta,
&desc_is_a_dup);
gtk_tree_store_insert_with_values (uc->ts, &iter, uc->parent, G_MAXINT, 0,
uc->namespace_name, 1,
GNUNET_FS_namespace_dup (uc->ns), 2,
last_id,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20041 - gnunet-gtk/src/fs,
gnunet <=