aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2005-07-16 19:20:38 +0000
committerChristian Grothoff <christian@grothoff.org>2005-07-16 19:20:38 +0000
commitb5e35a3bd6f944549226305c538de61da0a8c760 (patch)
tree19a037597a9132cffe33e4a5f5a6cf7a16546a7c
parent46a8b298fbd875dfd8d06db5096fb20fab851f35 (diff)
downloadgnunet-gtk-b5e35a3bd6f944549226305c538de61da0a8c760.tar.gz
gnunet-gtk-b5e35a3bd6f944549226305c538de61da0a8c760.zip
parse update interval
-rw-r--r--TODO7
-rw-r--r--src/plugins/fs/Makefile.am1
-rw-r--r--src/plugins/fs/helper.c7
-rw-r--r--src/plugins/fs/helper.h40
-rw-r--r--src/plugins/fs/namespace.c27
5 files changed, 73 insertions, 9 deletions
diff --git a/TODO b/TODO
index 1ddce7fc..a9f5cb3b 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,8 @@
10.7.0 (all of these can go under "known limitations", that 10.7.0 (all of these can go under "known limitations", that
2 is, they are not release-critical IMO): 2 is, they are not release-critical IMO):
31) update interval is not parsed 31) update namespace content (not implemented)
42) update namespace content (not implemented) 42) various minor memory leaks in models (esp. on shutdown)
53) various minor memory leaks in models (esp. on shutdown) 53) figure out where seemingly spurious "pending" downloads
64) figure out where seemingly spurious "pending" downloads
7 come from (still there?) 6 come from (still there?)
8 7
9Later (0.7.1+): 8Later (0.7.1+):
diff --git a/src/plugins/fs/Makefile.am b/src/plugins/fs/Makefile.am
index 6a1c3b93..894a1529 100644
--- a/src/plugins/fs/Makefile.am
+++ b/src/plugins/fs/Makefile.am
@@ -13,6 +13,7 @@ libgnunetgtkmodule_fs_la_SOURCES = \
13 collection.c collection.h \ 13 collection.c collection.h \
14 download.c download.h \ 14 download.c download.h \
15 fs.c fs.h \ 15 fs.c fs.h \
16 helper.c helper.h \
16 meta.c meta.h \ 17 meta.c meta.h \
17 namespace.c namespace.h \ 18 namespace.c namespace.h \
18 search.c search.h \ 19 search.c search.h \
diff --git a/src/plugins/fs/helper.c b/src/plugins/fs/helper.c
index 59772a60..f17f427b 100644
--- a/src/plugins/fs/helper.c
+++ b/src/plugins/fs/helper.c
@@ -24,6 +24,9 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26 26
27#include "platform.h"
28#include "helper.h"
29
27/** 30/**
28 * Parse a time given in the form 31 * Parse a time given in the form
29 * "XX seconds yy days zz months". 32 * "XX seconds yy days zz months".
@@ -32,7 +35,7 @@
32 * @return OK on success, SYSERR on error 35 * @return OK on success, SYSERR on error
33 */ 36 */
34int parseTime(const char * t, 37int parseTime(const char * t,
35 cron_t * val) { 38 cron_t * param) {
36 int pos; 39 int pos;
37 int start; 40 int start;
38 unsigned int val; 41 unsigned int val;
@@ -85,7 +88,7 @@ int parseTime(const char * t,
85 while ( t[pos] == ' ') 88 while ( t[pos] == ' ')
86 pos++; 89 pos++;
87 } 90 }
88 *val = ret; 91 *param = ret;
89 return OK; 92 return OK;
90} 93}
91 94
diff --git a/src/plugins/fs/helper.h b/src/plugins/fs/helper.h
new file mode 100644
index 00000000..24186aa7
--- /dev/null
+++ b/src/plugins/fs/helper.h
@@ -0,0 +1,40 @@
1/*
2 This file is part of GNUnet.
3 (C) 2005 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21#ifndef FS_HELPER_H
22#define FS_HELPER_H
23
24/**
25 * @file src/plugins/fs/helper.h
26 * @brief helper functions (parsing)
27 * @author Christian Grothoff
28 */
29
30/**
31 * Parse a time given in the form
32 * "XX seconds yy days zz months".
33 *
34 * @param val set to the computed time
35 * @return OK on success, SYSERR on error
36 */
37int parseTime(const char * t,
38 cron_t * val);
39
40#endif
diff --git a/src/plugins/fs/namespace.c b/src/plugins/fs/namespace.c
index cd8238d4..b0749096 100644
--- a/src/plugins/fs/namespace.c
+++ b/src/plugins/fs/namespace.c
@@ -27,6 +27,7 @@
27#include "platform.h" 27#include "platform.h"
28#include "gnunetgtk_common.h" 28#include "gnunetgtk_common.h"
29#include "fs.h" 29#include "fs.h"
30#include "helper.h"
30#include "meta.h" 31#include "meta.h"
31#include "namespace.h" 32#include "namespace.h"
32#include <extractor.h> 33#include <extractor.h>
@@ -632,6 +633,7 @@ static void initiateUpload(GtkTreeModel * model,
632void on_namespaceInsertButton_clicked(GtkWidget * dummy1, 633void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
633 GtkWidget * dummy2) { 634 GtkWidget * dummy2) {
634 const char * identifierName; 635 const char * identifierName;
636 const char * timeSpec;
635 NamespaceList * list; 637 NamespaceList * list;
636 GtkWidget * nameLine; 638 GtkWidget * nameLine;
637 GtkWidget * page; 639 GtkWidget * page;
@@ -721,6 +723,28 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
721 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 723 gtk_dialog_set_default_response(GTK_DIALOG(dialog),
722 GTK_RESPONSE_OK); 724 GTK_RESPONSE_OK);
723 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { 725 if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
726 update = glade_xml_get_widget(metaXML,
727 "updateIntervalComboBoxEntry");
728 timeSpec = gtk_entry_get_text(GTK_ENTRY(update));
729 if (0 == strcmp(_("--sporadic update--"),
730 timeSpec))
731 cls.updateInterval = ECRS_SBLOCK_UPDATE_SPORADIC;
732 else if (0 == strcmp(_("--no update--"),
733 timeSpec))
734 cls.updateInterval = ECRS_SBLOCK_UPDATE_NONE;
735 else if (OK != parseTime(timeSpec,
736 &cls.updateInterval)) {
737 dialog = gtk_message_dialog_new
738 (NULL,
739 GTK_DIALOG_MODAL,
740 GTK_MESSAGE_ERROR,
741 GTK_BUTTONS_CLOSE,
742 _("Failed to parse given time interval!"));
743 gtk_dialog_run(GTK_DIALOG(dialog));
744 gtk_widget_destroy(dialog);
745 return;
746 }
747
724 meta = ECRS_createMetaData(); 748 meta = ECRS_createMetaData();
725 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(metamodel), 749 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(metamodel),
726 &iter)) { 750 &iter)) {
@@ -763,9 +787,6 @@ void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
763 cls.nextId = &nextId; 787 cls.nextId = &nextId;
764 } 788 }
765 cls.meta = meta; 789 cls.meta = meta;
766 update = glade_xml_get_widget(metaXML,
767 "updateIntervalComboBoxEntry");
768 cls.updateInterval = 0; /* FIXME */
769 790
770 gtk_tree_selection_selected_foreach 791 gtk_tree_selection_selected_foreach
771 (selection, 792 (selection,