diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 52 |
1 files changed, 47 insertions, 5 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index 0e02a719..e77f7fd5 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -2376,6 +2376,33 @@ mark_download_progress (struct DownloadEntry *de, | |||
2376 | 2376 | ||
2377 | 2377 | ||
2378 | /** | 2378 | /** |
2379 | * Change the status icon for the download. | ||
2380 | * | ||
2381 | * @param de download that had an error | ||
2382 | * @param icon status icon to display | ||
2383 | */ | ||
2384 | static void | ||
2385 | change_download_status_icon (struct DownloadEntry *de, | ||
2386 | GdkPixbuf *icon) | ||
2387 | { | ||
2388 | GtkTreeIter iter; | ||
2389 | GtkTreePath *path; | ||
2390 | |||
2391 | path = gtk_tree_row_reference_get_path (de->sr->rr); | ||
2392 | if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (de->sr->tab->ts), &iter, path)) | ||
2393 | { | ||
2394 | GNUNET_break (0); | ||
2395 | gtk_tree_path_free (path); | ||
2396 | return; | ||
2397 | } | ||
2398 | gtk_tree_path_free (path); | ||
2399 | gtk_tree_store_set (de->sr->tab->ts, &iter, | ||
2400 | SEARCH_TAB_MC_STATUS_ICON, icon, | ||
2401 | -1); | ||
2402 | } | ||
2403 | |||
2404 | |||
2405 | /** | ||
2379 | * FS-API encountered an error downloading a file. Update the | 2406 | * FS-API encountered an error downloading a file. Update the |
2380 | * view accordingly. | 2407 | * view accordingly. |
2381 | * | 2408 | * |
@@ -2402,6 +2429,7 @@ mark_download_error (struct DownloadEntry *de, | |||
2402 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2429 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2403 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 0, | 2430 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 0, |
2404 | SEARCH_TAB_MC_URI_AS_STRING, emsg, | 2431 | SEARCH_TAB_MC_URI_AS_STRING, emsg, |
2432 | SEARCH_TAB_MC_STATUS_ICON, NULL /* FIXME: error icon? */, | ||
2405 | -1); | 2433 | -1); |
2406 | } | 2434 | } |
2407 | 2435 | ||
@@ -2432,6 +2460,8 @@ mark_download_completed (struct DownloadEntry *de, uint64_t size) | |||
2432 | gtk_tree_store_set (de->sr->tab->ts, &iter, | 2460 | gtk_tree_store_set (de->sr->tab->ts, &iter, |
2433 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100, | 2461 | SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100, |
2434 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100, | 2462 | SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100, |
2463 | SEARCH_TAB_MC_STATUS_ICON, | ||
2464 | GNUNET_GTK_animation_context_get_pixbuf (animation_downloaded), | ||
2435 | -1); | 2465 | -1); |
2436 | } | 2466 | } |
2437 | 2467 | ||
@@ -2575,6 +2605,7 @@ setup_download (struct DownloadEntry *de, struct DownloadEntry *pde, | |||
2575 | SEARCH_TAB_MC_COMPLETED, (guint64) completed, | 2605 | SEARCH_TAB_MC_COMPLETED, (guint64) completed, |
2576 | SEARCH_TAB_MC_FILENAME, de->filename, | 2606 | SEARCH_TAB_MC_FILENAME, de->filename, |
2577 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity, | 2607 | SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity, |
2608 | GNUNET_GTK_animation_context_get_pixbuf (animation_download_stalled), | ||
2578 | -1); | 2609 | -1); |
2579 | return de; | 2610 | return de; |
2580 | } | 2611 | } |
@@ -2703,6 +2734,8 @@ handle_publish_error (struct PublishEntry *pe, | |||
2703 | gtk_tree_path_free (path); | 2734 | gtk_tree_path_free (path); |
2704 | gtk_tree_store_set (pe->tab->ts, &iter, | 2735 | gtk_tree_store_set (pe->tab->ts, &iter, |
2705 | PUBLISH_TAB_MC_RESULT_STRING, emsg, | 2736 | PUBLISH_TAB_MC_RESULT_STRING, emsg, |
2737 | PUBLISH_TAB_MC_PROGRESS, 100, | ||
2738 | PUBLISH_TAB_MC_STATUS_ICON, NULL /* FIXME: error status icon? */, | ||
2706 | -1); | 2739 | -1); |
2707 | change_publish_color (pe, "red"); | 2740 | change_publish_color (pe, "red"); |
2708 | } | 2741 | } |
@@ -2715,23 +2748,28 @@ static void | |||
2715 | delete_publish_tab () | 2748 | delete_publish_tab () |
2716 | { | 2749 | { |
2717 | GtkNotebook *notebook; | 2750 | GtkNotebook *notebook; |
2751 | struct PublishTab *pt; | ||
2718 | int index; | 2752 | int index; |
2719 | int i; | 2753 | int i; |
2720 | 2754 | ||
2755 | if (NULL == publish_tab) | ||
2756 | return; | ||
2757 | pt = publish_tab; | ||
2758 | publish_tab = NULL; | ||
2721 | notebook = | 2759 | notebook = |
2722 | GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object | 2760 | GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object |
2723 | ("GNUNET_GTK_main_window_notebook")); | 2761 | ("GNUNET_GTK_main_window_notebook")); |
2724 | index = -1; | 2762 | index = -1; |
2725 | for (i = gtk_notebook_get_n_pages (notebook) - 1; i >= 0; i--) | 2763 | for (i = gtk_notebook_get_n_pages (notebook) - 1; i >= 0; i--) |
2726 | if (publish_tab->frame == gtk_notebook_get_nth_page (notebook, i)) | 2764 | if (pt->frame == gtk_notebook_get_nth_page (notebook, i)) |
2727 | index = i; | 2765 | index = i; |
2728 | gtk_notebook_remove_page (notebook, index); | 2766 | gtk_notebook_remove_page (notebook, index); |
2729 | 2767 | ||
2730 | /* fully destroy tab */ | 2768 | /* fully destroy tab */ |
2731 | g_object_unref (publish_tab->builder); | 2769 | g_object_unref (pt->builder); |
2732 | if (NULL != publish_tab->atv) | 2770 | if (NULL != pt->atv) |
2733 | GNUNET_GTK_animation_tree_view_unregister (publish_tab->atv); | 2771 | GNUNET_GTK_animation_tree_view_unregister (pt->atv); |
2734 | GNUNET_free (publish_tab); | 2772 | GNUNET_free (pt); |
2735 | publish_tab = NULL; | 2773 | publish_tab = NULL; |
2736 | GNUNET_GTK_animation_context_destroy (animation_publishing); | 2774 | GNUNET_GTK_animation_context_destroy (animation_publishing); |
2737 | animation_publishing = NULL; | 2775 | animation_publishing = NULL; |
@@ -3255,9 +3293,13 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
3255 | return NULL; | 3293 | return NULL; |
3256 | case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: | 3294 | case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE: |
3257 | change_download_color (info->value.download.cctx, "yellow"); | 3295 | change_download_color (info->value.download.cctx, "yellow"); |
3296 | change_download_status_icon (info->value.download.cctx, | ||
3297 | GNUNET_GTK_animation_context_get_pixbuf (animation_downloading)); | ||
3258 | return info->value.download.cctx; | 3298 | return info->value.download.cctx; |
3259 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: | 3299 | case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE: |
3260 | change_download_color (info->value.download.cctx, "blue"); | 3300 | change_download_color (info->value.download.cctx, "blue"); |
3301 | change_download_status_icon (info->value.download.cctx, | ||
3302 | GNUNET_GTK_animation_context_get_pixbuf (animation_download_stalled)); | ||
3261 | return info->value.download.cctx; | 3303 | return info->value.download.cctx; |
3262 | case GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT: | 3304 | case GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT: |
3263 | download_lost_parent (info->value.download.cctx); | 3305 | download_lost_parent (info->value.download.cctx); |