diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-16 19:14:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-16 19:14:55 +0000 |
commit | 9c58021e5b2263ec7ab57d56bcba9c37eb609677 (patch) | |
tree | bf510aa7b1860a81ea16fda8d9a0bf54fc7e8f57 | |
parent | 867cbecd72070b03dec1b6b88817dfd4d63e52af (diff) | |
download | gnunet-gtk-9c58021e5b2263ec7ab57d56bcba9c37eb609677.tar.gz gnunet-gtk-9c58021e5b2263ec7ab57d56bcba9c37eb609677.zip |
-towards status icons for searching
-rw-r--r-- | contrib/Makefile.am | 1 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 70 | ||||
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.h | 5 |
3 files changed, 75 insertions, 1 deletions
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 8025fe6a..48d2c230 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -14,6 +14,7 @@ EXTRA_DIST = \ | |||
14 | 14 | ||
15 | pkgdata_DATA = \ | 15 | pkgdata_DATA = \ |
16 | downloading.gif \ | 16 | downloading.gif \ |
17 | downloading_not_receiving.gif \ | ||
17 | downloaded.gif \ | 18 | downloaded.gif \ |
18 | found_source.gif \ | 19 | found_source.gif \ |
19 | published.gif \ | 20 | published.gif \ |
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index 81a23ad1..0e02a719 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -260,6 +260,36 @@ static struct PublishTab *publish_tab; | |||
260 | */ | 260 | */ |
261 | static struct GNUNET_FS_AnimationContext *animation_publishing; | 261 | static struct GNUNET_FS_AnimationContext *animation_publishing; |
262 | 262 | ||
263 | /** | ||
264 | * Animation to display after publishing is complete. | ||
265 | */ | ||
266 | static struct GNUNET_FS_AnimationContext *animation_published; | ||
267 | |||
268 | /** | ||
269 | * Animation to display while downloading. | ||
270 | */ | ||
271 | static struct GNUNET_FS_AnimationContext *animation_downloading; | ||
272 | |||
273 | /** | ||
274 | * Animation to display after downloading is complete. | ||
275 | */ | ||
276 | static struct GNUNET_FS_AnimationContext *animation_downloaded; | ||
277 | |||
278 | /** | ||
279 | * Animation to display if a download has stalled. | ||
280 | */ | ||
281 | static struct GNUNET_FS_AnimationContext *animation_download_stalled; | ||
282 | |||
283 | /** | ||
284 | * Animation to display while searching for sources to download from. | ||
285 | */ | ||
286 | static struct GNUNET_FS_AnimationContext *animation_searching_sources; | ||
287 | |||
288 | /** | ||
289 | * Animation to display if we found sources to download from. | ||
290 | */ | ||
291 | static struct GNUNET_FS_AnimationContext *animation_found_sources; | ||
292 | |||
263 | 293 | ||
264 | 294 | ||
265 | /* ***************** Search event handling ****************** */ | 295 | /* ***************** Search event handling ****************** */ |
@@ -1013,7 +1043,23 @@ close_search_tab (struct SearchTab *tab) | |||
1013 | GNUNET_CONTAINER_DLL_remove (search_tab_head, search_tab_tail, tab); | 1043 | GNUNET_CONTAINER_DLL_remove (search_tab_head, search_tab_tail, tab); |
1014 | if (tab == uri_tab) | 1044 | if (tab == uri_tab) |
1015 | uri_tab = NULL; | 1045 | uri_tab = NULL; |
1046 | if (NULL != tab->atv) | ||
1047 | GNUNET_GTK_animation_tree_view_unregister (tab->atv); | ||
1016 | GNUNET_free (tab); | 1048 | GNUNET_free (tab); |
1049 | if (NULL == search_tab_head) | ||
1050 | { | ||
1051 | GNUNET_GTK_animation_context_destroy (animation_downloading); | ||
1052 | animation_downloading = NULL; | ||
1053 | GNUNET_GTK_animation_context_destroy (animation_downloaded); | ||
1054 | animation_downloaded = NULL; | ||
1055 | GNUNET_GTK_animation_context_destroy (animation_download_stalled); | ||
1056 | animation_download_stalled = NULL; | ||
1057 | GNUNET_GTK_animation_context_destroy (animation_searching_sources); | ||
1058 | animation_searching_sources = NULL; | ||
1059 | GNUNET_GTK_animation_context_destroy (animation_found_sources); | ||
1060 | animation_found_sources = NULL; | ||
1061 | |||
1062 | } | ||
1017 | } | 1063 | } |
1018 | 1064 | ||
1019 | 1065 | ||
@@ -1921,8 +1967,18 @@ setup_search_tab (struct GNUNET_FS_SearchContext *sc, | |||
1921 | struct SearchTab *tab; | 1967 | struct SearchTab *tab; |
1922 | GtkNotebook *notebook; | 1968 | GtkNotebook *notebook; |
1923 | GtkWindow *sf; | 1969 | GtkWindow *sf; |
1970 | GtkTreeViewColumn *anim_col; | ||
1971 | GtkTreeView *tv; | ||
1924 | gint pages; | 1972 | gint pages; |
1925 | 1973 | ||
1974 | if (NULL == animation_downloading) | ||
1975 | { | ||
1976 | animation_downloading = load_animation ("downloading"); | ||
1977 | animation_downloaded = load_animation ("downloaded"); | ||
1978 | animation_download_stalled = load_animation ("downloading_not_receiving"); | ||
1979 | animation_searching_sources = load_animation ("searching_sources"); | ||
1980 | animation_found_sources = load_animation ("found_source"); | ||
1981 | } | ||
1926 | tab = GNUNET_malloc (sizeof (struct SearchTab)); | 1982 | tab = GNUNET_malloc (sizeof (struct SearchTab)); |
1927 | GNUNET_CONTAINER_DLL_insert (search_tab_head, search_tab_tail, tab); | 1983 | GNUNET_CONTAINER_DLL_insert (search_tab_head, search_tab_tail, tab); |
1928 | tab->sc = sc; | 1984 | tab->sc = sc; |
@@ -1945,6 +2001,12 @@ setup_search_tab (struct GNUNET_FS_SearchContext *sc, | |||
1945 | GTK_TREE_STORE (gtk_builder_get_object | 2001 | GTK_TREE_STORE (gtk_builder_get_object |
1946 | (tab->builder, | 2002 | (tab->builder, |
1947 | "GNUNET_GTK_file_sharing_result_tree_store")); | 2003 | "GNUNET_GTK_file_sharing_result_tree_store")); |
2004 | tv = GTK_TREE_VIEW (gtk_builder_get_object | ||
2005 | (tab->builder, "_search_result_frame")); | ||
2006 | anim_col = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object | ||
2007 | (tab->builder, "search_result_status_pixbuf_column")); | ||
2008 | tab->atv = GNUNET_GTK_animation_tree_view_register (tv, | ||
2009 | anim_col); | ||
1948 | /* load frame */ | 2010 | /* load frame */ |
1949 | sf = GTK_WINDOW (gtk_builder_get_object | 2011 | sf = GTK_WINDOW (gtk_builder_get_object |
1950 | (tab->builder, "_search_result_frame_window")); | 2012 | (tab->builder, "_search_result_frame_window")); |
@@ -2609,6 +2671,8 @@ handle_publish_completed (struct PublishEntry *pe, | |||
2609 | gtk_tree_store_set (pe->tab->ts, &iter, | 2671 | gtk_tree_store_set (pe->tab->ts, &iter, |
2610 | PUBLISH_TAB_MC_RESULT_STRING, uris, | 2672 | PUBLISH_TAB_MC_RESULT_STRING, uris, |
2611 | PUBLISH_TAB_MC_PROGRESS, 100, | 2673 | PUBLISH_TAB_MC_PROGRESS, 100, |
2674 | PUBLISH_TAB_MC_STATUS_ICON, | ||
2675 | GNUNET_GTK_animation_context_get_pixbuf (animation_published), | ||
2612 | -1); | 2676 | -1); |
2613 | GNUNET_free (uris); | 2677 | GNUNET_free (uris); |
2614 | change_publish_color (pe, "green"); | 2678 | change_publish_color (pe, "green"); |
@@ -2671,6 +2735,8 @@ delete_publish_tab () | |||
2671 | publish_tab = NULL; | 2735 | publish_tab = NULL; |
2672 | GNUNET_GTK_animation_context_destroy (animation_publishing); | 2736 | GNUNET_GTK_animation_context_destroy (animation_publishing); |
2673 | animation_publishing = NULL; | 2737 | animation_publishing = NULL; |
2738 | GNUNET_GTK_animation_context_destroy (animation_published); | ||
2739 | animation_published = NULL; | ||
2674 | } | 2740 | } |
2675 | 2741 | ||
2676 | 2742 | ||
@@ -2824,8 +2890,10 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const char *fn, | |||
2824 | pitrptr = &piter; | 2890 | pitrptr = &piter; |
2825 | } | 2891 | } |
2826 | if (NULL == animation_publishing) | 2892 | if (NULL == animation_publishing) |
2893 | { | ||
2827 | animation_publishing = load_animation ("publishing"); | 2894 | animation_publishing = load_animation ("publishing"); |
2828 | 2895 | animation_published = load_animation ("published"); | |
2896 | } | ||
2829 | /* create entry and perform insertion */ | 2897 | /* create entry and perform insertion */ |
2830 | ent = GNUNET_malloc (sizeof (struct PublishEntry)); | 2898 | ent = GNUNET_malloc (sizeof (struct PublishEntry)); |
2831 | ent->is_top = (parent == NULL) ? GNUNET_YES : GNUNET_NO; | 2899 | ent->is_top = (parent == NULL) ? GNUNET_YES : GNUNET_NO; |
diff --git a/src/fs/gnunet-fs-gtk_event-handler.h b/src/fs/gnunet-fs-gtk_event-handler.h index 621781a6..8ec10a4a 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.h +++ b/src/fs/gnunet-fs-gtk_event-handler.h | |||
@@ -108,6 +108,11 @@ struct SearchTab | |||
108 | GtkTreeStore *ts; | 108 | GtkTreeStore *ts; |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Animation handle associated with the tree store. | ||
112 | */ | ||
113 | struct GNUNET_FS_AnimationTreeViewHandle *atv; | ||
114 | |||
115 | /** | ||
111 | * Number of results we got for this search. | 116 | * Number of results we got for this search. |
112 | */ | 117 | */ |
113 | unsigned int num_results; | 118 | unsigned int num_results; |