diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-16 19:38:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-16 19:38:57 +0000 |
commit | 406fdbcea181a64fc0e00fabd72313b58bc27569 (patch) | |
tree | 28a4c59a4d8a9edde70941601e2b1d8738fa37fb | |
parent | 9c58021e5b2263ec7ab57d56bcba9c37eb609677 (diff) | |
download | gnunet-gtk-406fdbcea181a64fc0e00fabd72313b58bc27569.tar.gz gnunet-gtk-406fdbcea181a64fc0e00fabd72313b58bc27569.zip |
-working animations for most cases
-rw-r--r-- | contrib/gnunet_fs_gtk_publish_tab.glade | 2 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 52 | ||||
-rw-r--r-- | src/lib/animations.c | 3 |
3 files changed, 50 insertions, 7 deletions
diff --git a/contrib/gnunet_fs_gtk_publish_tab.glade b/contrib/gnunet_fs_gtk_publish_tab.glade index cb59bab2..2764b605 100644 --- a/contrib/gnunet_fs_gtk_publish_tab.glade +++ b/contrib/gnunet_fs_gtk_publish_tab.glade | |||
@@ -107,7 +107,7 @@ | |||
107 | <property name="label" translatable="yes">Publishing</property> | 107 | <property name="label" translatable="yes">Publishing</property> |
108 | </object> | 108 | </object> |
109 | <packing> | 109 | <packing> |
110 | <property name="expand">True</property> | 110 | <property name="expand">False</property> |
111 | <property name="fill">False</property> | 111 | <property name="fill">False</property> |
112 | <property name="padding">5</property> | 112 | <property name="padding">5</property> |
113 | <property name="position">0</property> | 113 | <property name="position">0</property> |
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); |
diff --git a/src/lib/animations.c b/src/lib/animations.c index bab9257f..b3f6bf5e 100644 --- a/src/lib/animations.c +++ b/src/lib/animations.c | |||
@@ -235,7 +235,8 @@ redraw_tree_view (struct GNUNET_FS_AnimationTreeViewHandle *atv) | |||
235 | gint width; | 235 | gint width; |
236 | 236 | ||
237 | gw = gtk_widget_get_window (GTK_WIDGET (atv->tv)); | 237 | gw = gtk_widget_get_window (GTK_WIDGET (atv->tv)); |
238 | 238 | if (! gtk_widget_get_realized (GTK_WIDGET (atv->tv))) | |
239 | return; | ||
239 | /* Get column x and width in bin window coordinates */ | 240 | /* Get column x and width in bin window coordinates */ |
240 | gtk_tree_view_get_cell_area (atv->tv, NULL, atv->image_col, &r); | 241 | gtk_tree_view_get_cell_area (atv->tv, NULL, atv->image_col, &r); |
241 | /* Convert x and width to window coordinates */ | 242 | /* Convert x and width to window coordinates */ |