gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r2707 - in gnunet-gtk: . src/plugins/fs
Date: Mon, 1 May 2006 21:33:42 -0700 (PDT)

Author: grothoff
Date: 2006-05-01 21:33:39 -0700 (Mon, 01 May 2006)
New Revision: 2707

Modified:
   gnunet-gtk/gnunet-gtk.glade
   gnunet-gtk/src/plugins/fs/download.c
Log:
fixing Mantis 1043

Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2006-05-02 03:45:35 UTC (rev 2706)
+++ gnunet-gtk/gnunet-gtk.glade 2006-05-02 04:33:39 UTC (rev 2707)
@@ -793,6 +793,189 @@
                                  <property 
name="pack_type">GTK_PACK_END</property>
                                </packing>
                              </child>
+
+                             <child>
+                               <widget class="GtkLabel" 
id="fs_status_URI_label">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="label" 
translatable="yes">_Enter URI:</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">True</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">statusDownloadURIEntry</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="statusDownloadURIEntry">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property name="has_focus">True</property>
+                                 <property name="editable">True</property>
+                                 <property name="visibility">True</property>
+                                 <property name="max_length">0</property>
+                                 <property 
name="text">gnunet://ecrs/</property>
+                                 <property name="has_frame">True</property>
+                                 <property name="invisible_char">*</property>
+                                 <property 
name="activates_default">True</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">True</property>
+                                 <property name="fill">True</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkButton" 
id="fs_status_download_button">
+                                 <property name="visible">True</property>
+                                 <property name="can_focus">True</property>
+                                 <property 
name="relief">GTK_RELIEF_NORMAL</property>
+                                 <property 
name="focus_on_click">True</property>
+                                 <signal name="clicked" 
handler="on_statusDownloadURIEntry_editing_done" 
object="statusDownloadURIEntry" last_modification_time="Tue, 02 May 2006 
05:03:46 GMT"/>
+
+                                 <child>
+                                   <widget class="GtkAlignment" 
id="alignment19">
+                                     <property name="visible">True</property>
+                                     <property name="xalign">0.5</property>
+                                     <property name="yalign">0.5</property>
+                                     <property name="xscale">0</property>
+                                     <property name="yscale">0</property>
+                                     <property name="top_padding">0</property>
+                                     <property 
name="bottom_padding">0</property>
+                                     <property name="left_padding">0</property>
+                                     <property 
name="right_padding">0</property>
+
+                                     <child>
+                                       <widget class="GtkHBox" id="hbox54">
+                                         <property 
name="visible">True</property>
+                                         <property 
name="homogeneous">False</property>
+                                         <property name="spacing">2</property>
+
+                                         <child>
+                                           <widget class="GtkImage" 
id="image41">
+                                             <property 
name="visible">True</property>
+                                             <property 
name="stock">gtk-go-down</property>
+                                             <property 
name="icon_size">4</property>
+                                             <property 
name="xalign">0.5</property>
+                                             <property 
name="yalign">0.5</property>
+                                             <property name="xpad">0</property>
+                                             <property name="ypad">0</property>
+                                           </widget>
+                                           <packing>
+                                             <property 
name="padding">0</property>
+                                             <property 
name="expand">False</property>
+                                             <property 
name="fill">False</property>
+                                           </packing>
+                                         </child>
+
+                                         <child>
+                                           <widget class="GtkLabel" 
id="label135">
+                                             <property 
name="visible">True</property>
+                                             <property name="label" 
translatable="yes">D_ownload</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">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>
+                                       </widget>
+                                     </child>
+                                   </widget>
+                                 </child>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkLabel" id="label136">
+                                 <property name="visible">True</property>
+                                 <property name="label" 
translatable="yes">with _anonymity</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">3</property>
+                                 <property name="ypad">0</property>
+                                 <property 
name="mnemonic_widget">fsstatusAnonymitySpin</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="fsstatusAnonymitySpin">
+                                 <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 1 999999 1 10 
10</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
+
+                             <child>
+                               <widget class="GtkVSeparator" id="vseparator2">
+                                 <property name="width_request">41</property>
+                                 <property name="visible">True</property>
+                               </widget>
+                               <packing>
+                                 <property name="padding">0</property>
+                                 <property name="expand">False</property>
+                                 <property name="fill">False</property>
+                               </packing>
+                             </child>
                            </widget>
                            <packing>
                              <property name="padding">5</property>
@@ -1348,7 +1531,7 @@
                  <child>
                    <widget class="GtkLabel" id="downloadfstab">
                      <property name="visible">True</property>
-                     <property name="label" 
translatable="yes">_Download</property>
+                     <property name="label" translatable="yes">Search and 
_Download</property>
                      <property name="use_underline">True</property>
                      <property name="use_markup">False</property>
                      <property name="justify">GTK_JUSTIFY_CENTER</property>

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2006-05-02 03:45:35 UTC (rev 
2706)
+++ gnunet-gtk/src/plugins/fs/download.c        2006-05-02 04:33:39 UTC (rev 
2707)
@@ -166,7 +166,6 @@
     }
   }
 
-
   uri_name = ECRS_uriToString(uri);
   if ( (uri_name == NULL) ||
        (strlen(uri_name) <
@@ -350,6 +349,94 @@
 }
 
 
+void on_statusDownloadURIEntry_editing_done(GtkWidget * entry,
+                                           GtkWidget * downloadButton) {
+  const char * uris;
+  struct ECRS_URI * uri;
+  unsigned int anon;
+  GtkWidget * spin;
+  char * tmp;
+  char * final_download_dir;
+  const char * dname;
+  DownloadList * list;
+  GtkTreeIter iiter;
+ 
+  uris = gtk_entry_get_text(GTK_ENTRY(entry));
+  uris = STRDUP(uris);
+  gtk_entry_set_text(GTK_ENTRY(entry),
+                    ECRS_URI_PREFIX);
+  uri = ECRS_stringToUri(uris);
+  if (uri == NULL) {
+    addLogEntry(_("Invalid URI `%s'"), uris);
+    return;
+  }
+  if (ECRS_isKeywordUri(uri)) {
+    addLogEntry(_("Please use the search function for keyword (KSK) URIs!"));
+    FREE(uris);
+    return;
+  } else if (ECRS_isLocationUri(uri)) {
+    addLogEntry(_("Location URIs are not yet supported"));
+    FREE(uris);
+    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);
+  FREE(final_download_dir);
+  if (tmp[strlen(tmp)] != DIR_SEPARATOR)
+    strcat(tmp, DIR_SEPARATOR_STR);
+  strcat(tmp, 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);
+  head = list;
+  gtk_tree_store_insert(summary,
+                        &iiter,
+                        NULL,
+                        0);
+  gtk_tree_store_set(summary,
+                     &iiter,
+                     DOWNLOAD_FILENAME, tmp,
+                     DOWNLOAD_SHORTNAME, uris,
+                     DOWNLOAD_SIZE, ECRS_fileSize(uri),
+                     DOWNLOAD_PROGRESS, 0, /* progress */
+                     DOWNLOAD_URISTRING, uris,
+                     DOWNLOAD_URI, ECRS_dupUri(uri),
+                     DOWNLOAD_TREEPATH, NULL, /* internal: row reference! */
+                     DOWNLOAD_DIRPATH, "",                     
+                     -1);
+
+  /* get anonymity level */
+  spin = glade_xml_get_widget(getMainXML(),
+                             "fsstatusAnonymitySpin");
+  if (spin == NULL) {
+    BREAK();
+    anon = 1;
+  } else {
+    anon = gtk_spin_button_get_value_as_int
+      (GTK_SPIN_BUTTON(spin));
+  }
+  addLogEntry(_("Downloading `%s'"), uris);
+  FSUI_startDownload(ctx,
+                     anon,
+                     uri,
+                     tmp);
+  FREE(uris);
+}
+
+
 /**
  */
 void displayDownloadUpdate(const struct ECRS_URI * uri,





reply via email to

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