GtkFileDialogPeer.java (nativeSetFile): New name for the former setFile native method.
* gnu/java/awt/peer/gtk/GtkFileDialogPeer.java (nativeSetFile): New name for the former setFile native method. (setFile): New method. (setDirectory): Implemented. (connectSignals): New native method. (setFilenameFilter): Improve comment. (getGraphics): Comment. (gtkHideFileDialog): New method. (gtkDisposeFileDialog): New method. (gtkSetFilename): New method. * java/awt/Dialog.java (show): Block on modal dialogs, but only for FileDialog for now. (hide): New method. (dispose): New method. * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c (Java_gnu_java_awt_peer_gtk_GtkFileDialog_create): Replace deprecated creation functions. Make dialog modal. Add it to the window group. (Java_gnu_java_awt_peer_gtk_GtkFileDialog_connectSignals): New function. (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_gtkFileSelectionSetFilename): Rename to... (Java_gnu_java_awt_peer_gtk_GtkFileDialogPeer_nativeSetFile): New name. (window_closed): New function. (ok_clicked): New function. (cancel_clicked): New function. From-SVN: r75557
This commit is contained in:
parent
d779bc04df
commit
06fe3d7df2
4 changed files with 386 additions and 13 deletions
|
@ -78,10 +78,15 @@ private boolean resizable = true;
|
|||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* This field indicates whether the dialog is undecorated or not.
|
||||
*/
|
||||
private boolean undecorated = false;
|
||||
/**
|
||||
* This field indicates whether the dialog is undecorated or not.
|
||||
*/
|
||||
private boolean undecorated = false;
|
||||
|
||||
/**
|
||||
* Indicates that we are blocked for modality in show
|
||||
*/
|
||||
private boolean blocked = false;
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
|
@ -380,11 +385,78 @@ addNotify()
|
|||
|
||||
/**
|
||||
* Makes this dialog visible and brings it to the front.
|
||||
* If the dialog is modal and is not already visible, this call will not
|
||||
* return until the dialog is hidden by someone calling hide or dispose.
|
||||
* If this is the event dispatching thread we must ensure that another event
|
||||
* thread runs while the one which invoked this method is blocked.
|
||||
*/
|
||||
public void
|
||||
public synchronized void
|
||||
show()
|
||||
{
|
||||
super.show();
|
||||
if (isModal())
|
||||
{
|
||||
// If already shown (and blocked) just return
|
||||
if (blocked)
|
||||
return;
|
||||
|
||||
/* FIXME: Currently this thread may block forever if it called from
|
||||
the event dispatch thread, so we only do this for FileDialog which
|
||||
only depends on a signal which is delivered in the Gtk thread.
|
||||
Remove this test when we add code to start another event
|
||||
dispatch thread. */
|
||||
if ((Thread.currentThread () instanceof EventDispatchThread) &&
|
||||
!(this instanceof FileDialog))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
blocked = true;
|
||||
wait ();
|
||||
blocked = false;
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
blocked = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Hides the Dialog and then
|
||||
* causes show() to return if it is currently blocked.
|
||||
*/
|
||||
|
||||
public synchronized void
|
||||
hide ()
|
||||
{
|
||||
if (blocked)
|
||||
{
|
||||
notifyAll ();
|
||||
}
|
||||
|
||||
super.hide();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* Disposes the Dialog and then causes show() to return
|
||||
* if it is currently blocked.
|
||||
*/
|
||||
|
||||
public synchronized void
|
||||
dispose ()
|
||||
{
|
||||
if (blocked)
|
||||
{
|
||||
notifyAll ();
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue