gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r2870 - in gnunet-gtk: po src/plugins/fs


From: grothoff
Subject: [GNUnet-SVN] r2870 - in gnunet-gtk: po src/plugins/fs
Date: Sat, 20 May 2006 07:32:38 -0700 (PDT)

Author: grothoff
Date: 2006-05-20 07:32:36 -0700 (Sat, 20 May 2006)
New Revision: 2870

Modified:
   gnunet-gtk/po/Makefile.in
   gnunet-gtk/src/plugins/fs/download.c
   gnunet-gtk/src/plugins/fs/search.c
   gnunet-gtk/src/plugins/fs/upload.c
Log:
fixing deadlocks

Modified: gnunet-gtk/po/Makefile.in
===================================================================
--- gnunet-gtk/po/Makefile.in   2006-05-20 13:41:49 UTC (rev 2869)
+++ gnunet-gtk/po/Makefile.in   2006-05-20 14:32:36 UTC (rev 2870)
@@ -11,7 +11,7 @@
 # Origin: gettext-0.13
 
 PACKAGE = gnunet-gtk
-VERSION = 0.7.0d
+VERSION = 0.7.0e
 
 SHELL = /bin/sh
 

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2006-05-20 13:41:49 UTC (rev 
2869)
+++ gnunet-gtk/src/plugins/fs/download.c        2006-05-20 14:32:36 UTC (rev 
2870)
@@ -105,60 +105,94 @@
   return OK;
 }
 
+typedef struct {
+  struct ECRS_URI * uri;
+  struct ECRS_MetaData * meta;
+  const char * name;
+  const char * mime;
+  char * final_download_destination;
+  unsigned int anon;
+  int ret;
+} InitiateDownloadCls;
+
+static void * startSearch(void * cls) {
+  InitiateDownloadCls * idc = cls;
+
+  idc->ret = FSUI_startSearch(ctx,
+                             idc->anon,
+                             idc->uri);
+  return NULL;
+}
+
+static void * startDownload(void * cls) {
+  InitiateDownloadCls * idc = cls;
+
+  FSUI_startDownload(ctx,
+                    idc->anon,
+                    idc->uri,
+                    idc->final_download_destination);
+  return NULL;
+}
+
 static void initiateDownload(GtkTreeModel * model,
                              GtkTreePath * path,
                              GtkTreeIter * iter,
                              gpointer unused) {
-  struct ECRS_URI * uri;
-  struct ECRS_MetaData * meta;
   char * uri_name;
-  char * final_download_destination;
   char * final_download_dir;
   DownloadList * list;
   GtkTreeIter iiter;
   GtkWidget * spin;
-  const char * name;
   const char * oname;
   const char * cname;
-  const char * mime;
   char * dname;
-  unsigned int anon;
   GtkTreePath *dirTreePath;
   char *dirPath;
   unsigned int dirPathLen;
   char * size_h;
   unsigned long long size;
+  InitiateDownloadCls idc;
 #ifdef WINDOWS
   char *filehash = NULL;
 #endif
 
   DEBUG_BEGIN();
-  uri = NULL;
-  meta = NULL;
-  name = NULL;
-  mime = NULL;
+  idc.uri = NULL;
+  idc.meta = NULL;
+  idc.name = NULL;
+  idc.mime = NULL;
   gtk_tree_model_get(model,
                      iter,
-                     SEARCH_NAME, &name,
-                     SEARCH_URI, &uri,
-                     SEARCH_META, &meta,
-                     SEARCH_MIME, &mime,
+                     SEARCH_NAME, &idc.name,
+                     SEARCH_URI, &idc.uri,
+                     SEARCH_META, &idc.meta,
+                     SEARCH_MIME, &idc.mime,
                      -1);
-  if (uri == NULL) {
+  if (idc.uri == NULL) {
     BREAK();
     return;
   }
-  if (! ECRS_isFileUri(uri)) {
-    if (ECRS_isNamespaceUri(uri)) {
+
+  spin = getAnonymityButtonFromTM(model);
+  if (spin == NULL) {
+    BREAK();
+    idc.anon = 1;
+  } else {
+    idc.anon = gtk_spin_button_get_value_as_int
+      (GTK_SPIN_BUTTON(spin));
+  }
+
+  if (! ECRS_isFileUri(idc.uri)) {
+    if (ECRS_isNamespaceUri(idc.uri)) {
       /* start namespace search; would probably be better
         to add this as a subtree, but for simplicity
         we'll just add it as a new tab for now */
-      if (OK == FSUI_startSearch(ctx,
-                                anon,
-                                uri))
+      run_with_save_calls(&startSearch,
+                         &idc);
+      if (idc.ret == OK) 
        openTabForSearch(NULL,
-                        uri,
-                        anon,
+                        idc.uri,
+                        idc.anon,
                         0,
                         NULL);
       return;
@@ -168,7 +202,7 @@
     }
   }
 
-  uri_name = ECRS_uriToString(uri);
+  uri_name = ECRS_uriToString(idc.uri);
   if ( (uri_name == NULL) ||
        (strlen(uri_name) <
         strlen(ECRS_URI_PREFIX) +
@@ -178,32 +212,32 @@
     return;
   }
 
-  if (name == NULL) {
+  if (idc.name == NULL) {
 #ifdef WINDOWS
     filehash = STRDUP(uri_name);
     filehash[16] = 0;
-    name = filehash;
+    idc.name = filehash;
 #else
-    name = uri_name;
+    idc.name = uri_name;
 #endif
   } 
 
-  cname = name;
-  oname = name;
-  dname = MALLOC(strlen(name)+1);
+  cname = idc.name;
+  oname = idc.name;
+  dname = MALLOC(strlen(idc.name)+1);
   dname[0] = '\0';
-  while (*name != '\0') {
-    if ( (*name == DIR_SEPARATOR) &&
-        (name[1] != '\0') ) {
-      memcpy(dname, oname, name - oname);
-      dname[name - oname] = '\0';
-      cname = &name[1];
+  while (*idc.name != '\0') {
+    if ( (*idc.name == DIR_SEPARATOR) &&
+        (idc.name[1] != '\0') ) {
+      memcpy(dname, oname, idc.name - oname);
+      dname[idc.name - oname] = '\0';
+      cname = &idc.name[1];
     }
-    name++;
+    idc.name++;
   }
   if (*cname == '\0') /* name ended in '/' - likely directory */
     cname = oname;
-  name = cname;
+  idc.name = cname;
 
   final_download_dir = getFileName("FS",
                                   "INCOMINGDIR",
@@ -259,47 +293,47 @@
 
 
   /* construct completed/directory/real-filename */
-  final_download_destination = MALLOC(strlen(final_download_dir) + 2 +
-               strlen(name) + strlen(GNUNET_DIRECTORY_EXT) +
-              strlen(dirPath));
-  strcpy(final_download_destination, final_download_dir);
-  if (final_download_destination[strlen(final_download_destination)-1] != 
DIR_SEPARATOR)
-    strcat(final_download_destination,
+  idc.final_download_destination = MALLOC(strlen(final_download_dir) + 2 +
+                                         strlen(idc.name) + 
strlen(GNUNET_DIRECTORY_EXT) +
+                                         strlen(dirPath));
+  strcpy(idc.final_download_destination, final_download_dir);
+  if (idc.final_download_destination[strlen(idc.final_download_destination)-1] 
!= DIR_SEPARATOR)
+    strcat(idc.final_download_destination,
            DIR_SEPARATOR_STR);
-  strcat(final_download_destination, dirPath);
-  mkdirp(final_download_destination);
-  strcat(final_download_destination, name);
-  if ( (final_download_destination[strlen(final_download_destination) - 1] == 
'/') ||
-       (final_download_destination[strlen(final_download_destination) - 1] == 
'\\') )
-    final_download_destination[strlen(final_download_destination) - 1] = '\0'; 
+  strcat(idc.final_download_destination, dirPath);
+  mkdirp(idc.final_download_destination);
+  strcat(idc.final_download_destination, idc.name);
+  if ( (idc.final_download_destination[strlen(idc.final_download_destination) 
- 1] == '/') ||
+       (idc.final_download_destination[strlen(idc.final_download_destination) 
- 1] == '\\') )
+    idc.final_download_destination[strlen(idc.final_download_destination) - 1] 
= '\0'; 
   /* append ".gnd" if needed (== directory and .gnd not present) */
-  if ( (mime != NULL) && 
-       (0 == strcmp(mime, GNUNET_DIRECTORY_MIME)) &&
-       ( (strlen(final_download_destination) < strlen(GNUNET_DIRECTORY_EXT)) ||
-        (0 != 
strcmp(&final_download_destination[strlen(final_download_destination) - 
strlen(GNUNET_DIRECTORY_EXT)],
+  if ( (idc.mime != NULL) && 
+       (0 == strcmp(idc.mime, GNUNET_DIRECTORY_MIME)) &&
+       ( (strlen(idc.final_download_destination) < 
strlen(GNUNET_DIRECTORY_EXT)) ||
+        (0 != 
strcmp(&idc.final_download_destination[strlen(idc.final_download_destination) - 
strlen(GNUNET_DIRECTORY_EXT)],
                      GNUNET_DIRECTORY_EXT)) ) )
-    strcat(final_download_destination, GNUNET_DIRECTORY_EXT);
+    strcat(idc.final_download_destination, GNUNET_DIRECTORY_EXT);
     
   /* setup visualization */
   list = MALLOC(sizeof(DownloadList));
   list->next = head;
   list->rr = NULL;
   list->model = NULL;
-  if (YES == ECRS_isDirectory(meta)) {
+  if (YES == ECRS_isDirectory(idc.meta)) {
     list->rr = gtk_tree_row_reference_new(model, path);
     list->model = model;
   }
-  list->uri = ECRS_dupUri(uri);
-  list->filename = final_download_destination;
-  list->finalName = MALLOC(strlen(final_download_dir) + strlen(dirPath) + 
strlen(name) + 2);  
+  list->uri = ECRS_dupUri(idc.uri);
+  list->filename = idc.final_download_destination;
+  list->finalName = MALLOC(strlen(final_download_dir) + strlen(dirPath) + 
strlen(idc.name) + 2);  
   strcpy(list->finalName, final_download_dir);
   if (final_download_dir[strlen(final_download_dir)-1] != DIR_SEPARATOR)
     strcat(list->finalName, DIR_SEPARATOR_STR);
   strcat(list->finalName, dirPath);
   mkdirp(list->finalName);
-  strcat(list->finalName, name);
+  strcat(list->finalName, idc.name);
   head = list;
-  size = ECRS_fileSize(uri);
+  size = ECRS_fileSize(idc.uri);
   size_h = getHumanSize(size);
   gtk_tree_store_insert(summary,
                         &iiter,
@@ -307,13 +341,13 @@
                         0);
   gtk_tree_store_set(summary,
                      &iiter,
-                     DOWNLOAD_FILENAME, final_download_destination,
-                     DOWNLOAD_SHORTNAME, name,
+                     DOWNLOAD_FILENAME, idc.final_download_destination,
+                     DOWNLOAD_SHORTNAME, idc.name,
                      DOWNLOAD_SIZE, size,
                     DOWNLOAD_HSIZE, size_h,
                      DOWNLOAD_PROGRESS, 0, /* progress */
                      DOWNLOAD_URISTRING, uri_name,
-                     DOWNLOAD_URI, ECRS_dupUri(uri),
+                     DOWNLOAD_URI, ECRS_dupUri(idc.uri),
                      DOWNLOAD_TREEPATH, list->rr, /* internal: row reference! 
*/
                      DOWNLOAD_DIRPATH, dirPath,                     
                      -1);
@@ -322,22 +356,9 @@
   FREE(dirPath);
   FREENONNULL(final_download_dir);
 
-
-  spin = getAnonymityButtonFromTM(model);
-  if (spin == NULL) {
-    BREAK();
-    anon = 1;
-  } else {
-    anon = gtk_spin_button_get_value_as_int
-      (GTK_SPIN_BUTTON(spin));
-  }
-
-  addLogEntry(_("Downloading `%s'"), name);
-  FSUI_startDownload(ctx,
-                     anon,
-                     uri,
-                     final_download_destination);
-
+  addLogEntry(_("Downloading `%s'"), idc.name);
+  run_with_save_calls(&startDownload,
+                     &idc);
 #ifdef WINDOWS
   FREENONNULL(filehash);
 #endif
@@ -359,12 +380,10 @@
 
 void on_statusDownloadURIEntry_editing_done(GtkWidget * entry,
                                            GtkWidget * downloadButton) {
+  InitiateDownloadCls idc;
   const char * uris;
   char * urid;
-  struct ECRS_URI * uri;
-  unsigned int anon;
   GtkWidget * spin;
-  char * tmp;
   char * final_download_dir;
   const char * dname;
   DownloadList * list;
@@ -375,60 +394,59 @@
   urid = STRDUP(uris);
   gtk_entry_set_text(GTK_ENTRY(entry),
                     ECRS_URI_PREFIX);
-  uri = ECRS_stringToUri(urid);
-  if (uri == NULL) {
+  idc.uri = ECRS_stringToUri(urid);
+  if (idc.uri == NULL) {
     addLogEntry(_("Invalid URI `%s'"), urid);
     FREE(urid);
     return;
   }
-  if (ECRS_isKeywordUri(uri)) {
+  if (ECRS_isKeywordUri(idc.uri)) {
     addLogEntry(_("Please use the search function for keyword (KSK) URIs!"));
     FREE(urid);
-    ECRS_freeUri(uri);
+    ECRS_freeUri(idc.uri);
     return;
-  } else if (ECRS_isLocationUri(uri)) {
+  } else if (ECRS_isLocationUri(idc.uri)) {
     addLogEntry(_("Location URIs are not yet supported"));
     FREE(urid);
-    ECRS_freeUri(uri);
+    ECRS_freeUri(idc.uri);
     return;
   }
-
   final_download_dir = getFileName("FS",
                                   "INCOMINGDIR",
                                   _("You must specify a directory in the 
configuration"
                                     " in section `%s' under `%s'."));
   mkdirp(final_download_dir);
   dname = &uris[strlen(ECRS_URI_PREFIX) + strlen(ECRS_FILE_INFIX)];
-  tmp = MALLOC(strlen(final_download_dir) + strlen(dname) + 2);
-  strcpy(tmp, final_download_dir);
+  idc.final_download_destination = MALLOC(strlen(final_download_dir) + 
strlen(dname) + 2);
+  strcpy(idc.final_download_destination, final_download_dir);
   FREE(final_download_dir);
-  if (tmp[strlen(tmp)] != DIR_SEPARATOR)
-    strcat(tmp, DIR_SEPARATOR_STR);
-  strcat(tmp, dname);
+  if (idc.final_download_destination[strlen(idc.final_download_destination)] 
!= DIR_SEPARATOR)
+    strcat(idc.final_download_destination, DIR_SEPARATOR_STR);
+  strcat(idc.final_download_destination, dname);
 
   /* setup visualization */
   list = MALLOC(sizeof(DownloadList));
   list->next = head;
   list->rr = NULL;
   list->model = NULL;
-  list->uri = uri;
-  list->filename = tmp;
-  list->finalName = STRDUP(tmp);
+  list->uri = idc.uri;
+  list->filename = idc.final_download_destination;
+  list->finalName = STRDUP(idc.final_download_destination);
   head = list;
-  size_h = getHumanSize(ECRS_fileSize(uri));
+  size_h = getHumanSize(ECRS_fileSize(idc.uri));
   gtk_tree_store_insert(summary,
                         &iiter,
                         NULL,
                         0);
   gtk_tree_store_set(summary,
                      &iiter,
-                     DOWNLOAD_FILENAME, tmp,
+                     DOWNLOAD_FILENAME, idc.final_download_destination,
                      DOWNLOAD_SHORTNAME, uris,
-                     DOWNLOAD_SIZE, ECRS_fileSize(uri),
+                     DOWNLOAD_SIZE, ECRS_fileSize(idc.uri),
                      DOWNLOAD_HSIZE, size_h,
                      DOWNLOAD_PROGRESS, 0, /* progress */
                      DOWNLOAD_URISTRING, uris,
-                     DOWNLOAD_URI, ECRS_dupUri(uri),
+                     DOWNLOAD_URI, ECRS_dupUri(idc.uri),
                      DOWNLOAD_TREEPATH, NULL, /* internal: row reference! */
                      DOWNLOAD_DIRPATH, "",                     
                      -1);
@@ -438,16 +456,14 @@
                              "fsstatusAnonymitySpin");
   if (spin == NULL) {
     BREAK();
-    anon = 1;
+    idc.anon = 1;
   } else {
-    anon = gtk_spin_button_get_value_as_int
+    idc.anon = gtk_spin_button_get_value_as_int
       (GTK_SPIN_BUTTON(spin));
   }
   addLogEntry(_("Downloading `%s'"), uris);
-  FSUI_startDownload(ctx,
-                     anon,
-                     uri,
-                     tmp);
+  run_with_save_calls(&startDownload,
+                     &idc);
   FREE(urid);
 }
 
@@ -608,6 +624,7 @@
   FSUI_clearCompletedDownloads(ctx,
                                &delDownloadView,
                                NULL);
+  return NULL;
 }
 
 void on_clearCompletedDownloadsButton_clicked(void * unused,

Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c  2006-05-20 13:41:49 UTC (rev 2869)
+++ gnunet-gtk/src/plugins/fs/search.c  2006-05-20 14:32:36 UTC (rev 2870)
@@ -720,6 +720,20 @@
   return child;
 }
 
+typedef struct {
+  struct ECRS_URI * uri;
+  int anon;
+} StartSearchClosure;
+
+static void * startSearch(void * cls) {
+  StartSearchClosure * ssc = cls;
+
+  FSUI_startSearch(ctx,
+                  ssc->anon,
+                  ssc->uri);
+  return NULL;
+}
+
 void on_fssearchbutton_clicked(gpointer dummy2,
                               GtkWidget * searchButton) {
   GtkWidget * searchKeywordGtkCB;
@@ -740,6 +754,7 @@
   char * tabtxt;
   SearchList * list;
   const char * descStr;
+  StartSearchClosure ssc;
 
   DEBUG_BEGIN();
   searchKeywordGtkCB
@@ -879,10 +894,11 @@
   gtk_notebook_set_current_page(GTK_NOTEBOOK(notebook),
                                pages);
   gtk_widget_show(notebook);
-  FSUI_startSearch(ctx,
-                  getAnonymityLevel(getMainXML(),
-                                    "searchAnonymitySelectionSpinButton"),
-                  uri);
+  ssc.anon = getAnonymityLevel(getMainXML(),
+                              "searchAnonymitySelectionSpinButton");
+  ssc.uri = uri;
+  run_with_save_calls(&startSearch,
+                     &ssc);
   FREE(tabtxt);
   DEBUG_END();
 }

Modified: gnunet-gtk/src/plugins/fs/upload.c
===================================================================
--- gnunet-gtk/src/plugins/fs/upload.c  2006-05-20 13:41:49 UTC (rev 2869)
+++ gnunet-gtk/src/plugins/fs/upload.c  2006-05-20 14:32:36 UTC (rev 2870)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2005 Christian Grothoff (and other contributing authors)
+     (C) 2005, 2006 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
@@ -284,9 +284,44 @@
                           "metaDataDialogMetaDataList");
 }
 
+typedef struct {
+  int anon;
+  int doRec;
+  int doIndex;
+  int deepIndex;
+  const char * filename;
+  struct ECRS_URI * keywordURI;
+  struct ECRS_URI * gkeywordURI;
+  struct ECRS_MetaData * meta;
+} UploadClosure;
+
+static void * doUpload(void * cls) {
+  UploadClosure * uc = cls;
+
+  if (uc->doRec) {
+    FSUI_uploadAll(ctx,
+                  uc->filename,
+                  uc->anon,
+                  uc->doIndex,
+                  uc->deepIndex,
+                  uc->meta,
+                  uc->gkeywordURI,
+                  uc->keywordURI);
+  } else {
+    FSUI_upload(ctx,
+               uc->filename,
+               uc->anon,
+               uc->doIndex,
+               NO,
+               uc->meta,
+               uc->keywordURI);
+  }
+  return NULL;
+}
+
 void on_fsinsertuploadbutton_clicked(gpointer dummy,
                                     GtkWidget * uploadButton) {
-  const char * filename;
+  UploadClosure uc;
   const char * filenamerest;
   GtkWidget * uploadLine;
   GtkWidget * entry;
@@ -294,11 +329,8 @@
   GtkWidget * recBut;
   GtkWidget * idxBut;
   GtkWidget * deepIndex;
-  struct ECRS_MetaData * meta;
   EXTRACTOR_ExtractorList * extractors;
   char * config;
-  struct ECRS_URI * keywordURI;
-  struct ECRS_URI * gkeywordURI;
 
   DEBUG_BEGIN();
   extractors = EXTRACTOR_loadDefaultLibraries();
@@ -313,8 +345,7 @@
   uploadLine = glade_xml_get_widget(getMainXML(),
                                    "uploadFilenameComboBoxEntry");
   entry = gtk_bin_get_child(GTK_BIN(uploadLine));
-  filename = gtk_entry_get_text(GTK_ENTRY(entry));
-
+  uc.filename = gtk_entry_get_text(GTK_ENTRY(entry));
   metaXML
     = glade_xml_new(getGladeFileName(),
                    "metaDataDialog",
@@ -322,83 +353,65 @@
   connectGladeWithPlugins(metaXML);
   dialog = glade_xml_get_widget(metaXML,
                                "metaDataDialog");
-  meta = ECRS_createMetaData();
-  ECRS_extractMetaData(meta,
-                      filename,
+  uc.meta = ECRS_createMetaData();
+  ECRS_extractMetaData(uc.meta,
+                      uc.filename,
                       extractors);
   EXTRACTOR_removeAll(extractors);
-  filenamerest = &filename[strlen(filename)-1];
-  while ( (filenamerest > filename) &&
+  filenamerest = &uc.filename[strlen(uc.filename)-1];
+  while ( (filenamerest > uc.filename) &&
          (filenamerest[-1] != DIR_SEPARATOR) )
     filenamerest--;
-  ECRS_addToMetaData(meta,
+  ECRS_addToMetaData(uc.meta,
                     EXTRACTOR_FILENAME,
                     filenamerest);
   createMetaDataListTreeView(metaXML,
                             "metaDataDialogMetaDataList",
                             "previewImage",
-                            meta);
-  keywordURI = ECRS_metaDataToUri(meta);
-  ECRS_freeMetaData(meta);
+                            uc.meta);
+  uc.keywordURI = ECRS_metaDataToUri(uc.meta);
+  ECRS_freeMetaData(uc.meta);
   createKeywordListTreeView(metaXML,
                            "metaDataDialogKeywordList",
-                           keywordURI);
-  ECRS_freeUri(keywordURI);
+                           uc.keywordURI);
+  ECRS_freeUri(uc.keywordURI);
   createMetaTypeComboBox(metaXML,
                         "metaDataDialogMetaTypeComboBox");
   gtk_dialog_set_default_response(GTK_DIALOG(dialog),
                                  GTK_RESPONSE_OK);
   if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) {
-    int doIndex;
-    int doRec;
-
     addLogEntry(_("Uploading `%s'"), filenamerest);
 
     recBut = glade_xml_get_widget(getMainXML(),
                                  "scopeRecursiveButton");
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recBut)))
-      doRec = YES;
+      uc.doRec = YES;
     else
-      doRec = NO;
+      uc.doRec = NO;
     idxBut = glade_xml_get_widget(getMainXML(),
                                  "indexbutton");
     if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(idxBut)))
-      doIndex = YES;
+      uc.doIndex = YES;
     else
-      doIndex = NO;
+      uc.doIndex = NO;
 
-    meta = getMetaDataFromList(metaXML,
-                              "metaDataDialogMetaDataList",
-                              "previewImage");
-    keywordURI = getKeywordURIFromList(metaXML,
-                                      "metaDataDialogKeywordList");
-    if (doRec) {
-      deepIndex = glade_xml_get_widget(getMainXML(),
-                                      "deepIndexCheckButton");
-      gkeywordURI = ECRS_stringToUri(ECRS_URI_PREFIX
-                                    ECRS_SEARCH_INFIX);
-      FSUI_uploadAll(ctx,
-                    filename,
-                    getAnonymityLevel(getMainXML(),
-                                      "uploadAnonymityLevelSpinButton"),
-                    doIndex,
-                    (TRUE == 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(deepIndex)))
-                    ? YES : NO,
-                    meta,
-                    gkeywordURI,
-                    keywordURI);
-    } else {
-      FSUI_upload(ctx,
-                 filename,
-                 getAnonymityLevel(getMainXML(),
-                                   "uploadAnonymityLevelSpinButton"),
-                 doIndex,
-                 NO,
-                 meta,
-                 keywordURI);
-    }
-    ECRS_freeMetaData(meta);
-    ECRS_freeUri(keywordURI);
+    uc.meta = getMetaDataFromList(metaXML,
+                                 "metaDataDialogMetaDataList",
+                                 "previewImage");
+    uc.keywordURI = getKeywordURIFromList(metaXML,
+                                         "metaDataDialogKeywordList");
+    uc.anon = getAnonymityLevel(getMainXML(),
+                               "uploadAnonymityLevelSpinButton");   
+    deepIndex = glade_xml_get_widget(getMainXML(),
+                                    "deepIndexCheckButton");
+    uc.deepIndex = (TRUE == 
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(deepIndex))) ? YES : NO;
+    uc.gkeywordURI = ECRS_stringToUri(ECRS_URI_PREFIX
+                                     ECRS_SEARCH_INFIX);
+    run_with_save_calls(&doUpload,
+                       &uc);
+    ECRS_freeMetaData(uc.meta);
+    ECRS_freeUri(uc.gkeywordURI);
+    ECRS_freeUri(uc.keywordURI);
   }
   gtk_widget_destroy (dialog);
   UNREF(metaXML);





reply via email to

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