gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r1558 - in gnunet-gtk: . src/plugins/fs


From: grothoff
Subject: [GNUnet-SVN] r1558 - in gnunet-gtk: . src/plugins/fs
Date: Sat, 16 Jul 2005 12:20:45 -0700 (PDT)

Author: grothoff
Date: 2005-07-16 12:20:38 -0700 (Sat, 16 Jul 2005)
New Revision: 1558

Added:
   gnunet-gtk/src/plugins/fs/helper.h
Modified:
   gnunet-gtk/TODO
   gnunet-gtk/src/plugins/fs/Makefile.am
   gnunet-gtk/src/plugins/fs/helper.c
   gnunet-gtk/src/plugins/fs/namespace.c
Log:
parse update interval

Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO     2005-07-16 18:16:30 UTC (rev 1557)
+++ gnunet-gtk/TODO     2005-07-16 19:20:38 UTC (rev 1558)
@@ -1,9 +1,8 @@
 0.7.0 (all of these can go under "known limitations", that
        is, they are not release-critical IMO):
-1) update interval is not parsed
-2) update namespace content (not implemented)
-3) various minor memory leaks in models (esp. on shutdown)
-4) figure out where seemingly spurious "pending" downloads 
+1) update namespace content (not implemented)
+2) various minor memory leaks in models (esp. on shutdown)
+3) figure out where seemingly spurious "pending" downloads 
    come from (still there?)
 
 Later (0.7.1+):

Modified: gnunet-gtk/src/plugins/fs/Makefile.am
===================================================================
--- gnunet-gtk/src/plugins/fs/Makefile.am       2005-07-16 18:16:30 UTC (rev 
1557)
+++ gnunet-gtk/src/plugins/fs/Makefile.am       2005-07-16 19:20:38 UTC (rev 
1558)
@@ -13,6 +13,7 @@
   collection.c collection.h \
   download.c download.h \
   fs.c fs.h \
+  helper.c helper.h \
   meta.c meta.h \
   namespace.c namespace.h \
   search.c search.h \

Modified: gnunet-gtk/src/plugins/fs/helper.c
===================================================================
--- gnunet-gtk/src/plugins/fs/helper.c  2005-07-16 18:16:30 UTC (rev 1557)
+++ gnunet-gtk/src/plugins/fs/helper.c  2005-07-16 19:20:38 UTC (rev 1558)
@@ -24,6 +24,9 @@
  * @author Christian Grothoff
  */
 
+#include "platform.h"
+#include "helper.h"
+
 /**
  * Parse a time given in the form
  * "XX seconds yy days zz months".
@@ -32,7 +35,7 @@
  * @return OK on success, SYSERR on error
  */
 int parseTime(const char * t,
-             cron_t * val) {
+             cron_t * param) {
   int pos;
   int start;
   unsigned int val;
@@ -85,7 +88,7 @@
     while ( t[pos] == ' ')
       pos++;
   }  
-  *val = ret;
+  *param = ret;
   return OK;
 }
 

Added: gnunet-gtk/src/plugins/fs/helper.h
===================================================================
--- gnunet-gtk/src/plugins/fs/helper.h  2005-07-16 18:16:30 UTC (rev 1557)
+++ gnunet-gtk/src/plugins/fs/helper.h  2005-07-16 19:20:38 UTC (rev 1558)
@@ -0,0 +1,40 @@
+/*
+     This file is part of GNUnet.
+     (C) 2005 Christian Grothoff (and other contributing authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+#ifndef FS_HELPER_H
+#define FS_HELPER_H
+
+/**
+ * @file src/plugins/fs/helper.h
+ * @brief helper functions (parsing)
+ * @author Christian Grothoff
+ */
+
+/**
+ * Parse a time given in the form
+ * "XX seconds yy days zz months".
+ *
+ * @param val set to the computed time
+ * @return OK on success, SYSERR on error
+ */
+int parseTime(const char * t,
+             cron_t * val);
+
+#endif

Modified: gnunet-gtk/src/plugins/fs/namespace.c
===================================================================
--- gnunet-gtk/src/plugins/fs/namespace.c       2005-07-16 18:16:30 UTC (rev 
1557)
+++ gnunet-gtk/src/plugins/fs/namespace.c       2005-07-16 19:20:38 UTC (rev 
1558)
@@ -27,6 +27,7 @@
 #include "platform.h"
 #include "gnunetgtk_common.h"
 #include "fs.h"
+#include "helper.h"
 #include "meta.h"
 #include "namespace.h"
 #include <extractor.h>
@@ -632,6 +633,7 @@
 void on_namespaceInsertButton_clicked(GtkWidget * dummy1,
                                      GtkWidget * dummy2) {
   const char * identifierName;
+  const char * timeSpec;
   NamespaceList * list;
   GtkWidget * nameLine;
   GtkWidget * page;
@@ -721,6 +723,28 @@
   gtk_dialog_set_default_response(GTK_DIALOG(dialog),
                                  GTK_RESPONSE_OK);
   if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
+    update = glade_xml_get_widget(metaXML,
+                                 "updateIntervalComboBoxEntry");
+    timeSpec = gtk_entry_get_text(GTK_ENTRY(update));
+    if (0 == strcmp(_("--sporadic update--"),
+                   timeSpec))
+      cls.updateInterval = ECRS_SBLOCK_UPDATE_SPORADIC;
+    else if (0 == strcmp(_("--no update--"),
+                        timeSpec))
+      cls.updateInterval = ECRS_SBLOCK_UPDATE_NONE;
+    else if (OK != parseTime(timeSpec,
+                            &cls.updateInterval)) {
+      dialog = gtk_message_dialog_new 
+       (NULL,
+        GTK_DIALOG_MODAL,
+        GTK_MESSAGE_ERROR,
+        GTK_BUTTONS_CLOSE,
+        _("Failed to parse given time interval!"));
+      gtk_dialog_run(GTK_DIALOG(dialog));
+      gtk_widget_destroy(dialog);      
+      return;
+    }
+
     meta = ECRS_createMetaData();
     if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(metamodel),
                                      &iter)) {
@@ -763,9 +787,6 @@
       cls.nextId = &nextId;
     }
     cls.meta = meta;
-    update = glade_xml_get_widget(metaXML,
-                                 "updateIntervalComboBoxEntry");
-    cls.updateInterval = 0; /* FIXME */
 
     gtk_tree_selection_selected_foreach
       (selection,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]