gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1208 - Extractor GNUnet/src/applications/fs/fsui GNUnet/sr


From: grothoff
Subject: [GNUnet-SVN] r1208 - Extractor GNUnet/src/applications/fs/fsui GNUnet/src/applications/identity GNUnet/src/include gnunet-gtk gnunet-gtk/src
Date: Sat, 2 Jul 2005 08:19:15 -0700 (PDT)

Author: grothoff
Date: 2005-07-02 08:19:04 -0700 (Sat, 02 Jul 2005)
New Revision: 1208

Modified:
   Extractor/ChangeLog
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/identity/identity.c
   GNUnet/src/include/gnunet_fsui_lib.h
   gnunet-gtk/TODO
   gnunet-gtk/src/download.c
   gnunet-gtk/src/search.c
Log:
gtk features

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2005-07-02 14:12:10 UTC (rev 1207)
+++ Extractor/ChangeLog 2005-07-02 15:19:04 UTC (rev 1208)
@@ -1,3 +1,9 @@
+Wed Jun 29 15:37:51 CEST 2005
+       Finally found out how to disable building static libs.
+       This should cut down compile time and installed size
+       by about a factor of 2 -- especially good since the
+       static version of the plugins is pretty, well, useless.
+
 Sat Jun 18 14:56:38 EST 2005
        Fixed a score of compiler warnings and some minor bugs,
        none of which should have been observable.

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2005-07-02 14:12:10 UTC (rev 
1207)
+++ GNUnet/src/applications/fs/fsui/download.c  2005-07-02 15:19:04 UTC (rev 
1208)
@@ -465,11 +465,13 @@
                      const struct ECRS_URI * uri,
                      const char * filename) {
   FSUI_DownloadList * dl;
+  FSUI_DownloadList * prev;
   unsigned int backup;
 
   GNUNET_ASSERT(filename != NULL);
   MUTEX_LOCK(&ctx->lock);
   dl = ctx->activeDownloads.child;
+  prev = NULL;
   while (dl != NULL) {
     if ( (ECRS_equalsUri(uri,
                       dl->uri)) &&
@@ -479,11 +481,18 @@
       backup = ctx->threadPoolSize;
       ctx->threadPoolSize = 0;
       updateDownloadThread(dl);
+      if (prev == NULL)
+       ctx->activeDownloads.child
+         = dl->next;
+      else
+       prev->next
+         = dl->next;
       freeDownloadList(dl);
       ctx->threadPoolSize = backup;
       MUTEX_UNLOCK(&ctx->lock);
       return OK;
     }
+    prev = dl;
     dl = dl->next;
   }
   MUTEX_UNLOCK(&ctx->lock);
@@ -529,6 +538,61 @@
 }
 
 /**
+ * Clear all completed top-level downloads from the FSUI list.
+ * 
+ * @param callback function to call on each completed download
+ *        that is being cleared.
+ * @return SYSERR on error, otherwise number of downloads cleared
+ */
+int FSUI_clearCompletedDownloads(struct FSUI_Context * ctx,
+                                FSUI_DownloadIterator iter,
+                                void * closure) {
+  FSUI_DownloadList * dl;
+  FSUI_DownloadList * prev;
+  int ret;
+  int stop;
+
+  ret = 0;
+  MUTEX_LOCK(&ctx->lock);
+  dl = ctx->activeDownloads.child;
+  prev = NULL;
+  stop = NO;
+  while ( (dl != NULL) &&
+         (stop == NO) ) {
+    if ( (dl->completed == dl->total) &&
+        (dl->signalTerminate == SYSERR) ) {
+      if (prev == NULL)
+       ctx->activeDownloads.child
+         = dl->next;
+      else
+       prev->next = dl->next;
+      if (iter != NULL)
+       if (OK != iter(closure,
+                      dl,
+                      dl->filename,
+                      dl->uri,
+                      dl->total,
+                      dl->completed,
+                      dl->is_recursive,
+                      dl->anonymityLevel))
+         stop = YES;
+      freeDownloadList(dl);
+      dl = prev->next;
+      ret++;
+    } else {
+      prev = dl;
+      dl = dl->next;
+    }
+  }
+  MUTEX_UNLOCK(&ctx->lock);
+  if (stop == NO)
+    return ret;
+  else
+    return SYSERR;
+}
+
+
+/**
  * Get parent of active download. 
  * @return NULL if there is no parent
  */

Modified: GNUnet/src/applications/identity/identity.c
===================================================================
--- GNUnet/src/applications/identity/identity.c 2005-07-02 14:12:10 UTC (rev 
1207)
+++ GNUnet/src/applications/identity/identity.c 2005-07-02 15:19:04 UTC (rev 
1208)
@@ -428,8 +428,6 @@
 
       if (entry->protocolCount == 0) {
        if (entry->heloCount > 0) {
-         BREAK(); /* very strange: have 
-                     helo but not proto number!? */
          for (j=0;j<entry->heloCount;j++)
            FREE(entry->helos[j]);
          GROW(entry->helos,

Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h        2005-07-02 14:12:10 UTC (rev 
1207)
+++ GNUnet/src/include/gnunet_fsui_lib.h        2005-07-02 15:19:04 UTC (rev 
1208)
@@ -516,6 +516,18 @@
                       void * closure); /* download.c */
 
 /**
+ * Clear all completed top-level downloads from the FSUI list.
+ * 
+ * @param callback function to call on each completed download
+ *        that is being cleared.
+ * @return SYSERR on error, otherwise number of downloads cleared
+ */
+int FSUI_clearCompletedDownloads(struct FSUI_Context * ctx,
+                                FSUI_DownloadIterator iter,
+                                void * closure); /* download.c */
+
+
+/**
  * Get parent of active download. 
  * @return NULL if there is no parent
  */

Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO     2005-07-02 14:12:10 UTC (rev 1207)
+++ gnunet-gtk/TODO     2005-07-02 15:19:04 UTC (rev 1208)
@@ -1,11 +1,3 @@
-0.7.0pre4:
-* allow user to cancel downloads (may need FSUI API extensions) [ medium, CG ]
-* allow user to clear completed downloads from summary [ easy, CG ]
-* search:
-  + update namespace list combo box [ easy, CG ]
-  + support namespace URIs          [ easy, CG ]
-
-
 Important (for 0.7.0):
 * bugs:
   - figure out where seemingly spurious "pending" downloads come from

Modified: gnunet-gtk/src/download.c
===================================================================
--- gnunet-gtk/src/download.c   2005-07-02 14:12:10 UTC (rev 1207)
+++ gnunet-gtk/src/download.c   2005-07-02 15:19:04 UTC (rev 1208)
@@ -228,6 +228,7 @@
      NULL);
 }
 
+
 /**
  */
 void displayDownloadUpdate(const struct ECRS_URI * uri,
@@ -254,7 +255,7 @@
          val = completed * 100 / total;
        else
          val = 100;
-       gtk_tree_store_set(GTK_TREE_STORE(summary),
+       gtk_tree_store_set(summary,
                           &iter,
                           DOWNLOAD_PROGRESS, val,
                           -1);  
@@ -329,6 +330,81 @@
 
 }
 
+static int delDownloadView(void * cls,
+                          const struct FSUI_DownloadList * pos,
+                          const char * filename,
+                          const struct ECRS_URI * uri,
+                          unsigned long long filesize,
+                          unsigned long long bytesCompleted,
+                          int isRecursive,
+                          unsigned int anonymityLevel) {
+  GtkTreeIter iter;
+  char * f;
+  struct ECRS_URI * u;
+
+  if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
+                                   &iter)) {
+    do {    
+      gtk_tree_model_get(GTK_TREE_MODEL(summary),
+                        &iter,
+                        DOWNLOAD_FILENAME, &f,
+                        DOWNLOAD_URI, &u,
+                        -1);
+      if ( (ECRS_equalsUri(u, uri)) &&
+          (0 == strcmp(f, filename)) ) {
+       gtk_tree_store_remove(summary,
+                             &iter);
+       break;
+      }
+    } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
+                                     &iter));
+  }
+  return OK;
+}
+
+void on_clearCompletedDownloadsButton_clicked(void * unused,
+                                             GtkWidget * clearButton) {
+  FSUI_clearCompletedDownloads(ctx,
+                              &delDownloadView,
+                              NULL);
+}
+
+static void abortDownloadCallback(GtkTreeModel * model,
+                                 GtkTreePath * path,
+                                 GtkTreeIter * iter,
+                                 GtkTreeStore * tree) {
+  struct ECRS_URI * u;
+  char * fn;
+
+  GNUNET_ASSERT(model == GTK_TREE_MODEL(summary));
+  gtk_tree_model_get(GTK_TREE_MODEL(summary),
+                    iter,
+                    DOWNLOAD_URI, &u,
+                    DOWNLOAD_FILENAME, &fn,
+                    -1);
+  FSUI_stopDownload(ctx,
+                   u,
+                   fn);
+  gtk_tree_store_remove(summary,
+                       iter);
+  if (u != NULL)
+    ECRS_freeUri(u);  
+}
+
+void on_abortDownloadButton_clicked(void * unused,
+                                   GtkWidget * clearButton) {
+  GtkTreeSelection * selection;
+  GtkWidget * downloadList;
+
+  downloadList = glade_xml_get_widget(mainXML,
+                                     "activeDownloadsList");
+  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(downloadList));
+  gtk_tree_selection_selected_foreach
+    (selection,
+     (GtkTreeSelectionForeachFunc) &abortDownloadCallback,
+     NULL);
+}
+
 static int addDownloadView(void * cls,
                           const struct FSUI_DownloadList * pos,
                           const char * filename,
@@ -364,7 +440,6 @@
 }
 
 
-
 void fs_download_start() {
   GtkWidget * downloadList;
   GtkCellRenderer * renderer;
@@ -425,7 +500,7 @@
                       &iter,
                       DOWNLOAD_URI, &u,
                       -1);
-    gtk_tree_store_set(GTK_TREE_STORE(summary),
+    gtk_tree_store_set(summary,
                       &iter,
                       DOWNLOAD_URI, NULL,
                       -1);  

Modified: gnunet-gtk/src/search.c
===================================================================
--- gnunet-gtk/src/search.c     2005-07-02 14:12:10 UTC (rev 1207)
+++ gnunet-gtk/src/search.c     2005-07-02 15:19:04 UTC (rev 1208)
@@ -487,13 +487,30 @@
        (0 == strcmp(ns,
                    _("globally"))) )
     ns = NULL;
-  ns = NULL; /* FIXME! */
   if (ns != NULL) {    
-    /* FIXME */
+    char * ustring;
+
+    GNUNET_ASSERT(strlen(ns) > sizeof(EncName));
+    ns = &ns[strlen(ns) - sizeof(EncName) + 1];
+    ustring = MALLOC(strlen(ss) + sizeof(EncName) +
+                    strlen(ECRS_URI_PREFIX) +
+                    strlen(ECRS_SUBSPACE_INFIX) + 10);
+    strcpy(ustring, ECRS_URI_PREFIX);
+    strcat(ustring, ECRS_SUBSPACE_INFIX);
+    strcat(ustring, ns);
+    strcat(ustring, "/");
+    strcat(ustring, ss);
+    uri = ECRS_stringToUri(ustring);
+    if (uri == NULL) {
+      LOG(LOG_ERROR,
+         _("Failed to create namespace URI from '%s'.\n"),
+         ustring);
+    }
+    FREE(ustring);
   } else {
     uri = FSUI_parseCharKeywordURI(ss);   
   }
-  if (uri == NULL)
+  if (uri == NULL) 
     return;
   if (ns == NULL) {
     tabtxt = STRDUP(ss);





reply via email to

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