gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r846 - GNUnet GNUnet/src/applications/fs/ecrs GNUnet/src/ap


From: grothoff
Subject: [GNUnet-SVN] r846 - GNUnet GNUnet/src/applications/fs/ecrs GNUnet/src/applications/fs/fsui gnunet-gtk gnunet-gtk/src
Date: Fri, 3 Jun 2005 05:28:30 -0700 (PDT)

Author: grothoff
Date: 2005-06-03 05:28:18 -0700 (Fri, 03 Jun 2005)
New Revision: 846

Modified:
   GNUnet/src/applications/fs/ecrs/uri.c
   GNUnet/src/applications/fs/fsui/upload.c
   GNUnet/todo
   gnunet-gtk/TODO
   gnunet-gtk/gnunet-gtk.glade
   gnunet-gtk/src/daemon.c
   gnunet-gtk/src/download.c
   gnunet-gtk/src/fs.c
   gnunet-gtk/src/upload.c
Log:
hacking

Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c       2005-06-02 19:17:03 UTC (rev 
845)
+++ GNUnet/src/applications/fs/ecrs/uri.c       2005-06-03 12:28:18 UTC (rev 
846)
@@ -576,7 +576,9 @@
 URI * ECRS_metaDataToUri(const MetaData * md) {
   URI * ret;
   int i;
+  int j;
   int havePreview;
+  int add;
 
   if (md == NULL)
     return NULL;
@@ -585,17 +587,39 @@
   ret->data.ksk.keywordCount = 0;
   ret->data.ksk.keywords = NULL;
   havePreview = 0;
-  for (i=md->itemCount-1;i>=0;i--)
-    if (md->items[i].type == EXTRACTOR_THUMBNAIL_DATA)
+  for (i=md->itemCount-1;i>=0;i--) {
+    if (md->items[i].type == EXTRACTOR_THUMBNAIL_DATA) {
       havePreview++;
+    } else {
+      for (j=md->itemCount-1;j>i;j--) {
+       if (0 == strcmp(md->items[i].data,
+                       md->items[j].data)) {
+         havePreview++; /* duplicate! */
+         break;
+       }
+      }      
+    }
+  }
   GROW(ret->data.ksk.keywords,
        ret->data.ksk.keywordCount,
        md->itemCount - havePreview);
   for (i=md->itemCount-1;i>=0;i--) {
-    if (md->items[i].type == EXTRACTOR_THUMBNAIL_DATA) 
+    if (md->items[i].type == EXTRACTOR_THUMBNAIL_DATA) {
       havePreview--;
-    else
-      ret->data.ksk.keywords[i-havePreview] = STRDUP(md->items[i].data);
+    } else {
+      add = 1;
+      for (j=md->itemCount-1;j>i;j--) {
+       if (0 == strcmp(md->items[i].data,
+                       md->items[j].data)) {
+         havePreview--;
+         add = 0;
+       }
+      }
+      if (add == 1) {
+       ret->data.ksk.keywords[i-havePreview] 
+         = STRDUP(md->items[i].data);
+      }
+    }
   }
   return ret;
 }

Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c    2005-06-02 19:17:03 UTC (rev 
845)
+++ GNUnet/src/applications/fs/fsui/upload.c    2005-06-03 12:28:18 UTC (rev 
846)
@@ -112,6 +112,7 @@
   int handle;
   DirTrack backup;
 
+  GNUNET_ASSERT(utc->filename != NULL);
   backup = utc->dir;
   memset(&utc->dir, 0, sizeof(DirTrack));
 
@@ -300,6 +301,7 @@
   int ret;
   char * inboundFN;
 
+  GNUNET_ASSERT(utc->main_filename != NULL);
   inboundFN
     = ECRS_getFromMetaData(utc->meta,
                           EXTRACTOR_FILENAME);
@@ -346,7 +348,8 @@
                         utc->extractors);
     utc->filename = NULL;
   } else if (utc->isRecursive) {
-    scanDirectory(utc->filename,
+    utc->filename = utc->main_filename;
+    scanDirectory(utc->main_filename,
                  (DirectoryEntryCallback)&dirEntryCallback,
                  utc);
     ret = uploadDirectory(utc,
@@ -365,6 +368,7 @@
       event.type = upload_error;
       event.data.message = _("Upload failed.\n");
     }
+    utc->filename = NULL;
   } else {
     event.type = upload_error;
     event.data.message = _("Cannot upload directory without using 
recursion.\n");

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-06-02 19:17:03 UTC (rev 845)
+++ GNUnet/todo 2005-06-03 12:28:18 UTC (rev 846)
@@ -1,5 +1,11 @@
 0.7.0pre3:
-- gnunet-gtk (see todo list there)
+- FSUI: 
+  * do NOT use libextractor with
+    FSUI_upload (full control should be with client!)
+- ECRS:
+  * fix bug in meta-data serialization (found existence by
+    inserting doodle SVN directory recursively with gnunet-gtk)
+- gnunet-gtk (debug a bit, add preview encoding for upload)
 - gnunet-setup:
    curses wizard?  [ Nils ];
    template path adjustment for non gconf setup [ Nils ]

Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO     2005-06-02 19:17:03 UTC (rev 845)
+++ gnunet-gtk/TODO     2005-06-03 12:28:18 UTC (rev 846)
@@ -1,41 +1,47 @@
 High priority (for 0.7.0pre3):
-* basic FS integration:
-  - insert (Thursday/Friday?)
-    + launch file selection window [ medium ]
-    + launch meta-data edit window [ medium ]
-    + launch insertion process [ medium ]
-    + add insertion to insertion view [ easy ]
-    + process insertion progress events [ easy ]
+* upload: fix preview meta-data encoding
+* debug
 
 Important (for 0.7.0):
 * make use of anonymity level specification widgets (easy):
   - search
   - download
   - upload
-* implement advanced FS operations (namespace, collection) [ medium ]
+  - namespace creation
+* download:
+  - allow download canncellation
+  - figure out where seemingly spurious "pending" downloads come from
+* implement advanced FS operations:
+  - create namespace [ medium ]
+  - publish to namespace [ medium ]
+  - publish update [ medium ]
+  - start collection [ medium ]
+  - stop collection [ easy ]
+  - create directory from arbitrary mix [ medium ]
 * search:
   + update namespace list combo box [ easy ]
   + support namespace URIs [ easy ]
+  + update search summary (new search start, new search result)
 * insertion:
-  + support nice progress view for recursive insertions [ medium ]
-* stats integration [ medium ]
-* available apps [ medium ]
+  + support nice progress view for recursive insertions [ medium ] (working 
already???)
 * highlight completed downloads [ easy ]
 * highlight active downloads in search list [ easy ]
 * allow user to cancel downloads [ medium ]
 * allow user to clear completed downloads from summary [ easy ]
 * process download progress events:
   - show contents of directory in associated search view! [ DIFFICULT, CG ]
-* auto-rename downloaded files to better names (user feedback!?) [ medium ]
-* cleanup-code (enum instead of 1,2,3,4)
+* cleanup-code (enum instead of 1,2,3,4) [ easy ]
 
 Later (0.7.1):
-* more help-texts (glade, easy)
-* pop-up dialogs / context menus (medium)
-* chat (difficult)
-* look into I18N (difficult)
+* auto-rename downloaded files to better names (user feedback!?) [ medium ]
+* stats integration [ medium ]
+* available apps [ medium ]
+* more help-texts (glade) [ easy ]
+* pop-up dialogs / context menus [ medium ]
+* chat [ difficult ]
+* look into I18N [ difficult ]
 * disable inactive buttons (if no search/download is selected to
-  operate on)
+  operate on) [ medium ]
 
 
 gnunet-gtk wishlist (from pre-0.7.0 days):

Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2005-06-02 19:17:03 UTC (rev 845)
+++ gnunet-gtk/gnunet-gtk.glade 2005-06-03 12:28:18 UTC (rev 846)
@@ -4,6 +4,7 @@
 <glade-interface>
 
 <widget class="GtkWindow" id="mainWindow">
+  <property agent="glademm" name="cxx_visibility">public</property>
   <property name="visible">True</property>
   <property name="title" translatable="yes">gnunet-gtk</property>
   <property name="type">GTK_WINDOW_TOPLEVEL</property>
@@ -1723,7 +1724,7 @@
                          <property name="use_underline">True</property>
 
                          <child internal-child="image">
-                           <widget class="GtkImage" id="image14">
+                           <widget class="GtkImage" id="image16">
                              <property name="visible">True</property>
                              <property name="stock">gtk-new</property>
                              <property name="icon_size">1</property>
@@ -1763,15 +1764,6 @@
                                  <signal name="activate" 
handler="createCollection_clicked" last_modification_time="Sat, 28 May 2005 
14:39:59 GMT"/>
                                </widget>
                              </child>
-
-                             <child>
-                               <widget class="GtkMenuItem" 
id="createAdvertisement">
-                                 <property name="visible">True</property>
-                                 <property name="label" 
translatable="yes">_Advertisement</property>
-                                 <property name="use_underline">True</property>
-                                 <signal name="activate" 
handler="createAdvertisement_clicked" last_modification_time="Sat, 28 May 2005 
14:39:59 GMT"/>
-                               </widget>
-                             </child>
                            </widget>
                          </child>
                        </widget>
@@ -1784,7 +1776,7 @@
                          <property name="use_underline">True</property>
 
                          <child internal-child="image">
-                           <widget class="GtkImage" id="image15">
+                           <widget class="GtkImage" id="image17">
                              <property name="visible">True</property>
                              <property name="stock">gtk-delete</property>
                              <property name="icon_size">1</property>
@@ -2179,8 +2171,6 @@
                      <property name="has_frame">True</property>
                      <property name="invisible_char">*</property>
                      <property name="activates_default">True</property>
-                     <signal name="activate" 
handler="chatMainEntryLine_clicked" last_modification_time="Mon, 23 May 2005 
17:28:12 GMT"/>
-                     <signal name="editing_done" 
handler="on_chatMainEntryLine_editing_done_clicked" 
last_modification_time="Mon, 23 May 2005 17:28:16 GMT"/>
                      <accelerator key="Return" modifiers="0" 
signal="activate"/>
                    </widget>
                  </child>
@@ -2323,7 +2313,6 @@
     <atkproperty name="AtkObject::accessible_name" translatable="yes">Edit 
File Information</atkproperty>
     <atkproperty name="AtkObject::accessible_description" 
translatable="yes">This dialog is used to edit information about shared 
files.</atkproperty>
   </accessibility>
-  <signal name="close" handler="on_metaDataDialog_close" 
last_modification_time="Mon, 23 May 2005 16:20:23 GMT"/>
 
   <child internal-child="vbox">
     <widget class="GtkVBox" id="dialog-vbox1">
@@ -2350,7 +2339,7 @@
                <atkproperty name="AtkObject::accessible_name" 
translatable="yes">metaDataDialogCancelButton</atkproperty>
                <atkproperty name="AtkObject::accessible_description" 
translatable="yes">Abort the upload operation.</atkproperty>
              </accessibility>
-             <accelerator key="Escape" modifiers="0" signal="activate"/>
+             <accelerator key="Return" modifiers="0" signal="activate"/>
            </widget>
          </child>
 
@@ -2364,7 +2353,7 @@
              <property name="relief">GTK_RELIEF_NORMAL</property>
              <property name="focus_on_click">True</property>
              <property name="response_id">-6</property>
-             <accelerator key="A" modifiers="GDK_MOD1_MASK" signal="activate"/>
+             <accelerator key="Escape" modifiers="GDK_MOD1_MASK" 
signal="activate"/>
            </widget>
          </child>
        </widget>
@@ -2489,8 +2478,6 @@
                <atkproperty name="AtkObject::accessible_description" 
translatable="yes">Enter the value for the meta-data of the specified type here.
 Press ENTER to add the data.</atkproperty>
              </accessibility>
-             <signal name="editing_done" 
handler="on_metaDataDialogValueEntry_editing_done" object="metaDataDialog" 
last_modification_time="Mon, 23 May 2005 17:24:04 GMT"/>
-             <signal name="activate" 
handler="on_metaDataDialogValueEntry_editing_done" object="metaDataDialog" 
last_modification_time="Mon, 23 May 2005 18:55:30 GMT"/>
              <accelerator key="Return" modifiers="0" signal="activate"/>
            </widget>
            <packing>
@@ -2551,7 +2538,6 @@
                  <property name="fixed_height_mode">False</property>
                  <property name="hover_selection">False</property>
                  <property name="hover_expand">False</property>
-                 <signal name="select_cursor_row" 
handler="on_metaDataDialogMetaDataList_select_cursor_row" 
object="metaDataDialog" last_modification_time="Mon, 23 May 2005 18:58:13 GMT"/>
                </widget>
              </child>
            </widget>
@@ -2631,8 +2617,6 @@
              <property name="has_frame">True</property>
              <property name="invisible_char">*</property>
              <property name="activates_default">False</property>
-             <signal name="activate" 
handler="fileInformationKeywordEntry_clicked" object="metaDataDialog" 
last_modification_time="Mon, 23 May 2005 17:23:09 GMT"/>
-             <signal name="editing_done" 
handler="fileInformationKeywordEntry_clicked" object="metaDataDialog" 
last_modification_time="Mon, 23 May 2005 18:56:54 GMT"/>
              <accelerator key="Return" modifiers="0" signal="activate"/>
            </widget>
            <packing>
@@ -2661,8 +2645,8 @@
        </widget>
        <packing>
          <property name="padding">0</property>
-         <property name="expand">True</property>
-         <property name="fill">True</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
        </packing>
       </child>
 
@@ -2697,7 +2681,6 @@
                  <property name="fixed_height_mode">False</property>
                  <property name="hover_selection">False</property>
                  <property name="hover_expand">False</property>
-                 <signal name="select_cursor_row" 
handler="on_metaDataDialogKeywordList_select_cursor_row" 
object="metaDataDialog" last_modification_time="Mon, 23 May 2005 18:58:34 GMT"/>
                </widget>
              </child>
            </widget>
@@ -2732,6 +2715,96 @@
          <property name="fill">True</property>
        </packing>
       </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox27">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="previewLabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Preview:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">5</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">scrolledwindow21</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow21">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="shadow_type">GTK_SHADOW_IN</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <widget class="GtkViewport" id="viewport7">
+                 <property name="visible">True</property>
+                 <property name="shadow_type">GTK_SHADOW_IN</property>
+
+                 <child>
+                   <widget class="GtkImage" id="previewImage">
+                     <property agent="glademm" 
name="cxx_visibility">public</property>
+                     <property name="visible">True</property>
+                     <property name="xalign">0.5</property>
+                     <property name="yalign">0.5</property>
+                     <property name="xpad">0</property>
+                     <property name="ypad">0</property>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkFileChooserButton" 
id="selectAlternativePreviewButton">
+             <property name="visible">True</property>
+             <property name="title" translatable="yes">Select A File</property>
+             <property name="action">GTK_FILE_CHOOSER_ACTION_OPEN</property>
+             <property name="local_only">True</property>
+             <property name="show_hidden">False</property>
+             <property name="width_chars">-1</property>
+             <signal name="selection_changed" 
handler="on_selectAlternativePreviewButton_selection_changed" 
object="previewImage" last_modification_time="Thu, 02 Jun 2005 22:46:15 GMT"/>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
     </widget>
   </child>
 </widget>
@@ -3943,4 +4016,530 @@
   </child>
 </widget>
 
+<widget class="GtkDialog" id="namespaceMetaDataDialog">
+  <property agent="glademm" name="cxx_visibility">public</property>
+  <property name="title" translatable="yes">Create Namespace</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">True</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="icon">info.png</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="focus_on_map">True</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox4">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="hbuttonbox1">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="button3">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-ok</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-5</property>
+             <accelerator key="Return" modifiers="0" signal="activate"/>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="button4">
+             <property name="visible">True</property>
+             <property name="can_default">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-cancel</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <property name="response_id">-6</property>
+             <accelerator key="Escape" modifiers="GDK_MOD1_MASK" 
signal="activate"/>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkLabel" id="label86">
+         <property name="visible">True</property>
+         <property name="label" translatable="yes">Please provide information 
about the namespace</property>
+         <property name="use_underline">False</property>
+         <property name="use_markup">True</property>
+         <property name="justify">GTK_JUSTIFY_CENTER</property>
+         <property name="wrap">False</property>
+         <property name="selectable">False</property>
+         <property name="xalign">0.5</property>
+         <property name="yalign">0.5</property>
+         <property name="xpad">0</property>
+         <property name="ypad">0</property>
+         <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+         <property name="width_chars">-1</property>
+         <property name="single_line_mode">False</property>
+         <property name="angle">0</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox31">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="label92">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Name:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">5</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">namespaceNameEntry</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="namespaceNameEntry">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char">*</property>
+             <property name="activates_default">False</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox32">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="label93">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Anonymity (for 
namespace advertisement):</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">5</property>
+             <property name="ypad">0</property>
+             <property 
name="mnemonic_widget">namespaceAnonymityspinbutton</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkSpinButton" id="namespaceAnonymityspinbutton">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="climb_rate">1</property>
+             <property name="digits">0</property>
+             <property name="numeric">True</property>
+             <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+             <property name="snap_to_ticks">False</property>
+             <property name="wrap">False</property>
+             <property name="adjustment">1 0 10000 1 10 10</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox33">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="label88">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Keyword:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_CENTER</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">5</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">entry3</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="entry3">
+             <property agent="glademm" name="cxx_visibility">public</property>
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char">*</property>
+             <property name="activates_default">False</property>
+             <accelerator key="Return" modifiers="0" signal="activate"/>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="button6">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-add</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" 
handler="on_namespacemetaDataDialogKeywordAddButton_clicked" 
last_modification_time="Thu, 02 Jun 2005 23:54:23 GMT"/>
+           </widget>
+           <packing>
+             <property name="padding">5</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkFrame" id="frame16">
+         <property name="visible">True</property>
+         <property name="label_xalign">0</property>
+         <property name="label_yalign">0.5</property>
+         <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow24">
+             <property name="visible">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="shadow_type">GTK_SHADOW_IN</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <widget class="GtkTreeView" id="treeview2">
+                 <property agent="glademm" 
name="cxx_visibility">public</property>
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">Select entries 
and use Delete button in order to delete keywords.</property>
+                 <property name="can_focus">True</property>
+                 <property name="headers_visible">False</property>
+                 <property name="rules_hint">True</property>
+                 <property name="reorderable">True</property>
+                 <property name="enable_search">True</property>
+                 <property name="fixed_height_mode">False</property>
+                 <property name="hover_selection">False</property>
+                 <property name="hover_expand">False</property>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label87">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Keywords</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="type">label_item</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox34">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="label89">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Type:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">5</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkComboBox" id="combobox1">
+             <property agent="glademm" name="cxx_visibility">public</property>
+             <property name="visible">True</property>
+             <property name="add_tearoffs">False</property>
+             <property name="focus_on_click">True</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label90">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">_Value:</property>
+             <property name="use_underline">True</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_CENTER</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">5</property>
+             <property name="ypad">0</property>
+             <property name="mnemonic_widget">entry4</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="entry4">
+             <property agent="glademm" name="cxx_visibility">public</property>
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="editable">True</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char">*</property>
+             <property name="activates_default">False</property>
+             <accelerator key="Return" modifiers="0" signal="activate"/>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="button7">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label">gtk-add</property>
+             <property name="use_stock">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="focus_on_click">True</property>
+             <signal name="clicked" 
handler="on_namespacemetaDataDialogMetaDataAddButton_clicked" 
last_modification_time="Thu, 02 Jun 2005 23:54:34 GMT"/>
+           </widget>
+           <packing>
+             <property name="padding">5</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkFrame" id="frame17">
+         <property name="visible">True</property>
+         <property name="label_xalign">0</property>
+         <property name="label_yalign">0.5</property>
+         <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+         <child>
+           <widget class="GtkScrolledWindow" id="scrolledwindow25">
+             <property name="visible">True</property>
+             <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+             <property name="shadow_type">GTK_SHADOW_IN</property>
+             <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+             <child>
+               <widget class="GtkTreeView" id="treeview4">
+                 <property agent="glademm" 
name="cxx_visibility">public</property>
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="headers_visible">True</property>
+                 <property name="rules_hint">True</property>
+                 <property name="reorderable">True</property>
+                 <property name="enable_search">True</property>
+                 <property name="fixed_height_mode">False</property>
+                 <property name="hover_selection">False</property>
+                 <property name="hover_expand">False</property>
+               </widget>
+             </child>
+           </widget>
+         </child>
+
+         <child>
+           <widget class="GtkLabel" id="label91">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Meta-data</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_LEFT</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+             <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+             <property name="width_chars">-1</property>
+             <property name="single_line_mode">False</property>
+             <property name="angle">0</property>
+           </widget>
+           <packing>
+             <property name="type">label_item</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
 </glade-interface>

Modified: gnunet-gtk/src/daemon.c
===================================================================
--- gnunet-gtk/src/daemon.c     2005-06-02 19:17:03 UTC (rev 845)
+++ gnunet-gtk/src/daemon.c     2005-06-03 12:28:18 UTC (rev 846)
@@ -194,6 +194,11 @@
  */
 void on_startDaemon_clicked(GtkWidget * widget,
                            gpointer data) {
+  GtkWidget * launchEntry = NULL;
+  launchEntry
+    = glade_xml_get_widget(mainXML,
+                          "startDaemon");
+  gtk_widget_set_sensitive(launchEntry, FALSE);
   if (OK == checkDaemonRunning() ) {
     cronCheckDaemon(NULL);
     return;
@@ -208,6 +213,12 @@
  */
 void on_stopDaemon_clicked(GtkWidget * widget,
                           gpointer data) {
+  GtkWidget * killEntry = NULL;
+  killEntry
+    = glade_xml_get_widget(mainXML,
+                          "stopDaemon");
+  gtk_widget_set_sensitive(killEntry, FALSE);
+  
   if (OK == checkDaemonRunning() ) {
     GNUNET_TCP_SOCKET * sock;
     CS_HEADER csHdr;

Modified: gnunet-gtk/src/download.c
===================================================================
--- gnunet-gtk/src/download.c   2005-06-02 19:17:03 UTC (rev 845)
+++ gnunet-gtk/src/download.c   2005-06-03 12:28:18 UTC (rev 846)
@@ -174,7 +174,10 @@
                       4, &u,
                       -1);
     if (ECRS_equalsUri(u, uri)) {
-      val = completed * 100 / total;
+      if (total != 0)
+       val = completed * 100 / total;
+      else
+       val = 100;
       gtk_tree_store_set(GTK_TREE_STORE(summary),
                         &iter,
                         2, val,
@@ -214,7 +217,10 @@
   int progress;
   char * uriname;
 
-  progress = bytesCompleted * 100 / filesize;
+  if (filesize != 0)
+    progress = bytesCompleted * 100 / filesize;
+  else
+    progress = 100;
   uriname = ECRS_uriToString(uri);
   gtk_tree_store_insert(summary,
                        &iiter,

Modified: gnunet-gtk/src/fs.c
===================================================================
--- gnunet-gtk/src/fs.c 2005-06-02 19:17:03 UTC (rev 845)
+++ gnunet-gtk/src/fs.c 2005-06-03 12:28:18 UTC (rev 846)
@@ -61,15 +61,25 @@
        if directory, also update search view! */
     break;
   case download_error:
+    BREAK();
     LOG(LOG_ERROR,
        _("Error while downloading: %s\n"),
        event->data.message);
     break;
   case upload_progress:
-    BREAK();
+    displayUploadUpdate(event->data.UploadProgress.main_filename,
+                       event->data.UploadProgress.filename,
+                       event->data.UploadProgress.completed,
+                       event->data.UploadProgress.total);
+    displayUploadUpdate(event->data.UploadProgress.main_filename,
+                       event->data.UploadProgress.main_filename,
+                       event->data.UploadProgress.main_completed,
+                       event->data.UploadProgress.main_total);
     break;
   case upload_complete:
-    BREAK();
+    displayUploadComplete(event->data.UploadComplete.main_filename,
+                         event->data.UploadComplete.filename,
+                         event->data.UploadComplete.uri);
     break;
   case upload_error:
     LOG(LOG_ERROR,
@@ -85,6 +95,7 @@
        _("Disconnected from gnunetd.\n"));
     break;
   default:
+    BREAK();
     LOG(LOG_ERROR,
        _("Unhandled (unknown) FSUI event: %u.\n"),
        event->type);
@@ -105,7 +116,6 @@
 }
 
 void gtk_fs_init() {
-  /* FSUI initialization here! */
   ctx = FSUI_start("gnunet-gtk",
                   YES,
                   &eventProcessor,

Modified: gnunet-gtk/src/upload.c
===================================================================
--- gnunet-gtk/src/upload.c     2005-06-02 19:17:03 UTC (rev 845)
+++ gnunet-gtk/src/upload.c     2005-06-03 12:28:18 UTC (rev 846)
@@ -32,6 +32,12 @@
 
 static GtkTreeStore * summary;
 
+/**
+ * XML tree for the meta-data dialog of upload.
+ * (there can only be one at a time; 
+ * maybe NULL at times where there is no dialog)
+ */
+static GladeXML * metaXML;
 
 /**
  */
@@ -39,6 +45,94 @@
                         const char * filename,
                         unsigned long long completed,
                         unsigned long long total) {
+  GtkTreeIter iter;
+  GtkTreeIter child;
+  int progress;
+  char * name;
+
+  if (total != 0)
+    progress = 100 * completed / total;
+  else
+    progress = 100;
+
+  if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
+                                   &iter)) {
+    do {       
+      gtk_tree_model_get(GTK_TREE_MODEL(summary),
+                        &iter,
+                        0, &name,
+                        -1);
+      if (0 == strcmp(name, filename)) {
+       gtk_tree_store_set(GTK_TREE_STORE(summary),
+                          &iter,
+                          1, progress,
+                          -1);
+       return;     
+      }
+      if (0 == strcmp(name, mainName)) {
+       if (gtk_tree_model_iter_children(GTK_TREE_MODEL(summary),
+                                        &child,
+                                        &iter)) {
+         do {  
+           gtk_tree_model_get(GTK_TREE_MODEL(summary),
+                              &child,
+                              0, &name,
+                              -1);
+           if (0 == strcmp(name, filename)) {
+             gtk_tree_store_set(GTK_TREE_STORE(summary),
+                                &child,
+                                1, progress,
+                                -1);
+             return;
+           }
+         } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
+                                           &child));     
+       }
+       gtk_tree_store_append(GTK_TREE_STORE(summary),
+                             &child,
+                             &iter);
+       gtk_tree_store_set(GTK_TREE_STORE(summary),
+                          &child,
+                          0, filename,
+                          1, progress,
+                          2, NULL,
+                          -1);
+       return;
+      }    
+    } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
+                                     &iter));
+  }
+  if (0 != strcmp(mainName,
+                 filename)) {
+    gtk_tree_store_append(GTK_TREE_STORE(summary),
+                         &iter,
+                         NULL);
+    gtk_tree_store_set(GTK_TREE_STORE(summary),
+                      &iter,
+                      0, mainName,
+                      1, 0,
+                      2, NULL,
+                      -1);
+    gtk_tree_store_append(GTK_TREE_STORE(summary),
+                         &child,
+                         &iter);
+    gtk_tree_store_set(GTK_TREE_STORE(summary),
+                      &iter,
+                      0, filename,
+                      1, progress,
+                      2, NULL,
+                      -1);
+  } else {
+    gtk_tree_store_append(GTK_TREE_STORE(summary),
+                         &iter,
+                         NULL);
+    gtk_tree_store_set(GTK_TREE_STORE(summary),
+                      &iter,
+                      0, filename,
+                      1, progress,
+                      2, NULL,
+                      -1);
+  }
 }
 
 /**
@@ -46,6 +140,97 @@
 void displayUploadComplete(const char * mainName,
                           const char * filename,
                           const struct ECRS_URI * uri) {
+  GtkTreeIter iter;
+  GtkTreeIter child;
+  char * name;
+  char * us;
+
+  us = ECRS_uriToString(uri);
+
+  if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(summary),
+                                   &iter)) {
+    do {       
+      gtk_tree_model_get(GTK_TREE_MODEL(summary),
+                        &iter,
+                        0, &name,
+                        -1);
+      if (0 == strcmp(name, filename)) {
+       gtk_tree_store_set(GTK_TREE_STORE(summary),
+                          &iter,
+                          1, 100,
+                          2, us,
+                          -1);
+       FREE(us);
+       return;     
+      }
+      if (0 == strcmp(name, mainName)) {
+       if (gtk_tree_model_iter_children(GTK_TREE_MODEL(summary),
+                                        &child,
+                                        &iter)) {
+         do {  
+           gtk_tree_model_get(GTK_TREE_MODEL(summary),
+                              &child,
+                              0, &name,
+                              -1);
+           if (0 == strcmp(name, filename)) {
+             gtk_tree_store_set(GTK_TREE_STORE(summary),
+                                &child,
+                                1, 100,
+                                2, us,
+                                -1);
+             FREE(us);
+             return;
+           }
+         } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
+                                           &child));     
+       }
+       gtk_tree_store_append(GTK_TREE_STORE(summary),
+                             &child,
+                             &iter);
+       gtk_tree_store_set(GTK_TREE_STORE(summary),
+                          &child,
+                          0, filename,
+                          1, 100,
+                          2, us,
+                          -1);
+       FREE(us);
+       return;
+      }    
+    } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(summary),
+                                     &iter));
+  }
+  if (0 != strcmp(mainName,
+                 filename)) {
+    gtk_tree_store_append(GTK_TREE_STORE(summary),
+                         &iter,
+                         NULL);
+    gtk_tree_store_set(GTK_TREE_STORE(summary),
+                      &iter,
+                      0, mainName,
+                      1, 0,
+                      2, NULL,
+                      -1);
+    gtk_tree_store_append(GTK_TREE_STORE(summary),
+                         &child,
+                         &iter);
+    gtk_tree_store_set(GTK_TREE_STORE(summary),
+                      &iter,
+                      0, filename,
+                      1, 100,
+                      2, NULL,
+                      -1);
+  } else {
+    gtk_tree_store_append(GTK_TREE_STORE(summary),
+                         &iter,
+                         NULL);
+    gtk_tree_store_set(GTK_TREE_STORE(summary),
+                      &iter,
+                      0, filename,
+                      1, 100,
+                      2, us,
+                      -1);
+  }
+  FREE(us);
 }
 
 
@@ -80,26 +265,120 @@
   return OK;
 }
 
-void on_fsinsertuploadbutton_clicked(GtkWidget * uploadButton,
-                                    gpointer dummy) {
+void on_selectAlternativePreviewButton_selection_changed(GtkWidget * preview,
+                                                        GtkWidget * 
fileChooser) {
+  char * fn;
+
+  fn = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fileChooser));
+  if (fn == NULL) {
+    gtk_image_set_from_pixbuf(GTK_IMAGE(preview),
+                             NULL);
+  } else {
+    gtk_image_set_from_file(GTK_IMAGE(preview),
+                           fn);
+    free(fn);
+  }
+}
+
+void on_metaDataDialogKeywordAddButton_clicked(gpointer dummy,
+                                              GtkWidget * uploadButton) {
+  GtkWidget * keywordList;
+  GtkWidget * entryLine;
+  const char * keyword;
+  GtkListStore * keymodel;
+  GtkTreeIter iter;
+  
+  keywordList = glade_xml_get_widget(metaXML,
+                                    "metaDataDialogKeywordList");
+  keymodel
+    = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(keywordList)));
+
+  entryLine = glade_xml_get_widget(metaXML,
+                                  "fileInformationKeywordEntry"); 
+  keyword = gtk_entry_get_text(GTK_ENTRY(entryLine));
+  gtk_list_store_append(keymodel,
+                       &iter);
+  gtk_list_store_set(keymodel,
+                    &iter,
+                    0, keyword,
+                    -1); 
+  gtk_entry_set_text(GTK_ENTRY(entryLine), "");
+}
+
+void on_metaDataDialogMetaDataAddButton_clicked(gpointer dummy,
+                                              GtkWidget * uploadButton) {
+  GtkWidget * metaList;
+  GtkWidget * entryLine;
+  GtkWidget * typeCB;
+  const char * value;
+  EXTRACTOR_KeywordType type;
+  GtkListStore * metamodel;
+  GtkListStore * typemodel;
+  GtkTreeIter iter;
+  char * stype;
+  
+  metaList = glade_xml_get_widget(metaXML,
+                                 "metaDataDialogMetaDataList");
+  metamodel
+    = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(metaList)));
+
+  entryLine = glade_xml_get_widget(metaXML,
+                                  "metaDataDialogValueEntry"); 
+  value = gtk_entry_get_text(GTK_ENTRY(entryLine));
+  typeCB = glade_xml_get_widget(metaXML,
+                               "metaDataDialogMetaTypeComboBox"); 
+  typemodel
+    = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(typeCB)));
+  if (! gtk_combo_box_get_active_iter(GTK_COMBO_BOX(typeCB),
+                                     &iter))
+    return; /* oops */
+  gtk_tree_model_get(GTK_TREE_MODEL(typemodel),
+                    &iter,
+                    0, &stype,
+                    1, &type,
+                    -1);  
+  gtk_list_store_append(metamodel,
+                       &iter);
+  gtk_list_store_set(metamodel,
+                    &iter,
+                    0, type,
+                    1, stype,
+                    2, value,
+                    -1); 
+  gtk_entry_set_text(GTK_ENTRY(entryLine), "");
+}
+
+void on_fsinsertuploadbutton_clicked(gpointer dummy,
+                                    GtkWidget * uploadButton) {
   const char * filename;
-  GladeXML * metaXML;
   GtkWidget * uploadLine;
   GtkWidget * metaList;
   GtkWidget * keywordList;
   GtkWidget * entry;
   GtkWidget * dialog;
+  GtkWidget * preview;
   GtkWidget * metaType;
-  GtkCellRenderer * renderer;
+  GtkWidget * recBut;
+  GtkWidget * idxBut;
   GtkListStore * metamodel;
   GtkListStore * keymodel;
+  GtkCellRenderer * renderer;
   GtkListStore * keywordTypeModel;
+  GtkTreeIter iter;
   struct ECRS_MetaData * meta;
   EXTRACTOR_ExtractorList * extractors;
   EXTRACTOR_KeywordType type;
   char * config;
   struct ECRS_URI * keywordURI;
   const char * stype;
+  GdkPixbuf * pixbuf;
+  GdkPixbufLoader * loader;
+  unsigned char * thumb;
+  size_t ts;
+  char * mvalue;
+  char ** keywords;
+  unsigned int pos;
+  unsigned int ksize;
 
   extractors = EXTRACTOR_loadDefaultLibraries();
   config = getConfigurationString("FS",
@@ -181,8 +460,6 @@
   gtk_combo_box_set_model(GTK_COMBO_BOX(metaType),
                          GTK_TREE_MODEL(keywordTypeModel));
   for (type=0;type<EXTRACTOR_getHighestKeywordTypeNumber();type++) {   
-    GtkTreeIter iter;
-
     stype = EXTRACTOR_getKeywordTypeAsString(type);    
     gtk_list_store_append(keywordTypeModel,
                          &iter);
@@ -201,13 +478,109 @@
                                "text", 0);
   gtk_combo_box_set_active(GTK_COMBO_BOX(metaType),
                           0);
-  gtk_widget_show(dialog);
+  gtk_dialog_set_default_response(GTK_DIALOG(dialog),
+                                 GTK_RESPONSE_OK);
+  thumb = NULL;
+  ts = ECRS_getThumbnailFromMetaData(meta,
+                                    &thumb);
   ECRS_freeMetaData(meta);
   ECRS_freeUri(keywordURI);
+  if (ts != 0) {
+    preview = glade_xml_get_widget(metaXML,
+                                  "previewImage");
+    loader = gdk_pixbuf_loader_new();
+    gdk_pixbuf_loader_write(loader,
+                           (const guchar*) thumb,
+                           ts,
+                           NULL);    
+    pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
+    gdk_pixbuf_loader_close(loader,
+                           NULL);    
+    gtk_image_set_from_pixbuf(GTK_IMAGE(preview),
+                             pixbuf);
+  }
   if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) {
+    int doIndex;
+    int doRec;
+    
+    recBut = glade_xml_get_widget(mainXML,
+                                 "scopeRecursiveButton");
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recBut)))
+      doRec = YES;
+    idxBut = glade_xml_get_widget(mainXML,
+                                 "indexbutton");
+    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(idxBut)))
+      doIndex = YES;
 
+    meta = ECRS_createMetaData();
+    if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(metamodel),
+                                     &iter)) {
+      do {     
+       gtk_tree_model_get(GTK_TREE_MODEL(metamodel),
+                          &iter,
+                          0, &type,
+                          2, &mvalue,
+                          -1);
+       ECRS_addToMetaData(meta,
+                          type,
+                          mvalue);
+      } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(metamodel),
+                                       &iter));
+    }
+    /* FIXME: also add preview to meta! */
+    keywords = NULL;
+    ksize = 0;
+    GROW(keywords,
+        ksize,
+        64);
+    if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(keymodel),
+                                     &iter)) {
+      do {     
+       gtk_tree_model_get(GTK_TREE_MODEL(keymodel),
+                          &iter,
+                          0, &mvalue,
+                          -1);
+       keywords[pos++] = mvalue;
+       if (pos == ksize)
+         GROW(keywords,
+              ksize,
+              pos*2);
+      } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(keymodel),
+                                       &iter));
+    }
+    keywords[pos] = NULL;
+
+    keywordURI = ECRS_keywordsToUri((const char**)keywords);    
+    while (pos > 0) 
+      FREE(keywords[--pos]);
+    GROW(keywords,
+        ksize,
+        0);
+
+    if (doRec) {
+      FSUI_uploadAll(ctx,
+                    filename,
+                    getConfigurationInt("FS",
+                                        "ANONYMITY"), /* FIXME */
+                    doIndex,
+                    meta,
+                    keywordURI,
+                    keywordURI);
+    } else {
+      FSUI_upload(ctx,
+                 filename,
+                 getConfigurationInt("FS",
+                                     "ANONYMITY"), /* FIXME */
+                 doIndex,
+                 meta,
+                 keywordURI);
+    }
+    ECRS_freeMetaData(meta);
+    ECRS_freeUri(keywordURI);
   }
+  gtk_widget_destroy (dialog);
   UNREF(metaXML);
+  metaXML = NULL;
 }
 
 void on_mainFileSharingInsertBrowseButton_clicked(GtkWidget * browseButton,
@@ -216,6 +589,7 @@
   GladeXML * uploadXML;
   GtkWidget * uploadLine;
   GtkWidget * entry;
+  GtkWidget * recBut;
   GtkListStore * model;
   GtkTreeIter iter;
 
@@ -226,16 +600,19 @@
   glade_xml_signal_autoconnect(uploadXML);
   dialog = glade_xml_get_widget(uploadXML,
                                "uploadfilechooserdialog");
-  /* 
-     FIXME:
-  if(recursive) 
-     gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog),
-                             GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
-  */
+
+  recBut = glade_xml_get_widget(mainXML,
+                               "scopeRecursiveButton");
+
+  
+  if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(recBut)))
+    gtk_file_chooser_set_action(GTK_FILE_CHOOSER(dialog),
+                               GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+  
   if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) {
-    char *filename;
+    char * filename;
     
-    filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+    filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
     uploadLine = glade_xml_get_widget(mainXML,
                                      "uploadFilenameComboBoxEntry");
     entry = gtk_bin_get_child(GTK_BIN(uploadLine));
@@ -249,7 +626,7 @@
                       0,
                       filename,
                       -1);
-    g_free (filename);
+    g_free(filename);
   }
   gtk_widget_destroy (dialog);
   UNREF(uploadXML);
@@ -271,7 +648,8 @@
                       G_TYPE_STRING);  /* URI (as string) - after completion */
   gtk_tree_view_set_model(GTK_TREE_VIEW(uploadList),
                          GTK_TREE_MODEL(summary));
-  renderer = gtk_cell_renderer_progress_new();  
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(uploadList),
+  renderer = gtk_cell_renderer_progress_new();  
+  gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(uploadList),
                                              -1,
                                              _("Filename"),
                                              renderer,





reply via email to

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