diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c index 11f983a8..d429694d 100644 --- a/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c +++ b/src/fs/gnunet-fs-gtk-main_window_adv_pseudonym.c | |||
@@ -27,8 +27,9 @@ | |||
27 | #include "gnunet-fs-gtk-edit_publish_dialog.h" | 27 | #include "gnunet-fs-gtk-edit_publish_dialog.h" |
28 | 28 | ||
29 | gboolean | 29 | gboolean |
30 | GNUNET_GTK_select_pseudonym_dialog_delete_event_cb (GtkWidget *widget, | 30 | GNUNET_GTK_select_pseudonym_dialog_delete_event_cb (GtkWidget * widget, |
31 | GdkEvent *event, gpointer user_Data) | 31 | GdkEvent * event, |
32 | gpointer user_Data) | ||
32 | { | 33 | { |
33 | gtk_widget_hide (widget); | 34 | gtk_widget_hide (widget); |
34 | return TRUE; | 35 | return TRUE; |
@@ -49,6 +50,7 @@ add_to_list (void *cls, const char *name, const GNUNET_HashCode * id) | |||
49 | GtkListStore *ls = cls; | 50 | GtkListStore *ls = cls; |
50 | GtkTreeIter iter; | 51 | GtkTreeIter iter; |
51 | char *name_utf8; | 52 | char *name_utf8; |
53 | |||
52 | name_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) name); | 54 | name_utf8 = GNUNET_GTK_from_loc_to_utf8 ((char *) name); |
53 | 55 | ||
54 | gtk_list_store_insert_with_values (ls, &iter, -1, 0, name_utf8, 1, | 56 | gtk_list_store_insert_with_values (ls, &iter, -1, 0, name_utf8, 1, |
@@ -65,6 +67,7 @@ selection_changed_cb (GtkTreeSelection * ts, gpointer user_data) | |||
65 | GtkTreeIter iter; | 67 | GtkTreeIter iter; |
66 | GtkWidget *ok_button; | 68 | GtkWidget *ok_button; |
67 | GtkBuilder *builder; | 69 | GtkBuilder *builder; |
70 | |||
68 | builder = GTK_BUILDER (user_data); | 71 | builder = GTK_BUILDER (user_data); |
69 | 72 | ||
70 | ok_button = | 73 | ok_button = |
@@ -105,26 +108,24 @@ struct NamespaceAdvertisementContext | |||
105 | */ | 108 | */ |
106 | static int | 109 | static int |
107 | advertise_namespace (void *cls, struct GNUNET_FS_FileInformation *fi, | 110 | advertise_namespace (void *cls, struct GNUNET_FS_FileInformation *fi, |
108 | uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, | 111 | uint64_t length, struct GNUNET_CONTAINER_MetaData *meta, |
109 | struct GNUNET_FS_Uri **uri, struct GNUNET_FS_BlockOptions *bo, | 112 | struct GNUNET_FS_Uri **uri, |
110 | int *do_index, void **client_info) | 113 | struct GNUNET_FS_BlockOptions *bo, int *do_index, |
114 | void **client_info) | ||
111 | { | 115 | { |
112 | struct NamespaceAdvertisementContext *nds = cls; | 116 | struct NamespaceAdvertisementContext *nds = cls; |
113 | 117 | ||
114 | GNUNET_FS_namespace_advertise (GNUNET_FS_GTK_get_fs_handle (), *uri, | 118 | GNUNET_FS_namespace_advertise (GNUNET_FS_GTK_get_fs_handle (), *uri, nds->ns, |
115 | nds->ns, meta, bo, nds->root, NULL, NULL); | 119 | meta, bo, nds->root, NULL, NULL); |
116 | return GNUNET_SYSERR; | 120 | return GNUNET_SYSERR; |
117 | } | 121 | } |
118 | 122 | ||
119 | 123 | ||
120 | static void | 124 | static void |
121 | adv_pseudonym_edit_publish_dialog_cb (gpointer cls, | 125 | adv_pseudonym_edit_publish_dialog_cb (gpointer cls, int do_index, |
122 | int do_index, | 126 | const char *short_fn, |
123 | const char *short_fn, | 127 | guint anonymity_level, guint priority, |
124 | guint anonymity_level, | 128 | const char *root, gint ret) |
125 | guint priority, | ||
126 | const char *root, | ||
127 | gint ret) | ||
128 | { | 129 | { |
129 | struct NamespaceAdvertisementContext *nds = cls; | 130 | struct NamespaceAdvertisementContext *nds = cls; |
130 | 131 | ||
@@ -135,8 +136,7 @@ adv_pseudonym_edit_publish_dialog_cb (gpointer cls, | |||
135 | nds->anonymity_level = anonymity_level; | 136 | nds->anonymity_level = anonymity_level; |
136 | nds->priority = priority; | 137 | nds->priority = priority; |
137 | nds->root = root; | 138 | nds->root = root; |
138 | GNUNET_FS_file_information_inspect (nds->fip, | 139 | GNUNET_FS_file_information_inspect (nds->fip, &advertise_namespace, nds); |
139 | &advertise_namespace, nds); | ||
140 | } | 140 | } |
141 | GNUNET_FS_namespace_delete (nds->ns, GNUNET_NO); | 141 | GNUNET_FS_namespace_delete (nds->ns, GNUNET_NO); |
142 | GNUNET_FS_file_information_destroy (nds->fip, NULL, NULL); | 142 | GNUNET_FS_file_information_destroy (nds->fip, NULL, NULL); |
@@ -144,8 +144,9 @@ adv_pseudonym_edit_publish_dialog_cb (gpointer cls, | |||
144 | } | 144 | } |
145 | 145 | ||
146 | void | 146 | void |
147 | GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog *dialog, | 147 | GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog * dialog, |
148 | gint response_id, gpointer user_data) | 148 | gint response_id, |
149 | gpointer user_data) | ||
149 | { | 150 | { |
150 | GtkBuilder *builder; | 151 | GtkBuilder *builder; |
151 | GtkWidget *ad; | 152 | GtkWidget *ad; |
@@ -170,8 +171,7 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog *dialog, | |||
170 | return; | 171 | return; |
171 | } | 172 | } |
172 | tv = GTK_TREE_VIEW (gtk_builder_get_object | 173 | tv = GTK_TREE_VIEW (gtk_builder_get_object |
173 | (builder, | 174 | (builder, "GNUNET_GTK_select_pseudonym_tree_view")); |
174 | "GNUNET_GTK_select_pseudonym_tree_view")); | ||
175 | sel = gtk_tree_view_get_selection (tv); | 175 | sel = gtk_tree_view_get_selection (tv); |
176 | 176 | ||
177 | GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, &tm, &iter)); | 177 | GNUNET_assert (TRUE == gtk_tree_selection_get_selected (sel, &tm, &iter)); |
@@ -202,23 +202,24 @@ GNUNET_GTK_select_pseudonym_dialog_response_cb (GtkDialog *dialog, | |||
202 | /* This is a bogus fileinfo. It's needed because edit_publish_dialog | 202 | /* This is a bogus fileinfo. It's needed because edit_publish_dialog |
203 | * was written to work with fileinfo, and return a fileinfo. | 203 | * was written to work with fileinfo, and return a fileinfo. |
204 | */ | 204 | */ |
205 | memset (&bo, 0, sizeof (bo)); | 205 | memset (&bo, 0, sizeof (bo)); |
206 | bo.expiration_time = GNUNET_FS_year_to_time (GNUNET_FS_get_current_year () + 2); | 206 | bo.expiration_time = |
207 | GNUNET_FS_year_to_time (GNUNET_FS_get_current_year () + 2); | ||
207 | bo.anonymity_level = 1; | 208 | bo.anonymity_level = 1; |
208 | nds->fip = GNUNET_FS_file_information_create_empty_directory (NULL, NULL, | 209 | nds->fip = |
209 | NULL, meta, &bo); | 210 | GNUNET_FS_file_information_create_empty_directory (NULL, NULL, NULL, meta, |
211 | &bo); | ||
210 | GNUNET_CONTAINER_meta_data_destroy (meta); | 212 | GNUNET_CONTAINER_meta_data_destroy (meta); |
211 | GNUNET_FS_GTK_edit_publish_dialog (builder, transient, | 213 | GNUNET_FS_GTK_edit_publish_dialog (builder, transient, nds->do_index, |
212 | nds->do_index, | 214 | nds->short_fn, nds->anonymity_level, |
213 | nds->short_fn, | 215 | nds->priority, nds->fip, FALSE, |
214 | nds->anonymity_level, | 216 | &adv_pseudonym_edit_publish_dialog_cb, |
215 | nds->priority, | 217 | nds); |
216 | nds->fip, FALSE, &adv_pseudonym_edit_publish_dialog_cb, nds); | ||
217 | } | 218 | } |
218 | 219 | ||
219 | void | 220 | void |
220 | GNUNET_GTK_select_pseudonym_dialog_realize_cb (GtkWidget *widget, | 221 | GNUNET_GTK_select_pseudonym_dialog_realize_cb (GtkWidget * widget, |
221 | gpointer user_data) | 222 | gpointer user_data) |
222 | { | 223 | { |
223 | GtkTreeView *tv; | 224 | GtkTreeView *tv; |
224 | GtkTreeSelection *sel; | 225 | GtkTreeSelection *sel; |