Use GTK+ file dialogs on Windows too, the Win32 dialogs are too buggy

This commit is contained in:
Berke Viktor 2012-07-18 20:16:35 +02:00
parent b63a4ced19
commit cb2f9f3e7b
4 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,4 @@
#if 0 /* native file dialogs */
#include <fcntl.h> #include <fcntl.h>
#include "thread.h" #include "thread.h"
@ -31,3 +32,4 @@ thread_start (thread *th, void *(*start_routine)(void *), void *arg)
return 1; return 1;
} }
#endif

View File

@ -1,3 +1,4 @@
#if 0 /* native file dialogs */
#include <windows.h> #include <windows.h>
typedef struct typedef struct
@ -8,3 +9,4 @@ typedef struct
thread *thread_new (void); thread *thread_new (void);
int thread_start (thread *th, void *(*start_routine)(void *), void *arg); int thread_start (thread *th, void *(*start_routine)(void *), void *arg);
#endif

View File

@ -53,8 +53,10 @@
#include "pixmaps.h" #include "pixmaps.h"
#ifdef WIN32 #ifdef WIN32
#if 0 /* native file dialogs */
#include "../common/fe.h" #include "../common/fe.h"
#include "../common/thread.h" #include "../common/thread.h"
#endif
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
@ -71,12 +73,14 @@ struct file_req
filereqcallback callback; filereqcallback callback;
int flags; /* FRF_* flags */ int flags; /* FRF_* flags */
#if 0 /* native file dialogs */
#ifdef WIN32 #ifdef WIN32
int multiple; int multiple;
thread *th; thread *th;
char *title; /* native locale */ char *title; /* native locale */
char *filter; char *filter;
#endif #endif
#endif
}; };
static char last_dir[256] = ""; static char last_dir[256] = "";
@ -178,6 +182,7 @@ gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
} }
} }
#if 0 /* native file dialogs */
#ifdef WIN32 #ifdef WIN32
static int static int
win32_openfile (char *file_buf, int file_buf_len, char *title_text, char *filter, win32_openfile (char *file_buf, int file_buf_len, char *title_text, char *filter,
@ -361,6 +366,7 @@ win32_read_thread (GIOChannel *source, GIOCondition cond, struct file_req *freq)
return FALSE; return FALSE;
} }
#endif #endif
#endif /* native file dialogs */
void void
gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter,
@ -370,6 +376,7 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
GtkWidget *dialog; GtkWidget *dialog;
extern char *get_xdir_fs (void); extern char *get_xdir_fs (void);
#if 0 /* native file dialogs */
#ifdef WIN32 #ifdef WIN32
if (!(flags & FRF_WRITE)) if (!(flags & FRF_WRITE))
{ {
@ -420,6 +427,7 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
return; return;
} }
#endif
#endif #endif
if (flags & FRF_WRITE) if (flags & FRF_WRITE)

View File

@ -147,12 +147,14 @@ void
plugingui_load (void) plugingui_load (void)
{ {
gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess, gtkutil_file_req (_("Select a Plugin or Script to load"), plugingui_load_cb, current_sess,
#if 0 /* native file dialogs */
#ifdef WIN32 #ifdef WIN32
"Plugins and Scripts\0*.dll;*.lua;*.pl;*.py;*.tcl\0" "Plugins and Scripts\0*.dll;*.lua;*.pl;*.py;*.tcl\0"
"All files\0*.*\0\0", 0); "All files\0*.*\0\0", 0);
#else #else
NULL, FRF_ADDFOLDER);
#endif #endif
#endif /* native file dialogs */
NULL, FRF_ADDFOLDER);
} }
static void static void