gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r964 - gnunet-gtk/src


From: durner
Subject: [GNUnet-SVN] r964 - gnunet-gtk/src
Date: Mon, 20 Jun 2005 13:33:30 -0700 (PDT)

Author: durner
Date: 2005-06-20 13:33:26 -0700 (Mon, 20 Jun 2005)
New Revision: 964

Modified:
   gnunet-gtk/src/plibc.h
   gnunet-gtk/src/upload.c
Log:
Use native Windows dialog to choose file or directory

Modified: gnunet-gtk/src/plibc.h
===================================================================
--- gnunet-gtk/src/plibc.h      2005-06-20 17:10:44 UTC (rev 963)
+++ gnunet-gtk/src/plibc.h      2005-06-20 20:33:26 UTC (rev 964)
@@ -22,7 +22,7 @@
  * @brief PlibC header
  * @attention This file is usually not installed under Unix,
  *            so ship it with your application
- * @version $Revision: 1.17 $
+ * @version $Revision: 1.19 $
  */
 
 #ifndef _PLIBC_H_
@@ -68,48 +68,6 @@
 #define int32_t long
 
 /* Thanks to the Cygwin project */
-#define EPERM 1                /* Not super-user */
-#define ENOENT 2       /* No such file or directory */
-#define ESRCH 3                /* No such process */
-#define EINTR 4                /* Interrupted system call */
-#define EIO 5          /* I/O error */
-#define ENXIO 6                /* No such device or address */
-#define E2BIG 7                /* Arg list too long */
-#define ENOEXEC 8      /* Exec format error */
-#define EBADF 9                /* Bad file number */
-#define ECHILD 10      /* No children */
-#define EAGAIN 11      /* Resource unavailable or operation would block, try 
again */
-#define ENOMEM 12      /* Not enough memory */
-#define EACCES 13      /* Permission denied */
-#define EFAULT 14      /* Bad address */
-#define ENOTBLK 15     /* Block device required */
-#define EBUSY 16       /* Mount device busy */
-#define EEXIST 17      /* File exists */
-#define EXDEV 18       /* Cross-device link */
-#define ENODEV 19      /* No such device */
-#define ENOTDIR 20     /* Not a directory */
-#define EISDIR 21      /* Is a directory */
-#define EINVAL 22      /* Invalid argument */
-#define ENFILE 23      /* Too many open files in system */
-#define EMFILE 24      /* Too many open files */
-#define ENOTTY 25      /* Not a typewriter */
-#define ETXTBSY 26     /* Text file busy */
-#define EFBIG 27       /* File too large */
-#define ENOSPC 28      /* No space left on device */
-#define ESPIPE 29      /* Illegal seek */
-#define EROFS 30       /* Read only file system */
-#define EMLINK 31      /* Too many links */
-#define EPIPE 32       /* Broken pipe */
-#define EDOM 33                /* Math arg out of domain of func */
-#define ERANGE 34      /* Math result not representable */
-#define ENOMSG 35      /* No message of desired type */
-#define EIDRM 36       /* Identifier removed */
-#define ECHRNG 37      /* Channel number out of range */
-#define EL2NSYNC 38    /* Level 2 not synchronized */
-#define L3HLT 39       /* Level 3 halted */
-#define EL3RST 40      /* Level 3 reset */
-#define ELNRNG 41      /* Link number out of range */
-#define EUNATCH 42     /* Protocol driver not attached */
 #define ENOCSI 43      /* No CSI structure available */
 #define EL2HLT 44      /* Level 2 halted */
 #ifndef  EDEADLK
@@ -125,7 +83,7 @@
 #define EBADRQC 54     /* Invalid request code */
 #define EBADSLT 55     /* Invalid slot */
 #ifndef  EDEADLOCK
-       #define EDEADLOCK 56    /* File locking deadlock error */
+       #define EDEADLOCK EDEADLK       /* File locking deadlock error */
 #endif
 #define EBFONT 57      /* Bad font file fmt */
 #define ENOSTR 60      /* Device not a stream */
@@ -319,6 +277,7 @@
 
 BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest);
 BOOL _plibc_DereferenceShortcut(char *pszShortcut);
+char *plibc_ChooseDir(char *pszTitle, unsigned long ulFlags);
 long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey,
               char *pszBuffer, long *pdLength);
 

Modified: gnunet-gtk/src/upload.c
===================================================================
--- gnunet-gtk/src/upload.c     2005-06-20 17:10:44 UTC (rev 963)
+++ gnunet-gtk/src/upload.c     2005-06-20 20:33:26 UTC (rev 964)
@@ -30,7 +30,13 @@
 #include "main.h"
 #include <extractor.h>
 
+#ifdef MINGW
+       #ifndef BIF_NONEWFOLDERBUTTON
+               #define BIF_NONEWFOLDERBUTTON 0x200
+       #endif
+#endif
 
+
 static GtkTreeStore * summary;
 
 /**
@@ -663,15 +669,12 @@
   metaXML = NULL;
 }
 
-void on_mainFileSharingInsertBrowseButton_clicked(GtkWidget * browseButton,
-                                                 gpointer dummy) {
+char *selectFile() {
+#ifndef MINGW
   GtkWidget *dialog;
   GladeXML * uploadXML;
-  GtkWidget * uploadLine;
-  GtkWidget * entry;
   GtkWidget * recBut;
-  GtkListStore * model;
-  GtkTreeIter iter;
+  char *ret;
 
   uploadXML
     = glade_xml_new(gladeFile,
@@ -683,7 +686,6 @@
 
   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),
@@ -693,6 +695,29 @@
     char * filename;
     
     filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+               ret = strdup(filename);
+    g_free(filename);
+  }
+  else
+       ret = NULL;
+
+  gtk_widget_destroy (dialog);
+  UNREF(uploadXML);
+#else /* MINGW */
+       return plibc_ChooseDir(_("Choose the file or directory you want to 
publish."),
+               BIF_BROWSEINCLUDEFILES | BIF_USENEWUI | BIF_SHAREABLE | 
BIF_NONEWFOLDERBUTTON);
+#endif /* MINGW */
+}
+
+void on_mainFileSharingInsertBrowseButton_clicked(GtkWidget * browseButton,
+                                                 gpointer dummy) {
+       char *filename;
+  GtkWidget * uploadLine;
+  GtkWidget * entry;
+  GtkListStore * model;
+  GtkTreeIter iter;
+  
+  if ((filename = selectFile())) {
     uploadLine = glade_xml_get_widget(mainXML,
                                      "uploadFilenameComboBoxEntry");
     entry = gtk_bin_get_child(GTK_BIN(uploadLine));
@@ -706,10 +731,8 @@
                       0,
                       filename,
                       -1);
-    g_free(filename);
+    free(filename);
   }
-  gtk_widget_destroy (dialog);
-  UNREF(uploadXML);
 }
 
 





reply via email to

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