[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6819 - gnunet-gtk/src/plugins/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6819 - gnunet-gtk/src/plugins/fs |
Date: |
Tue, 13 May 2008 21:41:13 -0600 (MDT) |
Author: grothoff
Date: 2008-05-13 21:41:04 -0600 (Tue, 13 May 2008)
New Revision: 6819
Modified:
gnunet-gtk/src/plugins/fs/fs.c
gnunet-gtk/src/plugins/fs/namespace.c
gnunet-gtk/src/plugins/fs/namespace_search.c
gnunet-gtk/src/plugins/fs/search.c
gnunet-gtk/src/plugins/fs/search.h
Log:
converting to new namespace / URI APIs
Modified: gnunet-gtk/src/plugins/fs/fs.c
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.c 2008-05-14 03:33:08 UTC (rev 6818)
+++ gnunet-gtk/src/plugins/fs/fs.c 2008-05-14 03:41:04 UTC (rev 6819)
@@ -161,7 +161,12 @@
case GNUNET_FSUI_search_stopped:
fs_search_stopped (event->data.SearchStopped.sc.cctx);
break;
-
+ case GNUNET_FSUI_search_update:
+ fs_search_update (event->data.SearchUpdate.sc.cctx,
+ &event->data.SearchUpdate.fi,
+ event->data.SearchUpdate.availability_rank,
+ event->data.SearchUpdate.applicability_rank);
+ break;
/* download events */
case GNUNET_FSUI_download_aborted:
fs_download_aborted (event->data.DownloadAborted.dc.cctx);
Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c 2008-05-14 03:33:08 UTC (rev
6818)
+++ gnunet-gtk/src/plugins/fs/namespace.c 2008-05-14 03:41:04 UTC (rev
6819)
@@ -433,7 +433,7 @@
label);
gtk_widget_show (notebook);
GNUNET_NS_namespace_list_contents
- (ectx, cfg, namespaceName, &addNamespaceContentToModel, list->model);
+ (ectx, cfg, namespaceId, &addNamespaceContentToModel, list->model);
GNUNET_GTK_DEBUG_END ();
/* enable "delete" menu entry */
@@ -562,7 +562,7 @@
if (GTK_RESPONSE_YES != ret)
return;
gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), num);
- GNUNET_NS_namespace_delete (ectx, cfg, list->name);
+ GNUNET_NS_namespace_delete (ectx, cfg, &list->id);
frame_destroy (list->treeview);
GNUNET_GTK_DEBUG_END ();
}
@@ -571,6 +571,7 @@
{
unsigned int anonymityLevel;
char *namespaceName;
+ GNUNET_HashCode nsid;
GNUNET_Int32Time updateInterval;
GNUNET_HashCode *lastId;
GNUNET_HashCode thisId;
@@ -603,7 +604,7 @@
}
resultURI = GNUNET_NS_add_to_namespace (ectx, cfg, cls->anonymityLevel,
1000, /* FIXME: priority */
GNUNET_get_time () + 2 *
GNUNET_CRON_YEARS, /* FIXME: expiration */
- cls->namespaceName,
+ &cls->nsid,
cls->updateInterval,
cls->lastId,
&cls->thisId, cls->nextId, dst,
@@ -688,6 +689,7 @@
return;
}
cls.namespaceName = list->name;
+ cls.nsid = list->id;
metaXML
= glade_xml_new (GNUNET_GTK_get_glade_filename (),
@@ -796,6 +798,7 @@
return;
}
cls.namespaceName = list->name;
+ cls.nsid = list->id;
/* find out what we are updating */
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (list->treeview));
@@ -837,7 +840,7 @@
if ((cls.updateInterval != GNUNET_ECRS_SBLOCK_UPDATE_SPORADIC) &&
(GNUNET_OK == GNUNET_NS_compute_next_identifier (NULL,
cfg,
- cls.namespaceName,
+ &cls.nsid,
&lastId,
&cls.thisId,
cls.updateInterval,
Modified: gnunet-gtk/src/plugins/fs/namespace_search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace_search.c 2008-05-14 03:33:08 UTC
(rev 6818)
+++ gnunet-gtk/src/plugins/fs/namespace_search.c 2008-05-14 03:41:04 UTC
(rev 6819)
@@ -51,6 +51,7 @@
char *description;
int rating;
int newrating;
+ GNUNET_HashCode nsid;
GNUNET_GTK_DEBUG_BEGIN ();
spin =
@@ -78,9 +79,11 @@
{
if (encStr != NULL)
{
+ GNUNET_enc_to_hash(encStr,
+ &nsid);
newrating = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spin));
rating = GNUNET_NS_namespace_rank (ectx,
- cfg, encStr,
+ cfg, &nsid,
newrating - rating);
if (rating != newrating)
{
@@ -160,7 +163,7 @@
= glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
"fssearchKeywordComboBoxEntry");
if (GNUNET_OK ==
- GNUNET_NS_namespace_get_root (ectx, cfg, encStr, &root))
+ GNUNET_NS_namespace_get_root (ectx, cfg, &ns, &root))
{
GNUNET_hash_to_enc (&root, &enc);
gtk_entry_set_text (GTK_ENTRY
Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c 2008-05-14 03:33:08 UTC (rev 6818)
+++ gnunet-gtk/src/plugins/fs/search.c 2008-05-14 03:41:04 UTC (rev 6819)
@@ -194,6 +194,23 @@
updateSearchSummary (searchContext);
}
+/**
+ * Update the applicability and availability rating
+ * for the given search result.
+ *
+ * @param info the search result (and metadata)
+ * @param availability_rank availability estimate
+ * @param applicability_rank relevance
+ */
+void fs_search_update (SearchList * searchContext,
+ const GNUNET_ECRS_FileInfo * info,
+ int availability_rank,
+ unsigned int applicability_rank)
+{
+ /* FIXME */
+}
+
+
static int
on_search_copy_uri_activate (void *cls, GtkWidget * searchEntry)
{
@@ -389,7 +406,6 @@
SearchList *list;
gint pages;
char *description;
- const char *dhead;
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkNotebook *notebook;
@@ -419,26 +435,18 @@
}
/* build new entry */
- description = GNUNET_ECRS_uri_to_string (uri);
+ if (GNUNET_ECRS_uri_test_ksk(uri))
+ description = GNUNET_ECRS_ksk_uri_to_human_readable_string (uri);
+ else
+ description = GNUNET_NS_sks_uri_to_human_readable_string (ectx, cfg, uri);
if (description == NULL)
{
GNUNET_GE_BREAK (ectx, 0);
return NULL;
}
- GNUNET_GE_ASSERT (ectx,
- strlen (description) >= strlen (GNUNET_ECRS_URI_PREFIX));
- dhead = &description[strlen (GNUNET_ECRS_URI_PREFIX)];
- if (0 ==
- strncmp (dhead, GNUNET_ECRS_SEARCH_INFIX,
- strlen (GNUNET_ECRS_SEARCH_INFIX)))
- dhead = &dhead[strlen (GNUNET_ECRS_SEARCH_INFIX)];
- else if (0 == strncmp (dhead,
- GNUNET_ECRS_SUBSPACE_INFIX,
- strlen (GNUNET_ECRS_SUBSPACE_INFIX)))
- dhead = &dhead[strlen (GNUNET_ECRS_SUBSPACE_INFIX)];
list = GNUNET_malloc (sizeof (SearchList));
memset (list, 0, sizeof (SearchList));
- list->searchString = GNUNET_strdup (dhead);
+ list->searchString = description;
list->uri = GNUNET_ECRS_uri_duplicate (uri);
list->fsui_list = fsui_list;
list->next = search_head;
@@ -585,10 +593,9 @@
gtk_list_store_append (search_summary, &iter);
gtk_list_store_set (search_summary,
&iter,
- SEARCH_SUMMARY_NAME, dhead,
+ SEARCH_SUMMARY_NAME, description,
SEARCH_SUMMARY_RESULT_COUNT, 0,
SEARCH_SUMMARY_INTERNAL, list, -1);
- GNUNET_free (description);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (search_summary), &iter);
list->summaryViewRowReference
= gtk_tree_row_reference_new (GTK_TREE_MODEL (search_summary), path);
Modified: gnunet-gtk/src/plugins/fs/search.h
===================================================================
--- gnunet-gtk/src/plugins/fs/search.h 2008-05-14 03:33:08 UTC (rev 6818)
+++ gnunet-gtk/src/plugins/fs/search.h 2008-05-14 03:41:04 UTC (rev 6819)
@@ -54,6 +54,19 @@
const struct GNUNET_ECRS_URI *uri);
/**
+ * Update the applicability and availability rating
+ * for the given search result.
+ *
+ * @param info the search result (and metadata)
+ * @param availability_rank availability estimate
+ * @param applicability_rank relevance
+ */
+void fs_search_update (SearchList * searchContext,
+ const GNUNET_ECRS_FileInfo * info,
+ int availability_rank,
+ unsigned int applicability_rank);
+
+/**
* A search has been started. Open tab.
*
* @return internal search context
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6819 - gnunet-gtk/src/plugins/fs,
gnunet <=