You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
ImageView/ImageButton: don't use deprecated gtk_picture_set_from_pixbuf, reduce code duplication
This commit is contained in:
@@ -210,10 +210,10 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageButton_native_1constructor
|
||||
/*
|
||||
* Class: android_widget_ImageButton
|
||||
* Method: native_setPixbuf
|
||||
* Signature: (J)V
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setPixbuf
|
||||
(JNIEnv *, jobject, jlong);
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_widget_ImageButton
|
||||
|
||||
@@ -210,10 +210,10 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageView_native_1constructor
|
||||
/*
|
||||
* Class: android_widget_ImageView
|
||||
* Method: native_setPixbuf
|
||||
* Signature: (J)V
|
||||
* Signature: (JJ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf
|
||||
(JNIEnv *, jobject, jlong);
|
||||
(JNIEnv *, jobject, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_widget_ImageView
|
||||
|
||||
@@ -19,12 +19,10 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageButton_native_1constructor(JNIE
|
||||
return _INTPTR(button);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setPixbuf(JNIEnv *env, jobject this, jlong pixbuf_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setPixbuf(JNIEnv *env, jobject this, jlong widget_ptr, jlong pixbuf_ptr)
|
||||
{
|
||||
GtkButton *button = _PTR(_GET_LONG_FIELD(this, "widget"));
|
||||
GtkWidget *image = gtk_button_get_child(GTK_BUTTON(button));
|
||||
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
|
||||
gtk_picture_set_pixbuf(GTK_PICTURE(image), pixbuf);
|
||||
GdkPaintable *paintable = GDK_PAINTABLE(gdk_texture_new_for_pixbuf(_PTR(pixbuf_ptr)));
|
||||
Java_android_widget_ImageButton_native_1setDrawable(env, this, widget_ptr, _INTPTR(paintable));
|
||||
}
|
||||
|
||||
struct touch_callback_data {
|
||||
@@ -65,7 +63,7 @@ JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setOnClickListene
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageButton_native_1setDrawable(JNIEnv *env, jobject this, jlong widget_ptr, jlong paintable_ptr)
|
||||
{
|
||||
GtkButton *button = _PTR(_GET_LONG_FIELD(this, "widget"));
|
||||
GtkButton *button = _PTR(widget_ptr);
|
||||
GtkPicture *picture = GTK_PICTURE(gtk_button_get_child(GTK_BUTTON(button)));
|
||||
GdkPaintable *paintable = _PTR(paintable_ptr);
|
||||
gtk_picture_set_paintable(picture, paintable);
|
||||
|
||||
@@ -25,11 +25,10 @@ JNIEXPORT jlong JNICALL Java_android_widget_ImageView_native_1constructor(JNIEnv
|
||||
return _INTPTR(image);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf(JNIEnv *env, jobject this, jlong pixbuf_ptr)
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setPixbuf(JNIEnv *env, jobject this, jlong widget_ptr, jlong pixbuf_ptr)
|
||||
{
|
||||
GtkWidget *image = _PTR(_GET_LONG_FIELD(this, "widget"));
|
||||
GdkPixbuf *pixbuf = _PTR(pixbuf_ptr);
|
||||
gtk_picture_set_pixbuf(GTK_PICTURE(image), pixbuf);
|
||||
GdkPaintable *paintable = GDK_PAINTABLE(gdk_texture_new_for_pixbuf(_PTR(pixbuf_ptr)));
|
||||
Java_android_widget_ImageView_native_1setDrawable(env, this, widget_ptr, _INTPTR(paintable));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_ImageView_native_1setDrawable(JNIEnv *env, jobject this, jlong widget_ptr, jlong paintable_ptr)
|
||||
|
||||
Reference in New Issue
Block a user