Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GTK4] Migrate deprecated FontChooser to FontDialog #1583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk3.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,48 @@ JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1file_1chooser_1set_1uri)
}
#endif

#ifndef NO_gtk_1font_1chooser_1dialog_1new
JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1font_1chooser_1dialog_1new)
(JNIEnv *env, jclass that, jbyteArray arg0, jlong arg1)
{
jbyte *lparg0=NULL;
jlong rc = 0;
GTK3_NATIVE_ENTER(env, that, gtk_1font_1chooser_1dialog_1new_FUNC);
if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
rc = (jlong)gtk_font_chooser_dialog_new((const gchar *)lparg0, (GtkWindow *)arg1);
fail:
if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
GTK3_NATIVE_EXIT(env, that, gtk_1font_1chooser_1dialog_1new_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1chooser_1get_1font
JNIEXPORT jlong JNICALL GTK3_NATIVE(gtk_1font_1chooser_1get_1font)
(JNIEnv *env, jclass that, jlong arg0)
{
jlong rc = 0;
GTK3_NATIVE_ENTER(env, that, gtk_1font_1chooser_1get_1font_FUNC);
rc = (jlong)gtk_font_chooser_get_font((GtkFontChooser *)arg0);
GTK3_NATIVE_EXIT(env, that, gtk_1font_1chooser_1get_1font_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1chooser_1set_1font
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1font_1chooser_1set_1font)
(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1)
{
jbyte *lparg1=NULL;
GTK3_NATIVE_ENTER(env, that, gtk_1font_1chooser_1set_1font_FUNC);
if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
gtk_font_chooser_set_font((GtkFontChooser *)arg0, (const gchar *)lparg1);
fail:
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
GTK3_NATIVE_EXIT(env, that, gtk_1font_1chooser_1set_1font_FUNC);
}
#endif

#ifndef NO_gtk_1frame_1set_1shadow_1type
JNIEXPORT void JNICALL GTK3_NATIVE(gtk_1frame_1set_1shadow_1type)
(JNIEnv *env, jclass that, jlong arg0, jint arg1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ typedef enum {
gtk_1file_1chooser_1set_1local_1only_FUNC,
gtk_1file_1chooser_1set_1select_1multiple_FUNC,
gtk_1file_1chooser_1set_1uri_FUNC,
gtk_1font_1chooser_1dialog_1new_FUNC,
gtk_1font_1chooser_1get_1font_FUNC,
gtk_1font_1chooser_1set_1font_FUNC,
gtk_1frame_1set_1shadow_1type_FUNC,
gtk_1gesture_1drag_1new_FUNC,
gtk_1gesture_1rotate_1new_FUNC,
Expand Down
106 changes: 106 additions & 0 deletions bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gtk4.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,112 @@ JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1file_1dialog_1set_1title)
}
#endif

#ifndef NO_gtk_1font_1dialog_1choose_1font
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1font_1dialog_1choose_1font)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2, jlong arg3, jlong arg4, jlong arg5)
{
GTK4_NATIVE_ENTER(env, that, gtk_1font_1dialog_1choose_1font_FUNC);
/*
gtk_font_dialog_choose_font(arg0, (GtkWindow *)arg1, (PangoFontDescription *)arg2, (GCancellable *)arg3, (GAsyncReadyCallback)arg4, (gpointer)arg5);
*/
{
GTK4_LOAD_FUNCTION(fp, gtk_font_dialog_choose_font)
if (fp) {
((void (CALLING_CONVENTION*)(jlong, GtkWindow *, PangoFontDescription *, GCancellable *, GAsyncReadyCallback, gpointer))fp)(arg0, (GtkWindow *)arg1, (PangoFontDescription *)arg2, (GCancellable *)arg3, (GAsyncReadyCallback)arg4, (gpointer)arg5);
}
}
GTK4_NATIVE_EXIT(env, that, gtk_1font_1dialog_1choose_1font_FUNC);
}
#endif

#ifndef NO_gtk_1font_1dialog_1choose_1font_1finish
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1font_1dialog_1choose_1font_1finish)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlongArray arg2)
{
jlong *lparg2=NULL;
jlong rc = 0;
GTK4_NATIVE_ENTER(env, that, gtk_1font_1dialog_1choose_1font_1finish_FUNC);
if (arg2) if ((lparg2 = (*env)->GetLongArrayElements(env, arg2, NULL)) == NULL) goto fail;
/*
rc = (jlong)gtk_font_dialog_choose_font_finish(arg0, (GAsyncResult *)arg1, (GError **)lparg2);
*/
{
GTK4_LOAD_FUNCTION(fp, gtk_font_dialog_choose_font_finish)
if (fp) {
rc = (jlong)((jlong (CALLING_CONVENTION*)(jlong, GAsyncResult *, GError **))fp)(arg0, (GAsyncResult *)arg1, (GError **)lparg2);
}
}
fail:
if (arg2 && lparg2) (*env)->ReleaseLongArrayElements(env, arg2, lparg2, 0);
GTK4_NATIVE_EXIT(env, that, gtk_1font_1dialog_1choose_1font_1finish_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1dialog_1new
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1font_1dialog_1new)
(JNIEnv *env, jclass that)
{
jlong rc = 0;
GTK4_NATIVE_ENTER(env, that, gtk_1font_1dialog_1new_FUNC);
/*
rc = (jlong)gtk_font_dialog_new();
*/
{
GTK4_LOAD_FUNCTION(fp, gtk_font_dialog_new)
if (fp) {
rc = (jlong)((jlong (CALLING_CONVENTION*)())fp)();
}
}
GTK4_NATIVE_EXIT(env, that, gtk_1font_1dialog_1new_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1dialog_1set_1modal
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1font_1dialog_1set_1modal)
(JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
{
jlong rc = 0;
GTK4_NATIVE_ENTER(env, that, gtk_1font_1dialog_1set_1modal_FUNC);
/*
rc = (jlong)gtk_font_dialog_set_modal(arg0, (gboolean)arg1);
*/
{
GTK4_LOAD_FUNCTION(fp, gtk_font_dialog_set_modal)
if (fp) {
rc = (jlong)((jlong (CALLING_CONVENTION*)(jlong, gboolean))fp)(arg0, (gboolean)arg1);
}
}
GTK4_NATIVE_EXIT(env, that, gtk_1font_1dialog_1set_1modal_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1dialog_1set_1title
JNIEXPORT jlong JNICALL GTK4_NATIVE(gtk_1font_1dialog_1set_1title)
(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1)
{
jbyte *lparg1=NULL;
jlong rc = 0;
GTK4_NATIVE_ENTER(env, that, gtk_1font_1dialog_1set_1title_FUNC);
if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
/*
rc = (jlong)gtk_font_dialog_set_title(arg0, (char *)lparg1);
*/
{
GTK4_LOAD_FUNCTION(fp, gtk_font_dialog_set_title)
if (fp) {
rc = (jlong)((jlong (CALLING_CONVENTION*)(jlong, char *))fp)(arg0, (char *)lparg1);
}
}
fail:
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
GTK4_NATIVE_EXIT(env, that, gtk_1font_1dialog_1set_1title_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1frame_1set_1child
JNIEXPORT void JNICALL GTK4_NATIVE(gtk_1frame_1set_1child)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ typedef enum {
gtk_1file_1dialog_1set_1initial_1folder_FUNC,
gtk_1file_1dialog_1set_1initial_1name_FUNC,
gtk_1file_1dialog_1set_1title_FUNC,
gtk_1font_1dialog_1choose_1font_FUNC,
gtk_1font_1dialog_1choose_1font_1finish_FUNC,
gtk_1font_1dialog_1new_FUNC,
gtk_1font_1dialog_1set_1modal_FUNC,
gtk_1font_1dialog_1set_1title_FUNC,
gtk_1frame_1set_1child_FUNC,
gtk_1gesture_1click_1new_FUNC,
gtk_1gesture_1drag_1new_FUNC,
Expand Down
42 changes: 0 additions & 42 deletions bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
Original file line number Diff line number Diff line change
Expand Up @@ -4781,48 +4781,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1file_1filter_1set_1name)
}
#endif

#ifndef NO_gtk_1font_1chooser_1dialog_1new
JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1font_1chooser_1dialog_1new)
(JNIEnv *env, jclass that, jbyteArray arg0, jlong arg1)
{
jbyte *lparg0=NULL;
jlong rc = 0;
GTK_NATIVE_ENTER(env, that, gtk_1font_1chooser_1dialog_1new_FUNC);
if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
rc = (jlong)gtk_font_chooser_dialog_new((const gchar *)lparg0, (GtkWindow *)arg1);
fail:
if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
GTK_NATIVE_EXIT(env, that, gtk_1font_1chooser_1dialog_1new_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1chooser_1get_1font
JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1font_1chooser_1get_1font)
(JNIEnv *env, jclass that, jlong arg0)
{
jlong rc = 0;
GTK_NATIVE_ENTER(env, that, gtk_1font_1chooser_1get_1font_FUNC);
rc = (jlong)gtk_font_chooser_get_font((GtkFontChooser *)arg0);
GTK_NATIVE_EXIT(env, that, gtk_1font_1chooser_1get_1font_FUNC);
return rc;
}
#endif

#ifndef NO_gtk_1font_1chooser_1set_1font
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1font_1chooser_1set_1font)
(JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1)
{
jbyte *lparg1=NULL;
GTK_NATIVE_ENTER(env, that, gtk_1font_1chooser_1set_1font_FUNC);
if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
gtk_font_chooser_set_font((GtkFontChooser *)arg0, (const gchar *)lparg1);
fail:
if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
GTK_NATIVE_EXIT(env, that, gtk_1font_1chooser_1set_1font_FUNC);
}
#endif

#ifndef NO_gtk_1frame_1get_1label_1widget
JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1frame_1get_1label_1widget)
(JNIEnv *env, jclass that, jlong arg0)
Expand Down
3 changes: 0 additions & 3 deletions bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,6 @@ typedef enum {
gtk_1file_1filter_1get_1name_FUNC,
gtk_1file_1filter_1new_FUNC,
gtk_1file_1filter_1set_1name_FUNC,
gtk_1font_1chooser_1dialog_1new_FUNC,
gtk_1font_1chooser_1get_1font_FUNC,
gtk_1font_1chooser_1set_1font_FUNC,
gtk_1frame_1get_1label_1widget_FUNC,
gtk_1frame_1new_FUNC,
gtk_1frame_1set_1label_1widget_FUNC,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,22 +776,6 @@ public class GTK extends OS {
*/
public static final native double gtk_gesture_zoom_get_scale_delta(long gesture);

/* GtkFontChooserDialog */
/**
* @param title cast=(const gchar *)
* @param parent cast=(GtkWindow *)
*/
public static final native long gtk_font_chooser_dialog_new(byte[] title, long parent);

/* GtkFontChooser Interface */
/** @param fontchooser cast=(GtkFontChooser *) */
public static final native long gtk_font_chooser_get_font(long fontchooser);
/**
* @param fsd cast=(GtkFontChooser *)
* @param fontname cast=(const gchar *)
*/
public static final native void gtk_font_chooser_set_font(long fsd, byte[] fontname);

/* GtkFrame */
/** @param label cast=(const gchar *) */
public static final native long gtk_frame_new(byte[] label);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,22 @@ public class GTK3 {
*/
public static final native long gtk_gesture_drag_new(long widget);

/* GtkFontChooserDialog */
/**
* @param title cast=(const gchar *)
* @param parent cast=(GtkWindow *)
*/
public static final native long gtk_font_chooser_dialog_new(byte[] title, long parent);

/* GtkFontChooser Interface */
/** @param fontchooser cast=(GtkFontChooser *) */
public static final native long gtk_font_chooser_get_font(long fontchooser);
/**
* @param fsd cast=(GtkFontChooser *)
* @param fontname cast=(const gchar *)
*/
public static final native void gtk_font_chooser_set_font(long fsd, byte[] fontname);

/* Sizeof */
public static final native int GtkTargetEntry_sizeof();
public static final native int GdkEvent_sizeof();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,42 @@ public class GTK4 {
*/
public static final native long gtk_file_dialog_save_finish(long self, long result, long[] error);

/* GtkFontDialog */
/**
* @method flags=dynamic
*
* @param parent cast=(GtkWindow *)
* @param initial_value cast=(PangoFontDescription *)
* @param cancellable cast=(GCancellable *)
* @param callback cast=(GAsyncReadyCallback)
* @param user_data cast=(gpointer)
*/
public static final native void gtk_font_dialog_choose_font(long self, long parent, long initial_value, long cancellable, long callback, long user_data);
/**
* @method flags=dynamic
*
* @param result cast=(GAsyncResult *)
* @param error cast=(GError **)
*/
public static final native long gtk_font_dialog_choose_font_finish(long self, long result, long[] error);
/**
* @method flags=dynamic
*/
public static final native long gtk_font_dialog_new();
/**
* @method flags=dynamic
*
* @param modal cast=(gboolean)
*/
public static final native long gtk_font_dialog_set_modal(long self, boolean modal);
/**
* @method flags=dynamic
*
* @param title cast=(char *)
*/
public static final native long gtk_font_dialog_set_title(long self, byte[] title);


/* GtkScrolledWindow */
public static final native long gtk_scrolled_window_new();
/** @param scrolled_window cast=(GtkScrolledWindow *) */
Expand Down
Loading
Loading