aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_publish-dialog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_publish-dialog.c')
-rw-r--r--src/fs/gnunet-fs-gtk_publish-dialog.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c
index ab52502d..9dd07700 100644
--- a/src/fs/gnunet-fs-gtk_publish-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-dialog.c
@@ -54,11 +54,6 @@ struct MainPublishingDialogContext
54 GtkBuilder *builder; 54 GtkBuilder *builder;
55 55
56 /** 56 /**
57 * Builder for the master window (FIXME: remove)
58 */
59 GtkBuilder *main_window_builder;
60
61 /**
62 * Handle to the main window of the publishing dialog. 57 * Handle to the main window of the publishing dialog.
63 */ 58 */
64 GtkWindow *master_pubdialog; 59 GtkWindow *master_pubdialog;
@@ -290,7 +285,6 @@ update_selectivity (struct MainPublishingDialogContext *ctx)
290 285
291 /* Don't let the user close the dialog until all scanners are finished and 286 /* Don't let the user close the dialog until all scanners are finished and
292 their windows are closed */ 287 their windows are closed */
293 /* FIXME: what about open-directory operations? */
294 if ( (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) && 288 if ( (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) &&
295 (ns_ok == GNUNET_YES) && 289 (ns_ok == GNUNET_YES) &&
296 (ctx->adddir_head == NULL) ) 290 (ctx->adddir_head == NULL) )
@@ -299,7 +293,6 @@ update_selectivity (struct MainPublishingDialogContext *ctx)
299 gtk_widget_set_sensitive (ctx->execute_button, FALSE); 293 gtk_widget_set_sensitive (ctx->execute_button, FALSE);
300 294
301 /* if an 'edit' operation is open, don't even allow "cancel" */ 295 /* if an 'edit' operation is open, don't even allow "cancel" */
302 /* FIXME: what about open-directory operations? */
303 if (ctx->adddir_head == NULL) 296 if (ctx->adddir_head == NULL)
304 gtk_widget_set_sensitive (ctx->cancel_button, TRUE); 297 gtk_widget_set_sensitive (ctx->cancel_button, TRUE);
305 else 298 else
@@ -1388,7 +1381,7 @@ GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget * dummy,
1388 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (ctx->open_file_builder, 1381 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (ctx->open_file_builder,
1389 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")), TRUE); 1382 "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")), TRUE);
1390 1383
1391 /* FIXME-UGLY: automatically connect using glade instead */ 1384 /* FIXME-STYLE: automatically connect using glade instead */
1392 g_signal_connect (G_OBJECT (ad), "response", 1385 g_signal_connect (G_OBJECT (ad), "response",
1393 G_CALLBACK (publish_file_dialog_response_cb), ctx); 1386 G_CALLBACK (publish_file_dialog_response_cb), ctx);
1394 combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->open_file_builder, 1387 combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->open_file_builder,
@@ -1419,7 +1412,6 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
1419 GtkWidget *ad; 1412 GtkWidget *ad;
1420 GtkComboBox *combo; 1413 GtkComboBox *combo;
1421 1414
1422 /* FIXME-UGLY: should we use a fresh, specific context for this dialog? */
1423 ctx->open_directory_builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_directory_dialog.glade", ctx); 1415 ctx->open_directory_builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_directory_dialog.glade", ctx);
1424 GNUNET_FS_GTK_setup_expiration_year_adjustment (ctx->open_directory_builder); 1416 GNUNET_FS_GTK_setup_expiration_year_adjustment (ctx->open_directory_builder);
1425 1417
@@ -1434,7 +1426,7 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
1434 ad = GTK_WIDGET (gtk_builder_get_object 1426 ad = GTK_WIDGET (gtk_builder_get_object
1435 (ctx->open_directory_builder, "GNUNET_GTK_publish_directory_dialog")); 1427 (ctx->open_directory_builder, "GNUNET_GTK_publish_directory_dialog"));
1436 1428
1437 /* FIXME-UGLY: automatically connect using glade instead */ 1429 /* FIXME-STYLE: automatically connect using glade instead */
1438 g_signal_connect (G_OBJECT (ad), "response", 1430 g_signal_connect (G_OBJECT (ad), "response",
1439 G_CALLBACK (publish_directory_dialog_response_cb), ctx); 1431 G_CALLBACK (publish_directory_dialog_response_cb), ctx);
1440 combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->open_directory_builder, 1432 combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->open_directory_builder,
@@ -1454,11 +1446,6 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy,
1454 1446
1455/** 1447/**
1456 * Context we keep while an "edit" sub-dialog is open. 1448 * Context we keep while an "edit" sub-dialog is open.
1457 *
1458 * FIXME-MAYBE: we should probably keep these also in a DLL with the
1459 * master dialog to prevent the master dialog from closing while the
1460 * edit dialog is running? Or are we otherwise already preventing
1461 * this?
1462 */ 1449 */
1463struct EditPublishContext 1450struct EditPublishContext
1464{ 1451{
@@ -1474,12 +1461,6 @@ struct EditPublishContext
1474 1461
1475 /** 1462 /**
1476 * Position in the tree that is being edited. 1463 * Position in the tree that is being edited.
1477 *
1478 * FIXME-MAYBE: using a TreeIter here is not great, as the row may be
1479 * moved (or even deleted) while the edit dialog is running. Should
1480 * use a RowReference instead. Also, how do we guard against two
1481 * edit dialogs being opened for the same file? (Shouldn't we store
1482 * the EditPublishContext with, say, the tree model?)
1483 */ 1464 */
1484 GtkTreeIter iter; 1465 GtkTreeIter iter;
1485}; 1466};
@@ -1626,23 +1607,22 @@ free_pseudonym_tree_store (GtkTreeModel * tm, GtkTreeIter * iter)
1626 struct GNUNET_CONTAINER_MetaData *meta; 1607 struct GNUNET_CONTAINER_MetaData *meta;
1627 struct GNUNET_FS_Namespace *ns; 1608 struct GNUNET_FS_Namespace *ns;
1628 1609
1629 gtk_tree_model_get (tm, iter, 1, &ns, 4, &meta, -1); 1610 gtk_tree_model_get (tm, iter,
1611 1, &ns,
1612 4, &meta,
1613 -1);
1630 if (NULL != meta) 1614 if (NULL != meta)
1631 GNUNET_CONTAINER_meta_data_destroy (meta); 1615 GNUNET_CONTAINER_meta_data_destroy (meta);
1632 if (NULL != ns) 1616 if (NULL != ns)
1633 { 1617 GNUNET_FS_namespace_delete (ns, GNUNET_NO);
1634 /* FIXME-BUG-MAYBE: should we not delete ns here? (resource leak?) */
1635 // GNUNET_FS_namespace_delete (nso, GNUNET_NO);
1636 }
1637 /* recursively clean up children */ 1618 /* recursively clean up children */
1638 if (gtk_tree_model_iter_children (tm, &child, iter)) 1619 if (! gtk_tree_model_iter_children (tm, &child, iter))
1620 return;
1621 do
1639 { 1622 {
1640 do 1623 free_pseudonym_tree_store (tm, &child);
1641 {
1642 free_pseudonym_tree_store (tm, &child);
1643 }
1644 while (gtk_tree_model_iter_next (tm, &child));
1645 } 1624 }
1625 while (gtk_tree_model_iter_next (tm, &child));
1646} 1626}
1647 1627
1648 1628
@@ -1687,7 +1667,6 @@ close_master_publish_dialog (struct MainPublishingDialogContext *ctx)
1687 GtkTreeIter iter; 1667 GtkTreeIter iter;
1688 1668
1689 /* Refuse to close until all scanners are finished */ 1669 /* Refuse to close until all scanners are finished */
1690 /* FIXME: what about open-directory operations? */
1691 if (NULL != ctx->adddir_head) 1670 if (NULL != ctx->adddir_head)
1692 return GNUNET_NO; 1671 return GNUNET_NO;
1693 1672
@@ -1754,7 +1733,7 @@ GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton * button,
1754 do 1733 do
1755 { 1734 {
1756 fi = get_file_information (ctx->file_info_treemodel, &iter); 1735 fi = get_file_information (ctx->file_info_treemodel, &iter);
1757 /* FIXME: should we convert namespace id and uid from UTF8? */ 1736 /* FIXME-FEATURE-BUG-MINOR: should we convert namespace id and uid from UTF8? */
1758 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), 1737 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (),
1759 fi, namespace, 1738 fi, namespace,
1760 namespace_id, namespace_uid, 1739 namespace_id, namespace_uid,
@@ -1875,7 +1854,7 @@ add_updateable_to_ts (void *cls, const char *last_id,
1875 return; 1854 return;
1876 GNUNET_CONTAINER_multihashmap_put (uc->seen, &hc, "dummy", 1855 GNUNET_CONTAINER_multihashmap_put (uc->seen, &hc, "dummy",
1877 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 1856 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
1878 /* FIXME: what if this put fails? Not convinced it cannot... */ 1857 /* FIXME-BUG-MAYBE: what if this put fails? Not convinced it cannot... */
1879 desc = 1858 desc =
1880 GNUNET_CONTAINER_meta_data_get_first_by_types (last_meta, 1859 GNUNET_CONTAINER_meta_data_get_first_by_types (last_meta,
1881 EXTRACTOR_METATYPE_DESCRIPTION, 1860 EXTRACTOR_METATYPE_DESCRIPTION,
@@ -1955,8 +1934,10 @@ add_namespace_to_ts (void *cls, const char *name, const GNUNET_HashCode * id)
1955 uc.ts = ts; 1934 uc.ts = ts;
1956 uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); 1935 uc.ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name);
1957 uc.update_called = GNUNET_NO; 1936 uc.update_called = GNUNET_NO;
1958 gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT, 0, name, 1, 1937 gtk_tree_store_insert_with_values (ts, &iter, NULL, G_MAXINT,
1959 uc.ns, 2, NULL /* last-id */ , 1938 0, name,
1939 1, uc.ns,
1940 2, NULL /* last-id */ ,
1960 3, NULL /* last-uri (as string!) */ , 1941 3, NULL /* last-uri (as string!) */ ,
1961 4, NULL /* meta */ , 1942 4, NULL /* meta */ ,
1962 5, NULL /* next-ID */ , 1943 5, NULL /* next-ID */ ,
@@ -1984,9 +1965,6 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, gpointer user_
1984 GtkTreeView *pseudonym_treeview; 1965 GtkTreeView *pseudonym_treeview;
1985 1966
1986 ctx = GNUNET_malloc (sizeof (struct MainPublishingDialogContext)); 1967 ctx = GNUNET_malloc (sizeof (struct MainPublishingDialogContext));
1987 /* FIXME-UNCLEAN: why bother keeping this one? */
1988 ctx->main_window_builder = GTK_BUILDER (user_data);
1989
1990 ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade", ctx); 1968 ctx->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade", ctx);
1991 if (ctx->builder == NULL) 1969 if (ctx->builder == NULL)
1992 { 1970 {