Index: /orxonox/branches/updater/src/gui/orxonox_gui.cc
===================================================================
--- /orxonox/branches/updater/src/gui/orxonox_gui.cc	(revision 3262)
+++ /orxonox/branches/updater/src/gui/orxonox_gui.cc	(revision 3263)
@@ -41,4 +41,5 @@
   OrxonoxGuiKeys* keys;
   OrxonoxGuiUpdate* update;
+int verbose = 4;
 
 int main( int argc, char *argv[] )
@@ -58,4 +59,5 @@
   initGTK(argc, argv);
 #endif /* HAVE_GTK2 */
+
   orxonoxGUI = new Window( "Grafical OrxOnoX loader, "PACKAGE_VERSION);
 #ifdef HAVE_GTK2
Index: /orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc
===================================================================
--- /orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc	(revision 3262)
+++ /orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc	(revision 3263)
@@ -47,4 +47,9 @@
 bool initGTK(int argc, char *argv[])
 {
+#ifdef HAVE_GTHREAD
+  PRINTF(3)("Initializing the ThreadSystem of the GUI\n");
+  g_thread_init(NULL);
+  gdk_threads_init();
+#endif /* HAVE_GTHREAD */
   gtk_init (&argc, &argv);
   gtk_rc_parse( "rc" );
@@ -56,5 +61,8 @@
 bool mainloopGTK(void)
 {
+  gdk_threads_enter();
+  PRINTF(1)("test\n");
   gtk_main();
+  gdk_threads_leave();
 }
 #endif /* HAVE_GTK2 */
@@ -529,4 +537,5 @@
   this->init();
 }
+
 /**
    \brief Creates a new EventBox with name title
@@ -1204,4 +1213,6 @@
   gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize);
 #endif /* HAVE_GTK2 */
+  PRINTF(3)("Progress: %f\n", progress*100.0/totalSize);
+
 }
 
Index: /orxonox/branches/updater/src/gui/orxonox_gui_gtk.h
===================================================================
--- /orxonox/branches/updater/src/gui/orxonox_gui_gtk.h	(revision 3262)
+++ /orxonox/branches/updater/src/gui/orxonox_gui_gtk.h	(revision 3263)
@@ -10,4 +10,6 @@
 #include <config.h> 
 #endif
+
+extern int verbose; // soon obsolete here
 
 #include "../debug.h"
@@ -36,5 +38,4 @@
 #endif /* HAVE_GTK2 */
 
-
 //! This is the topmost object that can be displayed all others are derived from it.
 class Widget
Index: /orxonox/branches/updater/src/gui/orxonox_gui_update.cc
===================================================================
--- /orxonox/branches/updater/src/gui/orxonox_gui_update.cc	(revision 3262)
+++ /orxonox/branches/updater/src/gui/orxonox_gui_update.cc	(revision 3263)
@@ -30,4 +30,7 @@
 #include "orxonox_gui.h"
 #include <stdio.h>
+#include <curl/curl.h>
+#include <curl/types.h>
+#include <curl/easy.h> /* new for v7 */
 using namespace std;
 
@@ -79,4 +82,9 @@
   updateDataBar = new ProgressBar ();
   updateDataBox->fill(updateDataBar);
+
+  updateDataBegin = new Button ("begin Download");
+  updateDataBegin->connectSignal ("button_press_event", updateDataBar, updateDataFunc);
+  updateDataBox->fill(updateDataBegin);
+
   updateDataWindow->fill (updateDataBox);
 
@@ -139,7 +147,18 @@
    \param button The Button, that triggered this event.
 */
-gint OrxonoxGuiUpdate::updateDataFunc(GtkWidget* w, GdkEventKey* event, void* button)
-{
-
+gint OrxonoxGuiUpdate::updateDataFunc(GtkWidget* w, GdkEventKey* event, void* bar)
+{
+  FileInfo* info = new FileInfo;
+
+  info->fileOnDisk = new char [5];
+  strcpy (info->fileOnDisk, "test");
+  info->fileOnNet = new char [100];
+  strcpy(info->fileOnNet, "http://www.orxonox.ethz.ch/files/taskHorizon.at.bermuda-funk.ogg");
+  info->Bar = (ProgressBar*)bar;
+  PRINTF(3)("Preparing to download file %s.\n", info->fileOnNet);
+  //downloadThread (info);
+
+  if (!g_thread_create(&downloadThread, info, FALSE, NULL) != 0)
+    PRINTF(1)("can't create the thread"); 
 }
 
@@ -156,4 +175,170 @@
   tmpBar->setProgress(tmpBar->getProgress()+1);
 }
-
-#endif /* HAVE_GTK2 */
+#endif /* HAVE_GTK2 */
+
+#ifdef HAVE_CURL
+size_t OrxonoxGuiUpdate::curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream)
+{
+  return fwrite(ptr, size, nmemb, stream);
+}
+
+size_t OrxonoxGuiUpdate::curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream)
+{
+  return fread(ptr, size, nmemb, stream);
+}
+
+
+int OrxonoxGuiUpdate::curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress)
+{
+  //  gdk_threads_enter();
+  Bar->setProgress(progress);
+  Bar->setTotalSize(totalSize);
+  //  gdk_threads_leave();
+  return 0;
+
+}
+
+void* OrxonoxGuiUpdate::downloadThread (void* fileInfo)
+{
+  PRINTF(3)("Downloading.\n");
+  FileInfo* info = (FileInfo*)fileInfo;
+  CURL* curl;
+  CURLcode res;
+  FILE* outfile;
+  curl = curl_easy_init();
+
+  if(curl)
+    {
+      outfile = fopen(info->fileOnDisk, "w");
+      
+      curl_easy_setopt(curl, CURLOPT_URL, info->fileOnNet);
+      curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
+      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriteFunc);
+      curl_easy_setopt(curl, CURLOPT_READFUNCTION, curlReadFunc);
+      curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
+      curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, curlProgressFunc);
+      curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, info->Bar);
+      
+      res = curl_easy_perform(curl);
+      
+      fclose(outfile);
+      curl_easy_cleanup(curl);
+    }
+  return NULL;
+}
+
+#endif /* HAVE_CURL */
+
+
+/*
+ int main(int argc, char **argv)
+ {
+   GtkWidget *Window, *Frame, *Frame2;
+   GtkAdjustment *adj;
+   
+   // Init thread 
+   g_thread_init(NULL);
+   gtk_init(&argc, &argv);
+   Window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+   Frame = gtk_frame_new(NULL);
+   gtk_frame_set_shadow_type(GTK_FRAME(Frame), GTK_SHADOW_OUT);
+   gtk_container_add(GTK_CONTAINER(Window), Frame);
+   Frame2 = gtk_frame_new(NULL);
+   gtk_frame_set_shadow_type(GTK_FRAME(Frame2), GTK_SHADOW_IN);
+   gtk_container_add(GTK_CONTAINER(Frame), Frame2);
+   gtk_container_set_border_width(GTK_CONTAINER(Frame2), 5);
+   adj = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
+   Bar = gtk_progress_bar_new_with_adjustment(adj);
+   gtk_container_add(GTK_CONTAINER(Frame2), Bar);
+   gtk_widget_show_all(Window);
+ 
+   if (!g_thread_create(&my_thread, argv[1], FALSE, NULL) != 0)
+     g_warning("can't create the thread");
+ 
+ 
+   gdk_threads_enter();
+   gtk_main();
+  gdk_threads_leave();
+   return 0;
+ }
+
+
+
+
+
+size_t writeFunc(void *ptr, size_t size, size_t nmemb, FILE *stream)
+ {
+   return fwrite(ptr, size, nmemb, stream);
+ }
+ 
+ size_t my_read_func(void *ptr, size_t size, size_t nmemb, FILE *stream)
+ {
+   return fread(ptr, size, nmemb, stream);
+ }
+ 
+ int my_progress_func(GtkWidget *Bar,
+                      double t, // dltotal 
+                      double d, // dlnow 
+                      double ultotal,
+                      double ulnow)
+ {
+   gdk_threads_enter();
+   gtk_progress_set_value(GTK_PROGRESS(Bar), d*100.0/t);
+   gdk_threads_leave();
+   return 0;
+ }
+
+ void *my_thread(void *ptr)
+ {
+   CURL *curl;
+   CURLcode res;
+   FILE *outfile;
+   gchar *url = ptr;
+ 
+   curl = curl_easy_init();
+   if(curl)
+   {
+     outfile = fopen("test.curl", "w");
+ 
+     curl_easy_setopt(curl, CURLOPT_URL, url);
+     curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
+     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_write_func);
+     curl_easy_setopt(curl, CURLOPT_READFUNCTION, my_read_func);
+     curl_easy_setopt(curl, CURLOPT_NOPROGRESS, FALSE);
+     curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, my_progress_func);
+     curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, Bar);
+ 
+     res = curl_easy_perform(curl);
+ 
+     fclose(outfile);
+     curl_easy_cleanup(curl);
+   }
+ 
+   return NULL;
+ }
+ 
+*/
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /orxonox/branches/updater/src/gui/orxonox_gui_update.h
===================================================================
--- /orxonox/branches/updater/src/gui/orxonox_gui_update.h	(revision 3262)
+++ /orxonox/branches/updater/src/gui/orxonox_gui_update.h	(revision 3263)
@@ -24,5 +24,5 @@
   Box* updateDataBox;          //!< A Box for the Window for the Data-update.
   ProgressBar* updateDataBar;  //!< A Bar to display the progress of the download.
-
+  Button* updateDataBegin;     //!< A Button to start the process.
 
   Button* updateSourceWindowButton;//!< A Button to update the Source of orxonox. \todo tricky
@@ -38,4 +38,19 @@
 #endif /* HAVE_GTK2 */
 
+#ifdef HAVE_CURL
+  struct FileInfo
+  {
+    char* fileOnNet;
+    char* fileOnDisk;
+    ProgressBar* Bar;
+  };
+
+  static size_t curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream);
+  static size_t curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream);
+  static int curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress);
+
+  static void* downloadThread (void* fileInfo);
+  
+#endif /* HAVE_CURL */
 
  public:
