diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c index 12d346e45b8..a650d5f349f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c @@ -780,6 +780,16 @@ JNIEXPORT jboolean JNICALL GTK3_NATIVE(gtk_1events_1pending) } #endif +#ifndef NO_gtk_1file_1chooser_1add_1filter +JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1add_1filter) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1) +{ + GTK3_NATIVE_ENTER(env, that, gtk_1file_1chooser_1add_1filter_FUNC); + gtk_file_chooser_add_filter((GtkFileChooser *)arg0, (GtkFileFilter *)arg1); + GTK3_NATIVE_EXIT(env, that, gtk_1file_1chooser_1add_1filter_FUNC); +} +#endif + #ifndef NO_gtk_1file_1chooser_1get_1filename JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1file_1chooser_1get_1filename) (JNIEnv *env, jclass that, jlong arg0) @@ -804,6 +814,18 @@ JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1file_1chooser_1get_1filenames) } #endif +#ifndef NO_gtk_1file_1chooser_1get_1filter +JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1file_1chooser_1get_1filter) + (JNIEnv *env, jclass that, jlong arg0) +{ + jlong rc = 0; + GTK3_NATIVE_ENTER(env, that, gtk_1file_1chooser_1get_1filter_FUNC); + rc = (jlong)gtk_file_chooser_get_filter((GtkFileChooser *)arg0); + GTK3_NATIVE_EXIT(env, that, gtk_1file_1chooser_1get_1filter_FUNC); + return rc; +} +#endif + #ifndef NO_gtk_1file_1chooser_1get_1uri JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1file_1chooser_1get_1uri) (JNIEnv *env, jclass that, jlong arg0) @@ -828,6 +850,36 @@ JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1file_1chooser_1get_1uris) } #endif +#ifndef NO_gtk_1file_1chooser_1native_1new +JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1file_1chooser_1native_1new) + (JNIEnv *env, jclass that, jbyteArray arg0, jlong arg1, jint arg2, jbyteArray arg3, jbyteArray arg4) +{ + jbyte *lparg0=NULL; + jbyte *lparg3=NULL; + jbyte *lparg4=NULL; + jlong rc = 0; + GTK3_NATIVE_ENTER(env, that, gtk_1file_1chooser_1native_1new_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; + if (arg4) if ((lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL)) == NULL) goto fail; +/* + rc = (jlong)gtk_file_chooser_native_new((const gchar *)lparg0, (GtkWindow *)arg1, arg2, (const gchar *)lparg3, (const gchar *)lparg4); +*/ + { + GTK3_LOAD_FUNCTION(fp, gtk_file_chooser_native_new) + if (fp) { + rc = (jlong)((jlong (CALLING_CONVENTION*)(const gchar *, GtkWindow *, jint, const gchar *, const gchar *))fp)((const gchar *)lparg0, (GtkWindow *)arg1, arg2, (const gchar *)lparg3, (const gchar *)lparg4); + } + } +fail: + if (arg4 && lparg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, JNI_ABORT); + if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, JNI_ABORT); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); + GTK3_NATIVE_EXIT(env, that, gtk_1file_1chooser_1native_1new_FUNC); + return rc; +} +#endif + #ifndef NO_gtk_1file_1chooser_1set_1current_1folder JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1current_1folder) (JNIEnv *env, jclass that, jlong arg0, jlong arg1) @@ -852,6 +904,20 @@ JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1current_1folder_1uri } #endif +#ifndef NO_gtk_1file_1chooser_1set_1current_1name +JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1current_1name) + (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + GTK3_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1current_1name_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + gtk_file_chooser_set_current_name((GtkFileChooser *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + GTK3_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1current_1name_FUNC); +} +#endif + #ifndef NO_gtk_1file_1chooser_1set_1do_1overwrite_1confirmation JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1do_1overwrite_1confirmation) (JNIEnv *env, jclass that, jlong arg0, jboolean arg1) @@ -882,6 +948,16 @@ JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1filename) } #endif +#ifndef NO_gtk_1file_1chooser_1set_1filter +JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1filter) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1) +{ + GTK3_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1filter_FUNC); + gtk_file_chooser_set_filter((GtkFileChooser *)arg0, (GtkFileFilter *)arg1); + GTK3_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1filter_FUNC); +} +#endif + #ifndef NO_gtk_1file_1chooser_1set_1local_1only JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1local_1only) (JNIEnv *env, jclass that, jlong arg0, jboolean arg1) @@ -892,6 +968,16 @@ JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1local_1only) } #endif +#ifndef NO_gtk_1file_1chooser_1set_1select_1multiple +JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1select_1multiple) + (JNIEnv *env, jclass that, jlong arg0, jboolean arg1) +{ + GTK3_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1select_1multiple_FUNC); + gtk_file_chooser_set_select_multiple((GtkFileChooser *)arg0, (gboolean)arg1); + GTK3_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1select_1multiple_FUNC); +} +#endif + #ifndef NO_gtk_1file_1chooser_1set_1uri JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1uri) (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.h index ed6b65e62ba..b55dcb2b113 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.h @@ -21,5 +21,7 @@ #define GTK_DISABLE_SINGLE_INCLUDES #include +// Hard-link code generated from GTK3.java to LIB_GTK +#define GTK3_LOAD_FUNCTION(var, name) LOAD_FUNCTION_LIB(var, LIB_GTK, name) #endif /* INC_gtk3_H */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h index 1a45f6466d0..656e9558a8c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3_stats.h @@ -88,16 +88,22 @@ typedef enum { gtk_1event_1box_1new_FUNC, gtk_1event_1controller_1handle_1event_FUNC, gtk_1events_1pending_FUNC, + gtk_1file_1chooser_1add_1filter_FUNC, gtk_1file_1chooser_1get_1filename_FUNC, gtk_1file_1chooser_1get_1filenames_FUNC, + gtk_1file_1chooser_1get_1filter_FUNC, gtk_1file_1chooser_1get_1uri_FUNC, gtk_1file_1chooser_1get_1uris_FUNC, + gtk_1file_1chooser_1native_1new_FUNC, gtk_1file_1chooser_1set_1current_1folder_FUNC, gtk_1file_1chooser_1set_1current_1folder_1uri_FUNC, + gtk_1file_1chooser_1set_1current_1name_FUNC, gtk_1file_1chooser_1set_1do_1overwrite_1confirmation_FUNC, gtk_1file_1chooser_1set_1extra_1widget_FUNC, gtk_1file_1chooser_1set_1filename_FUNC, + gtk_1file_1chooser_1set_1filter_FUNC, gtk_1file_1chooser_1set_1local_1only_FUNC, + gtk_1file_1chooser_1set_1select_1multiple_FUNC, gtk_1file_1chooser_1set_1uri_FUNC, gtk_1frame_1set_1shadow_1type_FUNC, gtk_1gesture_1drag_1new_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c index ada595dbbe0..589edf1b91b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c @@ -656,62 +656,104 @@ JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1expander_1set_1child) } #endif -#ifndef NO_gtk_1file_1chooser_1get_1file -JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1chooser_1get_1file) +#ifndef NO_gtk_1file_1dialog_1get_1default_1filter +JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1get_1default_1filter) (JNIEnv *env, jclass that, jlong arg0) { jlong rc = 0; - GTK4_NATIVE_ENTER(env, that, gtk_1file_1chooser_1get_1file_FUNC); - rc = (jlong)gtk_file_chooser_get_file((GtkFileChooser *)arg0); - GTK4_NATIVE_EXIT(env, that, gtk_1file_1chooser_1get_1file_FUNC); + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1get_1default_1filter_FUNC); + rc = (jlong)gtk_file_dialog_get_default_filter((GtkFileDialog *)arg0); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1get_1default_1filter_FUNC); return rc; } #endif -#ifndef NO_gtk_1file_1chooser_1get_1files -JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1chooser_1get_1files) - (JNIEnv *env, jclass that, jlong arg0) +#ifndef NO_gtk_1file_1dialog_1new +JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1new) + (JNIEnv *env, jclass that) { jlong rc = 0; - GTK4_NATIVE_ENTER(env, that, gtk_1file_1chooser_1get_1files_FUNC); - rc = (jlong)gtk_file_chooser_get_files((GtkFileChooser *)arg0); - GTK4_NATIVE_EXIT(env, that, gtk_1file_1chooser_1get_1files_FUNC); + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1new_FUNC); + rc = (jlong)gtk_file_dialog_new(); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1new_FUNC); return rc; } #endif -#ifndef NO_gtk_1file_1chooser_1set_1current_1folder -JNIEXPORT jboolean JNICALL GTK4_NATIVE(gtk_1file_1chooser_1set_1current_1folder) - (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2) +#ifndef NO_gtk_1file_1dialog_1open +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1open) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2, jlong arg3, jlong arg4) { - jboolean rc = 0; - GTK4_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1current_1folder_FUNC); - rc = (jboolean)gtk_file_chooser_set_current_folder((GtkFileChooser *)arg0, (GFile *)arg1, (GError **)arg2); - GTK4_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1current_1folder_FUNC); + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1open_FUNC); + gtk_file_dialog_open((GtkFileDialog *)arg0, (GtkWindow *)arg1, (GCancellable *)arg2, (GAsyncReadyCallback)arg3, (gpointer)arg4); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1open_FUNC); +} +#endif + +#ifndef NO_gtk_1file_1dialog_1open_1finish +JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1open_1finish) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlongArray arg2) +{ + jlong *lparg2=NULL; + jlong rc = 0; + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1open_1finish_FUNC); + if (arg2) if ((lparg2 = (*env)->GetLongArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jlong)gtk_file_dialog_open_finish((GtkFileDialog *)arg0, (GAsyncResult *)arg1, (GError **)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseLongArrayElements(env, arg2, lparg2, 0); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1open_1finish_FUNC); return rc; } #endif -#ifndef NO_gtk_1file_1chooser_1set_1file -JNIEXPORT jboolean JNICALL GTK4_NATIVE(gtk_1file_1chooser_1set_1file) - (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2) +#ifndef NO_gtk_1file_1dialog_1open_1multiple +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1open_1multiple) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2, jlong arg3, jlong arg4) { - jboolean rc = 0; - GTK4_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1file_FUNC); - rc = (jboolean)gtk_file_chooser_set_file((GtkFileChooser *)arg0, (GFile *)arg1, (GError **)arg2); - GTK4_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1file_FUNC); + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1open_1multiple_FUNC); + gtk_file_dialog_open_multiple((GtkFileDialog *)arg0, (GtkWindow *)arg1, (GCancellable *)arg2, (GAsyncReadyCallback)arg3, (gpointer)arg4); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1open_1multiple_FUNC); +} +#endif + +#ifndef NO_gtk_1file_1dialog_1open_1multiple_1finish +JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1open_1multiple_1finish) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlongArray arg2) +{ + jlong *lparg2=NULL; + jlong rc = 0; + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1open_1multiple_1finish_FUNC); + if (arg2) if ((lparg2 = (*env)->GetLongArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jlong)gtk_file_dialog_open_multiple_finish((GtkFileDialog *)arg0, (GAsyncResult *)arg1, (GError **)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseLongArrayElements(env, arg2, lparg2, 0); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1open_1multiple_1finish_FUNC); return rc; } #endif -#ifndef NO_gtk_1file_1dialog_1new -JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1new) - (JNIEnv *env, jclass that) +#ifndef NO_gtk_1file_1dialog_1save +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1save) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2, jlong arg3, jlong arg4) +{ + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1save_FUNC); + gtk_file_dialog_save((GtkFileDialog *)arg0, (GtkWindow *)arg1, (GCancellable *)arg2, (GAsyncReadyCallback)arg3, (gpointer)arg4); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1save_FUNC); +} +#endif + +#ifndef NO_gtk_1file_1dialog_1save_1finish +JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1save_1finish) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlongArray arg2) { + jlong *lparg2=NULL; jlong rc = 0; - GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1new_FUNC); - rc = (jlong)gtk_file_dialog_new(); - GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1new_FUNC); + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1save_1finish_FUNC); + if (arg2) if ((lparg2 = (*env)->GetLongArrayElements(env, arg2, NULL)) == NULL) goto fail; + rc = (jlong)gtk_file_dialog_save_finish((GtkFileDialog *)arg0, (GAsyncResult *)arg1, (GError **)lparg2); +fail: + if (arg2 && lparg2) (*env)->ReleaseLongArrayElements(env, arg2, lparg2, 0); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1save_1finish_FUNC); return rc; } #endif @@ -742,6 +784,36 @@ JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1file_1dialog_1select_1folder_1finish) } #endif +#ifndef NO_gtk_1file_1dialog_1set_1default_1filter +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1default_1filter) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1) +{ + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1set_1default_1filter_FUNC); + gtk_file_dialog_set_default_filter((GtkFileDialog *)arg0, (GtkFileFilter *)arg1); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1set_1default_1filter_FUNC); +} +#endif + +#ifndef NO_gtk_1file_1dialog_1set_1filters +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1filters) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1) +{ + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1set_1filters_FUNC); + gtk_file_dialog_set_filters((GtkFileDialog *)arg0, (GListModel *)arg1); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1set_1filters_FUNC); +} +#endif + +#ifndef NO_gtk_1file_1dialog_1set_1initial_1file +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1initial_1file) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1) +{ + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1set_1initial_1file_FUNC); + gtk_file_dialog_set_initial_file((GtkFileDialog *)arg0, (GFile *)arg1); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1set_1initial_1file_FUNC); +} +#endif + #ifndef NO_gtk_1file_1dialog_1set_1initial_1folder JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1initial_1folder) (JNIEnv *env, jclass that, jlong arg0, jlong arg1) @@ -752,6 +824,34 @@ JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1initial_1folder) } #endif +#ifndef NO_gtk_1file_1dialog_1set_1initial_1name +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1initial_1name) + (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1set_1initial_1name_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + gtk_file_dialog_set_initial_name((GtkFileDialog *)arg0, (char *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1set_1initial_1name_FUNC); +} +#endif + +#ifndef NO_gtk_1file_1dialog_1set_1title +JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1title) + (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + GTK4_NATIVE_ENTER(env, that, gtk_1file_1dialog_1set_1title_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + gtk_file_dialog_set_title((GtkFileDialog *)arg0, (char *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + GTK4_NATIVE_EXIT(env, that, gtk_1file_1dialog_1set_1title_FUNC); +} +#endif + #ifndef NO_gtk_1frame_1set_1child JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1frame_1set_1child) (JNIEnv *env, jclass that, jlong arg0, jlong arg1) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h index de0d695c1f0..f8c9e0bd018 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4_stats.h @@ -77,14 +77,22 @@ typedef enum { gtk_1event_1controller_1motion_1new_FUNC, gtk_1event_1controller_1scroll_1new_FUNC, gtk_1expander_1set_1child_FUNC, - gtk_1file_1chooser_1get_1file_FUNC, - gtk_1file_1chooser_1get_1files_FUNC, - gtk_1file_1chooser_1set_1current_1folder_FUNC, - gtk_1file_1chooser_1set_1file_FUNC, + gtk_1file_1dialog_1get_1default_1filter_FUNC, gtk_1file_1dialog_1new_FUNC, + gtk_1file_1dialog_1open_FUNC, + gtk_1file_1dialog_1open_1finish_FUNC, + gtk_1file_1dialog_1open_1multiple_FUNC, + gtk_1file_1dialog_1open_1multiple_1finish_FUNC, + gtk_1file_1dialog_1save_FUNC, + gtk_1file_1dialog_1save_1finish_FUNC, gtk_1file_1dialog_1select_1folder_FUNC, gtk_1file_1dialog_1select_1folder_1finish_FUNC, + gtk_1file_1dialog_1set_1default_1filter_FUNC, + gtk_1file_1dialog_1set_1filters_FUNC, + gtk_1file_1dialog_1set_1initial_1file_FUNC, gtk_1file_1dialog_1set_1initial_1folder_FUNC, + gtk_1file_1dialog_1set_1initial_1name_FUNC, + gtk_1file_1dialog_1set_1title_FUNC, gtk_1frame_1set_1child_FUNC, gtk_1gesture_1click_1new_FUNC, gtk_1gesture_1drag_1new_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 1267e2e4a5d..9e036be3b44 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -3357,6 +3357,18 @@ JNIEXPORT jlong JNICALL GTK_NATIVE(GTK_1TYPE_1CELL_1RENDERER_1TOGGLE) } #endif +#ifndef NO_GTK_1TYPE_1FILE_1FILTER +JNIEXPORT jlong JNICALL GTK_NATIVE(GTK_1TYPE_1FILE_1FILTER) + (JNIEnv *env, jclass that) +{ + jlong rc = 0; + GTK_NATIVE_ENTER(env, that, GTK_1TYPE_1FILE_1FILTER_FUNC); + rc = (jlong)GTK_TYPE_FILE_FILTER; + GTK_NATIVE_EXIT(env, that, GTK_1TYPE_1FILE_1FILTER_FUNC); + return rc; +} +#endif + #ifndef NO_GTK_1TYPE_1IM_1MULTICONTEXT JNIEXPORT jlong JNICALL GTK_NATIVE(GTK_1TYPE_1IM_1MULTICONTEXT) (JNIEnv *env, jclass that) @@ -4717,92 +4729,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1expander_1set_1label_1widget) } #endif -#ifndef NO_gtk_1file_1chooser_1add_1filter -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1file_1chooser_1add_1filter) - (JNIEnv *env, jclass that, jlong arg0, jlong arg1) -{ - GTK_NATIVE_ENTER(env, that, gtk_1file_1chooser_1add_1filter_FUNC); - gtk_file_chooser_add_filter((GtkFileChooser *)arg0, (GtkFileFilter *)arg1); - GTK_NATIVE_EXIT(env, that, gtk_1file_1chooser_1add_1filter_FUNC); -} -#endif - -#ifndef NO_gtk_1file_1chooser_1get_1filter -JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1file_1chooser_1get_1filter) - (JNIEnv *env, jclass that, jlong arg0) -{ - jlong rc = 0; - GTK_NATIVE_ENTER(env, that, gtk_1file_1chooser_1get_1filter_FUNC); - rc = (jlong)gtk_file_chooser_get_filter((GtkFileChooser *)arg0); - GTK_NATIVE_EXIT(env, that, gtk_1file_1chooser_1get_1filter_FUNC); - return rc; -} -#endif - -#ifndef NO_gtk_1file_1chooser_1native_1new -JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1file_1chooser_1native_1new) - (JNIEnv *env, jclass that, jbyteArray arg0, jlong arg1, jint arg2, jbyteArray arg3, jbyteArray arg4) -{ - jbyte *lparg0=NULL; - jbyte *lparg3=NULL; - jbyte *lparg4=NULL; - jlong rc = 0; - GTK_NATIVE_ENTER(env, that, gtk_1file_1chooser_1native_1new_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; - if (arg4) if ((lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL)) == NULL) goto fail; -/* - rc = (jlong)gtk_file_chooser_native_new((const gchar *)lparg0, (GtkWindow *)arg1, arg2, (const gchar *)lparg3, (const gchar *)lparg4); -*/ - { - GTK_LOAD_FUNCTION(fp, gtk_file_chooser_native_new) - if (fp) { - rc = (jlong)((jlong (CALLING_CONVENTION*)(const gchar *, GtkWindow *, jint, const gchar *, const gchar *))fp)((const gchar *)lparg0, (GtkWindow *)arg1, arg2, (const gchar *)lparg3, (const gchar *)lparg4); - } - } -fail: - if (arg4 && lparg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, JNI_ABORT); - if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, JNI_ABORT); - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, JNI_ABORT); - GTK_NATIVE_EXIT(env, that, gtk_1file_1chooser_1native_1new_FUNC); - return rc; -} -#endif - -#ifndef NO_gtk_1file_1chooser_1set_1current_1name -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1file_1chooser_1set_1current_1name) - (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1) -{ - jbyte *lparg1=NULL; - GTK_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1current_1name_FUNC); - if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; - gtk_file_chooser_set_current_name((GtkFileChooser *)arg0, (const gchar *)lparg1); -fail: - if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); - GTK_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1current_1name_FUNC); -} -#endif - -#ifndef NO_gtk_1file_1chooser_1set_1filter -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1file_1chooser_1set_1filter) - (JNIEnv *env, jclass that, jlong arg0, jlong arg1) -{ - GTK_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1filter_FUNC); - gtk_file_chooser_set_filter((GtkFileChooser *)arg0, (GtkFileFilter *)arg1); - GTK_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1filter_FUNC); -} -#endif - -#ifndef NO_gtk_1file_1chooser_1set_1select_1multiple -JNIEXPORT void JNICALL GTK_NATIVE(gtk_1file_1chooser_1set_1select_1multiple) - (JNIEnv *env, jclass that, jlong arg0, jboolean arg1) -{ - GTK_NATIVE_ENTER(env, that, gtk_1file_1chooser_1set_1select_1multiple_FUNC); - gtk_file_chooser_set_select_multiple((GtkFileChooser *)arg0, (gboolean)arg1); - GTK_NATIVE_EXIT(env, that, gtk_1file_1chooser_1set_1select_1multiple_FUNC); -} -#endif - #ifndef NO_gtk_1file_1filter_1add_1pattern JNIEXPORT void JNICALL GTK_NATIVE(gtk_1file_1filter_1add_1pattern) (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1) @@ -11564,6 +11490,28 @@ JNIEXPORT jlong JNICALL OS_NATIVE(g_1list_1previous) } #endif +#ifndef NO_g_1list_1store_1append +JNIEXPORT void JNICALL OS_NATIVE(g_1list_1store_1append) + (JNIEnv *env, jclass that, jlong arg0, jlong arg1) +{ + OS_NATIVE_ENTER(env, that, g_1list_1store_1append_FUNC); + g_list_store_append((GListStore *)arg0, (GObject *)arg1); + OS_NATIVE_EXIT(env, that, g_1list_1store_1append_FUNC); +} +#endif + +#ifndef NO_g_1list_1store_1new +JNIEXPORT jlong JNICALL OS_NATIVE(g_1list_1store_1new) + (JNIEnv *env, jclass that, jlong arg0) +{ + jlong rc = 0; + OS_NATIVE_ENTER(env, that, g_1list_1store_1new_FUNC); + rc = (jlong)g_list_store_new((GType)arg0); + OS_NATIVE_EXIT(env, that, g_1list_1store_1new_FUNC); + return rc; +} +#endif + #ifndef NO_g_1log_1default_1handler JNIEXPORT void JNICALL OS_NATIVE(g_1log_1default_1handler) (JNIEnv *env, jclass that, jlong arg0, jint arg1, jlong arg2, jlong arg3) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index 02a4e12d3b1..cc4d4ecce8a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -263,6 +263,7 @@ typedef enum { GTK_1TYPE_1CELL_1RENDERER_1PIXBUF_FUNC, GTK_1TYPE_1CELL_1RENDERER_1TEXT_FUNC, GTK_1TYPE_1CELL_1RENDERER_1TOGGLE_FUNC, + GTK_1TYPE_1FILE_1FILTER_FUNC, GTK_1TYPE_1IM_1MULTICONTEXT_FUNC, GTK_1TYPE_1TEXT_1VIEW_1ACCESSIBLE_FUNC, GTK_1TYPE_1WIDGET_FUNC, @@ -375,12 +376,6 @@ typedef enum { gtk_1expander_1new_FUNC, gtk_1expander_1set_1expanded_FUNC, gtk_1expander_1set_1label_1widget_FUNC, - gtk_1file_1chooser_1add_1filter_FUNC, - gtk_1file_1chooser_1get_1filter_FUNC, - gtk_1file_1chooser_1native_1new_FUNC, - gtk_1file_1chooser_1set_1current_1name_FUNC, - gtk_1file_1chooser_1set_1filter_FUNC, - gtk_1file_1chooser_1set_1select_1multiple_FUNC, gtk_1file_1filter_1add_1pattern_FUNC, gtk_1file_1filter_1get_1name_FUNC, gtk_1file_1filter_1new_FUNC, @@ -938,6 +933,8 @@ typedef enum { g_1list_1next_FUNC, g_1list_1nth_1data_FUNC, g_1list_1previous_FUNC, + g_1list_1store_1append_FUNC, + g_1list_1store_1new_FUNC, g_1log_1default_1handler_FUNC, g_1log_1remove_1handler_FUNC, g_1log_1set_1handler_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java index 95a0746f64b..919b524df51 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java @@ -245,6 +245,8 @@ public class GTK extends OS { public static final native long GTK_TYPE_WIDGET(); /** @method flags=const */ public static final native long GTK_TYPE_WINDOW(); + /** @method flags=const */ + public static final native long GTK_TYPE_FILE_FILTER(); /** GTK3 Macros [if-def'd in os.h] */ public static final native boolean GTK_IS_ACCEL_LABEL(long obj); @@ -699,30 +701,6 @@ public class GTK extends OS { /** @param expander cast=(GtkExpander *) */ public static final native long gtk_expander_get_label_widget(long expander); - /* GtkFileChooser */ - /** - * @param chooser cast=(GtkFileChooser *) - * @param filter cast=(GtkFileFilter *) - */ - public static final native void gtk_file_chooser_add_filter(long chooser, long filter); - /** @param chooser cast=(GtkFileChooser *) */ - public static final native long gtk_file_chooser_get_filter(long chooser); - /** - * @param chooser cast=(GtkFileChooser *) - * @param name cast=(const gchar *) - */ - public static final native void gtk_file_chooser_set_current_name(long chooser, byte[] name); - /** - * @param chooser cast=(GtkFileChooser *) - * @param filter cast=(GtkFileFilter *) - */ - public static final native void gtk_file_chooser_set_filter(long chooser, long filter); - /** - * @param chooser cast=(GtkFileChooser *) - * @param select_multiple cast=(gboolean) - */ - public static final native void gtk_file_chooser_set_select_multiple(long chooser, boolean select_multiple); - /* GtkEventController */ /** * @param controller cast=(GtkEventController *) @@ -741,16 +719,6 @@ public class GTK extends OS { /** @param gesture cast=(GtkGestureSingle *) */ public static final native int gtk_gesture_single_get_current_button(long gesture); - /* GtkFileChooserNative */ - /** - * @method flags=dynamic - * @param title cast=(const gchar *),flags=no_out - * @param parent cast=(GtkWindow *) - * @param accept_label cast=(const gchar *),flags=no_out - * @param cancel_label cast=(const gchar *),flags=no_out - */ - public static final native long gtk_file_chooser_native_new(byte[] title, long parent, int action, byte[] accept_label, byte[] cancel_label); - /* GtkFileFilter */ public static final native long gtk_file_filter_new(); /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 73c901d9b0f..599a3a0b3e8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2022 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2024 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -1096,6 +1096,15 @@ public static boolean isX11 () { */ public static final native long g_list_nth_data(long list, int n); public static final native long g_list_previous(long list); +/** + * @param item_type cast=(GType) + */ +public static final native long g_list_store_new(long item_type); +/** + * @param store cast=(GListStore *) + * @param item cast=(GObject *) + */ +public static final native void g_list_store_append(long store, long item); /** * @param log_domain cast=(gchar *) * @param log_levels cast=(GLogLevelFlags) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java index ec352c1f985..8b772cf1815 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk3/GTK3.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021 Syntevo and others. + * Copyright (c) 2021, 2024 Syntevo and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -516,6 +516,38 @@ public class GTK3 { * @param extra_widget cast=(GtkWidget *) */ public static final native void gtk_file_chooser_set_extra_widget(long chooser, long extra_widget); + /** + * @param chooser cast=(GtkFileChooser *) + * @param filter cast=(GtkFileFilter *) + */ + public static final native void gtk_file_chooser_add_filter(long chooser, long filter); + /** @param chooser cast=(GtkFileChooser *) */ + public static final native long gtk_file_chooser_get_filter(long chooser); + /** + * @param chooser cast=(GtkFileChooser *) + * @param name cast=(const gchar *) + */ + public static final native void gtk_file_chooser_set_current_name(long chooser, byte[] name); + /** + * @param chooser cast=(GtkFileChooser *) + * @param filter cast=(GtkFileFilter *) + */ + public static final native void gtk_file_chooser_set_filter(long chooser, long filter); + /** + * @param chooser cast=(GtkFileChooser *) + * @param select_multiple cast=(gboolean) + */ + public static final native void gtk_file_chooser_set_select_multiple(long chooser, boolean select_multiple); + + /* GtkFileChooserNative */ + /** + * @method flags=dynamic + * @param title cast=(const gchar *),flags=no_out + * @param parent cast=(GtkWindow *) + * @param accept_label cast=(const gchar *),flags=no_out + * @param cancel_label cast=(const gchar *),flags=no_out + */ + public static final native long gtk_file_chooser_native_new(byte[] title, long parent, int action, byte[] accept_label, byte[] cancel_label); /* GtkRadioButton */ /** @param radio_button cast=(GtkRadioButton *) */ @@ -1089,5 +1121,5 @@ public class GTK3 { public static final native int GdkEventWindowState_sizeof(); public static final native int GdkGeometry_sizeof(); public static final native int GdkWindowAttr_sizeof(); - + } diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java index 4397c0e11d3..62368c29cf9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk4/GTK4.java @@ -174,26 +174,70 @@ public class GTK4 { /** @param builder cast=(GdkContentFormatsBuilder *) */ public static final native long gdk_content_formats_builder_free_to_formats(long builder); - /* GtkFileChooser */ - /** @param chooser cast=(GtkFileChooser *) */ - public static final native long gtk_file_chooser_get_files(long chooser); - /** @param chooser cast=(GtkFileChooser *) */ - public static final native long gtk_file_chooser_get_file(long chooser); + /* GtkFileDialog */ + public static final native long gtk_file_dialog_new(); /** - * @param chooser cast=(GtkFileChooser *) - * @param file cast=(GFile *) + * @param self cast=(GtkFileDialog *) + * @param parent cast=(GtkWindow *) + * @param cancellable cast=(GCancellable *) + * @param callback cast=(GAsyncReadyCallback) + * @param user_data cast=(gpointer) + */ + public static final native void gtk_file_dialog_select_folder(long self, long parent, long cancellable, long callback, long user_data); + /** + * @param self cast=(GtkFileDialog *) + * @param result cast=(GAsyncResult *) * @param error cast=(GError **) */ - public static final native boolean gtk_file_chooser_set_current_folder(long chooser, long file, long error); + public static final native long gtk_file_dialog_select_folder_finish(long self, long result, long[] error); /** - * @param chooser cast=(GtkFileChooser *) + * @param self cast=(GtkFileDialog *) + * @param folder cast=(GFile *) + */ + public static final native void gtk_file_dialog_set_initial_folder(long self, long folder); + /** + * @param self cast=(GtkFileDialog *) + * @param title cast=(char *) + */ + public static final native void gtk_file_dialog_set_initial_name(long self, byte[] title); + /** + * @param self cast=(GtkFileDialog *) * @param file cast=(GFile *) + */ + public static final native void gtk_file_dialog_set_initial_file(long self, long file); + /** + * @param self cast=(GtkFileDialog *) + * @param title cast=(char *) + */ + public static final native void gtk_file_dialog_set_title(long self, byte[] title); + /** + * @param self cast=(GtkFileDialog *) + * @param filter cast=(GtkFileFilter *) + */ + public static final native void gtk_file_dialog_set_default_filter(long self, long filter); + /** + * @param self cast=(GtkFileDialog *) + * @param filters cast=(GListModel *) + */ + public static final native void gtk_file_dialog_set_filters(long self, long filters); + /** + * @param self cast=(GtkFileDialog *) + */ + public static final native long gtk_file_dialog_get_default_filter(long self); + /** + * @param self cast=(GtkFileDialog *) + * @param parent cast=(GtkWindow *) + * @param cancellable cast=(GCancellable *) + * @param callback cast=(GAsyncReadyCallback) + * @param user_data cast=(gpointer) + */ + public static final native void gtk_file_dialog_open_multiple(long self, long parent, long cancellable, long callback, long user_data); + /** + * @param self cast=(GtkFileDialog *) + * @param result cast=(GAsyncResult *) * @param error cast=(GError **) */ - public static final native boolean gtk_file_chooser_set_file(long chooser, long file, long error); - - /* GtkFileDialog */ - public static final native long gtk_file_dialog_new(); + public static final native long gtk_file_dialog_open_multiple_finish(long self, long result, long[] error); /** * @param self cast=(GtkFileDialog *) * @param parent cast=(GtkWindow *) @@ -201,18 +245,27 @@ public class GTK4 { * @param callback cast=(GAsyncReadyCallback) * @param user_data cast=(gpointer) */ - public static final native void gtk_file_dialog_select_folder(long self, long parent, long cancellable, long callback, long user_data); + public static final native void gtk_file_dialog_open(long self, long parent, long cancellable, long callback, long user_data); /** * @param self cast=(GtkFileDialog *) * @param result cast=(GAsyncResult *) * @param error cast=(GError **) */ - public static final native long gtk_file_dialog_select_folder_finish(long self, long result, long[] error); + public static final native long gtk_file_dialog_open_finish(long self, long result, long[] error); /** * @param self cast=(GtkFileDialog *) - * @param folder cast=(GFile *) + * @param parent cast=(GtkWindow *) + * @param cancellable cast=(GCancellable *) + * @param callback cast=(GAsyncReadyCallback) + * @param user_data cast=(gpointer) */ - public static final native void gtk_file_dialog_set_initial_folder(long self, long folder); + public static final native void gtk_file_dialog_save(long self, long parent, long cancellable, long callback, long user_data); + /** + * @param self cast=(GtkFileDialog *) + * @param result cast=(GAsyncResult *) + * @param error cast=(GError **) + */ + public static final native long gtk_file_dialog_save_finish(long self, long result, long[] error); /* GtkScrolledWindow */ public static final native long gtk_scrolled_window_new(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java index 7f58b6663e0..ca928d9e9ac 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/DirectoryDialog.java @@ -168,8 +168,9 @@ Optional openNativeChooserDialog () { long handle; if (GTK.GTK4) { handle = GTK4.gtk_file_dialog_new(); + GTK4.gtk_file_dialog_set_title(handle, titleBytes); } else { - handle = GTK.gtk_file_chooser_native_new(titleBytes, shellHandle, GTK.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, null, null); + handle = GTK3.gtk_file_chooser_native_new(titleBytes, shellHandle, GTK.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, null, null); } if (handle == 0) error (SWT.ERROR_NO_HANDLES); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java index a3e22d809b0..ce01e74c78c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/FileDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2019 IBM Corporation and others. + * Copyright (c) 2000, 2024 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -106,13 +106,13 @@ public FileDialog (Shell parent, int style) { super (parent, checkStyle (parent, style)); checkSubclass (); } -String computeResultChooserDialog () { +String computeResultChooserDialog (long file) { /* MULTI is only valid if the native dialog's action is Open */ fullPath = null; if ((style & SWT.MULTI) != 0) { long list = 0; if (GTK.GTK4) { - list = GTK4.gtk_file_chooser_get_files(handle); + list = file; } else { if (uriMode) { list = GTK3.gtk_file_chooser_get_uris (handle); @@ -172,7 +172,6 @@ String computeResultChooserDialog () { long utf8Ptr = 0; if (uriMode) { if (GTK.GTK4) { - long file = GTK4.gtk_file_chooser_get_file(handle); utf8Ptr = OS.g_file_get_uri(file); } else { utf8Ptr = GTK3.gtk_file_chooser_get_uri (handle); @@ -180,7 +179,6 @@ String computeResultChooserDialog () { } else { long path; if (GTK.GTK4) { - long file = GTK4.gtk_file_chooser_get_file(handle); path = OS.g_file_get_path(file); } else { path = GTK3.gtk_file_chooser_get_filename (handle); @@ -208,7 +206,12 @@ String computeResultChooserDialog () { } } filterIndex = -1; - long filter = GTK.gtk_file_chooser_get_filter (handle); + long filter; + if (GTK.GTK4) { + filter = GTK4.gtk_file_dialog_get_default_filter(handle); + } else { + filter = GTK3.gtk_file_chooser_get_filter (handle); + } if (filter != 0) { long filterNamePtr = GTK.gtk_file_filter_get_name (filter); if (filterNamePtr != 0) { @@ -376,7 +379,12 @@ Optional openNativeChooserDialog () { int action = (style & SWT.SAVE) != 0 ? GTK.GTK_FILE_CHOOSER_ACTION_SAVE : GTK.GTK_FILE_CHOOSER_ACTION_OPEN; long shellHandle = parent.topHandle(); Display display = parent != null ? parent.getDisplay (): Display.getCurrent(); - handle = GTK.gtk_file_chooser_native_new(titleBytes, shellHandle, action, null, null); + if (GTK.GTK4) { + handle = GTK4.gtk_file_dialog_new(); + GTK4.gtk_file_dialog_set_title(handle, titleBytes); + } else { + handle = GTK3.gtk_file_chooser_native_new(titleBytes, shellHandle, action, null, null); + } if (handle == 0) error (SWT.ERROR_NO_HANDLES); if (uriMode && !GTK.GTK4) { @@ -393,8 +401,24 @@ Optional openNativeChooserDialog () { } int response; + long file = 0; if (GTK.GTK4) { - response = SyncDialogUtil.run(display, handle, true); + if ((style & SWT.MULTI) != 0) { + file = SyncDialogUtil.run(display, + asyncCallback -> GTK4.gtk_file_dialog_open_multiple(handle, shellHandle, 0, asyncCallback, 0), + asyncResult -> GTK4.gtk_file_dialog_open_multiple_finish(handle, asyncResult, null)); + } else { + if ((style & SWT.SAVE) != 0) { + file = SyncDialogUtil.run(display, + asyncCallback -> GTK4.gtk_file_dialog_save(handle, shellHandle, 0, asyncCallback, 0), + asyncResult -> GTK4.gtk_file_dialog_save_finish(handle, asyncResult, null)); + } else { + file = SyncDialogUtil.run(display, + asyncCallback -> GTK4.gtk_file_dialog_open(handle, shellHandle, 0, asyncCallback, 0), + asyncResult -> GTK4.gtk_file_dialog_open_finish(handle, asyncResult, null)); + } + } + response = file != 0 ? GTK.GTK_RESPONSE_ACCEPT : GTK.GTK_RESPONSE_CANCEL; } else { display.externalEventLoop = true; display.sendPreExternalEventDispatchEvent (); @@ -409,7 +433,7 @@ Optional openNativeChooserDialog () { Optional result = Optional.empty(); if (response == GTK.GTK_RESPONSE_ACCEPT) { - result = Optional.ofNullable(computeResultChooserDialog ()); + result = Optional.ofNullable(computeResultChooserDialog (file)); } display.removeIdleProc (); OS.g_object_unref(handle); @@ -421,8 +445,8 @@ Optional openNativeChooserDialog () { void presetChooserDialog () { /* MULTI is only valid if the native dialog's action is Open */ - if ((style & (SWT.SAVE | SWT.MULTI)) == SWT.MULTI) { - GTK.gtk_file_chooser_set_select_multiple (handle, true); + if (!GTK.GTK4 && (style & (SWT.SAVE | SWT.MULTI)) == SWT.MULTI) { + GTK3.gtk_file_chooser_set_select_multiple (handle, true); } if (filterPath == null) filterPath = ""; if (fileName == null) fileName = ""; @@ -436,7 +460,7 @@ void presetChooserDialog () { if (GTK.GTK4) { long file = OS.g_file_new_for_uri(buffer); - GTK4.gtk_file_chooser_set_current_folder (handle, file, 0); + GTK4.gtk_file_dialog_set_initial_folder(handle, file); OS.g_object_unref(file); } else { GTK3.gtk_file_chooser_set_current_folder_uri (handle, buffer); @@ -454,7 +478,7 @@ void presetChooserDialog () { if (ptr != 0) { if (GTK.GTK4) { long file = OS.g_file_new_for_path(buffer); - GTK4.gtk_file_chooser_set_current_folder (handle, file, 0); + GTK4.gtk_file_dialog_set_initial_folder(handle, file); OS.g_object_unref(file); } else { GTK3.gtk_file_chooser_set_current_folder (handle, ptr); @@ -490,7 +514,11 @@ void presetChooserDialog () { } } byte [] buffer = Converter.wcsToMbcs (filenameWithExt.toString (), true); - GTK.gtk_file_chooser_set_current_name (handle, buffer); + if (GTK.GTK4) { + GTK4.gtk_file_dialog_set_initial_name(handle, buffer); + } else { + GTK3.gtk_file_chooser_set_current_name (handle, buffer); + } } } else { StringBuilder stringBuilder = new StringBuilder(); @@ -511,12 +539,12 @@ void presetChooserDialog () { long file; if (uriMode) { file = OS.g_file_new_for_uri(buffer); - GTK4.gtk_file_chooser_set_file (handle, file, 0); + GTK4.gtk_file_dialog_set_initial_file(handle, file); } else { file = OS.g_file_new_for_path(buffer); if (fileName.length() > 0) { - GTK4.gtk_file_chooser_set_file (handle, file, 0); + GTK4.gtk_file_dialog_set_initial_file(handle, file); } } @@ -556,6 +584,10 @@ void presetChooserDialog () { if (filterNames == null) filterNames = new String [0]; if (filterExtensions == null) filterExtensions = new String [0]; long initialFilter = 0; + long fileFilters = 0; + if (GTK.GTK4) { + fileFilters = OS.g_list_store_new(GTK.GTK_TYPE_FILE_FILTER()); + } for (int i = 0; i < filterExtensions.length; i++) { if (filterExtensions [i] != null) { long filter = GTK.gtk_file_filter_new (); @@ -578,14 +610,26 @@ void presetChooserDialog () { String current = filterExtensions [i].substring (start); byte [] filterString = Converter.wcsToMbcs (current, true); GTK.gtk_file_filter_add_pattern (filter, filterString); - GTK.gtk_file_chooser_add_filter (handle, filter); + if (GTK.GTK4) { + OS.g_list_store_append(fileFilters, filter); + } else { + GTK3.gtk_file_chooser_add_filter (handle, filter); + } if (i == filterIndex) { initialFilter = filter; } } } + if (GTK.GTK4) { + GTK4.gtk_file_dialog_set_filters(handle, fileFilters); + OS.g_object_unref(fileFilters); + } if (initialFilter != 0) { - GTK.gtk_file_chooser_set_filter(handle, initialFilter); + if (GTK.GTK4) { + GTK4.gtk_file_dialog_set_default_filter(handle, initialFilter); + } else { + GTK3.gtk_file_chooser_set_filter(handle, initialFilter); + } } fullPath = null; fileNames = new String [0];