diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk-edit_publish_dialog.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk-edit_publish_dialog.c | 367 |
1 files changed, 206 insertions, 161 deletions
diff --git a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c index 356385c7..e50ff82e 100644 --- a/src/fs/gnunet-fs-gtk-edit_publish_dialog.c +++ b/src/fs/gnunet-fs-gtk-edit_publish_dialog.c | |||
@@ -32,15 +32,19 @@ | |||
32 | 32 | ||
33 | #include "metatypes.c" | 33 | #include "metatypes.c" |
34 | 34 | ||
35 | void change_metatypes (GtkBuilder *builder, gint code) | 35 | void |
36 | change_metatypes (GtkBuilder * builder, gint code) | ||
36 | { | 37 | { |
37 | GtkListStore *metatypes_list; | 38 | GtkListStore *metatypes_list; |
38 | gint pub_type = 0, i; | 39 | gint pub_type = 0, i; |
39 | gint pubtype_count = 0; | 40 | gint pubtype_count = 0; |
40 | gint max_type; | 41 | gint max_type; |
41 | GtkTreeIter iter; | 42 | GtkTreeIter iter; |
42 | metatypes_list = GTK_LIST_STORE (gtk_builder_get_object (builder, | 43 | |
43 | "GNUNET_GTK_publication_metadata_types_liststore")); | 44 | metatypes_list = |
45 | GTK_LIST_STORE (gtk_builder_get_object | ||
46 | (builder, | ||
47 | "GNUNET_GTK_publication_metadata_types_liststore")); | ||
44 | 48 | ||
45 | for (pub_type = 0; types[pub_type] != NULL; pub_type++) | 49 | for (pub_type = 0; types[pub_type] != NULL; pub_type++) |
46 | pubtype_count += 1; | 50 | pubtype_count += 1; |
@@ -55,17 +59,20 @@ void change_metatypes (GtkBuilder *builder, gint code) | |||
55 | for (i = 0; types[pub_type][i] != EXTRACTOR_METATYPE_RESERVED; i++) | 59 | for (i = 0; types[pub_type][i] != EXTRACTOR_METATYPE_RESERVED; i++) |
56 | { | 60 | { |
57 | if (types[pub_type][i] < max_type && types[pub_type][i] > 0) | 61 | if (types[pub_type][i] < max_type && types[pub_type][i] > 0) |
58 | gtk_list_store_insert_with_values (metatypes_list, &iter, G_MAXINT, | 62 | gtk_list_store_insert_with_values (metatypes_list, &iter, G_MAXINT, 0, |
59 | 0, types[pub_type][i], | 63 | types[pub_type][i], 1, |
60 | 1, EXTRACTOR_METAFORMAT_UTF8, | 64 | EXTRACTOR_METAFORMAT_UTF8, 2, |
61 | 2, EXTRACTOR_metatype_to_string (types[pub_type][i]), | 65 | EXTRACTOR_metatype_to_string (types |
62 | 3, EXTRACTOR_metatype_to_description (types[pub_type][i]), -1); | 66 | [pub_type] |
67 | [i]), 3, | ||
68 | EXTRACTOR_metatype_to_description | ||
69 | (types[pub_type][i]), -1); | ||
63 | } | 70 | } |
64 | } | 71 | } |
65 | 72 | ||
66 | void | 73 | void |
67 | GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox *widget, | 74 | GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox * widget, |
68 | gpointer user_data) | 75 | gpointer user_data) |
69 | { | 76 | { |
70 | GtkTreeIter iter; | 77 | GtkTreeIter iter; |
71 | GtkBuilder *builder; | 78 | GtkBuilder *builder; |
@@ -76,8 +83,9 @@ GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox *widget, | |||
76 | return; | 83 | return; |
77 | builder = GTK_BUILDER (user_data); | 84 | builder = GTK_BUILDER (user_data); |
78 | 85 | ||
79 | pubtypes_list = GTK_LIST_STORE (gtk_builder_get_object (builder, | 86 | pubtypes_list = |
80 | "GNUNET_GTK_publication_types_liststore")); | 87 | GTK_LIST_STORE (gtk_builder_get_object |
88 | (builder, "GNUNET_GTK_publication_types_liststore")); | ||
81 | 89 | ||
82 | gtk_tree_model_get (GTK_TREE_MODEL (pubtypes_list), &iter, 0, &code, -1); | 90 | gtk_tree_model_get (GTK_TREE_MODEL (pubtypes_list), &iter, 0, &code, -1); |
83 | 91 | ||
@@ -116,8 +124,7 @@ metadata_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) | |||
116 | sel = gtk_tree_view_get_selection (tv); | 124 | sel = gtk_tree_view_get_selection (tv); |
117 | button = | 125 | button = |
118 | GTK_WIDGET (gtk_builder_get_object | 126 | GTK_WIDGET (gtk_builder_get_object |
119 | (builder, | 127 | (builder, "GNUNET_GTK_edit_publication_delete_button")); |
120 | "GNUNET_GTK_edit_publication_delete_button")); | ||
121 | gtk_widget_set_sensitive (button, | 128 | gtk_widget_set_sensitive (button, |
122 | gtk_tree_selection_get_selected (sel, NULL, NULL)); | 129 | gtk_tree_selection_get_selected (sel, NULL, NULL)); |
123 | } | 130 | } |
@@ -149,8 +156,8 @@ keywords_selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) | |||
149 | 156 | ||
150 | 157 | ||
151 | void | 158 | void |
152 | GNUNET_GTK_edit_publication_window_realize_cb (GtkWidget *widget, | 159 | GNUNET_GTK_edit_publication_window_realize_cb (GtkWidget * widget, |
153 | gpointer user_data) | 160 | gpointer user_data) |
154 | { | 161 | { |
155 | GtkBuilder *builder; | 162 | GtkBuilder *builder; |
156 | GtkTreeView *tv; | 163 | GtkTreeView *tv; |
@@ -158,14 +165,16 @@ GNUNET_GTK_edit_publication_window_realize_cb (GtkWidget *widget, | |||
158 | 165 | ||
159 | builder = GTK_BUILDER (user_data); | 166 | builder = GTK_BUILDER (user_data); |
160 | 167 | ||
161 | tv = GTK_TREE_VIEW (gtk_builder_get_object (builder, | 168 | tv = GTK_TREE_VIEW (gtk_builder_get_object |
162 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | 169 | (builder, |
170 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | ||
163 | sel = gtk_tree_view_get_selection (tv); | 171 | sel = gtk_tree_view_get_selection (tv); |
164 | g_signal_connect (G_OBJECT (sel), "changed", | 172 | g_signal_connect (G_OBJECT (sel), "changed", |
165 | G_CALLBACK (metadata_selection_changed_cb), builder); | 173 | G_CALLBACK (metadata_selection_changed_cb), builder); |
166 | 174 | ||
167 | tv = GTK_TREE_VIEW (gtk_builder_get_object (builder, | 175 | tv = GTK_TREE_VIEW (gtk_builder_get_object |
168 | "GNUNET_GTK_edit_publication_keyword_list_tree_view")); | 176 | (builder, |
177 | "GNUNET_GTK_edit_publication_keyword_list_tree_view")); | ||
169 | sel = gtk_tree_view_get_selection (tv); | 178 | sel = gtk_tree_view_get_selection (tv); |
170 | g_signal_connect (G_OBJECT (sel), "changed", | 179 | g_signal_connect (G_OBJECT (sel), "changed", |
171 | G_CALLBACK (keywords_selection_changed_cb), builder); | 180 | G_CALLBACK (keywords_selection_changed_cb), builder); |
@@ -173,8 +182,8 @@ GNUNET_GTK_edit_publication_window_realize_cb (GtkWidget *widget, | |||
173 | 182 | ||
174 | 183 | ||
175 | void | 184 | void |
176 | GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton *button, | 185 | GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton * button, |
177 | gpointer user_data) | 186 | gpointer user_data) |
178 | { | 187 | { |
179 | GtkBuilder *builder; | 188 | GtkBuilder *builder; |
180 | GtkTreeView *meta_tree; | 189 | GtkTreeView *meta_tree; |
@@ -182,29 +191,37 @@ GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton *button, | |||
182 | GtkTreeIter iter; | 191 | GtkTreeIter iter; |
183 | 192 | ||
184 | builder = GTK_BUILDER (user_data); | 193 | builder = GTK_BUILDER (user_data); |
185 | meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder, | 194 | meta_tree = |
186 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | 195 | GTK_TREE_VIEW (gtk_builder_get_object |
196 | (builder, | ||
197 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | ||
187 | meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree)); | 198 | meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree)); |
188 | 199 | ||
189 | gtk_list_store_insert (meta_list, &iter, 0); | 200 | gtk_list_store_insert (meta_list, &iter, 0); |
190 | /* type == 0 means "not set" */ | 201 | /* type == 0 means "not set" */ |
191 | gtk_list_store_set (meta_list, &iter, 0, 0, 1, EXTRACTOR_METAFORMAT_UTF8, | 202 | gtk_list_store_set (meta_list, &iter, 0, 0, 1, EXTRACTOR_METAFORMAT_UTF8, 2, |
192 | 2, _("Select a type"), 3, _("Specify a value"), 4, NULL, -1); | 203 | _("Select a type"), 3, _("Specify a value"), 4, NULL, -1); |
193 | } | 204 | } |
194 | 205 | ||
195 | 206 | ||
196 | gboolean | 207 | gboolean |
197 | GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *widget, | 208 | GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget * |
198 | GdkEventKey *event, gpointer user_data) | 209 | widget, |
210 | GdkEventKey * | ||
211 | event, | ||
212 | gpointer | ||
213 | user_data) | ||
199 | { | 214 | { |
200 | GtkBuilder *builder; | 215 | GtkBuilder *builder; |
201 | GtkButton *add_button; | 216 | GtkButton *add_button; |
217 | |||
202 | builder = GTK_BUILDER (user_data); | 218 | builder = GTK_BUILDER (user_data); |
203 | 219 | ||
204 | if (event->keyval == GDK_KEY_Return) | 220 | if (event->keyval == GDK_KEY_Return) |
205 | { | 221 | { |
206 | add_button = GTK_BUTTON (gtk_builder_get_object (builder, | 222 | add_button = |
207 | "GNUNET_GTK_edit_publication_add_button")); | 223 | GTK_BUTTON (gtk_builder_get_object |
224 | (builder, "GNUNET_GTK_edit_publication_add_button")); | ||
208 | GNUNET_GTK_edit_publication_add_button_clicked_cb (add_button, user_data); | 225 | GNUNET_GTK_edit_publication_add_button_clicked_cb (add_button, user_data); |
209 | return TRUE; | 226 | return TRUE; |
210 | } | 227 | } |
@@ -212,10 +229,9 @@ GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *widget, | |||
212 | } | 229 | } |
213 | 230 | ||
214 | 231 | ||
215 | void | 232 | void GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb |
216 | GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (GtkCellRendererText *renderer, | 233 | (GtkCellRendererText * renderer, gchar * path, gchar * new_text, |
217 | gchar *path, gchar *new_text, | 234 | gpointer user_data) |
218 | gpointer user_data) | ||
219 | { | 235 | { |
220 | GtkBuilder *builder; | 236 | GtkBuilder *builder; |
221 | GtkTreeView *meta_tree; | 237 | GtkTreeView *meta_tree; |
@@ -228,14 +244,19 @@ GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (GtkCellR | |||
228 | GtkTreeIter *pass_data = NULL; | 244 | GtkTreeIter *pass_data = NULL; |
229 | 245 | ||
230 | builder = GTK_BUILDER (user_data); | 246 | builder = GTK_BUILDER (user_data); |
231 | meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder, | 247 | meta_tree = |
232 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | 248 | GTK_TREE_VIEW (gtk_builder_get_object |
249 | (builder, | ||
250 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | ||
233 | meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree)); | 251 | meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree)); |
234 | if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (meta_list), &iter, path)) | 252 | if (!gtk_tree_model_get_iter_from_string |
253 | (GTK_TREE_MODEL (meta_list), &iter, path)) | ||
235 | return; | 254 | return; |
236 | 255 | ||
237 | combo = GTK_CELL_RENDERER_COMBO (gtk_builder_get_object (builder, | 256 | combo = |
238 | "GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer")); | 257 | GTK_CELL_RENDERER_COMBO (gtk_builder_get_object |
258 | (builder, | ||
259 | "GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer")); | ||
239 | 260 | ||
240 | pass_data = g_object_get_data (G_OBJECT (combo), "selected-type"); | 261 | pass_data = g_object_get_data (G_OBJECT (combo), "selected-type"); |
241 | if (!pass_data) | 262 | if (!pass_data) |
@@ -247,15 +268,15 @@ GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (GtkCellR | |||
247 | g_object_set_data (G_OBJECT (combo), "selected-type", NULL); | 268 | g_object_set_data (G_OBJECT (combo), "selected-type", NULL); |
248 | 269 | ||
249 | gtk_list_store_set (meta_list, &iter, 0, type_id, 1, | 270 | gtk_list_store_set (meta_list, &iter, 0, type_id, 1, |
250 | EXTRACTOR_METAFORMAT_UTF8, 2, new_text, 4, description, -1); | 271 | EXTRACTOR_METAFORMAT_UTF8, 2, new_text, 4, description, |
272 | -1); | ||
251 | g_free (description); | 273 | g_free (description); |
252 | } | 274 | } |
253 | 275 | ||
254 | 276 | ||
255 | void | 277 | void GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb |
256 | GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb ( | 278 | (GtkCellRendererCombo * combo, gchar * path_string, GtkTreeIter * new_iter, |
257 | GtkCellRendererCombo *combo, gchar *path_string, GtkTreeIter *new_iter, | 279 | gpointer user_data) |
258 | gpointer user_data) | ||
259 | { | 280 | { |
260 | GtkTreeIter *pass_data; | 281 | GtkTreeIter *pass_data; |
261 | 282 | ||
@@ -268,10 +289,9 @@ GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb ( | |||
268 | } | 289 | } |
269 | 290 | ||
270 | 291 | ||
271 | void | 292 | void GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb |
272 | GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb ( | 293 | (GtkCellRendererText * renderer, gchar * path, gchar * new_text, |
273 | GtkCellRendererText *renderer, gchar *path, gchar *new_text, | 294 | gpointer user_data) |
274 | gpointer user_data) | ||
275 | { | 295 | { |
276 | GtkBuilder *builder; | 296 | GtkBuilder *builder; |
277 | GtkTreeView *meta_tree; | 297 | GtkTreeView *meta_tree; |
@@ -287,14 +307,17 @@ GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb ( | |||
287 | struct EditPublicationState *state = NULL; | 307 | struct EditPublicationState *state = NULL; |
288 | 308 | ||
289 | builder = GTK_BUILDER (user_data); | 309 | builder = GTK_BUILDER (user_data); |
290 | meta_tree = GTK_TREE_VIEW (gtk_builder_get_object (builder, | 310 | meta_tree = |
291 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | 311 | GTK_TREE_VIEW (gtk_builder_get_object |
312 | (builder, | ||
313 | "GNUNET_GTK_edit_publication_metadata_tree_view")); | ||
292 | meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree)); | 314 | meta_list = GTK_LIST_STORE (gtk_tree_view_get_model (meta_tree)); |
293 | if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (meta_list), &iter, path)) | 315 | if (!gtk_tree_model_get_iter_from_string |
316 | (GTK_TREE_MODEL (meta_list), &iter, path)) | ||
294 | return; | 317 | return; |
295 | 318 | ||
296 | pubwindow = gtk_builder_get_object (builder, | 319 | pubwindow = |
297 | "GNUNET_GTK_edit_publication_window"); | 320 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
298 | state = g_object_get_data (pubwindow, PUBSTATE); | 321 | state = g_object_get_data (pubwindow, PUBSTATE); |
299 | if (!state) | 322 | if (!state) |
300 | { | 323 | { |
@@ -303,9 +326,8 @@ GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb ( | |||
303 | } | 326 | } |
304 | 327 | ||
305 | gtk_tree_model_get (GTK_TREE_MODEL (meta_list), &iter, 0, &metatype, -1); | 328 | gtk_tree_model_get (GTK_TREE_MODEL (meta_list), &iter, 0, &metatype, -1); |
306 | if (metatype == EXTRACTOR_METATYPE_FILENAME | 329 | if (metatype == EXTRACTOR_METATYPE_FILENAME && |
307 | && new_text[strlen (new_text) - 1] != '/' | 330 | new_text[strlen (new_text) - 1] != '/' && state->is_directory) |
308 | && state->is_directory) | ||
309 | { | 331 | { |
310 | GNUNET_asprintf (&avalue, "%s/", new_text); | 332 | GNUNET_asprintf (&avalue, "%s/", new_text); |
311 | /* if user typed '\' instead of '/', change it! */ | 333 | /* if user typed '\' instead of '/', change it! */ |
@@ -318,7 +340,7 @@ GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb ( | |||
318 | } | 340 | } |
319 | while (NULL != (pos = strstr (avalue, "\\"))) | 341 | while (NULL != (pos = strstr (avalue, "\\"))) |
320 | *pos = '/'; | 342 | *pos = '/'; |
321 | // remove '../' everywhere | 343 | // remove '../' everywhere |
322 | while (NULL != (pos = strstr (avalue, "../"))) | 344 | while (NULL != (pos = strstr (avalue, "../"))) |
323 | { | 345 | { |
324 | pos[0] = '_'; | 346 | pos[0] = '_'; |
@@ -339,8 +361,8 @@ GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb ( | |||
339 | 361 | ||
340 | 362 | ||
341 | void | 363 | void |
342 | GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton *button, | 364 | GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton * button, |
343 | gpointer user_data) | 365 | gpointer user_data) |
344 | { | 366 | { |
345 | GtkTreeView *tv; | 367 | GtkTreeView *tv; |
346 | GtkTreeSelection *sel; | 368 | GtkTreeSelection *sel; |
@@ -363,8 +385,10 @@ GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton *button, | |||
363 | 385 | ||
364 | 386 | ||
365 | void | 387 | void |
366 | GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb ( | 388 | GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (GtkButton * |
367 | GtkButton *button, gpointer user_data) | 389 | button, |
390 | gpointer | ||
391 | user_data) | ||
368 | { | 392 | { |
369 | const char *keyword; | 393 | const char *keyword; |
370 | GtkEntry *entry; | 394 | GtkEntry *entry; |
@@ -383,9 +407,10 @@ GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb ( | |||
383 | keyword = gtk_entry_get_text (entry); | 407 | keyword = gtk_entry_get_text (entry); |
384 | if (strlen (keyword) > 0) | 408 | if (strlen (keyword) > 0) |
385 | { | 409 | { |
386 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, TRUE, -1); | 410 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, TRUE, |
387 | ok = GTK_WIDGET (gtk_builder_get_object (builder, | 411 | -1); |
388 | "GNUNET_GTK_edit_publication_confirm_button")); | 412 | ok = GTK_WIDGET (gtk_builder_get_object |
413 | (builder, "GNUNET_GTK_edit_publication_confirm_button")); | ||
389 | gtk_widget_set_sensitive (ok, TRUE); | 414 | gtk_widget_set_sensitive (ok, TRUE); |
390 | } | 415 | } |
391 | gtk_entry_set_text (entry, ""); | 416 | gtk_entry_set_text (entry, ""); |
@@ -393,27 +418,29 @@ GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb ( | |||
393 | 418 | ||
394 | 419 | ||
395 | static gboolean | 420 | static gboolean |
396 | gtk_tree_model_has_items_cb (GtkTreeModel *model, GtkTreePath *path, | 421 | gtk_tree_model_has_items_cb (GtkTreeModel * model, GtkTreePath * path, |
397 | GtkTreeIter *iter, gpointer data) | 422 | GtkTreeIter * iter, gpointer data) |
398 | { | 423 | { |
399 | gboolean *val = (gboolean *) data; | 424 | gboolean *val = (gboolean *) data; |
425 | |||
400 | *val = TRUE; | 426 | *val = TRUE; |
401 | return TRUE; | 427 | return TRUE; |
402 | } | 428 | } |
403 | 429 | ||
404 | 430 | ||
405 | static gboolean | 431 | static gboolean |
406 | gtk_tree_model_has_items (GtkTreeModel *model) | 432 | gtk_tree_model_has_items (GtkTreeModel * model) |
407 | { | 433 | { |
408 | gboolean b = FALSE; | 434 | gboolean b = FALSE; |
435 | |||
409 | gtk_tree_model_foreach (model, >k_tree_model_has_items_cb, &b); | 436 | gtk_tree_model_foreach (model, >k_tree_model_has_items_cb, &b); |
410 | return b; | 437 | return b; |
411 | } | 438 | } |
412 | 439 | ||
413 | 440 | ||
414 | void | 441 | void |
415 | GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable *editable, | 442 | GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable * editable, |
416 | gpointer user_data) | 443 | gpointer user_data) |
417 | { | 444 | { |
418 | const char *keyword; | 445 | const char *keyword; |
419 | GtkEntry *entry; | 446 | GtkEntry *entry; |
@@ -435,8 +462,10 @@ GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable *editable, | |||
435 | 462 | ||
436 | 463 | ||
437 | void | 464 | void |
438 | GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb ( | 465 | GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (GtkButton * |
439 | GtkButton *button, gpointer user_data) | 466 | button, |
467 | gpointer | ||
468 | user_data) | ||
440 | { | 469 | { |
441 | GtkTreeView *tv; | 470 | GtkTreeView *tv; |
442 | GtkTreeSelection *sel; | 471 | GtkTreeSelection *sel; |
@@ -446,6 +475,7 @@ GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb ( | |||
446 | GtkWidget *ok; | 475 | GtkWidget *ok; |
447 | GObject *pubwindow; | 476 | GObject *pubwindow; |
448 | struct EditPublicationState *state = NULL; | 477 | struct EditPublicationState *state = NULL; |
478 | |||
449 | builder = GTK_BUILDER (user_data); | 479 | builder = GTK_BUILDER (user_data); |
450 | 480 | ||
451 | tv = GTK_TREE_VIEW (gtk_builder_get_object | 481 | tv = GTK_TREE_VIEW (gtk_builder_get_object |
@@ -461,11 +491,11 @@ GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb ( | |||
461 | if (gtk_list_store_remove (GTK_LIST_STORE (tm), &iter)) | 491 | if (gtk_list_store_remove (GTK_LIST_STORE (tm), &iter)) |
462 | gtk_tree_selection_select_iter (sel, &iter); | 492 | gtk_tree_selection_select_iter (sel, &iter); |
463 | 493 | ||
464 | ok = GTK_WIDGET (gtk_builder_get_object (builder, | 494 | ok = GTK_WIDGET (gtk_builder_get_object |
465 | "GNUNET_GTK_edit_publication_confirm_button")); | 495 | (builder, "GNUNET_GTK_edit_publication_confirm_button")); |
466 | 496 | ||
467 | pubwindow = gtk_builder_get_object (builder, | 497 | pubwindow = |
468 | "GNUNET_GTK_edit_publication_window"); | 498 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
469 | state = g_object_get_data (pubwindow, PUBSTATE); | 499 | state = g_object_get_data (pubwindow, PUBSTATE); |
470 | if (!state) | 500 | if (!state) |
471 | { | 501 | { |
@@ -478,9 +508,7 @@ GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb ( | |||
478 | } | 508 | } |
479 | 509 | ||
480 | 510 | ||
481 | void | 511 | void GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (GtkFileChooserButton * widget, gpointer user_data) |
482 | GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb ( | ||
483 | GtkFileChooserButton *widget, gpointer user_data) | ||
484 | { | 512 | { |
485 | gchar *fn; | 513 | gchar *fn; |
486 | GtkImage *image; | 514 | GtkImage *image; |
@@ -488,8 +516,8 @@ GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb ( | |||
488 | GtkBuilder *builder = GTK_BUILDER (user_data); | 516 | GtkBuilder *builder = GTK_BUILDER (user_data); |
489 | struct EditPublicationState *state = NULL; | 517 | struct EditPublicationState *state = NULL; |
490 | 518 | ||
491 | pubwindow = gtk_builder_get_object (builder, | 519 | pubwindow = |
492 | "GNUNET_GTK_edit_publication_window"); | 520 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
493 | state = g_object_get_data (pubwindow, PUBSTATE); | 521 | state = g_object_get_data (pubwindow, PUBSTATE); |
494 | if (!state) | 522 | if (!state) |
495 | { | 523 | { |
@@ -555,8 +583,8 @@ preserve_meta_items (void *cls, const char *plugin_name, | |||
555 | GObject *pubwindow; | 583 | GObject *pubwindow; |
556 | struct EditPublicationState *state = NULL; | 584 | struct EditPublicationState *state = NULL; |
557 | 585 | ||
558 | pubwindow = gtk_builder_get_object (builder, | 586 | pubwindow = |
559 | "GNUNET_GTK_edit_publication_window"); | 587 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
560 | state = g_object_get_data (pubwindow, PUBSTATE); | 588 | state = g_object_get_data (pubwindow, PUBSTATE); |
561 | if (!state) | 589 | if (!state) |
562 | { | 590 | { |
@@ -570,7 +598,8 @@ preserve_meta_items (void *cls, const char *plugin_name, | |||
570 | case EXTRACTOR_METAFORMAT_UTF8: | 598 | case EXTRACTOR_METAFORMAT_UTF8: |
571 | case EXTRACTOR_METAFORMAT_C_STRING: | 599 | case EXTRACTOR_METAFORMAT_C_STRING: |
572 | tm = GTK_TREE_MODEL (gtk_builder_get_object | 600 | tm = GTK_TREE_MODEL (gtk_builder_get_object |
573 | (builder, "GNUNET_GTK_publication_metadata_liststore")); | 601 | (builder, |
602 | "GNUNET_GTK_publication_metadata_liststore")); | ||
574 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) | 603 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) |
575 | { | 604 | { |
576 | do | 605 | do |
@@ -650,8 +679,8 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
650 | GObject *pubwindow; | 679 | GObject *pubwindow; |
651 | struct EditPublicationState *state = NULL; | 680 | struct EditPublicationState *state = NULL; |
652 | 681 | ||
653 | pubwindow = gtk_builder_get_object (builder, | 682 | pubwindow = |
654 | "GNUNET_GTK_edit_publication_window"); | 683 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
655 | state = g_object_get_data (pubwindow, PUBSTATE); | 684 | state = g_object_get_data (pubwindow, PUBSTATE); |
656 | if (!state) | 685 | if (!state) |
657 | { | 686 | { |
@@ -659,8 +688,9 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
659 | return GNUNET_SYSERR; | 688 | return GNUNET_SYSERR; |
660 | } | 689 | } |
661 | 690 | ||
662 | if (!GNUNET_GTK_get_selected_anonymity_level (builder, | 691 | if (!GNUNET_GTK_get_selected_anonymity_level |
663 | "GNUNET_GTK_edit_publication_anonymity_combobox", &bo->anonymity_level)) | 692 | (builder, "GNUNET_GTK_edit_publication_anonymity_combobox", |
693 | &bo->anonymity_level)) | ||
664 | return GNUNET_SYSERR; | 694 | return GNUNET_SYSERR; |
665 | bo->content_priority = | 695 | bo->content_priority = |
666 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | 696 | gtk_spin_button_get_value (GTK_SPIN_BUTTON |
@@ -677,14 +707,14 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
677 | "GNUNET_GTK_edit_publication_expiration_year_spin_button")); | 707 | "GNUNET_GTK_edit_publication_expiration_year_spin_button")); |
678 | bo->expiration_time = GNUNET_FS_GTK_get_expiration_time (sb); | 708 | bo->expiration_time = GNUNET_FS_GTK_get_expiration_time (sb); |
679 | 709 | ||
680 | if (! context->allow_no_keywords) | 710 | if (!context->allow_no_keywords) |
681 | { | 711 | { |
682 | g_free (context->root); | 712 | g_free (context->root); |
683 | context->root = | 713 | context->root = |
684 | g_strdup (gtk_entry_get_text (GTK_ENTRY | 714 | g_strdup (gtk_entry_get_text |
685 | (gtk_builder_get_object | 715 | (GTK_ENTRY |
686 | (builder, | 716 | (gtk_builder_get_object |
687 | "GNUNET_GTK_edit_publication_root_entry")))); | 717 | (builder, "GNUNET_GTK_edit_publication_root_entry")))); |
688 | } | 718 | } |
689 | /* update URI */ | 719 | /* update URI */ |
690 | if (NULL != (*uri)) | 720 | if (NULL != (*uri)) |
@@ -726,7 +756,8 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
726 | gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1); | 756 | gtk_tree_model_get (tm, &iter, 0, &ntype, 1, &nformat, 3, &value, -1); |
727 | if (ntype > 0) | 757 | if (ntype > 0) |
728 | GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat, | 758 | GNUNET_CONTAINER_meta_data_insert (nm, "<user>", ntype, nformat, |
729 | "text/plain", value, strlen (value) + 1); | 759 | "text/plain", value, |
760 | strlen (value) + 1); | ||
730 | g_free (value); | 761 | g_free (value); |
731 | } | 762 | } |
732 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); | 763 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); |
@@ -775,8 +806,8 @@ file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
775 | 806 | ||
776 | 807 | ||
777 | void | 808 | void |
778 | GNUNET_GTK_edit_publication_cancel_button_clicked_cb ( | 809 | GNUNET_GTK_edit_publication_cancel_button_clicked_cb (GtkButton * button, |
779 | GtkButton *button, gpointer user_data) | 810 | gpointer user_data) |
780 | { | 811 | { |
781 | GtkBuilder *builder; | 812 | GtkBuilder *builder; |
782 | GObject *pubwindow; | 813 | GObject *pubwindow; |
@@ -784,8 +815,8 @@ GNUNET_GTK_edit_publication_cancel_button_clicked_cb ( | |||
784 | 815 | ||
785 | builder = GTK_BUILDER (user_data); | 816 | builder = GTK_BUILDER (user_data); |
786 | 817 | ||
787 | pubwindow = gtk_builder_get_object (builder, | 818 | pubwindow = |
788 | "GNUNET_GTK_edit_publication_window"); | 819 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
789 | state = g_object_get_data (pubwindow, PUBSTATE); | 820 | state = g_object_get_data (pubwindow, PUBSTATE); |
790 | if (!state) | 821 | if (!state) |
791 | { | 822 | { |
@@ -794,7 +825,8 @@ GNUNET_GTK_edit_publication_cancel_button_clicked_cb ( | |||
794 | } | 825 | } |
795 | 826 | ||
796 | state->cb (state->cls, state->do_index, state->short_fn, | 827 | state->cb (state->cls, state->do_index, state->short_fn, |
797 | state->anonymity_level, state->priority, NULL, GTK_RESPONSE_CANCEL); | 828 | state->anonymity_level, state->priority, NULL, |
829 | GTK_RESPONSE_CANCEL); | ||
798 | g_free (state); | 830 | g_free (state); |
799 | g_object_set_data (pubwindow, PUBSTATE, NULL); | 831 | g_object_set_data (pubwindow, PUBSTATE, NULL); |
800 | gtk_widget_hide (GTK_WIDGET (pubwindow)); | 832 | gtk_widget_hide (GTK_WIDGET (pubwindow)); |
@@ -802,7 +834,8 @@ GNUNET_GTK_edit_publication_cancel_button_clicked_cb ( | |||
802 | 834 | ||
803 | 835 | ||
804 | void | 836 | void |
805 | GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton *button, gpointer user_data) | 837 | GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton * button, |
838 | gpointer user_data) | ||
806 | { | 839 | { |
807 | GtkBuilder *builder; | 840 | GtkBuilder *builder; |
808 | GObject *pubwindow; | 841 | GObject *pubwindow; |
@@ -811,8 +844,8 @@ GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton *button, gpoint | |||
811 | 844 | ||
812 | builder = GTK_BUILDER (user_data); | 845 | builder = GTK_BUILDER (user_data); |
813 | 846 | ||
814 | pubwindow = gtk_builder_get_object (builder, | 847 | pubwindow = |
815 | "GNUNET_GTK_edit_publication_window"); | 848 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
816 | state = g_object_get_data (pubwindow, PUBSTATE); | 849 | state = g_object_get_data (pubwindow, PUBSTATE); |
817 | if (!state) | 850 | if (!state) |
818 | { | 851 | { |
@@ -826,29 +859,27 @@ GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton *button, gpoint | |||
826 | ctx.md = NULL; | 859 | ctx.md = NULL; |
827 | ctx.allow_no_keywords = state->allow_no_keywords; | 860 | ctx.allow_no_keywords = state->allow_no_keywords; |
828 | 861 | ||
829 | GNUNET_FS_file_information_inspect (state->fip, &file_information_update, &ctx); | 862 | GNUNET_FS_file_information_inspect (state->fip, &file_information_update, |
863 | &ctx); | ||
830 | state->short_fn = ctx.short_fn; | 864 | state->short_fn = ctx.short_fn; |
831 | if (!GNUNET_GTK_get_selected_anonymity_level (builder, | 865 | if (!GNUNET_GTK_get_selected_anonymity_level |
832 | "GNUNET_GTK_edit_publication_anonymity_combobox", | 866 | (builder, "GNUNET_GTK_edit_publication_anonymity_combobox", |
833 | &state->anonymity_level)) | 867 | &state->anonymity_level)) |
834 | state->priority = | 868 | state->priority = |
835 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | 869 | gtk_spin_button_get_value (GTK_SPIN_BUTTON |
836 | (gtk_builder_get_object | 870 | (gtk_builder_get_object |
837 | (builder, | 871 | (builder, |
838 | "GNUNET_GTK_edit_publication_priority_spin_button"))); | 872 | "GNUNET_GTK_edit_publication_priority_spin_button"))); |
839 | state->do_index = | 873 | state->do_index = |
840 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON | 874 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON |
841 | (gtk_builder_get_object | 875 | (gtk_builder_get_object |
842 | (builder, | 876 | (builder, |
843 | "GNUNET_GTK_edit_publication_index_checkbutton"))); | 877 | "GNUNET_GTK_edit_publication_index_checkbutton"))); |
844 | 878 | ||
845 | 879 | ||
846 | state->cb (state->cls, | 880 | state->cb (state->cls, state->do_index, state->short_fn, |
847 | state->do_index, | 881 | state->anonymity_level, state->priority, ctx.root, |
848 | state->short_fn, | 882 | GTK_RESPONSE_OK); |
849 | state->anonymity_level, | ||
850 | state->priority, ctx.root, | ||
851 | GTK_RESPONSE_OK); | ||
852 | GNUNET_free_non_null (state->short_fn); | 883 | GNUNET_free_non_null (state->short_fn); |
853 | GNUNET_free (state); | 884 | GNUNET_free (state); |
854 | g_object_set_data (pubwindow, PUBSTATE, NULL); | 885 | g_object_set_data (pubwindow, PUBSTATE, NULL); |
@@ -856,15 +887,18 @@ GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton *button, gpoint | |||
856 | } | 887 | } |
857 | 888 | ||
858 | gboolean | 889 | gboolean |
859 | GNUNET_GTK_edit_publication_window_delete_event_cb (GtkWidget *widget, | 890 | GNUNET_GTK_edit_publication_window_delete_event_cb (GtkWidget * widget, |
860 | GdkEvent *event, gpointer user_data) | 891 | GdkEvent * event, |
892 | gpointer user_data) | ||
861 | { | 893 | { |
862 | GtkBuilder *builder; | 894 | GtkBuilder *builder; |
863 | GtkButton *button; | 895 | GtkButton *button; |
896 | |||
864 | builder = GTK_BUILDER (user_data); | 897 | builder = GTK_BUILDER (user_data); |
865 | 898 | ||
866 | button = GTK_BUTTON (gtk_builder_get_object (builder, | 899 | button = |
867 | "GNUNET_GTK_edit_publication_cancel_button")); | 900 | GTK_BUTTON (gtk_builder_get_object |
901 | (builder, "GNUNET_GTK_edit_publication_cancel_button")); | ||
868 | 902 | ||
869 | GNUNET_GTK_edit_publication_cancel_button_clicked_cb (button, user_data); | 903 | GNUNET_GTK_edit_publication_cancel_button_clicked_cb (button, user_data); |
870 | return TRUE; | 904 | return TRUE; |
@@ -885,7 +919,8 @@ add_keyword (void *cls, const char *keyword, int is_mandatory) | |||
885 | GtkTreeIter iter; | 919 | GtkTreeIter iter; |
886 | 920 | ||
887 | ls = GTK_LIST_STORE (cls); | 921 | ls = GTK_LIST_STORE (cls); |
888 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, FALSE, -1); | 922 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, keyword, 1, FALSE, |
923 | -1); | ||
889 | return GNUNET_OK; | 924 | return GNUNET_OK; |
890 | } | 925 | } |
891 | 926 | ||
@@ -924,9 +959,12 @@ file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
924 | GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword, ls); | 959 | GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword, ls); |
925 | if (NULL != meta) | 960 | if (NULL != meta) |
926 | { | 961 | { |
927 | ls = GTK_LIST_STORE (gtk_builder_get_object (builder, | 962 | ls = GTK_LIST_STORE (gtk_builder_get_object |
928 | "GNUNET_GTK_publication_metadata_liststore")); | 963 | (builder, |
929 | GNUNET_CONTAINER_meta_data_iterate (meta, &GNUNET_FS_GTK_add_meta_data_to_list_store, ls); | 964 | "GNUNET_GTK_publication_metadata_liststore")); |
965 | GNUNET_CONTAINER_meta_data_iterate (meta, | ||
966 | &GNUNET_FS_GTK_add_meta_data_to_list_store, | ||
967 | ls); | ||
930 | pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); | 968 | pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta); |
931 | if (pixbuf != NULL) | 969 | if (pixbuf != NULL) |
932 | { | 970 | { |
@@ -944,7 +982,8 @@ file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
944 | "GNUNET_GTK_edit_publication_expiration_year_spin_button")), | 982 | "GNUNET_GTK_edit_publication_expiration_year_spin_button")), |
945 | year); | 983 | year); |
946 | GNUNET_GTK_select_anonymity_level (builder, | 984 | GNUNET_GTK_select_anonymity_level (builder, |
947 | "GNUNET_GTK_edit_publication_anonymity_combobox", bo->anonymity_level); | 985 | "GNUNET_GTK_edit_publication_anonymity_combobox", |
986 | bo->anonymity_level); | ||
948 | gtk_spin_button_set_value (GTK_SPIN_BUTTON | 987 | gtk_spin_button_set_value (GTK_SPIN_BUTTON |
949 | (gtk_builder_get_object | 988 | (gtk_builder_get_object |
950 | (builder, | 989 | (builder, |
@@ -964,15 +1003,13 @@ file_information_extract (void *cls, struct GNUNET_FS_FileInformation *fi, | |||
964 | * short_fn MUST be UTF-8-encoded | 1003 | * short_fn MUST be UTF-8-encoded |
965 | */ | 1004 | */ |
966 | void | 1005 | void |
967 | GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, | 1006 | GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder * builder, GtkWindow * parent, |
968 | GtkWindow *parent, | 1007 | int do_index, const char *short_fn, |
969 | int do_index, | 1008 | uint32_t anonymity_level, uint32_t priority, |
970 | const char *short_fn, | 1009 | struct GNUNET_FS_FileInformation *fip, |
971 | uint32_t anonymity_level, | 1010 | gboolean allow_no_keywords, |
972 | uint32_t priority, | 1011 | GNUNET_FS_GTK_EditPublishDialogCallback cb, |
973 | struct GNUNET_FS_FileInformation *fip, | 1012 | gpointer cls) |
974 | gboolean allow_no_keywords, | ||
975 | GNUNET_FS_GTK_EditPublishDialogCallback cb, gpointer cls) | ||
976 | { | 1013 | { |
977 | GtkWidget *dialog; | 1014 | GtkWidget *dialog; |
978 | GObject *pubwindow; | 1015 | GObject *pubwindow; |
@@ -994,32 +1031,40 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, | |||
994 | "GNUNET_GTK_edit_publication_index_checkbutton"))); | 1031 | "GNUNET_GTK_edit_publication_index_checkbutton"))); |
995 | gtk_widget_hide (GTK_WIDGET | 1032 | gtk_widget_hide (GTK_WIDGET |
996 | (gtk_builder_get_object | 1033 | (gtk_builder_get_object |
997 | (builder, | 1034 | (builder, "GNUNET_GTK_edit_publication_index_label"))); |
998 | "GNUNET_GTK_edit_publication_index_label"))); | ||
999 | } | 1035 | } |
1000 | if (allow_no_keywords) | 1036 | if (allow_no_keywords) |
1001 | { | 1037 | { |
1002 | gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, | 1038 | gtk_widget_hide (GTK_WIDGET |
1003 | "GNUNET_GTK_edit_publication_root_entry"))); | 1039 | (gtk_builder_get_object |
1004 | gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (builder, | 1040 | (builder, "GNUNET_GTK_edit_publication_root_entry"))); |
1005 | "GNUNET_GTK_edit_publication_root_label"))); | 1041 | gtk_widget_hide (GTK_WIDGET |
1042 | (gtk_builder_get_object | ||
1043 | (builder, "GNUNET_GTK_edit_publication_root_label"))); | ||
1006 | } | 1044 | } |
1007 | gtk_list_store_clear (GTK_LIST_STORE (gtk_builder_get_object ( | 1045 | gtk_list_store_clear (GTK_LIST_STORE |
1008 | builder, "GNUNET_GTK_publication_keywords_liststore"))); | 1046 | (gtk_builder_get_object |
1009 | gtk_list_store_clear (GTK_LIST_STORE (gtk_builder_get_object ( | 1047 | (builder, |
1010 | builder, "GNUNET_GTK_publication_metadata_liststore"))); | 1048 | "GNUNET_GTK_publication_keywords_liststore"))); |
1049 | gtk_list_store_clear (GTK_LIST_STORE | ||
1050 | (gtk_builder_get_object | ||
1051 | (builder, | ||
1052 | "GNUNET_GTK_publication_metadata_liststore"))); | ||
1011 | 1053 | ||
1012 | GNUNET_FS_file_information_inspect (fip, &file_information_extract, builder); | 1054 | GNUNET_FS_file_information_inspect (fip, &file_information_extract, builder); |
1013 | dialog = GTK_WIDGET (gtk_builder_get_object (builder, | 1055 | dialog = |
1014 | "GNUNET_GTK_edit_publication_window")); | 1056 | GTK_WIDGET (gtk_builder_get_object |
1057 | (builder, "GNUNET_GTK_edit_publication_window")); | ||
1015 | if (NULL != short_fn) | 1058 | if (NULL != short_fn) |
1016 | gtk_window_set_title (GTK_WINDOW (dialog), short_fn); | 1059 | gtk_window_set_title (GTK_WINDOW (dialog), short_fn); |
1017 | else | 1060 | else |
1018 | gtk_window_set_title (GTK_WINDOW (dialog), _("<unnamed>")); | 1061 | gtk_window_set_title (GTK_WINDOW (dialog), _("<unnamed>")); |
1019 | pubtypes_list = GTK_LIST_STORE (gtk_builder_get_object (builder, | 1062 | pubtypes_list = |
1020 | "GNUNET_GTK_publication_types_liststore")); | 1063 | GTK_LIST_STORE (gtk_builder_get_object |
1021 | pubtypes_combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, | 1064 | (builder, "GNUNET_GTK_publication_types_liststore")); |
1022 | "GNUNET_GTK_edit_publication_type_combo")); | 1065 | pubtypes_combo = |
1066 | GTK_COMBO_BOX (gtk_builder_get_object | ||
1067 | (builder, "GNUNET_GTK_edit_publication_type_combo")); | ||
1023 | 1068 | ||
1024 | if (gtk_combo_box_get_active_iter (pubtypes_combo, &iter)) | 1069 | if (gtk_combo_box_get_active_iter (pubtypes_combo, &iter)) |
1025 | { | 1070 | { |
@@ -1046,11 +1091,11 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkBuilder *builder, | |||
1046 | GTK_ENTRY (gtk_builder_get_object | 1091 | GTK_ENTRY (gtk_builder_get_object |
1047 | (builder, "GNUNET_GTK_edit_publication_keyword_entry")); | 1092 | (builder, "GNUNET_GTK_edit_publication_keyword_entry")); |
1048 | gtk_entry_set_text (entry, ""); | 1093 | gtk_entry_set_text (entry, ""); |
1049 | pubwindow = gtk_builder_get_object (builder, | 1094 | pubwindow = |
1050 | "GNUNET_GTK_edit_publication_window"); | 1095 | gtk_builder_get_object (builder, "GNUNET_GTK_edit_publication_window"); |
1051 | g_object_set_data (pubwindow, PUBSTATE, state); | 1096 | g_object_set_data (pubwindow, PUBSTATE, state); |
1052 | ok = GTK_WIDGET (gtk_builder_get_object (builder, | 1097 | ok = GTK_WIDGET (gtk_builder_get_object |
1053 | "GNUNET_GTK_edit_publication_confirm_button")); | 1098 | (builder, "GNUNET_GTK_edit_publication_confirm_button")); |
1054 | gtk_widget_set_sensitive (ok, allow_no_keywords ? TRUE : FALSE); | 1099 | gtk_widget_set_sensitive (ok, allow_no_keywords ? TRUE : FALSE); |
1055 | gtk_window_set_transient_for (GTK_WINDOW (pubwindow), parent); | 1100 | gtk_window_set_transient_for (GTK_WINDOW (pubwindow), parent); |
1056 | gtk_window_present (GTK_WINDOW (dialog)); | 1101 | gtk_window_present (GTK_WINDOW (dialog)); |