aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_event-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r--src/fs/gnunet-fs-gtk_event-handler.c52
1 files changed, 44 insertions, 8 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c
index bd2378e1..a7aef9ba 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -156,6 +156,26 @@ static struct SearchTab *current_context_search_tab;
156 156
157/* ***************** Search event handling ****************** */ 157/* ***************** Search event handling ****************** */
158 158
159
160/**
161 * Clear the metadata list and the preview widget.
162 */
163static void
164clear_metadata_display ()
165{
166 GtkImage *image;
167 GtkListStore *ms;
168
169 image =
170 GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object
171 ("GNUNET_GTK_main_window_preview_image"));
172 gtk_image_clear (image);
173 ms = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object
174 ("GNUNET_GTK_meta_data_list_store"));
175 gtk_list_store_clear (ms);
176}
177
178
159/** 179/**
160 * This should get the default download directory (so that GNUnet 180 * This should get the default download directory (so that GNUnet
161 * won't offer the user to download files to the 'bin' subdirectory, 181 * won't offer the user to download files to the 'bin' subdirectory,
@@ -605,11 +625,6 @@ search_list_popup (GtkTreeModel *tm,
605 struct SearchResult *sr; 625 struct SearchResult *sr;
606 struct GNUNET_FS_Uri *uri; 626 struct GNUNET_FS_Uri *uri;
607 627
608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
609 "Creating a menu for SR=%p, DE=%p\n",
610 sr,
611 sr->download);
612
613 /* FIXME-UNCLEAN: move these to some menu context struct 628 /* FIXME-UNCLEAN: move these to some menu context struct
614 (de-globalize) */ 629 (de-globalize) */
615 current_context_search_tab = tab; 630 current_context_search_tab = tab;
@@ -623,7 +638,13 @@ search_list_popup (GtkTreeModel *tm,
623 gtk_tree_path_free (path); 638 gtk_tree_path_free (path);
624 639
625 gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1); 640 gtk_tree_model_get (tm, iter, 1, &uri, 9, &sr, -1);
626 641 /* FIXME-BUG: 'sr' can be NULL here, somehow some code fails to setup the record.. */
642 if (NULL == sr)
643 {
644 /* FIXME-BUG: this prevents the crash for now, but does not solve the problem */
645 GNUNET_break (0);
646 return FALSE;
647 }
627 menu = GTK_MENU (gtk_menu_new ()); 648 menu = GTK_MENU (gtk_menu_new ());
628 if ( (NULL == sr->download) && 649 if ( (NULL == sr->download) &&
629 (NULL != uri) ) 650 (NULL != uri) )
@@ -787,6 +808,7 @@ close_search_tab (struct SearchTab *tab)
787 GNUNET_free (tab); 808 GNUNET_free (tab);
788 return; 809 return;
789 } 810 }
811 clear_metadata_display ();
790 notebook = 812 notebook =
791 GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object 813 GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object
792 ("GNUNET_GTK_main_window_notebook")); 814 ("GNUNET_GTK_main_window_notebook"));
@@ -1617,6 +1639,13 @@ stop_download (struct DownloadEntry *de)
1617 } 1639 }
1618 gtk_tree_path_free (path); 1640 gtk_tree_path_free (path);
1619 gtk_tree_model_get (tm, &iter, 9, &search_result, -1); 1641 gtk_tree_model_get (tm, &iter, 9, &search_result, -1);
1642 /* FIXME-BUG: 'search_result' can be NULL here, somehow some code fails to setup the record.. */
1643 if (NULL == search_result)
1644 {
1645 /* FIXME-BUG: this prevents the crash for now, but does not solve the problem */
1646 GNUNET_break (0);
1647 return;
1648 }
1620 GNUNET_assert (search_result->download == de); 1649 GNUNET_assert (search_result->download == de);
1621 search_result->download = NULL; 1650 search_result->download = NULL;
1622 change_download_color (de, "white"); 1651 change_download_color (de, "white");
@@ -1763,11 +1792,17 @@ mark_download_progress (struct DownloadEntry *de, uint64_t size,
1763 return; 1792 return;
1764 } 1793 }
1765 gtk_tree_path_free (path); 1794 gtk_tree_path_free (path);
1766 /* FIXME-FEATURE: update availability-score here as well! */ 1795 /* FIXME-DESIGN: should we replace the 'availability' with
1796 'progress' once the download has started and re-use the
1797 space in the display? Probably yes, at least once we have
1798 a custom CellRenderer... */
1767 gtk_tree_store_set (de->ts, &iter, 1799 gtk_tree_store_set (de->ts, &iter,
1768 4, (guint) ((size > 1800 4, (guint) ((size >
1769 0) ? (100 * completed / 1801 0) ? (100 * completed /
1770 size) : 100) /* progress */ , 1802 size) : 100) /* progress */,
1803 5, (guint) ((size >
1804 0) ? (100 * completed /
1805 size) : 100) /* availability == progress */,
1771 14, completed, 1806 14, completed,
1772 -1); 1807 -1);
1773 if ( (depth == 0) && 1808 if ( (depth == 0) &&
@@ -2287,6 +2322,7 @@ GNUNET_FS_GTK_publish_label_close_button_clicked (GtkButton * button,
2287 } 2322 }
2288 while (TRUE == gtk_tree_model_iter_next (tm, &iter)); 2323 while (TRUE == gtk_tree_model_iter_next (tm, &iter));
2289 } 2324 }
2325 clear_metadata_display ();
2290 2326
2291 /* remove tab from notebook */ 2327 /* remove tab from notebook */
2292 notebook = 2328 notebook =