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.c291
1 files changed, 198 insertions, 93 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c
index 975db8c0..ffca4a33 100644
--- a/src/fs/gnunet-fs-gtk_publish-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-dialog.c
@@ -119,6 +119,25 @@ enum IDENTIFIERS_ModelColumns
119 119
120 120
121/** 121/**
122 * The columns in the "GNUNET_GTK_master_publish_dialog_ego_liststore"
123 */
124enum EGO_ModelColumns
125 {
126
127 /**
128 * A gchararray.
129 */
130 EGO_MC_NAME = 0,
131
132 /**
133 * A 'struct GNUNET_IDENTIFIER_Ego'.
134 */
135 EGO_MC_EGO = 1
136
137 };
138
139
140/**
122 * Context we create when we are scanning a directory. 141 * Context we create when we are scanning a directory.
123 */ 142 */
124struct AddDirClientContext; 143struct AddDirClientContext;
@@ -129,10 +148,16 @@ struct AddDirClientContext;
129 */ 148 */
130struct MainPublishingDialogContext 149struct MainPublishingDialogContext
131{ 150{
151
132 /** 152 /**
133 * Main builder for the publishing dialog. 153 * Main builder for the publishing dialog.
134 */ 154 */
135 GtkBuilder *builder; 155 GtkBuilder *builder;
156
157 /**
158 * Connection to the identity service.
159 */
160 struct GNUNET_IDENTITY_Handle *identity;
136 161
137 /** 162 /**
138 * Handle to the main window of the publishing dialog. 163 * Handle to the main window of the publishing dialog.
@@ -195,12 +220,6 @@ struct MainPublishingDialogContext
195 GtkWidget *own_checkbox; 220 GtkWidget *own_checkbox;
196 221
197 /** 222 /**
198 * The label that shows name of the default namespace (if no default
199 * namespace is selected, shows appropriate message).
200 */
201 GtkWidget *own_label;
202
203 /**
204 * Treeview that shows previously-used identifiers and possible update IDs. 223 * Treeview that shows previously-used identifiers and possible update IDs.
205 */ 224 */
206 GtkTreeView *identifiers_treeview; 225 GtkTreeView *identifiers_treeview;
@@ -451,8 +470,10 @@ update_selectivity_execute_cancel (struct MainPublishingDialogContext *ctx)
451 their windows are closed */ 470 their windows are closed */
452 if ( (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) && 471 if ( (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) &&
453 (pub_in_global || pub_in_own) && 472 (pub_in_global || pub_in_own) &&
454 ((!pub_in_own) || ((NULL != ns_id) && ('\0' != ns_id[0]))) && 473 ((!pub_in_own) || ( (NULL != ctx->ns) &&
455 (ctx->adddir_head == NULL) ) 474 (NULL != ns_id) &&
475 ('\0' != ns_id[0])) ) &&
476 (NULL == ctx->adddir_head) )
456 gtk_widget_set_sensitive (ctx->execute_button, TRUE); 477 gtk_widget_set_sensitive (ctx->execute_button, TRUE);
457 else 478 else
458 gtk_widget_set_sensitive (ctx->execute_button, FALSE); 479 gtk_widget_set_sensitive (ctx->execute_button, FALSE);
@@ -464,6 +485,7 @@ update_selectivity_execute_cancel (struct MainPublishingDialogContext *ctx)
464 gtk_widget_set_sensitive (ctx->cancel_button, FALSE); 485 gtk_widget_set_sensitive (ctx->cancel_button, FALSE);
465} 486}
466 487
488
467/** 489/**
468 * Update selectivity of up/down/left/right buttons in the master dialog. 490 * Update selectivity of up/down/left/right buttons in the master dialog.
469 * 491 *
@@ -684,7 +706,7 @@ copy_entry (struct MainPublishingDialogContext *ctx, GtkTreeModel * tm, GtkTreeI
684 copy_entry (ctx, tm, &child, &cnewpos, GNUNET_NO); 706 copy_entry (ctx, tm, &child, &cnewpos, GNUNET_NO);
685 path = gtk_tree_row_reference_get_path (crr); 707 path = gtk_tree_row_reference_get_path (crr);
686 gtk_tree_row_reference_free (crr); 708 gtk_tree_row_reference_free (crr);
687 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &child, path)); 709 GNUNET_assert (gtk_tree_model_get_iter (tm, &child, path));
688 gtk_tree_path_free (path); 710 gtk_tree_path_free (path);
689 } 711 }
690 while (gtk_tree_model_iter_next (tm, &child)); 712 while (gtk_tree_model_iter_next (tm, &child));
@@ -696,7 +718,7 @@ copy_entry (struct MainPublishingDialogContext *ctx, GtkTreeModel * tm, GtkTreeI
696 path = gtk_tree_row_reference_get_path (rr); 718 path = gtk_tree_row_reference_get_path (rr);
697 gtk_tree_row_reference_free (rr); 719 gtk_tree_row_reference_free (rr);
698 gtk_tree_view_expand_to_path (ctx->file_info_treeview, path); 720 gtk_tree_view_expand_to_path (ctx->file_info_treeview, path);
699 GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, newpos, path)); 721 GNUNET_assert (gtk_tree_model_get_iter (tm, newpos, path));
700 gtk_tree_path_free (path); 722 gtk_tree_path_free (path);
701 gtk_tree_selection_select_iter (ctx->file_info_selection, newpos); 723 gtk_tree_selection_select_iter (ctx->file_info_selection, newpos);
702 update_selectivity_edit (ctx); 724 update_selectivity_edit (ctx);
@@ -2039,7 +2061,7 @@ close_master_publish_dialog (struct MainPublishingDialogContext *ctx)
2039 } 2061 }
2040 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter)); 2062 while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
2041 gtk_tree_store_clear (GTK_TREE_STORE (ctx->file_info_treemodel)); 2063 gtk_tree_store_clear (GTK_TREE_STORE (ctx->file_info_treemodel));
2042 2064 GNUNET_IDENTITY_disconnect (ctx->identity);
2043 gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog)); 2065 gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog));
2044 g_object_unref (G_OBJECT (ctx->builder)); 2066 g_object_unref (G_OBJECT (ctx->builder));
2045 GNUNET_free_non_null (ctx->ns_name); 2067 GNUNET_free_non_null (ctx->ns_name);
@@ -2067,16 +2089,20 @@ close_master_publish_dialog (struct MainPublishingDialogContext *ctx)
2067 */ 2089 */
2068static int 2090static int
2069insert_advertisement (void *cls, struct GNUNET_FS_FileInformation *fi, 2091insert_advertisement (void *cls, struct GNUNET_FS_FileInformation *fi,
2070 uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, 2092 uint64_t length,
2071 struct GNUNET_FS_Uri **uri, 2093 struct GNUNET_CONTAINER_MetaData *meta,
2072 struct GNUNET_FS_BlockOptions *bo, int *do_index, 2094 struct GNUNET_FS_Uri **uri,
2073 void **client_info) 2095 struct GNUNET_FS_BlockOptions *bo,
2096 int *do_index,
2097 void **client_info)
2074{ 2098{
2075 struct MainPublishingDialogContext *ctx = cls; 2099 struct MainPublishingDialogContext *ctx = cls;
2076 struct GNUNET_CRYPTO_EccPublicKey pub; 2100 struct GNUNET_CRYPTO_EccPublicKey pub;
2077 struct GNUNET_FS_Uri *sks_uri; 2101 struct GNUNET_FS_Uri *sks_uri;
2078 char *sks_uri_string; 2102 char *sks_uri_string;
2079 2103
2104 if (NULL == ctx->ns)
2105 return GNUNET_SYSERR;
2080 GNUNET_IDENTITY_ego_get_public_key (ctx->ns, &pub); 2106 GNUNET_IDENTITY_ego_get_public_key (ctx->ns, &pub);
2081 sks_uri = GNUNET_FS_uri_sks_create (&pub, "/"); 2107 sks_uri = GNUNET_FS_uri_sks_create (&pub, "/");
2082 sks_uri_string = GNUNET_FS_uri_to_string (sks_uri); 2108 sks_uri_string = GNUNET_FS_uri_to_string (sks_uri);
@@ -2085,8 +2111,10 @@ insert_advertisement (void *cls, struct GNUNET_FS_FileInformation *fi,
2085 return GNUNET_SYSERR; 2111 return GNUNET_SYSERR;
2086 2112
2087 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>", 2113 GNUNET_CONTAINER_meta_data_insert (meta, "<gnunet>",
2088 EXTRACTOR_METATYPE_URI, EXTRACTOR_METAFORMAT_UTF8, 2114 EXTRACTOR_METATYPE_URI, EXTRACTOR_METAFORMAT_UTF8,
2089 "text/plain", sks_uri_string, strlen (sks_uri_string) + 1); 2115 "text/plain",
2116 sks_uri_string,
2117 strlen (sks_uri_string) + 1);
2090 GNUNET_free (sks_uri_string); 2118 GNUNET_free (sks_uri_string);
2091 return GNUNET_SYSERR; 2119 return GNUNET_SYSERR;
2092} 2120}
@@ -2175,7 +2203,6 @@ GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton * button,
2175 fi = get_file_information (ctx->file_info_treemodel, &iter); 2203 fi = get_file_information (ctx->file_info_treemodel, &iter);
2176 if (do_global && do_own && !disable_ads_insertion) 2204 if (do_global && do_own && !disable_ads_insertion)
2177 GNUNET_FS_file_information_inspect (fi, insert_advertisement, ctx); 2205 GNUNET_FS_file_information_inspect (fi, insert_advertisement, ctx);
2178 /* FIXME-FEATURE-BUG-MINOR: should we convert namespace id and uid from UTF8? */
2179 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (), 2206 GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (),
2180 fi, 2207 fi,
2181 GNUNET_IDENTITY_ego_get_private_key (ns), 2208 GNUNET_IDENTITY_ego_get_private_key (ns),
@@ -2356,7 +2383,9 @@ expander_callback (GObject *object,
2356 2383
2357 g_value_init (&gv, G_TYPE_BOOLEAN); 2384 g_value_init (&gv, G_TYPE_BOOLEAN);
2358 g_value_set_boolean (&gv, expanded); 2385 g_value_set_boolean (&gv, expanded);
2359 gtk_container_child_set_property (GTK_CONTAINER (ctx->vpaned), ctx->bottom_frame, "resize", &gv); 2386 gtk_container_child_set_property (GTK_CONTAINER (ctx->vpaned),
2387 ctx->bottom_frame,
2388 "resize", &gv);
2360 paned_pos = gtk_paned_get_position (GTK_PANED (ctx->vpaned)); 2389 paned_pos = gtk_paned_get_position (GTK_PANED (ctx->vpaned));
2361 paned_pos = paned_pos + (scrolled_allocation.height * (expanded ? -1 : 1)); 2390 paned_pos = paned_pos + (scrolled_allocation.height * (expanded ? -1 : 1));
2362 gtk_paned_set_position (GTK_PANED (ctx->vpaned), paned_pos); 2391 gtk_paned_set_position (GTK_PANED (ctx->vpaned), paned_pos);
@@ -2449,7 +2478,9 @@ add_updateable_to_ts (void *cls, const char *last_id,
2449 urilen = 0; 2478 urilen = 0;
2450 2479
2451 mdbuf = NULL; 2480 mdbuf = NULL;
2452 mdsize = GNUNET_CONTAINER_meta_data_serialize (last_meta, &mdbuf, 64*1024, GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL); 2481 mdsize = GNUNET_CONTAINER_meta_data_serialize (last_meta,
2482 &mdbuf, 64*1024,
2483 GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
2453 if (0 > mdsize) 2484 if (0 > mdsize)
2454 mdsize = 0; 2485 mdsize = 0;
2455 2486
@@ -2535,18 +2566,19 @@ add_updateable_to_ts (void *cls, const char *last_id,
2535 next_id, 2566 next_id,
2536 &add_updateable_to_ts, 2567 &add_updateable_to_ts,
2537 &sc); 2568 &sc);
2538 if ((sc.update_called == GNUNET_NO) && (next_id != NULL) && 2569 if ((sc.update_called == GNUNET_NO) &&
2570 (NULL != next_id) &&
2539 (strlen (next_id) > 0)) 2571 (strlen (next_id) > 0))
2540 { 2572 {
2541 /* add leaf */ 2573 /* add leaf */
2542 displaytext = g_strdup_printf ("<b>%s</b>", next_id); 2574 displaytext = g_strdup_printf ("<b>%s</b>", next_id);
2543 gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT, 2575 gtk_tree_store_insert_with_values (uc->ts, &titer, &iter, G_MAXINT,
2544 IDENTIFIERS_MC_ID, next_id, 2576 IDENTIFIERS_MC_ID, next_id,
2545 IDENTIFIERS_MC_UPDATE_ID, NULL, 2577 IDENTIFIERS_MC_UPDATE_ID, NULL,
2546 IDENTIFIERS_MC_DESCRIPTION, NULL, 2578 IDENTIFIERS_MC_DESCRIPTION, NULL,
2547 IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL, 2579 IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL,
2548 IDENTIFIERS_MC_ID_MARKED_UP, displaytext, 2580 IDENTIFIERS_MC_ID_MARKED_UP, displaytext,
2549 -1); 2581 -1);
2550 g_free (displaytext); 2582 g_free (displaytext);
2551 } 2583 }
2552} 2584}
@@ -2572,30 +2604,142 @@ free_seen_paths (void *cls,
2572 2604
2573 2605
2574/** 2606/**
2575 * Add all updateable entries of the current namespace to the 2607 * User changed the selected namespace. Check if it is valid,
2576 * tree store. 2608 * and if so, update the rest of the dialog accordingly.
2577 * 2609 *
2578 * @param cls the 'GtkTreeStore' to update 2610 * @param combo the namespace selection combo box
2579 * @param name name of the namespace to add 2611 * @param user_data the 'struct MainPublishingDialogContext'
2580 * @param id identity of the namespace to add
2581 */ 2612 */
2582static void 2613void
2583add_namespace_to_ts (GtkTreeStore *ts, 2614GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb (GtkComboBox *combo,
2584 struct GNUNET_IDENTITY_Ego *ns) 2615 gpointer user_data)
2585{ 2616{
2617 struct MainPublishingDialogContext *ctx = user_data;
2618 GtkTreeIter iter;
2619 GtkTreeStore *ts;
2620 GtkTreeModel *tm;
2621 struct GNUNET_IDENTITY_Ego *ego;
2586 struct UpdateableContext uc; 2622 struct UpdateableContext uc;
2587 2623
2624 ts = GTK_TREE_STORE (gtk_builder_get_object (ctx->builder,
2625 "GNUNET_GTK_update_identifiers_treestore"));
2626 gtk_tree_store_clear (ts);
2627 if (! gtk_combo_box_get_active_iter (combo, &iter))
2628 {
2629 /* entry unselected, etc. */
2630 ctx->ns = NULL;
2631 gtk_widget_set_sensitive (ctx->identifier_entry, FALSE);
2632 gtk_widget_set_sensitive (ctx->updateable_checkbox, FALSE);
2633 gtk_widget_set_sensitive (ctx->update_id_entry, FALSE);
2634 update_selectivity_execute_cancel (ctx);
2635 return;
2636 }
2637 tm = GTK_TREE_MODEL (gtk_builder_get_object (ctx->builder,
2638 "GNUNET_GTK_master_publish_dialog_ego_liststore"));
2639 gtk_tree_model_get (tm, &iter,
2640 EGO_MC_EGO, &ego,
2641 -1);
2642 if (NULL == ego)
2643 {
2644 GNUNET_break (0);
2645 gtk_widget_set_sensitive (ctx->identifier_entry, FALSE);
2646 gtk_widget_set_sensitive (ctx->updateable_checkbox, FALSE);
2647 gtk_widget_set_sensitive (ctx->update_id_entry, FALSE);
2648 update_selectivity_execute_cancel (ctx);
2649 return;
2650 }
2651 ctx->ns = ego;
2588 uc.parent = NULL; 2652 uc.parent = NULL;
2589 uc.ts = ts; 2653 uc.ts = ts;
2590 uc.ns = ns; 2654 uc.ns = ego;
2591 uc.update_called = GNUNET_NO; 2655 uc.update_called = GNUNET_NO;
2592 uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO); 2656 uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
2657
2593 GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (), 2658 GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (),
2594 GNUNET_IDENTITY_ego_get_private_key (uc.ns), 2659 GNUNET_IDENTITY_ego_get_private_key (ego),
2595 NULL, 2660 NULL,
2596 &add_updateable_to_ts, &uc); 2661 &add_updateable_to_ts,
2597 GNUNET_CONTAINER_multihashmap_iterate (uc.seen, free_seen_paths, NULL); 2662 &uc);
2663 GNUNET_CONTAINER_multihashmap_iterate (uc.seen, &free_seen_paths, NULL);
2598 GNUNET_CONTAINER_multihashmap_destroy (uc.seen); 2664 GNUNET_CONTAINER_multihashmap_destroy (uc.seen);
2665 gtk_widget_set_sensitive (ctx->identifier_entry, TRUE);
2666 gtk_widget_set_sensitive (ctx->updateable_checkbox, TRUE);
2667 gtk_widget_set_sensitive (ctx->update_id_entry, TRUE);
2668 update_selectivity_execute_cancel (ctx);
2669}
2670
2671
2672/**
2673 * Add all updateable entries of the current namespace to the
2674 * tree store.
2675 *
2676 * @param cls our 'struct MainPublishingDialogContext'
2677 * @param ego identity of the namespace to add
2678 * @param ego_ctx where to store context data
2679 * @param name name of the namespace to add
2680 */
2681static void
2682add_namespace_to_ts (void *cls,
2683 struct GNUNET_IDENTITY_Ego *ego,
2684 void **ego_ctx,
2685 const char *name)
2686{
2687 struct MainPublishingDialogContext *ctx = cls;
2688 GtkListStore *ls;
2689 GtkTreePath *path;
2690 GtkTreeRowReference *rr;
2691 GtkTreeIter iter;
2692 gboolean have_ns;
2693
2694 if (NULL == ego)
2695 return; /* nothing to be done */
2696 ls = GTK_LIST_STORE (gtk_builder_get_object (ctx->builder,
2697 "GNUNET_GTK_master_publish_dialog_ego_liststore"));
2698 rr = *ego_ctx;
2699 if (NULL == rr)
2700 {
2701 /* insert operation */
2702 GNUNET_assert (NULL != name);
2703 gtk_list_store_insert_with_values (ls,
2704 &iter, G_MAXINT,
2705 EGO_MC_NAME, name,
2706 EGO_MC_EGO, ego,
2707 -1);
2708 path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls),
2709 &iter);
2710 rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ls),
2711 path);
2712 gtk_tree_path_free (path);
2713 *ego_ctx = rr;
2714 }
2715 else if (NULL == name)
2716 {
2717 /* delete operation */
2718 path = gtk_tree_row_reference_get_path (rr);
2719 gtk_tree_row_reference_free (rr);
2720 GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ls),
2721 &iter, path));
2722 gtk_tree_path_free (path);
2723 gtk_list_store_remove (ls, &iter);
2724 *ego_ctx = NULL;
2725 }
2726 else
2727 {
2728 /* rename operation */
2729 path = gtk_tree_row_reference_get_path (rr);
2730 GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ls),
2731 &iter, path));
2732 gtk_list_store_set (ls,
2733 &iter, G_MAXINT,
2734 EGO_MC_NAME, name,
2735 -1);
2736 gtk_tree_path_free (path);
2737 }
2738 have_ns = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls), &iter);
2739 gtk_widget_set_sensitive (ctx->own_checkbox, have_ns);
2740 gtk_widget_set_sensitive (ctx->identifier_entry, have_ns);
2741 gtk_widget_set_sensitive (ctx->updateable_checkbox, have_ns);
2742 gtk_widget_set_sensitive (ctx->update_id_entry, have_ns);
2599} 2743}
2600 2744
2601 2745
@@ -2610,9 +2754,8 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
2610 gpointer user_data) 2754 gpointer user_data)
2611{ 2755{
2612 struct MainPublishingDialogContext *ctx; 2756 struct MainPublishingDialogContext *ctx;
2613/* GtkTreeView *pseudonym_treeview;*/
2614 const struct GNUNET_CONFIGURATION_Handle *cfg; 2757 const struct GNUNET_CONFIGURATION_Handle *cfg;
2615 gboolean have_ns; 2758 GtkWidget *toplevel;
2616 int updateable_enabled; 2759 int updateable_enabled;
2617 int own_enabled; 2760 int own_enabled;
2618 int global_enabled; 2761 int global_enabled;
@@ -2642,7 +2785,7 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
2642 ctx->execute_button = GTK_WIDGET (gtk_builder_get_object 2785 ctx->execute_button = GTK_WIDGET (gtk_builder_get_object
2643 (ctx->builder, "GNUNET_GTK_master_publish_dialog_execute_button")); 2786 (ctx->builder, "GNUNET_GTK_master_publish_dialog_execute_button"));
2644 ctx->cancel_button = GTK_WIDGET (gtk_builder_get_object 2787 ctx->cancel_button = GTK_WIDGET (gtk_builder_get_object
2645 (ctx->builder , "GNUNET_GTK_master_publish_dialog_cancel_button")); 2788 (ctx->builder, "GNUNET_GTK_master_publish_dialog_cancel_button"));
2646 ctx->file_info_treeview = GTK_TREE_VIEW (gtk_builder_get_object 2789 ctx->file_info_treeview = GTK_TREE_VIEW (gtk_builder_get_object
2647 (ctx->builder, "GNUNET_GTK_master_publish_dialog_file_information_tree_view")); 2790 (ctx->builder, "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
2648 ctx->file_info_selection = gtk_tree_view_get_selection (ctx->file_info_treeview); 2791 ctx->file_info_selection = gtk_tree_view_get_selection (ctx->file_info_treeview);
@@ -2652,20 +2795,18 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
2652 (ctx->builder, "GNUNET_GTK_master_publish_dialog")); 2795 (ctx->builder, "GNUNET_GTK_master_publish_dialog"));
2653 2796
2654 ctx->global_checkbox = GTK_WIDGET (gtk_builder_get_object 2797 ctx->global_checkbox = GTK_WIDGET (gtk_builder_get_object
2655 (ctx->builder , "GNUNET_GTK_master_publish_dialog_global_checkbox")); 2798 (ctx->builder, "GNUNET_GTK_master_publish_dialog_global_checkbox"));
2656 ctx->own_checkbox = GTK_WIDGET (gtk_builder_get_object 2799 ctx->own_checkbox = GTK_WIDGET (gtk_builder_get_object
2657 (ctx->builder , "GNUNET_GTK_master_publish_dialog_own_checkbox")); 2800 (ctx->builder, "GNUNET_GTK_master_publish_dialog_own_checkbox"));
2658 ctx->own_label = GTK_WIDGET (gtk_builder_get_object
2659 (ctx->builder , "GNUNET_GTK_master_publish_dialog_own_label"));
2660 ctx->updateable_checkbox = GTK_WIDGET (gtk_builder_get_object 2801 ctx->updateable_checkbox = GTK_WIDGET (gtk_builder_get_object
2661 (ctx->builder , "GNUNET_GTK_master_publish_dialog_updateable_checkbox")); 2802 (ctx->builder, "GNUNET_GTK_master_publish_dialog_updateable_checkbox"));
2662 ctx->update_id_entry = GTK_WIDGET (gtk_builder_get_object 2803 ctx->update_id_entry = GTK_WIDGET (gtk_builder_get_object
2663 (ctx->builder , "GNUNET_GTK_master_publish_dialog_update_id_entry")); 2804 (ctx->builder, "GNUNET_GTK_master_publish_dialog_update_id_entry"));
2664 2805
2665 ctx->own_vbox = GTK_WIDGET (gtk_builder_get_object 2806 ctx->own_vbox = GTK_WIDGET (gtk_builder_get_object
2666 (ctx->builder , "GNUNET_GTK_master_publish_dialog_own_vbox")); 2807 (ctx->builder, "GNUNET_GTK_master_publish_dialog_own_vbox"));
2667 ctx->update_id_hbox = GTK_WIDGET (gtk_builder_get_object 2808 ctx->update_id_hbox = GTK_WIDGET (gtk_builder_get_object
2668 (ctx->builder , "GNUNET_GTK_master_publish_dialog_update_id_hbox")); 2809 (ctx->builder, "GNUNET_GTK_master_publish_dialog_update_id_hbox"));
2669 2810
2670 ctx->identifiers_expander = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander")); 2811 ctx->identifiers_expander = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander"));
2671 ctx->vpaned = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_vpaned")); 2812 ctx->vpaned = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog_vpaned"));
@@ -2687,50 +2828,10 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
2687 G_CALLBACK (identifiers_selection_changed_cb), ctx); 2828 G_CALLBACK (identifiers_selection_changed_cb), ctx);
2688 2829
2689 cfg = GNUNET_FS_GTK_get_configuration (); 2830 cfg = GNUNET_FS_GTK_get_configuration ();
2690#if FIXME_MIGRATE_TO_IDENTITY_SERVICE 2831 ctx->identity = GNUNET_IDENTITY_connect (cfg,
2691 if (GNUNET_OK != 2832 &add_namespace_to_ts,
2692 GNUNET_CONFIGURATION_get_value_string (cfg, 2833 ctx);
2693 "gnunet-fs-gtk",
2694 "DEFAULT_NAMESPACE",
2695 &ctx->ns_name))
2696 ctx->ns_name = NULL;
2697 else
2698 {
2699 ctx->ns = GNUNET_FS_namespace_open_existing (GNUNET_FS_GTK_get_fs_handle (),
2700 ctx->ns_name);
2701 if (NULL == ctx->ns)
2702 GNUNET_free (ctx->ns_name);
2703 }
2704#endif
2705 have_ns = (NULL != ctx->ns);
2706 2834
2707 gtk_widget_set_sensitive (ctx->own_checkbox, have_ns);
2708 gtk_widget_set_sensitive (ctx->identifier_entry, have_ns);
2709 gtk_widget_set_sensitive (ctx->updateable_checkbox, have_ns);
2710 gtk_widget_set_sensitive (ctx->update_id_entry, have_ns);
2711 if (ctx->ns)
2712 {
2713 gtk_label_set_text (GTK_LABEL (ctx->own_label), ctx->ns_name);
2714 gtk_widget_set_tooltip_text (ctx->own_label, _(
2715 "This is the label of your namespace that will be used for "
2716 "publication, if you enable that option.\n"
2717 "This label will not be part of the publication.\n"
2718 "If you don't like this label, use Namespace Organizer to change it."
2719 ));
2720 add_namespace_to_ts (GTK_TREE_STORE (ctx->identifiers_treemodel), ctx->ns);
2721 gtk_tree_view_expand_all (ctx->identifiers_treeview);
2722 }
2723 else
2724 {
2725 gtk_label_set_text (GTK_LABEL (ctx->own_label),
2726 _("<no namespace is selected>"));
2727 gtk_widget_set_tooltip_text (ctx->own_label, _(
2728 "Namespace publication is unavailable, no namespace is selected.\n"
2729 "Try to close this dialog, open Namespace Organizer dialog, and "
2730 "select a namespace from a list of namespaces you own.\n"
2731 "You may need to create one, if you don't have any."
2732 ));
2733 }
2734 2835
2735 updateable_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg, 2836 updateable_enabled = GNUNET_CONFIGURATION_get_value_yesno (cfg,
2736 "gnunet-fs-gtk", "MAKE_UPDATEABLE_PUBLICATIONS_BY_DEFAULT"); 2837 "gnunet-fs-gtk", "MAKE_UPDATEABLE_PUBLICATIONS_BY_DEFAULT");
@@ -2756,6 +2857,10 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy,
2756 GNUNET_YES == global_enabled); 2857 GNUNET_YES == global_enabled);
2757 2858
2758 /* show dialog */ 2859 /* show dialog */
2860 toplevel = gtk_widget_get_toplevel (dummy);
2861 if (GTK_IS_WINDOW (toplevel))
2862 gtk_window_set_transient_for (GTK_WINDOW (ctx->master_pubdialog),
2863 GTK_WINDOW (toplevel));
2759 gtk_window_present (GTK_WINDOW (ctx->master_pubdialog)); 2864 gtk_window_present (GTK_WINDOW (ctx->master_pubdialog));
2760} 2865}
2761 2866