aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-01-29 14:46:35 +0000
committerChristian Grothoff <christian@grothoff.org>2012-01-29 14:46:35 +0000
commit8c4ec1ab2417b24a62148c8210783e620233bdc7 (patch)
tree591af572caa82d31b8189e68f9e84d395ef20f5e
parent11c61b3c3cf92f3b4dd85a269b0ff7cfb8ae2a9e (diff)
downloadgnunet-gtk-8c4ec1ab2417b24a62148c8210783e620233bdc7.tar.gz
gnunet-gtk-8c4ec1ab2417b24a62148c8210783e620233bdc7.zip
-fix compile errors
-rw-r--r--src/fs/gnunet-fs-gtk-main_window_file_publish.c52
1 files changed, 21 insertions, 31 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 bf113ca6..ca9a1500 100644
--- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c
+++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c
@@ -984,7 +984,7 @@ cancel_scan (struct AddDirClientContext *adcc)
984 if (adcc->ds != NULL) 984 if (adcc->ds != NULL)
985 { 985 {
986 /* Still scanning - signal the scanner to finish */ 986 /* Still scanning - signal the scanner to finish */
987 GNUNET_FS_directory_scan_finish (adcc->ds, GNUNET_NO); 987 GNUNET_FS_directory_scan_abort (adcc->ds);
988 result = GNUNET_NO; 988 result = GNUNET_NO;
989 } 989 }
990 if (adcc->directory_scan_result != NULL) 990 if (adcc->directory_scan_result != NULL)
@@ -1039,17 +1039,18 @@ directory_trim_complete (void *cls,
1039 } 1039 }
1040} 1040}
1041 1041
1042static int 1042static void
1043directory_scan_cb (void *cls, struct GNUNET_FS_DirScanner *ds, 1043directory_scan_cb (void *cls, struct GNUNET_FS_DirScanner *ds,
1044 const char *filename, int is_directory, 1044 const char *filename, int is_directory,
1045 enum GNUNET_FS_DirScannerProgressUpdateReason reason) 1045 enum GNUNET_FS_DirScannerProgressUpdateReason reason)
1046{ 1046{
1047 struct AddDirClientContext *adcc = cls; 1047 struct AddDirClientContext *adcc = cls;
1048 char *s; 1048 char *s;
1049
1049 gtk_progress_bar_pulse (adcc->progress_dialog_bar); 1050 gtk_progress_bar_pulse (adcc->progress_dialog_bar);
1050 switch (reason) 1051 switch (reason)
1051 { 1052 {
1052 case GNUNET_FS_DIRSCANNER_NEW_FILE: 1053 case GNUNET_FS_DIRSCANNER_FILE_START:
1053 if (filename != NULL) 1054 if (filename != NULL)
1054 { 1055 {
1055 if (is_directory) 1056 if (is_directory)
@@ -1071,7 +1072,7 @@ directory_scan_cb (void *cls, struct GNUNET_FS_DirScanner *ds,
1071 GNUNET_free (s); 1072 GNUNET_free (s);
1072 } 1073 }
1073 break; 1074 break;
1074 case GNUNET_FS_DIRSCANNER_ASKED_TO_STOP: 1075 case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR:
1075 if (filename != NULL) 1076 if (filename != NULL)
1076 { 1077 {
1077 GNUNET_asprintf (&s, 1078 GNUNET_asprintf (&s,
@@ -1083,43 +1084,32 @@ directory_scan_cb (void *cls, struct GNUNET_FS_DirScanner *ds,
1083 else 1084 else
1084 insert_progress_dialog_text (adcc, _("Scanner is stopping.\n")); 1085 insert_progress_dialog_text (adcc, _("Scanner is stopping.\n"));
1085 break; 1086 break;
1086 case GNUNET_FS_DIRSCANNER_SHUTDOWN:
1087 insert_progress_dialog_text (adcc, _("Client is shutting down.\n"));
1088 break;
1089 case GNUNET_FS_DIRSCANNER_FINISHED: 1087 case GNUNET_FS_DIRSCANNER_FINISHED:
1090 insert_progress_dialog_text (adcc, _("Scanner has finished.\n")); 1088 insert_progress_dialog_text (adcc, _("Scanner has finished.\n"));
1091 break; 1089 break;
1092 case GNUNET_FS_DIRSCANNER_PROTOCOL_ERROR: 1090 case GNUNET_FS_DIRSCANNER_ALL_COUNTED:
1093 insert_progress_dialog_text (adcc, 1091 // FIXME...
1094 _("There was a failure communicating with the scanner.\n"));
1095 adcc->keep = 1;
1096 break; 1092 break;
1097 default: 1093 case GNUNET_FS_DIRSCANNER_SUBTREE_COUNTED:
1094 // FIXME...
1095 break;
1096 case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
1097 // FIXME...
1098 GNUNET_asprintf (&s,_("Got unknown scanner update with filename `%s'.\n"), 1098 GNUNET_asprintf (&s,_("Got unknown scanner update with filename `%s'.\n"),
1099 filename); 1099 filename);
1100 insert_progress_dialog_text (adcc, s); 1100 insert_progress_dialog_text (adcc, s);
1101 GNUNET_free (s); 1101 GNUNET_free (s);
1102 adcc->directory_scan_intermediary_result = GNUNET_FS_directory_scan_get_result (ds);
1103 GNUNET_FS_share_tree_trim (adcc->directory_scan_intermediary_result);
1104 // FIXME...
1105 directory_trim_complete (adcc, NULL);
1106 adcc->ds = NULL;
1102 adcc->keep = 1; 1107 adcc->keep = 1;
1103 break; 1108 break;
1104 } 1109 }
1105 if ((filename == NULL && GNUNET_FS_DIRSCANNER_FINISHED)
1106 || reason == GNUNET_FS_DIRSCANNER_PROTOCOL_ERROR
1107 || reason == GNUNET_FS_DIRSCANNER_SHUTDOWN)
1108 {
1109 /* Any of this causes us to try to clean up the scanner */
1110 adcc->directory_scan_intermediary_result = GNUNET_FS_directory_scan_cleanup (ds);
1111 adcc->pmc = GNUNET_FS_trim_share_tree (adcc->directory_scan_intermediary_result,
1112 &directory_trim_complete, adcc);
1113
1114 adcc->ds = NULL;
1115 /* FIXME: change the tree processor to be able to free untrimmed trees
1116 * right here instead of waiting for trimming to complete, if we need to
1117 * cancel everything.
1118 */
1119 }
1120 return 0;
1121} 1110}
1122 1111
1112
1123void 1113void
1124scan_file_or_directory (struct MainPublishingDialogContext *ctx, gchar *filename, 1114scan_file_or_directory (struct MainPublishingDialogContext *ctx, gchar *filename,
1125 struct GNUNET_FS_BlockOptions *bo, int do_index) 1115 struct GNUNET_FS_BlockOptions *bo, int do_index)
@@ -1131,7 +1121,7 @@ scan_file_or_directory (struct MainPublishingDialogContext *ctx, gchar *filename
1131 adcc->ctx = ctx; 1121 adcc->ctx = ctx;
1132 GNUNET_CONTAINER_DLL_insert_tail (ctx->adddir_head, ctx->adddir_tail, adcc); 1122 GNUNET_CONTAINER_DLL_insert_tail (ctx->adddir_head, ctx->adddir_tail, adcc);
1133 adcc->ds = GNUNET_FS_directory_scan_start (filename, 1123 adcc->ds = GNUNET_FS_directory_scan_start (filename,
1134 GNUNET_NO, NULL, directory_scan_cb, adcc); 1124 GNUNET_NO, NULL, &directory_scan_cb, adcc);
1135 adcc->directory_scan_bo = *bo; 1125 adcc->directory_scan_bo = *bo;
1136 adcc->directory_scan_do_index = do_index; 1126 adcc->directory_scan_do_index = do_index;
1137 1127