diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-27 11:14:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-27 11:14:37 +0000 |
commit | fef3bb3b03d2efba0e93eaee2c16ea32379cddab (patch) | |
tree | 7894028c5e6960d61b9a0e94daadce41608974c6 | |
parent | c1320a6bb621148c5961fcc2f84de78aa71fe559 (diff) | |
download | gnunet-gtk-fef3bb3b03d2efba0e93eaee2c16ea32379cddab.tar.gz gnunet-gtk-fef3bb3b03d2efba0e93eaee2c16ea32379cddab.zip |
handling lost parent
-rw-r--r-- | contrib/open_url_dialog.glade | 24 | ||||
-rw-r--r-- | contrib/search_tab.glade | 240 | ||||
-rw-r--r-- | src/fs_event_handler.c | 158 | ||||
-rw-r--r-- | src/fs_event_handler.h | 16 | ||||
-rw-r--r-- | src/main_window_open_directory.c | 11 |
5 files changed, 296 insertions, 153 deletions
diff --git a/contrib/open_url_dialog.glade b/contrib/open_url_dialog.glade index 64cecacb..4717ef9e 100644 --- a/contrib/open_url_dialog.glade +++ b/contrib/open_url_dialog.glade | |||
@@ -2,9 +2,19 @@ | |||
2 | <interface> | 2 | <interface> |
3 | <requires lib="gtk+" version="2.20"/> | 3 | <requires lib="gtk+" version="2.20"/> |
4 | <!-- interface-naming-policy project-wide --> | 4 | <!-- interface-naming-policy project-wide --> |
5 | <object class="GtkImage" id="execute_stock_image"> | ||
6 | <property name="visible">True</property> | ||
7 | <property name="stock">gtk-execute</property> | ||
8 | </object> | ||
9 | <object class="GtkAdjustment" id="GNUNET_GTK_open_url_anonymity_adjustment"> | ||
10 | <property name="upper">100000</property> | ||
11 | <property name="value">1</property> | ||
12 | <property name="step_increment">1</property> | ||
13 | <property name="page_increment">10</property> | ||
14 | </object> | ||
5 | <object class="GtkDialog" id="GNUNET_GTK_open_url_dialog"> | 15 | <object class="GtkDialog" id="GNUNET_GTK_open_url_dialog"> |
6 | <property name="width_request">500</property> | 16 | <property name="width_request">500</property> |
7 | <property name="height_request">350</property> | 17 | <property name="height_request">100</property> |
8 | <property name="border_width">5</property> | 18 | <property name="border_width">5</property> |
9 | <property name="title" translatable="yes">Download from URI</property> | 19 | <property name="title" translatable="yes">Download from URI</property> |
10 | <property name="modal">True</property> | 20 | <property name="modal">True</property> |
@@ -77,6 +87,8 @@ | |||
77 | <signal name="value-changed" handler="GNUNET_GTK_anonymity_spin_button_value_changed_cb" swapped="no"/> | 87 | <signal name="value-changed" handler="GNUNET_GTK_anonymity_spin_button_value_changed_cb" swapped="no"/> |
78 | </object> | 88 | </object> |
79 | <packing> | 89 | <packing> |
90 | <property name="expand">False</property> | ||
91 | <property name="fill">False</property> | ||
80 | <property name="position">3</property> | 92 | <property name="position">3</property> |
81 | </packing> | 93 | </packing> |
82 | </child> | 94 | </child> |
@@ -138,14 +150,4 @@ | |||
138 | <action-widget response="-5">GNUNET_GTK_open_url_dialog_execute_button</action-widget> | 150 | <action-widget response="-5">GNUNET_GTK_open_url_dialog_execute_button</action-widget> |
139 | </action-widgets> | 151 | </action-widgets> |
140 | </object> | 152 | </object> |
141 | <object class="GtkAdjustment" id="GNUNET_GTK_open_url_anonymity_adjustment"> | ||
142 | <property name="upper">100000</property> | ||
143 | <property name="value">1</property> | ||
144 | <property name="step_increment">1</property> | ||
145 | <property name="page_increment">10</property> | ||
146 | </object> | ||
147 | <object class="GtkImage" id="execute_stock_image"> | ||
148 | <property name="visible">True</property> | ||
149 | <property name="stock">gtk-execute</property> | ||
150 | </object> | ||
151 | </interface> | 153 | </interface> |
diff --git a/contrib/search_tab.glade b/contrib/search_tab.glade index 18497adb..00423c5f 100644 --- a/contrib/search_tab.glade +++ b/contrib/search_tab.glade | |||
@@ -2,37 +2,105 @@ | |||
2 | <interface> | 2 | <interface> |
3 | <requires lib="gtk+" version="2.20"/> | 3 | <requires lib="gtk+" version="2.20"/> |
4 | <!-- interface-naming-policy project-wide --> | 4 | <!-- interface-naming-policy project-wide --> |
5 | <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_result_tree_store"> | 5 | <object class="GtkWindow" id="_search_result_label_window"> |
6 | <columns> | 6 | <child> |
7 | <!-- column-name metadata --> | 7 | <object class="GtkHBox" id="_search_result_label_hbox"> |
8 | <column type="gpointer"/> | 8 | <property name="visible">True</property> |
9 | <!-- column-name uri --> | 9 | <property name="border_width">5</property> |
10 | <column type="gpointer"/> | 10 | <child> |
11 | <!-- column-name filesize --> | 11 | <object class="GtkLabel" id="_search_result_label_window_label"> |
12 | <column type="guint64"/> | 12 | <property name="height_request">30</property> |
13 | <!-- column-name preview --> | 13 | <property name="visible">True</property> |
14 | <column type="GdkPixbuf"/> | 14 | <property name="label" translatable="yes">query</property> |
15 | <!-- column-name percent_progress --> | 15 | </object> |
16 | <column type="guint"/> | 16 | <packing> |
17 | <!-- column-name percent_availability --> | 17 | <property name="fill">False</property> |
18 | <column type="guint"/> | 18 | <property name="padding">5</property> |
19 | <!-- column-name filename --> | 19 | <property name="position">0</property> |
20 | <column type="gchararray"/> | 20 | </packing> |
21 | <!-- column-name uri_as_string --> | 21 | </child> |
22 | <column type="gchararray"/> | 22 | <child> |
23 | <!-- column-name status_colour --> | 23 | <object class="GtkButton" id="_search_result_label_play_button"> |
24 | <column type="gchararray"/> | 24 | <property name="can_focus">True</property> |
25 | <!-- column-name struct_search_result --> | 25 | <property name="receives_default">True</property> |
26 | <column type="gpointer"/> | 26 | <property name="use_action_appearance">False</property> |
27 | <!-- column-name mimetype --> | 27 | <child> |
28 | <column type="gchararray"/> | 28 | <object class="GtkImage" id="play_icon_stock_image"> |
29 | <!-- column-name applicability_rank --> | 29 | <property name="visible">True</property> |
30 | <column type="guint"/> | 30 | <property name="stock">gtk-media-play</property> |
31 | <!-- column-name availability_certainty --> | 31 | <property name="icon-size">2</property> |
32 | <column type="guint"/> | 32 | </object> |
33 | <!-- column-name availability_rank --> | 33 | </child> |
34 | <column type="gint"/> | 34 | </object> |
35 | </columns> | 35 | <packing> |
36 | <property name="expand">False</property> | ||
37 | <property name="fill">False</property> | ||
38 | <property name="position">1</property> | ||
39 | </packing> | ||
40 | </child> | ||
41 | <child> | ||
42 | <object class="GtkButton" id="_search_result_label_pause_button"> | ||
43 | <property name="visible">True</property> | ||
44 | <property name="can_focus">True</property> | ||
45 | <property name="receives_default">True</property> | ||
46 | <property name="use_action_appearance">False</property> | ||
47 | <child> | ||
48 | <object class="GtkImage" id="pause_icon_stock_image"> | ||
49 | <property name="visible">True</property> | ||
50 | <property name="stock">gtk-media-pause</property> | ||
51 | <property name="icon-size">2</property> | ||
52 | </object> | ||
53 | </child> | ||
54 | </object> | ||
55 | <packing> | ||
56 | <property name="expand">False</property> | ||
57 | <property name="fill">False</property> | ||
58 | <property name="position">2</property> | ||
59 | </packing> | ||
60 | </child> | ||
61 | <child> | ||
62 | <object class="GtkButton" id="_search_result_label_clear_button"> | ||
63 | <property name="sensitive">False</property> | ||
64 | <property name="can_focus">True</property> | ||
65 | <property name="receives_default">True</property> | ||
66 | <property name="use_action_appearance">False</property> | ||
67 | <child> | ||
68 | <object class="GtkImage" id="clear_icon_stock_image"> | ||
69 | <property name="visible">True</property> | ||
70 | <property name="stock">gtk-clear</property> | ||
71 | </object> | ||
72 | </child> | ||
73 | </object> | ||
74 | <packing> | ||
75 | <property name="expand">False</property> | ||
76 | <property name="fill">False</property> | ||
77 | <property name="padding">5</property> | ||
78 | <property name="position">3</property> | ||
79 | </packing> | ||
80 | </child> | ||
81 | <child> | ||
82 | <object class="GtkButton" id="_search_result_label_close_button"> | ||
83 | <property name="visible">True</property> | ||
84 | <property name="can_focus">True</property> | ||
85 | <property name="receives_default">True</property> | ||
86 | <property name="use_action_appearance">False</property> | ||
87 | <property name="relief">half</property> | ||
88 | <child> | ||
89 | <object class="GtkImage" id="close_icon_stock_image"> | ||
90 | <property name="visible">True</property> | ||
91 | <property name="stock">gtk-close</property> | ||
92 | <property name="icon-size">2</property> | ||
93 | </object> | ||
94 | </child> | ||
95 | </object> | ||
96 | <packing> | ||
97 | <property name="expand">False</property> | ||
98 | <property name="fill">False</property> | ||
99 | <property name="position">4</property> | ||
100 | </packing> | ||
101 | </child> | ||
102 | </object> | ||
103 | </child> | ||
36 | </object> | 104 | </object> |
37 | <object class="GtkWindow" id="_search_result_frame_window"> | 105 | <object class="GtkWindow" id="_search_result_frame_window"> |
38 | <property name="title">You should never see this</property> | 106 | <property name="title">You should never see this</property> |
@@ -132,84 +200,36 @@ | |||
132 | </object> | 200 | </object> |
133 | </child> | 201 | </child> |
134 | </object> | 202 | </object> |
135 | <object class="GtkWindow" id="_search_result_label_window"> | 203 | <object class="GtkTreeStore" id="GNUNET_GTK_file_sharing_result_tree_store"> |
136 | <child> | 204 | <columns> |
137 | <object class="GtkHBox" id="_search_result_label_hbox"> | 205 | <!-- column-name metadata --> |
138 | <property name="visible">True</property> | 206 | <column type="gpointer"/> |
139 | <property name="border_width">5</property> | 207 | <!-- column-name uri --> |
140 | <child> | 208 | <column type="gpointer"/> |
141 | <object class="GtkLabel" id="_search_result_label_window_label"> | 209 | <!-- column-name filesize --> |
142 | <property name="height_request">30</property> | 210 | <column type="guint64"/> |
143 | <property name="visible">True</property> | 211 | <!-- column-name preview --> |
144 | <property name="label" translatable="yes">query</property> | 212 | <column type="GdkPixbuf"/> |
145 | </object> | 213 | <!-- column-name percent_progress --> |
146 | <packing> | 214 | <column type="guint"/> |
147 | <property name="fill">False</property> | 215 | <!-- column-name percent_availability --> |
148 | <property name="padding">5</property> | 216 | <column type="guint"/> |
149 | <property name="position">0</property> | 217 | <!-- column-name filename --> |
150 | </packing> | 218 | <column type="gchararray"/> |
151 | </child> | 219 | <!-- column-name uri_as_string --> |
152 | <child> | 220 | <column type="gchararray"/> |
153 | <object class="GtkButton" id="_search_result_label_close_button"> | 221 | <!-- column-name status_colour --> |
154 | <property name="visible">True</property> | 222 | <column type="gchararray"/> |
155 | <property name="can_focus">True</property> | 223 | <!-- column-name struct_search_result --> |
156 | <property name="receives_default">True</property> | 224 | <column type="gpointer"/> |
157 | <property name="use_action_appearance">False</property> | 225 | <!-- column-name mimetype --> |
158 | <property name="relief">half</property> | 226 | <column type="gchararray"/> |
159 | <child> | 227 | <!-- column-name applicability_rank --> |
160 | <object class="GtkImage" id="close_icon_stock_image"> | 228 | <column type="guint"/> |
161 | <property name="visible">True</property> | 229 | <!-- column-name availability_certainty --> |
162 | <property name="stock">gtk-close</property> | 230 | <column type="guint"/> |
163 | <property name="icon-size">2</property> | 231 | <!-- column-name availability_rank --> |
164 | </object> | 232 | <column type="gint"/> |
165 | </child> | 233 | </columns> |
166 | </object> | ||
167 | <packing> | ||
168 | <property name="expand">False</property> | ||
169 | <property name="fill">False</property> | ||
170 | <property name="position">1</property> | ||
171 | </packing> | ||
172 | </child> | ||
173 | <child> | ||
174 | <object class="GtkButton" id="_search_result_label_play_button"> | ||
175 | <property name="can_focus">True</property> | ||
176 | <property name="receives_default">True</property> | ||
177 | <property name="use_action_appearance">False</property> | ||
178 | <child> | ||
179 | <object class="GtkImage" id="play_icon_stock_image"> | ||
180 | <property name="visible">True</property> | ||
181 | <property name="stock">gtk-media-play</property> | ||
182 | <property name="icon-size">2</property> | ||
183 | </object> | ||
184 | </child> | ||
185 | </object> | ||
186 | <packing> | ||
187 | <property name="expand">False</property> | ||
188 | <property name="fill">False</property> | ||
189 | <property name="position">2</property> | ||
190 | </packing> | ||
191 | </child> | ||
192 | <child> | ||
193 | <object class="GtkButton" id="_search_result_label_pause_button"> | ||
194 | <property name="visible">True</property> | ||
195 | <property name="can_focus">True</property> | ||
196 | <property name="receives_default">True</property> | ||
197 | <property name="use_action_appearance">False</property> | ||
198 | <child> | ||
199 | <object class="GtkImage" id="pause_icon_stock_image"> | ||
200 | <property name="visible">True</property> | ||
201 | <property name="stock">gtk-media-pause</property> | ||
202 | <property name="icon-size">2</property> | ||
203 | </object> | ||
204 | </child> | ||
205 | </object> | ||
206 | <packing> | ||
207 | <property name="expand">False</property> | ||
208 | <property name="fill">False</property> | ||
209 | <property name="position">3</property> | ||
210 | </packing> | ||
211 | </child> | ||
212 | </object> | ||
213 | </child> | ||
214 | </object> | 234 | </object> |
215 | </interface> | 235 | </interface> |
diff --git a/src/fs_event_handler.c b/src/fs_event_handler.c index b4cc9d13..f37d575e 100644 --- a/src/fs_event_handler.c +++ b/src/fs_event_handler.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "common.h" | 26 | #include "common.h" |
27 | #include "download.h" | 27 | #include "download.h" |
28 | #include "fs_event_handler.h" | ||
28 | #include <string.h> | 29 | #include <string.h> |
29 | 30 | ||
30 | 31 | ||
@@ -215,6 +216,39 @@ mark_publish_progress (struct PublishEntry *pe, | |||
215 | 216 | ||
216 | 217 | ||
217 | /** | 218 | /** |
219 | * Handle the case where an active download lost its | ||
220 | * search parent by moving it to the URI tab. | ||
221 | */ | ||
222 | static struct DownloadEntry * | ||
223 | download_lost_parent (struct DownloadEntry *de, | ||
224 | uint64_t size, | ||
225 | uint64_t completed, | ||
226 | int is_active) | ||
227 | { | ||
228 | GtkTreeIter iter; | ||
229 | |||
230 | gtk_tree_row_reference_free (de->rr); | ||
231 | de->sr = NULL; | ||
232 | de->ts = GNUNET_GTK_add_to_uri_tab (&iter, | ||
233 | de->meta, | ||
234 | de->uri); | ||
235 | mark_download_progress (de, size, completed); | ||
236 | if (size > completed) | ||
237 | { | ||
238 | if (is_active) | ||
239 | change_download_colour (de, "yellow"); | ||
240 | else | ||
241 | change_download_colour (de, "blue"); | ||
242 | } | ||
243 | else | ||
244 | { | ||
245 | change_download_colour (de, "green"); | ||
246 | } | ||
247 | return de; | ||
248 | } | ||
249 | |||
250 | |||
251 | /** | ||
218 | * Setup a new download entry. | 252 | * Setup a new download entry. |
219 | * | 253 | * |
220 | * @param pde parent download entry, or NULL | 254 | * @param pde parent download entry, or NULL |
@@ -259,10 +293,14 @@ setup_download (struct DownloadEntry *pde, | |||
259 | } | 293 | } |
260 | else | 294 | else |
261 | { | 295 | { |
262 | /* FIXME: find or create tab with just download results and | 296 | de->ts = GNUNET_GTK_add_to_uri_tab (&iter, |
263 | create new entry! */ | 297 | meta, |
264 | GNUNET_break (0); | 298 | uri); |
265 | return de; | 299 | path = gtk_tree_model_get_path (GTK_TREE_MODEL (de->ts), |
300 | &iter); | ||
301 | de->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (de->ts), | ||
302 | path); | ||
303 | gtk_tree_path_free (path); | ||
266 | } | 304 | } |
267 | path = gtk_tree_row_reference_get_path (de->rr); | 305 | path = gtk_tree_row_reference_get_path (de->rr); |
268 | if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), | 306 | if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (de->ts), |
@@ -627,8 +665,7 @@ continue_search (GtkButton *button, | |||
627 | */ | 665 | */ |
628 | static struct SearchTab * | 666 | static struct SearchTab * |
629 | setup_search (struct GNUNET_FS_SearchContext *sc, | 667 | setup_search (struct GNUNET_FS_SearchContext *sc, |
630 | const struct GNUNET_FS_Uri *query, | 668 | const struct GNUNET_FS_Uri *query) |
631 | uint32_t anonymity) | ||
632 | { | 669 | { |
633 | struct SearchTab *tab; | 670 | struct SearchTab *tab; |
634 | GtkTreeView *tv; | 671 | GtkTreeView *tv; |
@@ -641,10 +678,17 @@ setup_search (struct GNUNET_FS_SearchContext *sc, | |||
641 | search_tab_tail, | 678 | search_tab_tail, |
642 | tab); | 679 | tab); |
643 | tab->sc = sc; | 680 | tab->sc = sc; |
644 | if (GNUNET_FS_uri_test_ksk (query)) | 681 | if (query == NULL) |
645 | tab->query_txt = GNUNET_FS_uri_ksk_to_string_fancy (query); | 682 | { |
683 | tab->query_txt = GNUNET_strdup ("*"); | ||
684 | } | ||
646 | else | 685 | else |
647 | tab->query_txt = GNUNET_FS_uri_to_string (query); | 686 | { |
687 | if (GNUNET_FS_uri_test_ksk (query)) | ||
688 | tab->query_txt = GNUNET_FS_uri_ksk_to_string_fancy (query); | ||
689 | else | ||
690 | tab->query_txt = GNUNET_FS_uri_to_string (query); | ||
691 | } | ||
648 | tab->builder = GNUNET_GTK_get_new_builder ("search_tab.glade"); | 692 | tab->builder = GNUNET_GTK_get_new_builder ("search_tab.glade"); |
649 | 693 | ||
650 | /* load frame */ | 694 | /* load frame */ |
@@ -709,18 +753,16 @@ setup_search (struct GNUNET_FS_SearchContext *sc, | |||
709 | } | 753 | } |
710 | 754 | ||
711 | 755 | ||
712 | |||
713 | static struct SearchResult * | 756 | static struct SearchResult * |
714 | process_search_result (void *cls, | 757 | add_search_result (struct SearchTab *tab, |
715 | void *parent, | 758 | GtkTreeIter *iter, |
716 | const struct GNUNET_FS_Uri *uri, | 759 | void *parent, |
717 | const struct GNUNET_CONTAINER_MetaData *meta, | 760 | const struct GNUNET_FS_Uri *uri, |
718 | struct GNUNET_FS_SearchResult *result, | 761 | const struct GNUNET_CONTAINER_MetaData *meta, |
719 | uint32_t applicability_rank) | 762 | struct GNUNET_FS_SearchResult *result, |
763 | uint32_t applicability_rank) | ||
720 | { | 764 | { |
721 | struct SearchTab *tab = cls; | ||
722 | struct SearchResult *sr; | 765 | struct SearchResult *sr; |
723 | GtkTreeIter iter; | ||
724 | GtkTreePath *tp; | 766 | GtkTreePath *tp; |
725 | GtkTreeStore *ts; | 767 | GtkTreeStore *ts; |
726 | char *desc; | 768 | char *desc; |
@@ -761,7 +803,7 @@ process_search_result (void *cls, | |||
761 | ts = GTK_TREE_STORE (gtk_builder_get_object (tab->builder, | 803 | ts = GTK_TREE_STORE (gtk_builder_get_object (tab->builder, |
762 | "GNUNET_GTK_file_sharing_result_tree_store")); | 804 | "GNUNET_GTK_file_sharing_result_tree_store")); |
763 | gtk_tree_store_insert_with_values (ts, | 805 | gtk_tree_store_insert_with_values (ts, |
764 | &iter, | 806 | iter, |
765 | NULL, | 807 | NULL, |
766 | G_MAXINT, | 808 | G_MAXINT, |
767 | 0, GNUNET_CONTAINER_meta_data_duplicate (meta), | 809 | 0, GNUNET_CONTAINER_meta_data_duplicate (meta), |
@@ -780,14 +822,13 @@ process_search_result (void *cls, | |||
780 | 13, 0 /* avail-rank */, | 822 | 13, 0 /* avail-rank */, |
781 | -1); | 823 | -1); |
782 | tab->num_results++; | 824 | tab->num_results++; |
783 | update_search_label (tab); | ||
784 | if (pixbuf != NULL) | 825 | if (pixbuf != NULL) |
785 | g_object_unref (pixbuf); | 826 | g_object_unref (pixbuf); |
786 | GNUNET_free (uris); | 827 | GNUNET_free (uris); |
787 | GNUNET_free (desc); | 828 | GNUNET_free (desc); |
788 | GNUNET_free_non_null (mime); | 829 | GNUNET_free_non_null (mime); |
789 | tp = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), | 830 | tp = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), |
790 | &iter); | 831 | iter); |
791 | sr->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), | 832 | sr->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), |
792 | tp); | 833 | tp); |
793 | gtk_tree_path_free (tp); | 834 | gtk_tree_path_free (tp); |
@@ -796,6 +837,65 @@ process_search_result (void *cls, | |||
796 | 837 | ||
797 | 838 | ||
798 | static struct SearchResult * | 839 | static struct SearchResult * |
840 | process_search_result (void *cls, | ||
841 | void *parent, | ||
842 | const struct GNUNET_FS_Uri *uri, | ||
843 | const struct GNUNET_CONTAINER_MetaData *meta, | ||
844 | struct GNUNET_FS_SearchResult *result, | ||
845 | uint32_t applicability_rank) | ||
846 | { | ||
847 | struct SearchTab *tab = cls; | ||
848 | struct SearchResult *sr; | ||
849 | GtkTreeIter iter; | ||
850 | |||
851 | sr = add_search_result (tab, &iter, parent, uri, | ||
852 | meta, result, applicability_rank); | ||
853 | update_search_label (tab); | ||
854 | return sr; | ||
855 | } | ||
856 | |||
857 | |||
858 | /** | ||
859 | * Setup a new top-level entry in the URI tab. If necessary, create | ||
860 | * the URI tab first. | ||
861 | * | ||
862 | * @param iter set to the new entry | ||
863 | * @param meta metadata for the new entry | ||
864 | * @param uri URI for the new entry | ||
865 | * @return NULL on error, otherwise tree store matching iter | ||
866 | */ | ||
867 | GtkTreeStore * | ||
868 | GNUNET_GTK_add_to_uri_tab (GtkTreeIter *iter, | ||
869 | const struct GNUNET_CONTAINER_MetaData *meta, | ||
870 | const struct GNUNET_FS_Uri *uri) | ||
871 | { | ||
872 | struct SearchTab *utab; | ||
873 | struct SearchResult *sr; | ||
874 | |||
875 | utab = search_tab_head; | ||
876 | while (utab != NULL) | ||
877 | { | ||
878 | if (utab->sc != NULL) | ||
879 | utab = utab->next; | ||
880 | } | ||
881 | if (utab == NULL) | ||
882 | { | ||
883 | utab = setup_search (NULL, NULL); | ||
884 | } | ||
885 | else | ||
886 | { | ||
887 | /* FIXME: make 'utab' the current page */ | ||
888 | GNUNET_break (0); | ||
889 | } | ||
890 | sr = add_search_result (utab, iter, | ||
891 | NULL, uri, meta, | ||
892 | NULL, 0); | ||
893 | return GTK_TREE_STORE (gtk_builder_get_object (utab->builder, | ||
894 | "GNUNET_GTK_file_sharing_result_tree_store")); | ||
895 | } | ||
896 | |||
897 | |||
898 | static struct SearchResult * | ||
799 | update_search_result (struct SearchResult *sr, | 899 | update_search_result (struct SearchResult *sr, |
800 | const struct GNUNET_CONTAINER_MetaData *meta, | 900 | const struct GNUNET_CONTAINER_MetaData *meta, |
801 | int32_t availability_rank, | 901 | int32_t availability_rank, |
@@ -1107,15 +1207,10 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
1107 | return change_download_colour (info->value.download.cctx, | 1207 | return change_download_colour (info->value.download.cctx, |
1108 | "blue"); | 1208 | "blue"); |
1109 | case GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT: | 1209 | case GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT: |
1110 | /* FIXME: keep entry (especially if download is not | 1210 | return download_lost_parent (info->value.download.cctx, |
1111 | done!?) ? */ | 1211 | info->value.download.size, |
1112 | /* FIXME: if we do not stop here, we currently crash on exit; | 1212 | info->value.download.completed, |
1113 | I think this is because somehow fs-lib fails to handle | 1213 | info->value.download.is_active); |
1114 | LOST_PARENT correctly and does not generate the necessary | ||
1115 | suspend event in this case */ | ||
1116 | stop_download (info->value.download.cctx, | ||
1117 | GNUNET_YES); | ||
1118 | break; | ||
1119 | case GNUNET_FS_STATUS_SEARCH_START: | 1214 | case GNUNET_FS_STATUS_SEARCH_START: |
1120 | fprintf (stderr, | 1215 | fprintf (stderr, |
1121 | "Search started!\n"); | 1216 | "Search started!\n"); |
@@ -1125,8 +1220,7 @@ GNUNET_GTK_fs_event_handler (void *cls, | |||
1125 | break; | 1220 | break; |
1126 | } | 1221 | } |
1127 | return setup_search (info->value.search.sc, | 1222 | return setup_search (info->value.search.sc, |
1128 | info->value.search.query, | 1223 | info->value.search.query); |
1129 | info->value.search.anonymity); | ||
1130 | case GNUNET_FS_STATUS_SEARCH_RESUME: | 1224 | case GNUNET_FS_STATUS_SEARCH_RESUME: |
1131 | GNUNET_break (0); | 1225 | GNUNET_break (0); |
1132 | break; | 1226 | break; |
diff --git a/src/fs_event_handler.h b/src/fs_event_handler.h index 2643994e..d883545f 100644 --- a/src/fs_event_handler.h +++ b/src/fs_event_handler.h | |||
@@ -25,6 +25,22 @@ | |||
25 | */ | 25 | */ |
26 | #include "common.h" | 26 | #include "common.h" |
27 | 27 | ||
28 | |||
29 | /** | ||
30 | * Setup a new top-level entry in the URI tab. If necessary, create | ||
31 | * the URI tab first. | ||
32 | * | ||
33 | * @param iter set to the new entry | ||
34 | * @param meta metadata for the new entry | ||
35 | * @param uri URI for the new entry | ||
36 | * @return NULL on error, otherwise tree store matching iter | ||
37 | */ | ||
38 | GtkTreeStore * | ||
39 | GNUNET_GTK_add_to_uri_tab (GtkTreeIter *iter, | ||
40 | const struct GNUNET_CONTAINER_MetaData *meta, | ||
41 | const struct GNUNET_FS_Uri *uri); | ||
42 | |||
43 | |||
28 | /** | 44 | /** |
29 | * Notification of FS to a client about the progress of an | 45 | * Notification of FS to a client about the progress of an |
30 | * operation. Callbacks of this type will be used for uploads, | 46 | * operation. Callbacks of this type will be used for uploads, |
diff --git a/src/main_window_open_directory.c b/src/main_window_open_directory.c index cd67adba..5384222d 100644 --- a/src/main_window_open_directory.c +++ b/src/main_window_open_directory.c | |||
@@ -53,8 +53,19 @@ GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy, | |||
53 | filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(ad)); | 53 | filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(ad)); |
54 | gtk_widget_destroy (ad); | 54 | gtk_widget_destroy (ad); |
55 | g_object_unref (G_OBJECT (builder)); | 55 | g_object_unref (G_OBJECT (builder)); |
56 | #if 0 | ||
57 | open_directory; | ||
58 | uri = compute_uri_from_file (filename); | ||
59 | meta = new; | ||
60 | meta_make_directory (); | ||
61 | meta_add (filename); | ||
62 | ts = setup_entry_in_uri_tab (&iter, | ||
63 | meta, | ||
64 | uri); | ||
65 | directory_iterate (add_child, ts, &iter); | ||
56 | 66 | ||
57 | GNUNET_break (0); | 67 | GNUNET_break (0); |
68 | #endif | ||
58 | g_free (filename); | 69 | g_free (filename); |
59 | } | 70 | } |
60 | 71 | ||