diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk-main_window_file_publish.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk-main_window_file_publish.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/fs/gnunet-fs-gtk-main_window_file_publish.c b/src/fs/gnunet-fs-gtk-main_window_file_publish.c index 18be9531..e8003acf 100644 --- a/src/fs/gnunet-fs-gtk-main_window_file_publish.c +++ b/src/fs/gnunet-fs-gtk-main_window_file_publish.c | |||
@@ -50,6 +50,7 @@ struct MainPublishingDialogContext | |||
50 | GtkWindow *master_pubdialog; | 50 | GtkWindow *master_pubdialog; |
51 | 51 | ||
52 | gulong open_directory_handler_id; | 52 | gulong open_directory_handler_id; |
53 | GtkBuilder *open_directory_builder; | ||
53 | gulong open_file_handler_id; | 54 | gulong open_file_handler_id; |
54 | }; | 55 | }; |
55 | 56 | ||
@@ -1294,40 +1295,38 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog, | |||
1294 | GtkSpinButton *sb; | 1295 | GtkSpinButton *sb; |
1295 | struct GNUNET_FS_BlockOptions bo; | 1296 | struct GNUNET_FS_BlockOptions bo; |
1296 | GtkWidget *ad; | 1297 | GtkWidget *ad; |
1297 | GtkBuilder *builder; | ||
1298 | 1298 | ||
1299 | if (g_signal_handler_is_connected (G_OBJECT (dialog), ctx->open_directory_handler_id)) | 1299 | if (g_signal_handler_is_connected (G_OBJECT (dialog), ctx->open_directory_handler_id)) |
1300 | g_signal_handler_disconnect (G_OBJECT (dialog), ctx->open_directory_handler_id); | 1300 | g_signal_handler_disconnect (G_OBJECT (dialog), ctx->open_directory_handler_id); |
1301 | ctx->open_directory_handler_id = 0; | 1301 | ctx->open_directory_handler_id = 0; |
1302 | 1302 | ||
1303 | builder = ctx->main_window_builder; | ||
1304 | ad = GTK_WIDGET (gtk_builder_get_object | 1303 | ad = GTK_WIDGET (gtk_builder_get_object |
1305 | (builder, "GNUNET_GTK_publish_directory_dialog")); | 1304 | (ctx->open_directory_builder, "GNUNET_GTK_publish_directory_dialog")); |
1306 | if (response_id == -5) | 1305 | if (response_id == -5) |
1307 | { | 1306 | { |
1308 | filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (ad)); | 1307 | filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (ad)); |
1309 | sb = GTK_SPIN_BUTTON (gtk_builder_get_object | 1308 | sb = GTK_SPIN_BUTTON (gtk_builder_get_object |
1310 | (builder, | 1309 | (ctx->open_directory_builder, |
1311 | "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button")); | 1310 | "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button")); |
1312 | if (!GNUNET_GTK_get_selected_anonymity_level | 1311 | if (!GNUNET_GTK_get_selected_anonymity_level |
1313 | (builder, "GNUNET_GTK_publish_directory_dialog_anonymity_combobox", | 1312 | (ctx->open_directory_builder, "GNUNET_GTK_publish_directory_dialog_anonymity_combobox", |
1314 | &bo.anonymity_level)) | 1313 | &bo.anonymity_level)) |
1315 | bo.anonymity_level = 1; | 1314 | bo.anonymity_level = 1; |
1316 | bo.content_priority = | 1315 | bo.content_priority = |
1317 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | 1316 | gtk_spin_button_get_value (GTK_SPIN_BUTTON |
1318 | (gtk_builder_get_object | 1317 | (gtk_builder_get_object |
1319 | (builder, | 1318 | (ctx->open_directory_builder, |
1320 | "GNUNET_GTK_publish_directory_dialog_priority_spin_button"))); | 1319 | "GNUNET_GTK_publish_directory_dialog_priority_spin_button"))); |
1321 | bo.replication_level = | 1320 | bo.replication_level = |
1322 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | 1321 | gtk_spin_button_get_value (GTK_SPIN_BUTTON |
1323 | (gtk_builder_get_object | 1322 | (gtk_builder_get_object |
1324 | (builder, | 1323 | (ctx->open_directory_builder, |
1325 | "GNUNET_GTK_publish_directory_dialog_replication_spin_button"))); | 1324 | "GNUNET_GTK_publish_directory_dialog_replication_spin_button"))); |
1326 | bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb); | 1325 | bo.expiration_time = GNUNET_FS_GTK_get_expiration_time (sb); |
1327 | do_index = | 1326 | do_index = |
1328 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON | 1327 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON |
1329 | (gtk_builder_get_object | 1328 | (gtk_builder_get_object |
1330 | (builder, | 1329 | (ctx->open_directory_builder, |
1331 | "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton"))); | 1330 | "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton"))); |
1332 | 1331 | ||
1333 | /* FIXME: open progress dialog here... */ | 1332 | /* FIXME: open progress dialog here... */ |
@@ -1335,7 +1334,8 @@ GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog * dialog, | |||
1335 | g_free (filename); | 1334 | g_free (filename); |
1336 | update_selectivity (ctx); | 1335 | update_selectivity (ctx); |
1337 | } | 1336 | } |
1338 | gtk_widget_hide (ad); | 1337 | gtk_widget_destroy (ad); |
1338 | g_object_unref (G_OBJECT (ctx->open_directory_builder)); | ||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | 1341 | ||
@@ -1344,15 +1344,23 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy, | |||
1344 | struct MainPublishingDialogContext *ctx) | 1344 | struct MainPublishingDialogContext *ctx) |
1345 | { | 1345 | { |
1346 | GtkWidget *ad; | 1346 | GtkWidget *ad; |
1347 | GtkBuilder *builder; | ||
1348 | 1347 | ||
1349 | builder = ctx->main_window_builder; | 1348 | GtkComboBox *combo; |
1350 | GNUNET_FS_GTK_setup_expiration_year_adjustment (builder); | 1349 | GtkTreeModel *anon_treemodel; |
1350 | |||
1351 | ctx->open_directory_builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_directory_dialog.glade", ctx); | ||
1352 | GNUNET_FS_GTK_setup_expiration_year_adjustment (ctx->open_directory_builder); | ||
1351 | ad = GTK_WIDGET (gtk_builder_get_object | 1353 | ad = GTK_WIDGET (gtk_builder_get_object |
1352 | (builder, "GNUNET_GTK_publish_directory_dialog")); | 1354 | (ctx->open_directory_builder, "GNUNET_GTK_publish_directory_dialog")); |
1353 | 1355 | ||
1354 | ctx->open_directory_handler_id = g_signal_connect (G_OBJECT (ad), "response", G_CALLBACK (GNUNET_GTK_publish_directory_dialog_response_cb), ctx); | 1356 | ctx->open_directory_handler_id = g_signal_connect (G_OBJECT (ad), "response", G_CALLBACK (GNUNET_GTK_publish_directory_dialog_response_cb), ctx); |
1355 | 1357 | ||
1358 | anon_treemodel = GTK_TREE_MODEL (gtk_builder_get_object (ctx->main_window_builder, | ||
1359 | "main_window_search_anonymity_liststore")); | ||
1360 | combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->open_directory_builder, | ||
1361 | "GNUNET_GTK_publish_directory_dialog_anonymity_combobox")); | ||
1362 | gtk_combo_box_set_model (combo, anon_treemodel); | ||
1363 | |||
1356 | gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog); | 1364 | gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog); |
1357 | 1365 | ||
1358 | gtk_window_present (GTK_WINDOW (ad)); | 1366 | gtk_window_present (GTK_WINDOW (ad)); |
@@ -1659,7 +1667,7 @@ hide_master_publish_dialog (struct MainPublishingDialogContext *ctx, gint ret) | |||
1659 | while (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter)); | 1667 | while (TRUE == gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter)); |
1660 | gtk_tree_store_clear (GTK_TREE_STORE (ctx->file_info_treemodel)); | 1668 | gtk_tree_store_clear (GTK_TREE_STORE (ctx->file_info_treemodel)); |
1661 | gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog)); | 1669 | gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog)); |
1662 | gtk_object_unref (GTK_OBJECT (ctx->builder)); | 1670 | g_object_unref (G_OBJECT (ctx->builder)); |
1663 | GNUNET_free (ctx); | 1671 | GNUNET_free (ctx); |
1664 | } | 1672 | } |
1665 | 1673 | ||