[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12432 - gnunet gnunet-gtk/src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12432 - gnunet gnunet-gtk/src |
Date: |
Mon, 2 Aug 2010 14:37:20 +0200 |
Author: grothoff
Date: 2010-08-02 14:37:20 +0200 (Mon, 02 Aug 2010)
New Revision: 12432
Modified:
gnunet-gtk/src/fs_event_handler.c
gnunet-gtk/src/fs_event_handler.h
gnunet/TODO
Log:
done
Modified: gnunet/TODO
===================================================================
--- gnunet/TODO 2010-08-02 08:27:11 UTC (rev 12431)
+++ gnunet/TODO 2010-08-02 12:37:20 UTC (rev 12432)
@@ -18,11 +18,6 @@
* FS: [CG]
- implement 'GNUNET_FS_namespace_list_updateable', reconsider API!
* GNUNET-GTK: [CG]
- - events:
- + implement clear button in search tabs (to stop downloads)
- + search resume
- + download resume
- + publish resume
- namespaces:
+ implement advertise-pseudonym dialog
/ activate menu item if pseudonym is available
@@ -96,7 +91,6 @@
- do meaningful update to status line (starting up, peer running,
#connections, shutdown, ...)
- events:
+ search error
- + download error
+ publish error
+ unindex error
* MONKEY: [Safey]
Modified: gnunet-gtk/src/fs_event_handler.c
===================================================================
--- gnunet-gtk/src/fs_event_handler.c 2010-08-02 08:27:11 UTC (rev 12431)
+++ gnunet-gtk/src/fs_event_handler.c 2010-08-02 12:37:20 UTC (rev 12432)
@@ -74,6 +74,11 @@
*/
GtkTreeRowReference *rr;
+ /**
+ * URI of the file (set after completion).
+ */
+ struct GNUNET_FS_Uri *uri;
+
int is_top;
};
@@ -313,12 +318,40 @@
static struct DownloadEntry *
+mark_download_error (struct DownloadEntry *de,
+ const char *emsg)
+{
+ GtkTreeIter iter;
+ GtkTreePath *path;
+
+ de = change_download_colour (de,
+ "red");
+ de->is_done = GNUNET_YES;
+ path = gtk_tree_row_reference_get_path (de->rr);
+ if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (de->tab->ts),
+ &iter, path))
+ {
+ GNUNET_break (0);
+ gtk_tree_path_free (path);
+ return de;
+ }
+ gtk_tree_path_free (path);
+ gtk_tree_store_set (de->tab->ts, &iter,
+ 4, 0,
+ 7, emsg,
+ -1);
+ return de;
+}
+
+
+static struct DownloadEntry *
mark_download_completed (struct DownloadEntry *de,
uint64_t size,
const char *filename)
{
struct AddDirectoryEntryContext ade;
-
+
+ de->is_done = GNUNET_YES;
(void) mark_download_progress (de, size, size, NULL, 0, 0, 0);
if ( (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (de->meta)) &&
(filename != NULL) )
@@ -838,8 +871,34 @@
}
+/**
+ * Close a publish tab and free associated state.
+ */
+static struct PublishEntry *
+handle_publish_completed (struct PublishEntry *ent,
+ const struct GNUNET_FS_Uri *uri)
+{
+ ent->uri = GNUNET_FS_uri_dup (uri);
+ return change_publish_colour (ent,
+ "green");
+}
+
+
/**
+ * Handle error.
+ */
+static struct PublishEntry *
+handle_publish_error (struct PublishEntry *ent,
+ const char *emsg)
+{
+ GNUNET_break (0);
+ return change_publish_colour (ent,
+ "red");
+}
+
+
+/**
* Close a publish tab and free associated state.
*/
static void
@@ -862,6 +921,8 @@
return;
}
tab = ent->tab;
+ if (ent->uri != NULL)
+ GNUNET_FS_uri_destroy (ent->uri);
GNUNET_free (ent);
notebook = GTK_NOTEBOOK (GNUNET_GTK_get_main_window_object
("GNUNET_GTK_main_window_notebook"));
index = -1;
@@ -905,8 +966,25 @@
gpointer user_data)
{
struct SearchTab *tab = user_data;
+ struct SearchResult *sr;
+ GtkTreeModel *tm;
+ GtkTreeIter iter;
- GNUNET_assert (tab != NULL);
+ tm = GTK_TREE_MODEL (tab->ts);
+ if (TRUE != gtk_tree_model_get_iter_first (tm, &iter))
+ return;
+ do
+ {
+ gtk_tree_model_get (tm, &iter,
+ 9, &sr,
+ -1);
+ if ( (sr->download != NULL) &&
+ (sr->download->is_done == GNUNET_YES) )
+ GNUNET_FS_download_stop (sr->download->dc,
+ GNUNET_YES);
+ }
+ while (TRUE == gtk_tree_model_iter_next (tm, &iter));
+
GNUNET_break (0); /* not implemented */
}
@@ -1010,8 +1088,6 @@
"_search_result_label_clear_button"));
g_signal_connect(G_OBJECT(tab->clear_button), "clicked",
G_CALLBACK(clear_downloads), tab);
- /* FIXME: clear not implemented, hence not visible... */
- gtk_widget_set_visible (tab->clear_button, FALSE);
tab->play_button = GTK_WIDGET (gtk_builder_get_object (tab->builder,
"_search_result_label_play_button"));
g_signal_connect(G_OBJECT(tab->play_button), "clicked",
@@ -1247,6 +1323,16 @@
}
+static struct SearchTab *
+handle_search_error (struct SearchTab *sr,
+ const char *emsg)
+{
+ /* FIXME: implement error handler */
+ GNUNET_break (0);
+ return sr;
+}
+
+
static struct SearchResult *
update_search_result (struct SearchResult *sr,
const struct GNUNET_CONTAINER_MetaData *meta,
@@ -1499,6 +1585,8 @@
GNUNET_GTK_fs_event_handler (void *cls,
const struct GNUNET_FS_ProgressInfo *info)
{
+ void *ret;
+
switch (info->status)
{
case GNUNET_FS_STATUS_PUBLISH_START:
@@ -1507,8 +1595,21 @@
info->value.publish.size,
info->value.publish.pctx);
case GNUNET_FS_STATUS_PUBLISH_RESUME:
- GNUNET_break (0);
- break;
+ ret = setup_publish (info->value.publish.pc,
+ info->value.publish.filename,
+ info->value.publish.size,
+ info->value.publish.pctx);
+ if (info->value.publish.specifics.resume.message != NULL)
+ {
+ ret = handle_publish_error (ret,
+
info->value.publish.specifics.resume.message);
+ }
+ else if (info->value.publish.specifics.resume.chk_uri != NULL)
+ {
+ ret = handle_publish_completed (ret,
+
info->value.publish.specifics.resume.chk_uri);
+ }
+ return ret;
case GNUNET_FS_STATUS_PUBLISH_SUSPEND:
close_publish_tab (info->value.publish.cctx);
return NULL;
@@ -1517,11 +1618,11 @@
info->value.publish.size,
info->value.publish.completed);
case GNUNET_FS_STATUS_PUBLISH_ERROR:
- GNUNET_break (0);
- break;
+ return handle_publish_error (info->value.publish.cctx,
+ info->value.publish.specifics.error.message);
case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
- return change_publish_colour (info->value.publish.cctx,
- "green");
+ return handle_publish_completed (info->value.publish.cctx,
+
info->value.publish.specifics.completed.chk_uri);
case GNUNET_FS_STATUS_PUBLISH_STOPPED:
close_publish_tab (info->value.publish.cctx);
return NULL;
@@ -1535,8 +1636,20 @@
info->value.download.size,
info->value.download.completed);
case GNUNET_FS_STATUS_DOWNLOAD_RESUME:
- GNUNET_break (0);
- break;
+ ret = setup_download (info->value.download.cctx,
+ info->value.download.pctx,
+ info->value.download.sctx,
+ info->value.download.dc,
+ info->value.download.uri,
+ info->value.download.specifics.resume.meta,
+ info->value.download.size,
+ info->value.download.completed);
+ if (info->value.download.specifics.resume.message != NULL)
+ {
+ ret = mark_download_error (ret,
+
info->value.download.specifics.resume.message);
+ }
+ return ret;
case GNUNET_FS_STATUS_DOWNLOAD_SUSPEND:
stop_download (info->value.download.cctx, GNUNET_YES);
return NULL;
@@ -1549,8 +1662,8 @@
info->value.download.specifics.progress.data_len,
info->value.download.specifics.progress.depth);
case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
- return change_download_colour (info->value.download.cctx,
- "red");
+ return mark_download_error (info->value.download.cctx,
+ info->value.download.specifics.error.message);
case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
return mark_download_completed (info->value.download.cctx,
info->value.download.size,
@@ -1578,11 +1691,24 @@
return setup_search (info->value.search.sc,
info->value.search.query);
case GNUNET_FS_STATUS_SEARCH_RESUME:
- GNUNET_break (0);
- break;
+ ret = setup_search (info->value.search.sc,
+ info->value.search.query);
+ if (info->value.search.specifics.resume.message)
+ ret = handle_search_error (ret,
+ info->value.search.specifics.resume.message);
+ return ret;
case GNUNET_FS_STATUS_SEARCH_RESUME_RESULT:
- GNUNET_break (0);
- break;
+ ret = process_search_result (info->value.search.cctx,
+ info->value.search.pctx,
+
info->value.search.specifics.resume_result.uri,
+
info->value.search.specifics.resume_result.meta,
+
info->value.search.specifics.resume_result.result,
+
info->value.search.specifics.resume_result.applicability_rank);
+ return update_search_result (ret,
+
info->value.search.specifics.resume_result.meta,
+
info->value.search.specifics.resume_result.applicability_rank,
+
info->value.search.specifics.resume_result.availability_certainty,
+
info->value.search.specifics.resume_result.availability_rank);
case GNUNET_FS_STATUS_SEARCH_SUSPEND:
close_search_tab (info->value.search.cctx);
return NULL;
@@ -1603,8 +1729,8 @@
info->value.search.specifics.update.availability_certainty,
info->value.search.specifics.update.availability_rank);
case GNUNET_FS_STATUS_SEARCH_ERROR:
- GNUNET_break (0);
- break;
+ return handle_search_error (info->value.search.cctx,
+ info->value.search.specifics.error.message);
case GNUNET_FS_STATUS_SEARCH_PAUSED:
return info->value.search.cctx;
case GNUNET_FS_STATUS_SEARCH_CONTINUED:
Modified: gnunet-gtk/src/fs_event_handler.h
===================================================================
--- gnunet-gtk/src/fs_event_handler.h 2010-08-02 08:27:11 UTC (rev 12431)
+++ gnunet-gtk/src/fs_event_handler.h 2010-08-02 12:37:20 UTC (rev 12432)
@@ -117,6 +117,12 @@
* Tab where this download is currently on display.
*/
struct SearchTab *tab;
+
+ /**
+ * Has the download completed (or errored)?
+ */
+ int is_done;
+
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12432 - gnunet gnunet-gtk/src,
gnunet <=