-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GTK4] Cleanup execution of non-blocking dialog calls
This adds a new AsyncReadyCallback class which is used to handle the asynchronous execution of dialogs. The goal is provide a cleaner and more readable interface than what is currently available by SyncDialogUtil. Note that this class currently simply wraps the call to SyncDialogUtil. But once all of the remaining dialogs (Color/Font/MessageDialog) have been migrated, it might make sense to remove this class entirely to avoid this additional indirection. Follow-up to 2e61b4b
- Loading branch information
Showing
4 changed files
with
85 additions
and
15 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/internal/AsyncReadyCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Patrick Ziegler and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Patrick Ziegler - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.swt.internal; | ||
|
||
/** | ||
* This class implements the GIO AsyncReadyCallback type and is used to | ||
* transform an asynchronous {@code async} and synchronous {@code await} | ||
* operation into a single synchronous {@code run} operation. | ||
*/ | ||
public interface AsyncReadyCallback { | ||
/** | ||
* This method is responsible for initializes the asynchronous operation | ||
* | ||
* @param callback The callback address to execute when the operation is | ||
* complete. | ||
*/ | ||
void async(long callback); | ||
|
||
/** | ||
* This method is called from within the callback function in order to | ||
* finish the executed operation and to return the result. | ||
* | ||
* @param result The generic, asynchronous function result. | ||
* @return The specific result of the operation. | ||
*/ | ||
long await(long result); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters