aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-16 19:00:48 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-16 19:00:48 +0000
commitbf559a4725f2c73c0ef56eb9039baed491f942cf (patch)
tree350ff1898b74a8ca78bb77065ae6d86d09a5ded8
parent07bbab38caebf01b02eaa53c5f7d90e1b74c1fab (diff)
downloadgnunet-gtk-bf559a4725f2c73c0ef56eb9039baed491f942cf.tar.gz
gnunet-gtk-bf559a4725f2c73c0ef56eb9039baed491f942cf.zip
LRN: Various changes (#1759)
* Make preview sensitive (prevent graying-out) * Enable fs persistence and probes (crashes, but who said it was going to be easy? * Make Save File dialog non-blocking
-rw-r--r--contrib/gnunet_fs_gtk_about_window.glade363
-rw-r--r--contrib/gnunet_fs_gtk_download_as_dialog.glade106
-rw-r--r--contrib/gnunet_fs_gtk_main_window.glade17
-rw-r--r--src/fs/gnunet-fs-gtk-download.c154
-rw-r--r--src/fs/gnunet-fs-gtk.c5
5 files changed, 547 insertions, 98 deletions
diff --git a/contrib/gnunet_fs_gtk_about_window.glade b/contrib/gnunet_fs_gtk_about_window.glade
new file mode 100644
index 00000000..90d118e4
--- /dev/null
+++ b/contrib/gnunet_fs_gtk_about_window.glade
@@ -0,0 +1,363 @@
1<?xml version="1.0" encoding="UTF-8"?>
2<interface>
3 <requires lib="gtk+" version="2.24"/>
4 <!-- interface-naming-policy project-wide -->
5 <object class="GtkWindow" id="about_window">
6 <property name="can_focus">False</property>
7 <property name="modal">True</property>
8 <property name="destroy_with_parent">True</property>
9 <signal name="realize" handler="GNUNET_GTK_about_window_realized" swapped="no"/>
10 <signal name="delete-event" handler="GNUNET_GTK_about_window_got_delete_event" swapped="no"/>
11 <child>
12 <object class="GtkVBox" id="about_main_vbox">
13 <property name="visible">True</property>
14 <property name="can_focus">False</property>
15 <property name="border_width">10</property>
16 <child>
17 <object class="GtkImage" id="about_logo_image">
18 <property name="visible">True</property>
19 <property name="can_focus">False</property>
20 <property name="pixbuf">gnunet_logo.png</property>
21 </object>
22 <packing>
23 <property name="expand">False</property>
24 <property name="fill">True</property>
25 <property name="position">0</property>
26 </packing>
27 </child>
28 <child>
29 <object class="GtkLabel" id="about_name_version_label">
30 <property name="visible">True</property>
31 <property name="can_focus">False</property>
32 <property name="label">GNUnet GTK r18546</property>
33 <attributes>
34 <attribute name="weight" value="bold"/>
35 <attribute name="size" value="200"/>
36 </attributes>
37 </object>
38 <packing>
39 <property name="expand">False</property>
40 <property name="fill">True</property>
41 <property name="position">1</property>
42 </packing>
43 </child>
44 <child>
45 <object class="GtkLabel" id="about_copyright_label">
46 <property name="visible">True</property>
47 <property name="can_focus">False</property>
48 <property name="label">(C) 2010-2011 The GNUnet Project</property>
49 </object>
50 <packing>
51 <property name="expand">False</property>
52 <property name="fill">True</property>
53 <property name="position">2</property>
54 </packing>
55 </child>
56 <child>
57 <object class="GtkLabel" id="about_link_label">
58 <property name="visible">True</property>
59 <property name="can_focus">False</property>
60 <property name="label">&lt;a href="https://gnunet.org/"&gt;GNUnet: GNU's Framework for Secure P2P Networking&lt;/a&gt;</property>
61 <property name="use_markup">True</property>
62 <property name="wrap">True</property>
63 </object>
64 <packing>
65 <property name="expand">False</property>
66 <property name="fill">True</property>
67 <property name="position">3</property>
68 </packing>
69 </child>
70 <child>
71 <object class="GtkNotebook" id="about_credits_notebook">
72 <property name="can_focus">True</property>
73 <child>
74 <object class="GtkScrolledWindow" id="about_credits_authors_scroller">
75 <property name="visible">True</property>
76 <property name="can_focus">True</property>
77 <property name="hscrollbar_policy">automatic</property>
78 <property name="vscrollbar_policy">automatic</property>
79 <child>
80 <object class="GtkTextView" id="about_credits_authors_textview">
81 <property name="visible">True</property>
82 <property name="can_focus">True</property>
83 <property name="editable">False</property>
84 <property name="wrap_mode">word</property>
85 <property name="cursor_visible">False</property>
86 <property name="buffer">credits_authors_contents</property>
87 <property name="accepts_tab">False</property>
88 </object>
89 </child>
90 </object>
91 </child>
92 <child type="tab">
93 <object class="GtkLabel" id="about_credits_authors_tab">
94 <property name="visible">True</property>
95 <property name="can_focus">False</property>
96 <property name="label" translatable="yes">Developed by</property>
97 </object>
98 <packing>
99 <property name="tab_fill">False</property>
100 </packing>
101 </child>
102 <child>
103 <object class="GtkScrolledWindow" id="about_credits_docs_scroller">
104 <property name="visible">True</property>
105 <property name="can_focus">True</property>
106 <property name="hscrollbar_policy">automatic</property>
107 <property name="vscrollbar_policy">automatic</property>
108 <child>
109 <object class="GtkTextView" id="about_credits_docs_textview">
110 <property name="visible">True</property>
111 <property name="can_focus">True</property>
112 <property name="editable">False</property>
113 <property name="wrap_mode">word</property>
114 <property name="cursor_visible">False</property>
115 <property name="buffer">credits_docs_contents</property>
116 <property name="accepts_tab">False</property>
117 </object>
118 </child>
119 </object>
120 <packing>
121 <property name="position">1</property>
122 </packing>
123 </child>
124 <child type="tab">
125 <object class="GtkLabel" id="about_credits_docs_tab">
126 <property name="visible">True</property>
127 <property name="can_focus">False</property>
128 <property name="label" translatable="yes">Documented by</property>
129 </object>
130 <packing>
131 <property name="position">1</property>
132 <property name="tab_fill">False</property>
133 </packing>
134 </child>
135 <child>
136 <object class="GtkScrolledWindow" id="about_credits_trans_scroller">
137 <property name="visible">True</property>
138 <property name="can_focus">True</property>
139 <property name="hscrollbar_policy">automatic</property>
140 <property name="vscrollbar_policy">automatic</property>
141 <child>
142 <object class="GtkTextView" id="about_credits_trans_textview">
143 <property name="visible">True</property>
144 <property name="can_focus">True</property>
145 <property name="editable">False</property>
146 <property name="wrap_mode">word</property>
147 <property name="cursor_visible">False</property>
148 <property name="buffer">credits_trans_contents</property>
149 <property name="accepts_tab">False</property>
150 </object>
151 </child>
152 </object>
153 <packing>
154 <property name="position">2</property>
155 </packing>
156 </child>
157 <child type="tab">
158 <object class="GtkLabel" id="about_credits_trans_tab">
159 <property name="visible">True</property>
160 <property name="can_focus">False</property>
161 <property name="label" translatable="yes">Translated by</property>
162 </object>
163 <packing>
164 <property name="position">2</property>
165 <property name="tab_fill">False</property>
166 </packing>
167 </child>
168 <child>
169 <object class="GtkScrolledWindow" id="about_credits_art_scroller">
170 <property name="visible">True</property>
171 <property name="can_focus">True</property>
172 <property name="hscrollbar_policy">automatic</property>
173 <property name="vscrollbar_policy">automatic</property>
174 <child>
175 <object class="GtkTextView" id="about_credits_art_textview">
176 <property name="visible">True</property>
177 <property name="can_focus">True</property>
178 <property name="editable">False</property>
179 <property name="wrap_mode">word</property>
180 <property name="cursor_visible">False</property>
181 <property name="buffer">credits_art_contents</property>
182 <property name="accepts_tab">False</property>
183 </object>
184 </child>
185 </object>
186 <packing>
187 <property name="position">3</property>
188 </packing>
189 </child>
190 <child type="tab">
191 <object class="GtkLabel" id="about_credits_art_tab">
192 <property name="visible">True</property>
193 <property name="can_focus">False</property>
194 <property name="label" translatable="yes">Artwork by</property>
195 </object>
196 <packing>
197 <property name="position">3</property>
198 <property name="tab_fill">False</property>
199 </packing>
200 </child>
201 </object>
202 <packing>
203 <property name="expand">True</property>
204 <property name="fill">True</property>
205 <property name="position">4</property>
206 </packing>
207 </child>
208 <child>
209 <object class="GtkScrolledWindow" id="about_license_scroller">
210 <property name="can_focus">True</property>
211 <property name="hscrollbar_policy">never</property>
212 <property name="shadow_type">out</property>
213 <child>
214 <object class="GtkTextView" id="about_license_textview">
215 <property name="visible">True</property>
216 <property name="can_focus">True</property>
217 <property name="editable">False</property>
218 <property name="wrap_mode">word</property>
219 <property name="cursor_visible">False</property>
220 <property name="buffer">license_contents</property>
221 <property name="accepts_tab">False</property>
222 </object>
223 </child>
224 </object>
225 <packing>
226 <property name="expand">True</property>
227 <property name="fill">True</property>
228 <property name="position">5</property>
229 </packing>
230 </child>
231 <child>
232 <object class="GtkHBox" id="about_buttons_hbox">
233 <property name="visible">True</property>
234 <property name="can_focus">False</property>
235 <property name="border_width">5</property>
236 <property name="homogeneous">True</property>
237 <child>
238 <object class="GtkButton" id="about_credits_button">
239 <property name="label" translatable="yes">Credits</property>
240 <property name="visible">True</property>
241 <property name="can_focus">True</property>
242 <property name="receives_default">True</property>
243 <property name="use_action_appearance">False</property>
244 <signal name="clicked" handler="GNUNET_GTK_about_credits_button_clicked" swapped="no"/>
245 </object>
246 <packing>
247 <property name="expand">True</property>
248 <property name="fill">False</property>
249 <property name="position">0</property>
250 </packing>
251 </child>
252 <child>
253 <object class="GtkButton" id="about_license_button">
254 <property name="label" translatable="yes">License</property>
255 <property name="visible">True</property>
256 <property name="can_focus">True</property>
257 <property name="receives_default">True</property>
258 <property name="use_action_appearance">False</property>
259 <signal name="clicked" handler="GNUNET_GTK_about_license_button_clicked" swapped="no"/>
260 </object>
261 <packing>
262 <property name="expand">True</property>
263 <property name="fill">False</property>
264 <property name="position">1</property>
265 </packing>
266 </child>
267 <child>
268 <object class="GtkButton" id="about_close_button">
269 <property name="label">gtk-close</property>
270 <property name="visible">True</property>
271 <property name="can_focus">True</property>
272 <property name="receives_default">True</property>
273 <property name="use_action_appearance">False</property>
274 <property name="use_stock">True</property>
275 <signal name="clicked" handler="GNUNET_GTK_about_close_button_clicked" swapped="no"/>
276 </object>
277 <packing>
278 <property name="expand">True</property>
279 <property name="fill">False</property>
280 <property name="pack_type">end</property>
281 <property name="position">2</property>
282 </packing>
283 </child>
284 <child>
285 <placeholder/>
286 </child>
287 </object>
288 <packing>
289 <property name="expand">False</property>
290 <property name="fill">False</property>
291 <property name="pack_type">end</property>
292 <property name="position">6</property>
293 </packing>
294 </child>
295 </object>
296 </child>
297 </object>
298 <object class="GtkTextBuffer" id="credits_art_contents">
299 <property name="text">Jakub 'jimmac' Steiner &lt;jimmac@ximian.org&gt;
300Christian Muellner &lt;chris@flop.de&gt;
301Alex Jones &lt;alexrjones@ntlworld.com&gt;
302Nicklas Larsson &lt;whybill@gmail.com&gt;
303</property>
304 </object>
305 <object class="GtkTextBuffer" id="credits_authors_contents">
306 <property name="text">Juergen Appel &lt;jappel@linux01.gwdg.de&gt;
307Krista Grothoff &lt;krista@grothoff.org&gt;
308James Blackwell &lt;jblack@linuxguru.net&gt;
309Ludovic Courtes &lt;ludo@chbouib.org&gt;
310Nils Durner &lt;durner@gnunet.org&gt;
311Renaldo Ferreira &lt;rf@cs.purdue.edu&gt;
312Christian Grothoff &lt;christian@grothoff.org&gt;
313Eric Haumant
314Tzvetan Horozov &lt;horozov@motorola.com&gt;
315Gerd Knorr &lt;kraxel@bytesex.org&gt;
316Werner Koch &lt;libgcrypt@g10code.com&gt;
317Uli Luckas &lt;luckas@musoft.de&gt;
318Blake Matheny
319Glenn McGrath
320Hendrik Pagenhardt &lt;Hendrik.Pagenhardt@gmx.net&gt;
321Ioana Patrascu &lt;ioanapatrascu@yahoo.com&gt;
322Marko Raeihae
323Paul Ruth &lt;ruth@cs.purdue.edu&gt;
324Risto Saarelma
325Antti Salonen
326Tiberius Stef &lt;tstef@cs.purdue.edu&gt;
327Tuomas Toivonen
328Tomi Tukiainen
329Kevin Vandersloot &lt;kfv101@psu.edu&gt;
330Simo Viitanen
331Larry Waldo
332Igor Wronsky &lt;iwronsky@users.sourceforge.net&gt;
333&lt;january@hushmail.com&gt;</property>
334 </object>
335 <object class="GtkTextBuffer" id="credits_docs_contents">
336 <property name="text">Christian Grothoff &lt;christian@grothoff.org&gt;
337Anders Carlsson &lt;andersca@gnu.org&gt;
338Nils Durner &lt;durner@gnunet.org&gt;
339Nicklas Larsson &lt;whybill@gmail.com&gt;
340Milan Bouchet-Valat &lt;nalimilan@club.fr&gt;
341Igor Wronsky &lt;iwronsky@users.sourceforge.net&gt;
342</property>
343 </object>
344 <object class="GtkTextBuffer" id="credits_trans_contents">
345 <property name="text">Di Ma
346Jens Palsberg &lt;palsberg@cs.ucla.edu&gt;
347Christian Grothoff &lt;christian@grothoff.org&gt;
348Nils Durner &lt;durner@gnunet.org&gt;
349Mathieu &lt;mollo@bghflt.org&gt;
350Eric Haumant
351milan@skoid.org
352Hiroshi Yamauchi &lt;yamauchi@cs.purdue.edu&gt;
353Adam Welc &lt;welc@cs.purdue.edu&gt;
354Bogdan Carbunar &lt;carbunar@cs.purdue.edu&gt;
355Steven Michael Murphy &lt;murf@e-tools.com&gt;
356Phan Vinh Thinh &lt;teppi82@gmail.com&gt;
357Daniel Nylander &lt;po@danielnylander.se&gt;
358</property>
359 </object>
360 <object class="GtkTextBuffer" id="license_contents">
361 <property name="text" translatable="yes">License should be loaded here at runtime from the license file (no need to copy the whole GPL in here...).</property>
362 </object>
363</interface>
diff --git a/contrib/gnunet_fs_gtk_download_as_dialog.glade b/contrib/gnunet_fs_gtk_download_as_dialog.glade
index 74aa83f2..d15ca724 100644
--- a/contrib/gnunet_fs_gtk_download_as_dialog.glade
+++ b/contrib/gnunet_fs_gtk_download_as_dialog.glade
@@ -9,6 +9,7 @@
9 <property name="page_increment">10</property> 9 <property name="page_increment">10</property>
10 </object> 10 </object>
11 <object class="GtkFileChooserDialog" id="GNUNET_GTK_save_as_dialog"> 11 <object class="GtkFileChooserDialog" id="GNUNET_GTK_save_as_dialog">
12 <property name="can_focus">False</property>
12 <property name="can_default">True</property> 13 <property name="can_default">True</property>
13 <property name="has_default">True</property> 14 <property name="has_default">True</property>
14 <property name="border_width">5</property> 15 <property name="border_width">5</property>
@@ -17,26 +18,78 @@
17 <property name="destroy_with_parent">True</property> 18 <property name="destroy_with_parent">True</property>
18 <property name="icon_name">document-save-as</property> 19 <property name="icon_name">document-save-as</property>
19 <property name="type_hint">dialog</property> 20 <property name="type_hint">dialog</property>
20 <property name="has_separator">False</property>
21 <property name="use_preview_label">False</property>
22 <property name="action">save</property> 21 <property name="action">save</property>
23 <property name="preview_widget_active">False</property> 22 <property name="preview_widget_active">False</property>
23 <property name="use_preview_label">False</property>
24 <signal name="response" handler="GNUNET_GTK_save_as_dialog_response_cb" swapped="no"/>
24 <child internal-child="vbox"> 25 <child internal-child="vbox">
25 <object class="GtkVBox" id="dialog-vbox4"> 26 <object class="GtkVBox" id="dialog-vbox4">
26 <property name="visible">True</property> 27 <property name="visible">True</property>
28 <property name="can_focus">False</property>
27 <property name="spacing">2</property> 29 <property name="spacing">2</property>
30 <child internal-child="action_area">
31 <object class="GtkHButtonBox" id="dialog-action_area5">
32 <property name="visible">True</property>
33 <property name="can_focus">False</property>
34 <property name="layout_style">end</property>
35 <child>
36 <object class="GtkButton" id="GNUNET_GTK_save_as_dialog_cancel_button">
37 <property name="label">gtk-cancel</property>
38 <property name="use_action_appearance">False</property>
39 <property name="visible">True</property>
40 <property name="can_focus">True</property>
41 <property name="receives_default">False</property>
42 <property name="use_stock">True</property>
43 <signal name="clicked" handler="GNUNET_GTK_save_as_dialog_cancel_button_clicked_cb" swapped="no"/>
44 </object>
45 <packing>
46 <property name="expand">False</property>
47 <property name="fill">False</property>
48 <property name="position">0</property>
49 </packing>
50 </child>
51 <child>
52 <object class="GtkButton" id="GNUNET_GTK_save_as_dialog_ok_button">
53 <property name="label">gtk-save</property>
54 <property name="use_action_appearance">False</property>
55 <property name="visible">True</property>
56 <property name="can_focus">True</property>
57 <property name="can_default">True</property>
58 <property name="has_default">True</property>
59 <property name="receives_default">True</property>
60 <property name="use_stock">True</property>
61 <signal name="clicked" handler="GNUNET_GTK_save_as_dialog_ok_button_clicked_cb" swapped="no"/>
62 </object>
63 <packing>
64 <property name="expand">False</property>
65 <property name="fill">False</property>
66 <property name="position">1</property>
67 </packing>
68 </child>
69 </object>
70 <packing>
71 <property name="expand">False</property>
72 <property name="fill">True</property>
73 <property name="pack_type">end</property>
74 <property name="position">0</property>
75 </packing>
76 </child>
28 <child> 77 <child>
29 <object class="GtkHBox" id="hbox2"> 78 <object class="GtkHBox" id="hbox2">
30 <property name="visible">True</property> 79 <property name="visible">True</property>
80 <property name="can_focus">False</property>
31 <child> 81 <child>
32 <object class="GtkLabel" id="GNUNET_GTK_save_as_dialog_anonymity_label"> 82 <object class="GtkLabel" id="GNUNET_GTK_save_as_dialog_anonymity_label">
33 <property name="visible">True</property> 83 <property name="visible">True</property>
84 <property name="can_focus">False</property>
34 <property name="label" translatable="yes">_Anonymity:</property> 85 <property name="label" translatable="yes">_Anonymity:</property>
35 <property name="use_underline">True</property> 86 <property name="use_underline">True</property>
36 <property name="selectable">True</property> 87 <property name="selectable">True</property>
37 <property name="mnemonic_widget">GNUNET_GTK_save_as_dialog_anonymity_spin_button</property> 88 <property name="mnemonic_widget">GNUNET_GTK_save_as_dialog_anonymity_spin_button</property>
38 </object> 89 </object>
39 <packing> 90 <packing>
91 <property name="expand">True</property>
92 <property name="fill">True</property>
40 <property name="position">0</property> 93 <property name="position">0</property>
41 </packing> 94 </packing>
42 </child> 95 </child>
@@ -46,6 +99,10 @@
46 <property name="can_focus">True</property> 99 <property name="can_focus">True</property>
47 <property name="invisible_char">●</property> 100 <property name="invisible_char">●</property>
48 <property name="caps_lock_warning">False</property> 101 <property name="caps_lock_warning">False</property>
102 <property name="primary_icon_activatable">False</property>
103 <property name="secondary_icon_activatable">False</property>
104 <property name="primary_icon_sensitive">True</property>
105 <property name="secondary_icon_sensitive">True</property>
49 <property name="adjustment">GNUNET_GTK_anonymity_adjustment</property> 106 <property name="adjustment">GNUNET_GTK_anonymity_adjustment</property>
50 <property name="numeric">True</property> 107 <property name="numeric">True</property>
51 <signal name="value-changed" handler="GNUNET_GTK_anonymity_spin_button_value_changed_cb" after="yes" swapped="no"/> 108 <signal name="value-changed" handler="GNUNET_GTK_anonymity_spin_button_value_changed_cb" after="yes" swapped="no"/>
@@ -59,11 +116,11 @@
59 <child> 116 <child>
60 <object class="GtkCheckButton" id="GNUNET_GTK_save_as_recursive_check_button"> 117 <object class="GtkCheckButton" id="GNUNET_GTK_save_as_recursive_check_button">
61 <property name="label" translatable="yes">_recursive</property> 118 <property name="label" translatable="yes">_recursive</property>
119 <property name="use_action_appearance">False</property>
62 <property name="visible">True</property> 120 <property name="visible">True</property>
63 <property name="sensitive">False</property> 121 <property name="sensitive">False</property>
64 <property name="can_focus">True</property> 122 <property name="can_focus">True</property>
65 <property name="receives_default">False</property> 123 <property name="receives_default">False</property>
66 <property name="use_action_appearance">False</property>
67 <property name="use_underline">True</property> 124 <property name="use_underline">True</property>
68 <property name="draw_indicator">True</property> 125 <property name="draw_indicator">True</property>
69 </object> 126 </object>
@@ -81,49 +138,6 @@
81 <property name="position">2</property> 138 <property name="position">2</property>
82 </packing> 139 </packing>
83 </child> 140 </child>
84 <child internal-child="action_area">
85 <object class="GtkHButtonBox" id="dialog-action_area5">
86 <property name="visible">True</property>
87 <property name="layout_style">end</property>
88 <child>
89 <object class="GtkButton" id="GNUNET_GTK_save_as_dialog_cancel_button">
90 <property name="label">gtk-cancel</property>
91 <property name="visible">True</property>
92 <property name="can_focus">True</property>
93 <property name="receives_default">False</property>
94 <property name="use_action_appearance">False</property>
95 <property name="use_stock">True</property>
96 </object>
97 <packing>
98 <property name="expand">False</property>
99 <property name="fill">False</property>
100 <property name="position">0</property>
101 </packing>
102 </child>
103 <child>
104 <object class="GtkButton" id="GNUNET_GTK_save_as_dialog_ok_button">
105 <property name="label">gtk-save</property>
106 <property name="visible">True</property>
107 <property name="can_focus">True</property>
108 <property name="can_default">True</property>
109 <property name="has_default">True</property>
110 <property name="receives_default">True</property>
111 <property name="use_action_appearance">False</property>
112 <property name="use_stock">True</property>
113 </object>
114 <packing>
115 <property name="expand">False</property>
116 <property name="fill">False</property>
117 <property name="position">1</property>
118 </packing>
119 </child>
120 </object>
121 <packing>
122 <property name="expand">False</property>
123 <property name="pack_type">end</property>
124 <property name="position">0</property>
125 </packing>
126 </child>
127 </object> 141 </object>
128 </child> 142 </child>
129 <action-widgets> 143 <action-widgets>
diff --git a/contrib/gnunet_fs_gtk_main_window.glade b/contrib/gnunet_fs_gtk_main_window.glade
index 5183ba9c..37dab80d 100644
--- a/contrib/gnunet_fs_gtk_main_window.glade
+++ b/contrib/gnunet_fs_gtk_main_window.glade
@@ -575,7 +575,6 @@
575 <property name="width_request">128</property> 575 <property name="width_request">128</property>
576 <property name="height_request">128</property> 576 <property name="height_request">128</property>
577 <property name="visible">True</property> 577 <property name="visible">True</property>
578 <property name="sensitive">False</property>
579 <property name="can_focus">False</property> 578 <property name="can_focus">False</property>
580 <property name="has_tooltip">True</property> 579 <property name="has_tooltip">True</property>
581 <property name="tooltip_text" translatable="yes">Thumbnail associated with the currently selected content</property> 580 <property name="tooltip_text" translatable="yes">Thumbnail associated with the currently selected content</property>
@@ -759,6 +758,14 @@
759 <property name="can_focus">False</property> 758 <property name="can_focus">False</property>
760 <property name="stock">gtk-index</property> 759 <property name="stock">gtk-index</property>
761 </object> 760 </object>
761 <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
762 <property name="mode">vertical</property>
763 <widgets>
764 <widget name="main_window_search_entry"/>
765 <widget name="main_window_search_anonymity_combobox"/>
766 <widget name="main_window_search_mime_combobox"/>
767 </widgets>
768 </object>
762 <object class="GtkListStore" id="main_window_search_anonymity_liststore"> 769 <object class="GtkListStore" id="main_window_search_anonymity_liststore">
763 <columns> 770 <columns>
764 <!-- column-name Name --> 771 <!-- column-name Name -->
@@ -786,14 +793,6 @@
786 </row> 793 </row>
787 </data> 794 </data>
788 </object> 795 </object>
789 <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
790 <property name="mode">vertical</property>
791 <widgets>
792 <widget name="main_window_search_entry"/>
793 <widget name="main_window_search_anonymity_combobox"/>
794 <widget name="main_window_search_mime_combobox"/>
795 </widgets>
796 </object>
797 <object class="GtkListStore" id="main_window_search_mime_liststore"> 796 <object class="GtkListStore" id="main_window_search_mime_liststore">
798 <columns> 797 <columns>
799 <!-- column-name MIME --> 798 <!-- column-name MIME -->
diff --git a/src/fs/gnunet-fs-gtk-download.c b/src/fs/gnunet-fs-gtk-download.c
index fe239e5a..d9451e1c 100644
--- a/src/fs/gnunet-fs-gtk-download.c
+++ b/src/fs/gnunet-fs-gtk-download.c
@@ -27,65 +27,74 @@
27#include "gnunet-fs-gtk.h" 27#include "gnunet-fs-gtk.h"
28#include "gnunet-fs-gtk-event_handler.h" 28#include "gnunet-fs-gtk-event_handler.h"
29 29
30struct dialog_context
31{
32 GtkBuilder *builder;
33 GtkWidget *dialog;
34 gint response;
35 struct DownloadContext *dc;
36};
30 37
31void 38void
32GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc) 39GNUNET_GTK_save_as_dialog_ok_button_clicked_cb (GtkButton *button,
40 gpointer user_data)
33{ 41{
34 GtkWidget *ad; 42 return;
35 GtkBuilder *builder; 43 struct dialog_context *dlc = NULL;
36 struct GNUNET_FS_Handle *fs; 44 dlc = g_object_get_data (G_OBJECT (button), "dialog-context");
37 uint64_t len; 45 if (dlc != NULL)
46 dlc->response = 1;
47}
48
49void
50GNUNET_GTK_save_as_dialog_cancel_button_clicked_cb (GtkButton *button,
51 gpointer user_data)
52{
53 return;
54 struct dialog_context *dlc = NULL;
55 dlc = g_object_get_data (G_OBJECT (button), "dialog-context");
56 if (dlc != NULL)
57 dlc->response = 2;
58}
59
60gboolean
61GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget *widget, GdkEvent *event,
62 gpointer user_data)
63{
64 GtkBuilder *builder = NULL;
65 struct dialog_context *dlc = NULL;
66 struct DownloadContext *dc = NULL;
38 enum GNUNET_FS_DownloadOptions opt; 67 enum GNUNET_FS_DownloadOptions opt;
39 uint32_t anonymity; 68 struct GNUNET_FS_Handle *fs;
40 struct DownloadEntry *de; 69 struct DownloadEntry *de;
41 GtkWidget *cb; 70 GtkWidget *cb;
71 uint32_t anonymity;
72 uint64_t len;
42 73
43 builder = 74 builder = GTK_BUILDER (user_data);
44 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_download_as_dialog.glade"); 75 dlc = g_object_get_data (G_OBJECT (widget), "dialog-context");
45 if (builder == NULL) 76 if (dlc == NULL)
46 { 77 {
47 if (dc->rr != NULL) 78 g_object_unref (G_OBJECT (builder));
48 gtk_tree_row_reference_free (dc->rr); 79 return FALSE;
49 GNUNET_free_non_null (dc->mime);
50 GNUNET_free_non_null (dc->filename);
51 GNUNET_FS_uri_destroy (dc->uri);
52 GNUNET_free (dc);
53 return;
54 } 80 }
81 dc = dlc->dc;
55 cb = GTK_WIDGET (gtk_builder_get_object 82 cb = GTK_WIDGET (gtk_builder_get_object
56 (builder, "GNUNET_GTK_save_as_recursive_check_button")); 83 (builder, "GNUNET_GTK_save_as_recursive_check_button"));
57 if (GNUNET_FS_meta_data_test_for_directory (dc->meta)) 84 if (GTK_RESPONSE_OK != dlc->response)
58 gtk_widget_set_sensitive (cb, TRUE);
59 ad = GTK_WIDGET (gtk_builder_get_object
60 (builder, "GNUNET_GTK_save_as_dialog"));
61 if (dc->filename != NULL)
62 {
63 char buf[1024];
64
65 if (NULL != getcwd (buf, sizeof (buf)))
66 {
67 if (strlen (buf) + strlen (dc->filename) + 2 < sizeof (buf))
68 {
69 strcat (buf, DIR_SEPARATOR_STR);
70 strcat (buf, dc->filename);
71 }
72 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad), buf);
73 }
74 }
75 if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
76 { 85 {
77 gtk_widget_destroy (ad); 86 g_object_unref (G_OBJECT (dlc->builder));
78 g_object_unref (G_OBJECT (builder));
79 if (dc->rr != NULL) 87 if (dc->rr != NULL)
80 gtk_tree_row_reference_free (dc->rr); 88 gtk_tree_row_reference_free (dc->rr);
81 GNUNET_free_non_null (dc->mime); 89 GNUNET_free_non_null (dc->mime);
82 GNUNET_free_non_null (dc->filename); 90 GNUNET_free_non_null (dc->filename);
83 GNUNET_FS_uri_destroy (dc->uri); 91 GNUNET_FS_uri_destroy (dc->uri);
84 GNUNET_free (dc); 92 GNUNET_free (dc);
85 return; 93 g_free (dlc);
94 return FALSE;
86 } 95 }
87 GNUNET_free_non_null (dc->filename); 96 GNUNET_free_non_null (dc->filename);
88 dc->filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (ad)); 97 dc->filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlc->dialog));
89 dc->is_recursive = 98 dc->is_recursive =
90 (TRUE == 99 (TRUE ==
91 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES : 100 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES :
@@ -100,7 +109,6 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
100 (builder, 109 (builder,
101 "GNUNET_GTK_save_as_dialog_anonymity_spin_button"))); 110 "GNUNET_GTK_save_as_dialog_anonymity_spin_button")));
102 len = GNUNET_FS_uri_chk_get_file_size (dc->uri); 111 len = GNUNET_FS_uri_chk_get_file_size (dc->uri);
103 gtk_widget_destroy (ad);
104 g_object_unref (G_OBJECT (builder)); 112 g_object_unref (G_OBJECT (builder));
105 de = GNUNET_malloc (sizeof (struct DownloadEntry)); 113 de = GNUNET_malloc (sizeof (struct DownloadEntry));
106 de->uri = dc->uri; 114 de->uri = dc->uri;
@@ -130,6 +138,72 @@ GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
130 NULL /* parent download ctx */ )); 138 NULL /* parent download ctx */ ));
131 } 139 }
132 GNUNET_free (dc); 140 GNUNET_free (dc);
141 GNUNET_free (dlc);
142 return FALSE;
143}
144
145void
146GNUNET_GTK_save_as_dialog_response_cb (GtkDialog *dialog,
147 gint response_id, gpointer user_data)
148{
149 struct dialog_context *dlc = NULL;
150 dlc = g_object_get_data (G_OBJECT (dialog), "dialog-context");
151 if (dlc != NULL)
152 dlc->response = response_id;
153 /* dialogs don't get delete-event the way normal windows do,
154 * call the handler manually
155 */
156 GNUNET_GTK_save_as_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL, user_data);
157 gtk_widget_destroy (GTK_WIDGET (dialog));
158}
159
160void
161GNUNET_FS_GTK_open_download_as_dialog (struct DownloadContext *dc)
162{
163 GtkWidget *ad;
164 GtkBuilder *builder;
165 GtkWidget *cb;
166 struct dialog_context *dlc;
167
168 builder =
169 GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_download_as_dialog.glade");
170 if (builder == NULL)
171 {
172 if (dc->rr != NULL)
173 gtk_tree_row_reference_free (dc->rr);
174 GNUNET_free_non_null (dc->mime);
175 GNUNET_free_non_null (dc->filename);
176 GNUNET_FS_uri_destroy (dc->uri);
177 GNUNET_free (dc);
178 return;
179 }
180 cb = GTK_WIDGET (gtk_builder_get_object
181 (builder, "GNUNET_GTK_save_as_recursive_check_button"));
182 if (GNUNET_FS_meta_data_test_for_directory (dc->meta))
183 gtk_widget_set_sensitive (cb, TRUE);
184 ad = GTK_WIDGET (gtk_builder_get_object
185 (builder, "GNUNET_GTK_save_as_dialog"));
186 if (dc->filename != NULL)
187 {
188 char buf[1024];
189
190 if (NULL != getcwd (buf, sizeof (buf)))
191 {
192 if (strlen (buf) + strlen (dc->filename) + 2 < sizeof (buf))
193 {
194 strcat (buf, DIR_SEPARATOR_STR);
195 strcat (buf, dc->filename);
196 }
197 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (ad), buf);
198 }
199 }
200 dlc = g_new0 (struct dialog_context, 1);
201 dlc->builder = builder;
202 dlc->dialog = ad;
203 dlc->response = 0;
204 dlc->dc = dc;
205 g_object_set_data (G_OBJECT (ad), "dialog-context", dlc);
206 gtk_widget_show_all (ad);
133} 207}
134 208
135/* end of gnunet-fs-gtk-download.c */ 209/* end of gnunet-fs-gtk-download.c */
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index d5a6cb52..aa8d97be 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -648,9 +648,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
648 plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY); 648 plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
649 fs = GNUNET_FS_start (GNUNET_GTK_main_loop_get_configuration (ml), 649 fs = GNUNET_FS_start (GNUNET_GTK_main_loop_get_configuration (ml),
650 "gnunet-gtk", &GNUNET_GTK_fs_event_handler, NULL, 650 "gnunet-gtk", &GNUNET_GTK_fs_event_handler, NULL,
651 GNUNET_FS_FLAGS_NONE 651 GNUNET_FS_FLAGS_PERSISTENCE |
652 /* fixme later for persistence/probes */ , 652 GNUNET_FS_FLAGS_DO_PROBES,
653 /* set other options here later! */
654 GNUNET_FS_OPTIONS_END); 653 GNUNET_FS_OPTIONS_END);
655 if (fs != NULL) 654 if (fs != NULL)
656 { 655 {