aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2005-07-07 23:43:14 +0000
committerChristian Grothoff <christian@grothoff.org>2005-07-07 23:43:14 +0000
commite461eb85bd6562303f45ea41f8f1239f94ca2ac8 (patch)
tree19d3762e1af4952bef99005d6db7f2be3d93b79d
parentf07540cdce1d564409687bd85f72b307edd500d6 (diff)
downloadgnunet-gtk-e461eb85bd6562303f45ea41f8f1239f94ca2ac8.tar.gz
gnunet-gtk-e461eb85bd6562303f45ea41f8f1239f94ca2ac8.zip
collections, some more namespace work, debugging
-rw-r--r--TODO37
-rw-r--r--src/common/helper.c21
-rw-r--r--src/include/platform.h2
-rw-r--r--src/plugins/fs/collection.c231
-rw-r--r--src/plugins/fs/download.c6
-rw-r--r--src/plugins/fs/fs.h1
-rw-r--r--src/plugins/fs/namespace.c168
7 files changed, 411 insertions, 55 deletions
diff --git a/TODO b/TODO
index 8115e013..7aeb4f2c 100644
--- a/TODO
+++ b/TODO
@@ -1,24 +1,17 @@
1Important (for 0.7.0): 10.7.0 (all of these can go under "known limitations", that
2* bugs: 2 is, they are not release-critical IMO):
3 - figure out where seemingly spurious "pending" downloads come from 31) stats integration (daemon+own module for graphical stats)
4 - why can the "file sharing" tab not be selected first 42) update interval is not parsed
5 (I can select first "General" and then "file sharing"!, 53) update namespace content (not implemented)
6 glade shows no difference between the two!!!) 64) code cleanup (lots of repetition of code in fs plugin)
7* implement advanced FS operations: 75) various minor memory leaks in models (esp. on shutdown)
8 - create namespace [ medium, CG ] 86) figure out where seemingly spurious "pending" downloads
9 * minor FIXMEs: root entry, minor FIXMEs, error hanlding 9 come from (still there?)
10 - delete namespace [ medium, CG ] 107) why can the "file sharing" tab not be selected first
11 - publish to namespace [ easy, CG ] 11 (I can select first "General" and then "file sharing"!,
12 - publish update [ easy, CG ] 12 glade shows no difference between the two!!!)
13 - start collection [ easy, CG ]
14 * enable stop collection!
15 * need visual feedback for collection status!
16 - stop collection [ easy, CG ]
17 * enable start collection!
18 13
19 14Later (0.7.1+):
20Later (0.7.1):
210) stats integration (daemon+own module for graphical stats) [ medium ]
221) auto-rename downloaded files 151) auto-rename downloaded files
23 to better names (user feedback!?) [ medium ] 16 to better names (user feedback!?) [ medium ]
242) create directory from known file IDs [ medium ] 172) create directory from known file IDs [ medium ]
@@ -27,8 +20,10 @@ Later (0.7.1):
274) more help-texts (glade) [ easy ] 204) more help-texts (glade) [ easy ]
285) highlight completed downloads [ easy ] 215) highlight completed downloads [ easy ]
296) highlight active downloads in search list [ easy ] 226) highlight active downloads in search list [ easy ]
307) pop-up dialogs / context menus [ medium ] 237) pop-up dialogs / context menus (show extra information,
24 in particular full metadata) [ medium ]
318) chat [ difficult ] 258) chat [ difficult ]
269) show content of current collection
32 27
33 28
34gnunet-gtk wishlist (from pre-0.7.0 days): 29gnunet-gtk wishlist (from pre-0.7.0 days):
diff --git a/src/common/helper.c b/src/common/helper.c
index c4aa8e18..c8065716 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -257,6 +257,7 @@ static void connector(const gchar *handler_name,
257 Plugin * plug = user_data; 257 Plugin * plug = user_data;
258 void * method; 258 void * method;
259 259
260 method = NULL;
260 while (plug != NULL) { 261 while (plug != NULL) {
261 method = trybindDynamicMethod(plug->library, 262 method = trybindDynamicMethod(plug->library,
262 "", 263 "",
@@ -283,8 +284,7 @@ void connectGladeWithPlugins(GladeXML * xml) {
283 284
284typedef void (*PlainCall)(); 285typedef void (*PlainCall)();
285 286
286static Plugin * loadPlugin(const char * name, 287static void loadPlugin(const char * name) {
287 Plugin * next) {
288 Plugin * p; 288 Plugin * p;
289 void * lib; 289 void * lib;
290 PlainCall init; 290 PlainCall init;
@@ -295,29 +295,27 @@ static Plugin * loadPlugin(const char * name,
295 LOG(LOG_WARNING, 295 LOG(LOG_WARNING,
296 _("Failed to load plugin '%s'\n"), 296 _("Failed to load plugin '%s'\n"),
297 name); 297 name);
298 return next; 298 return;
299 } 299 }
300 p = MALLOC(sizeof(Plugin)); 300 p = MALLOC(sizeof(Plugin));
301 p->name = STRDUP(name); 301 p->name = STRDUP(name);
302 p->next = next; 302 p->next = plugin;
303 p->library = lib; 303 p->library = lib;
304 plugin = p;
304 init = trybindDynamicMethod(lib, 305 init = trybindDynamicMethod(lib,
305 "init_", 306 "init_",
306 name); 307 name);
307 if (init != NULL) 308 if (init != NULL)
308 init(); 309 init();
309
310 return p;
311} 310}
312 311
313static Plugin * loadPlugins(const char * names, 312static void loadPlugins(const char * names) {
314 Plugin * plug) {
315 char * dup; 313 char * dup;
316 char * next; 314 char * next;
317 const char * pos; 315 const char * pos;
318 316
319 if (names == NULL) 317 if (names == NULL)
320 return plug; 318 return;
321 319
322 dup = STRDUP(names); 320 dup = STRDUP(names);
323 next = dup; 321 next = dup;
@@ -338,11 +336,10 @@ static Plugin * loadPlugins(const char * names,
338 LOG(LOG_DEBUG, 336 LOG(LOG_DEBUG,
339 "Loading plugin '%s'\n", 337 "Loading plugin '%s'\n",
340 pos); 338 pos);
341 plug = loadPlugin(pos, plug); 339 loadPlugin(pos);
342 } 340 }
343 } while (next != NULL); 341 } while (next != NULL);
344 FREE(dup); 342 FREE(dup);
345 return plug;
346} 343}
347 344
348static void unloadPlugin(Plugin * plug) { 345static void unloadPlugin(Plugin * plug) {
@@ -392,7 +389,7 @@ void initGNUnetGTKCommon() {
392 "PLUGINS"); 389 "PLUGINS");
393 if (load == NULL) 390 if (load == NULL)
394 load = STRDUP("about daemon fs"); 391 load = STRDUP("about daemon fs");
395 plugin = loadPlugins(load, NULL); 392 loadPlugins(load);
396 FREE(load); 393 FREE(load);
397 394
398 connectGladeWithPlugins(mainXML); 395 connectGladeWithPlugins(mainXML);
diff --git a/src/include/platform.h b/src/include/platform.h
index 0d2d6ac0..75ce9652 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -37,7 +37,7 @@
37 37
38#define _(a) gettext(a) 38#define _(a) gettext(a)
39 39
40#define UNREF(a) LOG(LOG_DEBUG, "unref %s:%u\n", __FILE__, __LINE__); g_object_unref(a) 40#define UNREF(a) /*LOG(LOG_DEBUG, "unref %s:%u\n", __FILE__, __LINE__);*/ g_object_unref(a)
41 41
42#include "plibc.h" 42#include "plibc.h"
43 43
diff --git a/src/plugins/fs/collection.c b/src/plugins/fs/collection.c
index df1ca7f6..144840ac 100644
--- a/src/plugins/fs/collection.c
+++ b/src/plugins/fs/collection.c
@@ -30,25 +30,232 @@
30#include "collection.h" 30#include "collection.h"
31#include <extractor.h> 31#include <extractor.h>
32 32
33void create_collection_clicked(GtkWidget * dummy1, 33static GladeXML * metaXML;
34 GtkWidget * dummy2) { 34
35 /* 35
36 FSUI_startCollection(ctx, 36
37 unsigned int anonymityLevel, 37/**
38 cron_t updateInterval, 38 * FIXME: somehow this function is not called
39 const char * name, 39 * when the button is clicked.
40 const struct ECRS_MetaData * meta);
41 */ 40 */
41void
42on_collectionDialogMetaDataAddButton_clicked(gpointer dummy,
43 GtkWidget * uploadButton) {
44 GtkWidget * metaList;
45 GtkWidget * entryLine;
46 GtkWidget * typeCB;
47 const char * value;
48 EXTRACTOR_KeywordType type;
49 GtkListStore * metamodel;
50 GtkListStore * typemodel;
51 GtkTreeIter iter;
52 char * stype;
53
54 metaList = glade_xml_get_widget(metaXML,
55 "collectionMetaDataTreeView");
56 metamodel
57 = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(metaList)));
58
59 entryLine = glade_xml_get_widget(metaXML,
60 "collectionMetaDataValueEntry");
61 value = gtk_entry_get_text(GTK_ENTRY(entryLine));
62 typeCB = glade_xml_get_widget(metaXML,
63 "collectionMetaDataTypeComboBox");
64 typemodel
65 = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(typeCB)));
66 if (! gtk_combo_box_get_active_iter(GTK_COMBO_BOX(typeCB),
67 &iter))
68 return; /* oops */
69 gtk_tree_model_get(GTK_TREE_MODEL(typemodel),
70 &iter,
71 META_STYPE, &stype,
72 META_TYPE, &type,
73 -1);
74 gtk_list_store_append(metamodel,
75 &iter);
76 gtk_list_store_set(metamodel,
77 &iter,
78 META_TYPE, type,
79 META_STYPE, stype,
80 META_VALUE, value,
81 -1);
82 gtk_entry_set_text(GTK_ENTRY(entryLine), "");
42} 83}
43 84
44void collectionDelete_clicked(GtkWidget * dummy1, 85
86void createCollection_clicked(GtkWidget * dummy1,
87 GtkWidget * dummy2) {
88 GtkWidget * w;
89 const char * collectionName;
90 GtkWidget * nameLine;
91 GtkWidget * metaList;
92 GtkWidget * dialog;
93 GtkWidget * metaType;
94 GtkWidget * spin;
95 GtkListStore * metamodel;
96 GtkCellRenderer * renderer;
97 GtkListStore * keywordTypeModel;
98 GtkTreeIter iter;
99 struct ECRS_MetaData * meta;
100 EXTRACTOR_KeywordType type;
101 const char * stype;
102 char * mvalue;
103 struct ECRS_URI * root;
104 cron_t updateInterval;
105 const char * updateIntervalString;
106
107 metaXML
108 = glade_xml_new(getGladeFileName(),
109 "createCollectionDialog",
110 NULL);
111 connectGladeWithPlugins(metaXML);
112 dialog = glade_xml_get_widget(metaXML,
113 "createCollectionDialog");
114 metamodel
115 = gtk_list_store_new(META_NUM,
116 G_TYPE_INT,
117 G_TYPE_STRING,
118 G_TYPE_STRING);
119 metaList = glade_xml_get_widget(metaXML,
120 "collectionMetaDataTreeView");
121 renderer = gtk_cell_renderer_text_new();
122 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(metaList),
123 -1,
124 _("Category"),
125 renderer,
126 "text", META_STYPE,
127 NULL);
128 renderer = gtk_cell_renderer_text_new();
129 gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(metaList),
130 -1,
131 _("Value"),
132 renderer,
133 "text", META_VALUE,
134 NULL);
135 gtk_tree_view_set_model(GTK_TREE_VIEW(metaList),
136 GTK_TREE_MODEL(metamodel));
137 keywordTypeModel
138 = gtk_list_store_new(KTYPE_NUM,
139 G_TYPE_STRING,
140 G_TYPE_INT);
141 metaType
142 = glade_xml_get_widget(metaXML,
143 "collectionMetaTypeComboBox");
144 gtk_combo_box_set_model(GTK_COMBO_BOX(metaType),
145 GTK_TREE_MODEL(keywordTypeModel));
146 for (type=0;type<EXTRACTOR_getHighestKeywordTypeNumber();type++) {
147 stype = EXTRACTOR_getKeywordTypeAsString(type);
148 gtk_list_store_append(keywordTypeModel,
149 &iter);
150 gtk_list_store_set(keywordTypeModel,
151 &iter,
152 KTYPE_STRING, stype,
153 KTYPE_TYPE, type,
154 -1);
155 }
156 renderer = gtk_cell_renderer_text_new();
157 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(metaType),
158 renderer,
159 FALSE);
160 gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(metaType),
161 renderer,
162 "text", KTYPE_STRING);
163 gtk_combo_box_set_active(GTK_COMBO_BOX(metaType),
164 0);
165 gtk_dialog_set_default_response(GTK_DIALOG(dialog),
166 GTK_RESPONSE_OK);
167 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
168 meta = ECRS_createMetaData();
169 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(metamodel),
170 &iter)) {
171 do {
172 gtk_tree_model_get(GTK_TREE_MODEL(metamodel),
173 &iter,
174 META_TYPE, &type,
175 META_VALUE, &mvalue,
176 -1);
177 ECRS_addToMetaData(meta,
178 type,
179 mvalue);
180 } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(metamodel),
181 &iter));
182 }
183 spin = glade_xml_get_widget(metaXML,
184 "collectionAnonymityLevel");
185 nameLine
186 = glade_xml_get_widget(metaXML,
187 "collectionUpdateIntervalComboBoxEntry");
188 nameLine
189 = gtk_bin_get_child(GTK_BIN(nameLine));
190 updateIntervalString
191 = gtk_entry_get_text(GTK_ENTRY(nameLine));
192 updateInterval = 0; /* FIXME */
193 nameLine = glade_xml_get_widget(metaXML,
194 "collectionIdentifierEntry");
195 collectionName
196 = gtk_entry_get_text(GTK_ENTRY(nameLine));
197 root = NULL;
198 if (OK == FSUI_startCollection(ctx,
199 gtk_spin_button_get_value_as_int
200 (GTK_SPIN_BUTTON(spin)),
201 updateInterval,
202 collectionName,
203 meta)) {
204 w = glade_xml_get_widget(getMainXML(),
205 "createCollection");
206 gtk_widget_set_sensitive(w, FALSE);
207 w = glade_xml_get_widget(getMainXML(),
208 "deleteCollection");
209 gtk_widget_set_sensitive(w, TRUE);
210 } else {
211 GtkWidget * dialog;
212
213 dialog = gtk_message_dialog_new
214 (NULL,
215 GTK_DIALOG_MODAL,
216 GTK_MESSAGE_ERROR,
217 GTK_BUTTONS_CLOSE,
218 _("Failed to start collection '%s' (consult logs)."),
219 collectionName);
220 gtk_dialog_run(GTK_DIALOG(dialog));
221 gtk_widget_destroy(dialog);
222 }
223 ECRS_freeMetaData(meta);
224 }
225 gtk_widget_destroy(dialog);
226 UNREF(metaXML);
227 metaXML = NULL;
228}
229
230void deleteCollection_clicked(GtkWidget * dummy1,
45 GtkWidget * dummy2) { 231 GtkWidget * dummy2) {
46 FSUI_stopCollection(ctx); 232 GtkWidget * w;
47 /* fixme: disable stop collection button, 233
48 enable start collection button! */ 234 if (OK == FSUI_stopCollection(ctx)) {
235 w = glade_xml_get_widget(getMainXML(),
236 "createCollection");
237 gtk_widget_set_sensitive(w, TRUE);
238 w = glade_xml_get_widget(getMainXML(),
239 "deleteCollection");
240 gtk_widget_set_sensitive(w, FALSE);
241 infoMessage(NO,
242 _("Collection stopped.\n"));
243 } else {
244 infoMessage(YES,
245 _("Failed to stop collection (consult logs).\n"));
246 }
49} 247}
50 248
51void fs_collection_start() { 249void fs_collection_start() {
250 GtkWidget * w;
251
252 if (NULL != FSUI_getCollection(ctx))
253 w = glade_xml_get_widget(getMainXML(),
254 "createCollection");
255 else
256 w = glade_xml_get_widget(getMainXML(),
257 "deleteCollection");
258 gtk_widget_set_sensitive(w, FALSE);
52} 259}
53 260
54void fs_collection_stop() { 261void fs_collection_stop() {
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c
index b6679b05..c6ea9450 100644
--- a/src/plugins/fs/download.c
+++ b/src/plugins/fs/download.c
@@ -100,10 +100,10 @@ static int addFilesToDirectory
100 return OK; 100 return OK;
101} 101}
102 102
103static void initiateDownload(GtkTreeModel *model, 103static void initiateDownload(GtkTreeModel * model,
104 GtkTreePath * path, 104 GtkTreePath * path,
105 GtkTreeIter * iter, 105 GtkTreeIter * iter,
106 GtkTreeStore * tree) { 106 gpointer unused) {
107 struct ECRS_URI * uri; 107 struct ECRS_URI * uri;
108 struct ECRS_MetaData * meta; 108 struct ECRS_MetaData * meta;
109 char * filename; 109 char * filename;
@@ -235,7 +235,7 @@ void on_downloadButton_clicked(GtkWidget * treeview,
235 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); 235 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
236 gtk_tree_selection_selected_foreach 236 gtk_tree_selection_selected_foreach
237 (selection, 237 (selection,
238 (GtkTreeSelectionForeachFunc) &initiateDownload, 238 &initiateDownload,
239 NULL); 239 NULL);
240} 240}
241 241
diff --git a/src/plugins/fs/fs.h b/src/plugins/fs/fs.h
index cd61cd41..896fb659 100644
--- a/src/plugins/fs/fs.h
+++ b/src/plugins/fs/fs.h
@@ -64,6 +64,7 @@ enum {
64 NAMESPACE_SIZE, 64 NAMESPACE_SIZE,
65 NAMESPACE_URISTRING, 65 NAMESPACE_URISTRING,
66 NAMESPACE_URI, 66 NAMESPACE_URI,
67 NAMESPACE_META,
67 NAMESPACE_NUM 68 NAMESPACE_NUM
68}; 69};
69 70
diff --git a/src/plugins/fs/namespace.c b/src/plugins/fs/namespace.c
index 48d41958..c2062f4f 100644
--- a/src/plugins/fs/namespace.c
+++ b/src/plugins/fs/namespace.c
@@ -1,4 +1,4 @@
1/* 1 /*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2005 Christian Grothoff (and other contributing authors) 3 (C) 2005 Christian Grothoff (and other contributing authors)
4 4
@@ -206,6 +206,7 @@ static int updateView(const ECRS_FileInfo * fi,
206 NAMESPACE_SIZE, size, 206 NAMESPACE_SIZE, size,
207 NAMESPACE_URISTRING, uriString, 207 NAMESPACE_URISTRING, uriString,
208 NAMESPACE_URI, ECRS_dupUri(fi->uri), 208 NAMESPACE_URI, ECRS_dupUri(fi->uri),
209 NAMESPACE_META, ECRS_dupMetaData(fi->meta),
209 -1); 210 -1);
210 FREE(filename); 211 FREE(filename);
211 FREE(uriString); 212 FREE(uriString);
@@ -725,24 +726,144 @@ void namespaceDelete_clicked(GtkWidget * dummy1,
725 FREE(list); 726 FREE(list);
726} 727}
727 728
729typedef struct {
730 unsigned int anonymityLevel;
731 char * namespaceName;
732 cron_t updateInterval;
733 HashCode512 * lastId;
734 HashCode512 thisId;
735 HashCode512 * nextId;
736 struct ECRS_MetaData * meta;
737} IUC;
728 738
739/**
740 * Publish the selected file in the
741 * selected namespace.
742 */
743static void initiateUpload(GtkTreeModel * model,
744 GtkTreePath * path,
745 GtkTreeIter * iter,
746 gpointer data) {
747 IUC * cls = data;
748 struct ECRS_URI * resultURI;
749 struct ECRS_URI * dst;
750 struct ECRS_MetaData * ometa;
751 struct ECRS_MetaData * meta;
752 NamespaceList * list;
753 ECRS_FileInfo fi;
754
755 dst = NULL;
756 meta = cls->meta;
757 gtk_tree_model_get(model,
758 iter,
759 NAMESPACE_URI, &dst,
760 NAMESPACE_META, &ometa,
761 -1);
762 /* FIXME: we may want to optionally combine the metadata from the
763 original file ID (ometa) with the new metadata (cls->meta) here;
764 or if we limit us to one file at a time, show the original
765 metadata immediately with the dialog. */
766
767 if (dst == NULL) {
768 BREAK();
769 return;
770 }
771 if (OK == FSUI_addToNamespace(ctx,
772 cls->anonymityLevel,
773 cls->namespaceName,
774 cls->updateInterval,
775 cls->lastId,
776 &cls->thisId,
777 cls->nextId,
778 dst,
779 meta,
780 &resultURI)) {
781 list = head;
782 while ( (list != NULL) &&
783 (0 != strcmp(cls->namespaceName,
784 list->name)) )
785 list = list->next;
786 if (list == NULL) {
787 BREAK();
788 } else {
789 /* update namespace content list! */
790 fi.uri = resultURI;
791 fi.meta = meta;
792 addNamespaceContentToModel(list->model,
793 &fi,
794 &cls->thisId,
795 cls->nextId,
796 cls->updateInterval,
797 cls->updateInterval
798 + cronTime(NULL) );
799 }
800 ECRS_freeUri(resultURI);
801 } else {
802 infoMessage(YES,
803 _("Failed to insert content into namespace "
804 "(consult logs).\n"));
805 }
806}
729 807
730void on_namespaceInsertButton_clicked(GtkWidget * dummy1, 808void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
731 GtkWidget * dummy2) { 809 GtkWidget * dummy2) {
732 const char * identifierName; 810 const char * identifierName;
811 NamespaceList * list;
733 GtkWidget * nameLine; 812 GtkWidget * nameLine;
813 GtkWidget * page;
814 GtkWidget * notebook;
734 GtkWidget * metaList; 815 GtkWidget * metaList;
735 GtkWidget * dialog; 816 GtkWidget * dialog;
736 GtkWidget * spin; 817 GtkWidget * spin;
818 GtkWidget * update;
737 GtkListStore * metamodel; 819 GtkListStore * metamodel;
738 GtkCellRenderer * renderer; 820 GtkCellRenderer * renderer;
739 GtkTreeIter iter; 821 GtkTreeIter iter;
740 struct ECRS_MetaData * meta; 822 struct ECRS_MetaData * meta;
741 EXTRACTOR_KeywordType type; 823 EXTRACTOR_KeywordType type;
742 char * mvalue; 824 char * mvalue;
743 HashCode512 identifier; 825 HashCode512 nextId;
826 GtkWidget * contentList;
827 GtkTreeSelection * selection;
828 IUC cls;
829 gint num;
830
831 contentList
832 = glade_xml_get_widget(getMainXML(),
833 "availableContentList");
834 selection
835 = gtk_tree_view_get_selection(GTK_TREE_VIEW(contentList));
836 if (0 == gtk_tree_selection_count_selected_rows(selection)) {
837 /* IMPROVE-ME: disable the menu item
838 as long as this may happen! */
839 dialog = gtk_message_dialog_new
840 (NULL,
841 GTK_DIALOG_MODAL,
842 GTK_MESSAGE_ERROR,
843 GTK_BUTTONS_CLOSE,
844 _("You must select some available content for publication first!"));
845 gtk_dialog_run(GTK_DIALOG(dialog));
846 gtk_widget_destroy(dialog);
847 return;
848 }
849
850 notebook
851 = glade_xml_get_widget(getMainXML(),
852 "localNamespacesNotebook");
853 num = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
854 GNUNET_ASSERT(num != -1);
855 page =gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook),
856 num);
857 list = head;
858 while ( (list != NULL) &&
859 (list->namespacepage != page) )
860 list = list->next;
861 if (list == NULL) {
862 BREAK();
863 return;
864 }
865 cls.namespaceName = list->name;
744 866
745 /* FIXME */
746 metaXML 867 metaXML
747 = glade_xml_new(getGladeFileName(), 868 = glade_xml_new(getGladeFileName(),
748 "namespaceMetaDataDialog", 869 "namespaceMetaDataDialog",
@@ -792,7 +913,9 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
792 &iter)); 913 &iter));
793 } 914 }
794 spin = glade_xml_get_widget(metaXML, 915 spin = glade_xml_get_widget(metaXML,
795 "namespaceAnonymityspinbutton"); 916 "anonymitySpinButton");
917 cls.anonymityLevel
918 = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
796 nameLine = glade_xml_get_widget(metaXML, 919 nameLine = glade_xml_get_widget(metaXML,
797 "namespaceContentIdentifierEntry"); 920 "namespaceContentIdentifierEntry");
798 identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine)); 921 identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine));
@@ -800,9 +923,32 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
800 identifierName = ""; 923 identifierName = "";
801 hash(identifierName, 924 hash(identifierName,
802 strlen(identifierName), 925 strlen(identifierName),
803 &identifier); 926 &cls.thisId);
927 cls.lastId = NULL;
804 928
929 nameLine = glade_xml_get_widget(metaXML,
930 "nextIdentifierEntry");
931 identifierName = gtk_entry_get_text(GTK_ENTRY(nameLine));
932 if ( (identifierName == NULL) ||
933 (strlen(identifierName) == 0)) {
934 cls.nextId = NULL;
935 } else {
936 hash(identifierName,
937 strlen(identifierName),
938 &nextId);
939 cls.nextId = &nextId;
940 }
941 cls.meta = meta;
942 update = glade_xml_get_widget(metaXML,
943 "updateIntervalComboBoxEntry");
944 cls.updateInterval = 0; /* FIXME */
805 945
946 gtk_tree_selection_selected_foreach
947 (selection,
948 &initiateUpload,
949 &cls);
950
951 ECRS_freeMetaData(meta);
806 } 952 }
807 gtk_widget_destroy(dialog); 953 gtk_widget_destroy(dialog);
808 UNREF(metaXML); 954 UNREF(metaXML);
@@ -811,7 +957,16 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
811 957
812void on_namespaceUpdateButton_clicked(GtkWidget * dummy1, 958void on_namespaceUpdateButton_clicked(GtkWidget * dummy1,
813 GtkWidget * dummy2) { 959 GtkWidget * dummy2) {
814 /* FIXME */ 960 GtkWidget * dialog;
961
962 dialog = gtk_message_dialog_new
963 (NULL,
964 GTK_DIALOG_MODAL,
965 GTK_MESSAGE_ERROR,
966 GTK_BUTTONS_CLOSE,
967 _("Not implemented!"));
968 gtk_dialog_run(GTK_DIALOG(dialog));
969 gtk_widget_destroy(dialog);
815} 970}
816 971
817 972
@@ -829,6 +984,7 @@ void fs_namespace_start() {
829 G_TYPE_STRING, /* name */ 984 G_TYPE_STRING, /* name */
830 G_TYPE_UINT64, /* size */ 985 G_TYPE_UINT64, /* size */
831 G_TYPE_STRING, /* uri-string */ 986 G_TYPE_STRING, /* uri-string */
987 G_TYPE_POINTER,
832 G_TYPE_POINTER); /* uri */ 988 G_TYPE_POINTER); /* uri */
833 gtk_tree_view_set_model(GTK_TREE_VIEW(contentList), 989 gtk_tree_view_set_model(GTK_TREE_VIEW(contentList),
834 GTK_TREE_MODEL(model)); 990 GTK_TREE_MODEL(model));