40 |
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h" |
#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h" |
41 |
#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h" |
#include "gnu_java_awt_peer_gtk_GtkFileDialogPeer.h" |
42 |
|
|
43 |
|
#define AWT_FILEDIALOG_LOAD 0 |
44 |
|
#define AWT_FILEDIALOG_SAVE 1 |
45 |
|
|
46 |
static void handle_response_cb (GtkDialog *dialog, |
static void handle_response_cb (GtkDialog *dialog, |
47 |
gint responseId, |
gint responseId, |
48 |
jobject peer_obj); |
jobject peer_obj); |
90 |
|
|
91 |
JNIEXPORT void JNICALL |
JNIEXPORT void JNICALL |
92 |
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create |
Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_create |
93 |
(JNIEnv *env, jobject obj, jobject parent) |
(JNIEnv *env, jobject obj, jobject parent, int mode) |
94 |
{ |
{ |
95 |
void *parentp; |
void *parentp; |
96 |
gpointer widget; |
gpointer widget; |
102 |
|
|
103 |
parentp = NSA_GET_PTR(env, parent); |
parentp = NSA_GET_PTR(env, parent); |
104 |
|
|
105 |
/* FIXME: we should be using the default gnome-vfs backend but it is |
if (mode == AWT_FILEDIALOG_LOAD) |
106 |
not currently thread-safe. See: |
widget = gtk_file_chooser_dialog_new |
107 |
http://bugzilla.gnome.org/show_bug.cgi?id=166852 */ |
("Open File", |
108 |
widget = gtk_file_chooser_dialog_new_with_backend |
GTK_WINDOW(parentp), |
109 |
("Open File", |
GTK_FILE_CHOOSER_ACTION_OPEN, |
110 |
GTK_WINDOW(parentp), |
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
111 |
GTK_FILE_CHOOSER_ACTION_OPEN, |
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, |
112 |
"gtk+", |
NULL); |
113 |
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
else |
114 |
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, |
{ |
115 |
NULL); |
widget = gtk_file_chooser_dialog_new |
116 |
|
("Save File", |
117 |
|
GTK_WINDOW(parentp), |
118 |
|
GTK_FILE_CHOOSER_ACTION_SAVE, |
119 |
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
120 |
|
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, |
121 |
|
NULL); |
122 |
|
gtk_file_chooser_set_do_overwrite_confirmation |
123 |
|
(GTK_FILE_CHOOSER (widget), TRUE); |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
/* GtkFileSelect is not modal by default */ |
/* GtkFileChooserDialog is not modal by default */ |
128 |
gtk_window_set_modal (GTK_WINDOW (widget), TRUE); |
gtk_window_set_modal (GTK_WINDOW (widget), TRUE); |
129 |
|
|
130 |
/* We must add this window to the group so input in the others are |
/* We must add this window to the group so input in the others are |