diff options
author | Bogdan Gheorghe <gheorghe> | 2009-11-11 17:14:15 +0000 |
---|---|---|
committer | Bogdan Gheorghe <gheorghe> | 2009-11-11 17:14:15 +0000 |
commit | 13a025bd51afcbc91969bc9e2cc641b3f36fec4c (patch) | |
tree | 44c80ab5c24ab0e20d5cf5f0ecc08b8c5b667108 /bundles/org.eclipse.swt | |
parent | 7626ff31966ce4808bcae79f4d61b2fe12aacf96 (diff) | |
download | eclipse.platform.swt-13a025bd51afcbc91969bc9e2cc641b3f36fec4c.tar.gz eclipse.platform.swt-13a025bd51afcbc91969bc9e2cc641b3f36fec4c.tar.xz eclipse.platform.swt-13a025bd51afcbc91969bc9e2cc641b3f36fec4c.zip |
215377 Program.getExtensions() return an empty array on Linux/GTK
Diffstat (limited to 'bundles/org.eclipse.swt')
10 files changed, 1248 insertions, 27 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ImageTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ImageTransfer.java index 16d78823a0..c4875c1bf9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ImageTransfer.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/gtk/org/eclipse/swt/dnd/ImageTransfer.java @@ -141,7 +141,6 @@ public Object nativeToJava(TransferData transferData) { OS.gdk_pixbuf_loader_close(loader, null); int /*long*/ pixbuf = OS.gdk_pixbuf_loader_get_pixbuf(loader); if (pixbuf != 0) { - OS.g_object_ref(pixbuf); int /*long*/ [] pixmap_return = new int /*long*/ [1]; OS.gdk_pixbuf_render_pixmap_and_mask(pixbuf, pixmap_return, null, 0); int /*long*/ handle = pixmap_return[0]; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh index 996a1df05c..97adf0bc30 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/build.sh @@ -55,6 +55,9 @@ esac if [ "${MODEL}" = "" ]; then if uname -i > /dev/null 2>&1; then MODEL=`uname -i` + if [ ${MODEL} = 'unknown' ]; then + MODEL=`uname -m` + fi else MODEL=`uname -m` fi diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak index 5f2da181fe..cb1de94489 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_linux.mak @@ -117,7 +117,7 @@ ifndef NO_STRIP LIBS := $(LIBS) -s endif -all: make_swt make_atk make_gnome make_glx +all: make_swt make_atk make_glx # # SWT libs 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 cf4d3d39bc..bdb4ea46e9 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 @@ -2300,6 +2300,237 @@ fail: } #endif +#ifndef NO__1g_1app_1info_1create_1from_1commandline +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1create_1from_1commandline) + (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jintLong arg2, jintLong arg3) +{ + jbyte *lparg0=NULL; + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1create_1from_1commandline_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_app_info_create_from_commandline(lparg0, lparg1, arg2, arg3); +*/ + { + LOAD_FUNCTION(fp, g_app_info_create_from_commandline) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *, jbyte *, jintLong, jintLong))fp)(lparg0, lparg1, arg2, arg3); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1create_1from_1commandline_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1get_1all +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1get_1all) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1get_1all_FUNC); +/* + rc = (jintLong)g_app_info_get_all(); +*/ + { + LOAD_FUNCTION(fp, g_app_info_get_all) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1get_1all_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1get_1default_1for_1type +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1get_1default_1for_1type) + (JNIEnv *env, jclass that, jbyteArray arg0, jboolean arg1) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1get_1default_1for_1type_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_app_info_get_default_for_type(lparg0, arg1); +*/ + { + LOAD_FUNCTION(fp, g_app_info_get_default_for_type) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *, jboolean))fp)(lparg0, arg1); + } + } +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1get_1default_1for_1type_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1get_1executable +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1get_1executable) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1get_1executable_FUNC); +/* + rc = (jintLong)g_app_info_get_executable(arg0); +*/ + { + LOAD_FUNCTION(fp, g_app_info_get_executable) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1get_1executable_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1get_1icon +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1get_1icon) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1get_1icon_FUNC); +/* + rc = (jintLong)g_app_info_get_icon(arg0); +*/ + { + LOAD_FUNCTION(fp, g_app_info_get_icon) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1get_1icon_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1get_1id +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1get_1id) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1get_1id_FUNC); +/* + rc = (jintLong)g_app_info_get_id(arg0); +*/ + { + LOAD_FUNCTION(fp, g_app_info_get_id) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1get_1id_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1get_1name +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1app_1info_1get_1name) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1get_1name_FUNC); +/* + rc = (jintLong)g_app_info_get_name(arg0); +*/ + { + LOAD_FUNCTION(fp, g_app_info_get_name) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1get_1name_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1launch +JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1app_1info_1launch) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1launch_FUNC); +/* + rc = (jboolean)g_app_info_launch(arg0, arg1, arg2, arg3); +*/ + { + LOAD_FUNCTION(fp, g_app_info_launch) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jintLong, jintLong, jintLong))fp)(arg0, arg1, arg2, arg3); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1launch_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1launch_1default_1for_1uri +JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1app_1info_1launch_1default_1for_1uri) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1launch_1default_1for_1uri_FUNC); +/* + rc = (jboolean)g_app_info_launch_default_for_uri(arg0, arg1, arg2); +*/ + { + LOAD_FUNCTION(fp, g_app_info_launch_default_for_uri) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong, jintLong, jintLong))fp)(arg0, arg1, arg2); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1launch_1default_1for_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1should_1show +JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1app_1info_1should_1show) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1should_1show_FUNC); +/* + rc = (jboolean)g_app_info_should_show(arg0); +*/ + { + LOAD_FUNCTION(fp, g_app_info_should_show) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1should_1show_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1app_1info_1supports_1uris +JNIEXPORT jboolean JNICALL OS_NATIVE(_1g_1app_1info_1supports_1uris) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jboolean rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1app_1info_1supports_1uris_FUNC); +/* + rc = (jboolean)g_app_info_supports_uris(arg0); +*/ + { + LOAD_FUNCTION(fp, g_app_info_supports_uris) + if (fp) { + rc = (jboolean)((jboolean (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1app_1info_1supports_1uris_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1cclosure_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1cclosure_1new) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) @@ -2334,6 +2565,268 @@ JNIEXPORT void JNICALL OS_NATIVE(_1g_1closure_1unref) } #endif +#ifndef NO__1g_1content_1type_1get_1mime_1type +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1content_1type_1get_1mime_1type) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1content_1type_1get_1mime_1type_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_content_type_get_mime_type(lparg0); +*/ + { + LOAD_FUNCTION(fp, g_content_type_get_mime_type) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *))fp)(lparg0); + } + } +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1content_1type_1get_1mime_1type_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1content_1types_1get_1registered +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1content_1types_1get_1registered) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1content_1types_1get_1registered_FUNC); +/* + rc = (jintLong)g_content_types_get_registered(); +*/ + { + LOAD_FUNCTION(fp, g_content_types_get_registered) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } + OS_NATIVE_EXIT(env, that, _1g_1content_1types_1get_1registered_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1data_1input_1stream_1new +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1data_1input_1stream_1new) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1data_1input_1stream_1new_FUNC); +/* + rc = (jintLong)g_data_input_stream_new(arg0); +*/ + { + LOAD_FUNCTION(fp, g_data_input_stream_new) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1data_1input_1stream_1new_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1data_1input_1stream_1read_1line +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1data_1input_1stream_1read_1line) + (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1, jintLong arg2, jintLong arg3) +{ + jint *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1data_1input_1stream_1read_1line_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_data_input_stream_read_line(arg0, lparg1, arg2, arg3); +*/ + { + LOAD_FUNCTION(fp, g_data_input_stream_read_line) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jint *, jintLong, jintLong))fp)(arg0, lparg1, arg2, arg3); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1data_1input_1stream_1read_1line_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1desktop_1app_1info_1new_1from_1filename +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1desktop_1app_1info_1new_1from_1filename) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1desktop_1app_1info_1new_1from_1filename_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_desktop_app_info_new_from_filename(lparg0); +*/ + { + LOAD_FUNCTION(fp, g_desktop_app_info_new_from_filename) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *))fp)(lparg0); + } + } +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1desktop_1app_1info_1new_1from_1filename_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1file_1get_1path +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1get_1path) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1get_1path_FUNC); +/* + rc = (jintLong)g_file_get_path(arg0); +*/ + { + LOAD_FUNCTION(fp, g_file_get_path) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1file_1get_1path_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1file_1get_1uri +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1get_1uri) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1get_1uri_FUNC); +/* + rc = (jintLong)g_file_get_uri(arg0); +*/ + { + LOAD_FUNCTION(fp, g_file_get_uri) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1file_1get_1uri_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1file_1icon_1get_1file +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1icon_1get_1file) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1icon_1get_1file_FUNC); +/* + rc = (jintLong)g_file_icon_get_file(arg0); +*/ + { + LOAD_FUNCTION(fp, g_file_icon_get_file) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1file_1icon_1get_1file_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1file_1info_1get_1modification_1time +JNIEXPORT void JNICALL OS_NATIVE(_1g_1file_1info_1get_1modification_1time) + (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1) +{ + jintLong *lparg1=NULL; + OS_NATIVE_ENTER(env, that, _1g_1file_1info_1get_1modification_1time_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + g_file_info_get_modification_time(arg0, lparg1); +*/ + { + LOAD_FUNCTION(fp, g_file_info_get_modification_time) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jintLong *))fp)(arg0, lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1file_1info_1get_1modification_1time_FUNC); +} +#endif + +#ifndef NO__1g_1file_1new_1for_1path +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1new_1for_1path) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1new_1for_1path_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_file_new_for_path(lparg0); +*/ + { + LOAD_FUNCTION(fp, g_file_new_for_path) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *))fp)(lparg0); + } + } +fail: + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1file_1new_1for_1path_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1file_1query_1info +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1query_1info) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintLong arg2, jintLong arg3, jintLong arg4) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1query_1info_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_file_query_info(arg0, lparg1, arg2, arg3, arg4); +*/ + { + LOAD_FUNCTION(fp, g_file_query_info) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jbyte *, jintLong, jintLong, jintLong))fp)(arg0, lparg1, arg2, arg3, arg4); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1file_1query_1info_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1file_1read +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1file_1read) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1file_1read_FUNC); +/* + rc = (jintLong)g_file_read(arg0, arg1, arg2); +*/ + { + LOAD_FUNCTION(fp, g_file_read) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jintLong, jintLong))fp)(arg0, arg1, arg2); + } + } + OS_NATIVE_EXIT(env, that, _1g_1file_1read_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1filename_1from_1uri JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1filename_1from_1uri) (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1, jintLongArray arg2) @@ -2423,6 +2916,53 @@ JNIEXPORT void JNICALL OS_NATIVE(_1g_1free) } #endif +#ifndef NO__1g_1icon_1new_1for_1string +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1icon_1new_1for_1string) + (JNIEnv *env, jclass that, jbyteArray arg0, jintLongArray arg1) +{ + jbyte *lparg0=NULL; + jintLong *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1icon_1new_1for_1string_FUNC); + if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; + if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)g_icon_new_for_string(lparg0, lparg1); +*/ + { + LOAD_FUNCTION(fp, g_icon_new_for_string) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jbyte *, jintLong *))fp)(lparg0, lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0); + if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + OS_NATIVE_EXIT(env, that, _1g_1icon_1new_1for_1string_FUNC); + return rc; +} +#endif + +#ifndef NO__1g_1icon_1to_1string +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1icon_1to_1string) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1icon_1to_1string_FUNC); +/* + rc = (jintLong)g_icon_to_string(arg0); +*/ + { + LOAD_FUNCTION(fp, g_icon_to_string) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1icon_1to_1string_FUNC); + return rc; +} +#endif + #ifndef NO__1g_1idle_1add JNIEXPORT jint JNICALL OS_NATIVE(_1g_1idle_1add) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) @@ -8656,6 +9196,30 @@ fail: } #endif +#ifndef NO__1gtk_1icon_1info_1load_1icon +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1icon_1info_1load_1icon) + (JNIEnv *env, jclass that, jintLong arg0, jintLongArray arg1) +{ + jintLong *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1icon_1info_1load_1icon_FUNC); + if (arg1) if ((lparg1 = (*env)->GetIntLongArrayElements(env, arg1, NULL)) == NULL) goto fail; +/* + rc = (jintLong)gtk_icon_info_load_icon(arg0, lparg1); +*/ + { + LOAD_FUNCTION(fp, gtk_icon_info_load_icon) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jintLong *))fp)(arg0, lparg1); + } + } +fail: + if (arg1 && lparg1) (*env)->ReleaseIntLongArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1gtk_1icon_1info_1load_1icon_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1icon_1set_1render_1icon JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1icon_1set_1render_1icon) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3, jint arg4, jintLong arg5, jintLong arg6) @@ -8700,6 +9264,46 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1icon_1source_1set_1pixbuf) } #endif +#ifndef NO__1gtk_1icon_1theme_1get_1default +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1icon_1theme_1get_1default) + (JNIEnv *env, jclass that) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1icon_1theme_1get_1default_FUNC); +/* + rc = (jintLong)gtk_icon_theme_get_default(); +*/ + { + LOAD_FUNCTION(fp, gtk_icon_theme_get_default) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)())fp)(); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1icon_1theme_1get_1default_FUNC); + return rc; +} +#endif + +#ifndef NO__1gtk_1icon_1theme_1lookup_1by_1gicon +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1icon_1theme_1lookup_1by_1gicon) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jint arg3) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1icon_1theme_1lookup_1by_1gicon_FUNC); +/* + rc = (jintLong)gtk_icon_theme_lookup_by_gicon(arg0, arg1, arg2, arg3); +*/ + { + LOAD_FUNCTION(fp, gtk_icon_theme_lookup_by_gicon) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jintLong, jint, jint))fp)(arg0, arg1, arg2, arg3); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1icon_1theme_1lookup_1by_1gicon_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1im_1context_1filter_1keypress JNIEXPORT jboolean JNICALL OS_NATIVE(_1gtk_1im_1context_1filter_1keypress) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 190e7e50f9..c84b4768ca 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -85,6 +85,9 @@ #define gtk_expander_set_label_LIB "libgtk-x11-2.0.so.0" #define gtk_expander_set_label_widget_LIB "libgtk-x11-2.0.so.0" #define gtk_label_set_line_wrap_mode_LIB "libgtk-x11-2.0.so.0" +#define gtk_icon_info_load_icon_LIB "libgtk-x11-2.0.so.0" +#define gtk_icon_theme_lookup_by_gicon_LIB "libgtk-x11-2.0.so.0" +#define gtk_icon_theme_get_default_LIB "libgtk-x11-2.0.so.0" #define gtk_menu_shell_set_take_focus_LIB "libgtk-x11-2.0.so.0" #define gtk_window_set_keep_below_LIB "libgtk-x11-2.0.so.0" #define gtk_tooltip_trigger_tooltip_query_LIB "libgtk-x11-2.0.so.0" @@ -213,6 +216,32 @@ #define gtk_printer_is_default_LIB "libgtk-x11-2.0.so.0" #define FcConfigAppFontAddFile_LIB "libfontconfig.so.1" +#define g_app_info_create_from_commandline_LIB "libgio-2.0.so.0" +#define g_app_info_get_all_LIB "libgio-2.0.so.0" +#define g_app_info_get_executable_LIB "libgio-2.0.so.0" +#define g_app_info_get_icon_LIB "libgio-2.0.so.0" +#define g_app_info_get_id_LIB "libgio-2.0.so.0" +#define g_app_info_get_name_LIB "libgio-2.0.so.0" +#define g_app_info_launch_LIB "libgio-2.0.so.0" +#define g_app_info_get_default_for_type_LIB "libgio-2.0.so.0" +#define g_app_info_launch_default_for_uri_LIB "libgio-2.0.so.0" +#define g_app_info_supports_uris_LIB "libgio-2.0.so.0" +#define g_app_info_should_show_LIB "libgio-2.0.so.0" +#define g_data_input_stream_new_LIB "libgio-2.0.so.0" +#define g_data_input_stream_read_line_LIB "libgio-2.0.so.0" +#define g_content_type_get_mime_type_LIB "libgio-2.0.so.0" +#define g_content_types_get_registered_LIB "libgio-2.0.so.0" +#define g_desktop_app_info_new_from_filename_LIB "libgio-2.0.so.0" +#define g_file_get_path_LIB "libgio-2.0.so.0" +#define g_file_get_uri_LIB "libgio-2.0.so.0" +#define g_file_icon_get_file_LIB "libgio-2.0.so.0" +#define g_file_info_get_modification_time_LIB "libgio-2.0.so.0" +#define g_file_new_for_path_LIB "libgio-2.0.so.0" +#define g_file_read_LIB "libgio-2.0.so.0" +#define g_icon_to_string_LIB "libgio-2.0.so.0" +#define g_icon_new_for_string_LIB "libgio-2.0.so.0" +#define g_file_query_info_LIB "libgio-2.0.so.0" + /* Field accessors */ #define G_OBJECT_CLASS_CONSTRUCTOR(arg0) (arg0)->constructor #define G_OBJECT_CLASS_SET_CONSTRUCTOR(arg0, arg1) (arg0)->constructor = (GObject* (*) (GType, guint, GObjectConstructParam *))arg1 diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index bea26506c0..02037298d8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1299; -int OS_nativeFunctionCallCount[1299]; +int OS_nativeFunctionCount = 1327; +int OS_nativeFunctionCallCount[1327]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -207,14 +207,39 @@ char * OS_nativeFunctionNames[] = { "_1dlclose", "_1dlopen", "_1dlsym", + "_1g_1app_1info_1create_1from_1commandline", + "_1g_1app_1info_1get_1all", + "_1g_1app_1info_1get_1default_1for_1type", + "_1g_1app_1info_1get_1executable", + "_1g_1app_1info_1get_1icon", + "_1g_1app_1info_1get_1id", + "_1g_1app_1info_1get_1name", + "_1g_1app_1info_1launch", + "_1g_1app_1info_1launch_1default_1for_1uri", + "_1g_1app_1info_1should_1show", + "_1g_1app_1info_1supports_1uris", "_1g_1cclosure_1new", "_1g_1closure_1ref", "_1g_1closure_1unref", + "_1g_1content_1type_1get_1mime_1type", + "_1g_1content_1types_1get_1registered", + "_1g_1data_1input_1stream_1new", + "_1g_1data_1input_1stream_1read_1line", + "_1g_1desktop_1app_1info_1new_1from_1filename", + "_1g_1file_1get_1path", + "_1g_1file_1get_1uri", + "_1g_1file_1icon_1get_1file", + "_1g_1file_1info_1get_1modification_1time", + "_1g_1file_1new_1for_1path", + "_1g_1file_1query_1info", + "_1g_1file_1read", "_1g_1filename_1from_1uri", "_1g_1filename_1from_1utf8", "_1g_1filename_1to_1uri", "_1g_1filename_1to_1utf8", "_1g_1free", + "_1g_1icon_1new_1for_1string", + "_1g_1icon_1to_1string", "_1g_1idle_1add", "_1g_1list_1append", "_1g_1list_1data", @@ -700,10 +725,13 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1hscrollbar_1new", "_1gtk_1hseparator_1new", "_1gtk_1icon_1factory_1lookup_1default", + "_1gtk_1icon_1info_1load_1icon", "_1gtk_1icon_1set_1render_1icon", "_1gtk_1icon_1source_1free", "_1gtk_1icon_1source_1new", "_1gtk_1icon_1source_1set_1pixbuf", + "_1gtk_1icon_1theme_1get_1default", + "_1gtk_1icon_1theme_1lookup_1by_1gicon", "_1gtk_1im_1context_1filter_1keypress", "_1gtk_1im_1context_1focus_1in", "_1gtk_1im_1context_1focus_1out", 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 20e32905d0..fe0bc5e60a 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 @@ -215,14 +215,39 @@ typedef enum { _1dlclose_FUNC, _1dlopen_FUNC, _1dlsym_FUNC, + _1g_1app_1info_1create_1from_1commandline_FUNC, + _1g_1app_1info_1get_1all_FUNC, + _1g_1app_1info_1get_1default_1for_1type_FUNC, + _1g_1app_1info_1get_1executable_FUNC, + _1g_1app_1info_1get_1icon_FUNC, + _1g_1app_1info_1get_1id_FUNC, + _1g_1app_1info_1get_1name_FUNC, + _1g_1app_1info_1launch_FUNC, + _1g_1app_1info_1launch_1default_1for_1uri_FUNC, + _1g_1app_1info_1should_1show_FUNC, + _1g_1app_1info_1supports_1uris_FUNC, _1g_1cclosure_1new_FUNC, _1g_1closure_1ref_FUNC, _1g_1closure_1unref_FUNC, + _1g_1content_1type_1get_1mime_1type_FUNC, + _1g_1content_1types_1get_1registered_FUNC, + _1g_1data_1input_1stream_1new_FUNC, + _1g_1data_1input_1stream_1read_1line_FUNC, + _1g_1desktop_1app_1info_1new_1from_1filename_FUNC, + _1g_1file_1get_1path_FUNC, + _1g_1file_1get_1uri_FUNC, + _1g_1file_1icon_1get_1file_FUNC, + _1g_1file_1info_1get_1modification_1time_FUNC, + _1g_1file_1new_1for_1path_FUNC, + _1g_1file_1query_1info_FUNC, + _1g_1file_1read_FUNC, _1g_1filename_1from_1uri_FUNC, _1g_1filename_1from_1utf8_FUNC, _1g_1filename_1to_1uri_FUNC, _1g_1filename_1to_1utf8_FUNC, _1g_1free_FUNC, + _1g_1icon_1new_1for_1string_FUNC, + _1g_1icon_1to_1string_FUNC, _1g_1idle_1add_FUNC, _1g_1list_1append_FUNC, _1g_1list_1data_FUNC, @@ -708,10 +733,13 @@ typedef enum { _1gtk_1hscrollbar_1new_FUNC, _1gtk_1hseparator_1new_FUNC, _1gtk_1icon_1factory_1lookup_1default_FUNC, + _1gtk_1icon_1info_1load_1icon_FUNC, _1gtk_1icon_1set_1render_1icon_FUNC, _1gtk_1icon_1source_1free_FUNC, _1gtk_1icon_1source_1new_FUNC, _1gtk_1icon_1source_1set_1pixbuf_FUNC, + _1gtk_1icon_1theme_1get_1default_FUNC, + _1gtk_1icon_1theme_1lookup_1by_1gicon_FUNC, _1gtk_1im_1context_1filter_1keypress_FUNC, _1gtk_1im_1context_1focus_1in_FUNC, _1gtk_1im_1context_1focus_1out_FUNC, 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 56fe30e18e..fa474402ad 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 @@ -389,6 +389,9 @@ public class OS extends C { public static final int G_LOG_FLAG_FATAL = 0x2; public static final int G_LOG_FLAG_RECURSION = 0x1; public static final int G_LOG_LEVEL_MASK = 0xfffffffc; + public static final int G_APP_INFO_CREATE_NONE = 0; + public static final int G_APP_INFO_CREATE_NEEDS_TERMINAL = (1 << 0); + public static final int G_APP_INFO_CREATE_SUPPORTS_URIS = (1 << 1); public static final int None = 0; public static final int PANGO_ALIGN_LEFT = 0; public static final int PANGO_ALIGN_CENTER = 1; @@ -1768,6 +1771,264 @@ public static final int /*long*/ dlsym(int /*long*/ handle, byte[] symbol) { lock.unlock(); } } +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_create_from_commandline(byte[] commandline, byte[] applName, int /*long*/ flags, int /*long*/ error); +public static final int /*long*/ g_app_info_create_from_commandline(byte[] commandline, byte[] applName, int /*long*/ flags, int /*long*/ error) { + lock.lock(); + try { + return _g_app_info_create_from_commandline(commandline, applName, flags, error); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_get_all(); +public static final int /*long*/ g_app_info_get_all() { + lock.lock(); + try { + return _g_app_info_get_all(); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_get_executable(int /*long*/ appInfo); +public static final int /*long*/ g_app_info_get_executable(int /*long*/ appInfo) { + lock.lock(); + try { + return _g_app_info_get_executable(appInfo); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_get_icon(int /*long*/ appInfo); +public static final int /*long*/ g_app_info_get_icon(int /*long*/ appInfo) { + lock.lock(); + try { + return _g_app_info_get_icon(appInfo); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_get_id(int /*long*/ appInfo); +public static final int /*long*/ g_app_info_get_id(int /*long*/ appInfo) { + lock.lock(); + try { + return _g_app_info_get_id(appInfo); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_get_name(int /*long*/ appInfo); +public static final int /*long*/ g_app_info_get_name(int /*long*/ appInfo) { + lock.lock(); + try { + return _g_app_info_get_name(appInfo); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _g_app_info_launch(int /*long*/ appInfo, int /*long*/ list, int /*long*/ launchContext, int /*long*/ error); +public static final boolean g_app_info_launch(int /*long*/ appInfo, int /*long*/ list, int /*long*/ launchContext, int /*long*/ error) { + lock.lock(); + try { + return _g_app_info_launch(appInfo, list, launchContext, error); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_app_info_get_default_for_type(byte[] mimeType, boolean mustSupportURIs); +public static final int /*long*/ g_app_info_get_default_for_type(byte[] mimeType, boolean mustSupportURIs) { + lock.lock(); + try { + return _g_app_info_get_default_for_type(mimeType, mustSupportURIs); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _g_app_info_launch_default_for_uri(int /*long*/ uri, int /*long*/ launchContext, int /*long*/ error); +public static final boolean g_app_info_launch_default_for_uri(int /*long*/ appInfo, int /*long*/ launchContext, int /*long*/ error) { + lock.lock(); + try { + return _g_app_info_launch_default_for_uri(appInfo, launchContext, error); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _g_app_info_should_show(int /*long*/ appInfo); +public static final boolean g_app_info_should_show(int /*long*/ appInfo) { + lock.lock(); + try { + return _g_app_info_should_show(appInfo); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native boolean _g_app_info_supports_uris(int /*long*/ appInfo); +public static final boolean g_app_info_supports_uris(int /*long*/ appInfo) { + lock.lock(); + try { + return _g_app_info_supports_uris(appInfo); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_data_input_stream_new(int /*long*/ input_stream); +public static final int /*long*/ g_data_input_stream_new(int /*long*/ input_stream) { + lock.lock(); + try { + return _g_data_input_stream_new(input_stream); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_data_input_stream_read_line(int /*long*/ stream, int[] count, int /*long*/ cancellable, int /*long*/ error); +public static final int /*long*/ g_data_input_stream_read_line(int /*long*/ stream, int[] count, int /*long*/ cancellable, int /*long*/ error) { + lock.lock(); + try { + return _g_data_input_stream_read_line(stream, count, cancellable, error); + } finally { + lock.unlock(); + } +} + +//gboolean g_content_type_is_unknown (const char *type); +///** @method flags=dynamic */ +//public static final native int /*long*/ _g_content_type_get_mime_type(int /*long*/ type); +//public static final int /*long*/ g_content_type_get_mime_type(int /*long*/ type) { +// +//} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_content_type_get_mime_type(byte[] mime_type); +public static final int /*long*/ g_content_type_get_mime_type(byte[] mime_type) { + lock.lock(); + try { + return _g_content_type_get_mime_type(mime_type); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_content_types_get_registered(); +public static final int /*long*/ g_content_types_get_registered() { + lock.lock(); + try { + return _g_content_types_get_registered(); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_desktop_app_info_new_from_filename(byte[] fileName); +public static final int /*long*/ g_desktop_app_info_new_from_filename(byte[] fileName) { + lock.lock(); + try { + return _g_desktop_app_info_new_from_filename(fileName); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_file_get_path(int /*long*/ file); +public static final int /*long*/ g_file_get_path (int /*long*/ file) { + lock.lock(); + try { + return _g_file_get_path(file); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_file_get_uri(int /*long*/ file); +public static final int /*long*/ g_file_get_uri (int /*long*/ file) { + lock.lock(); + try { + return _g_file_get_uri(file); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native void _g_file_info_get_modification_time(int /*long*/ info, int /*long*/[] result); +public static final void g_file_info_get_modification_time(int /*long*/ info, int /*long*/[] result) { + lock.lock(); + try { + _g_file_info_get_modification_time(info, result); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_file_icon_get_file(int /*long*/ icon); +public static final int /*long*/ g_file_icon_get_file(int /*long*/ icon) { + lock.lock(); + try { + return _g_file_icon_get_file(icon); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_file_new_for_path(byte[] fileName); +public static final int /*long*/ g_file_new_for_path(byte[] fileName) { + lock.lock(); + try { + return _g_file_new_for_path(fileName); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_file_query_info (int /*long*/ file, byte[] attributes, int /*long*/ flags, int /*long*/ cancellable, int /*long*/ error); +public static final int /*long*/ g_file_query_info (int /*long*/ file,byte[] attributes, int /*long*/ flags, int /*long*/ cancellable, int /*long*/ error) { + lock.lock(); + try { + return _g_file_query_info (file, attributes, flags, cancellable, error); + } finally { + lock.unlock(); + } +} + +/** @method flags=dynamic */ +public static final native int /*long*/ _g_file_read(int /*long*/ file, int /*long*/ cancellable, int /*long*/ error); +public static final int /*long*/ g_file_read(int /*long*/ file, int /*long*/ cancellable, int /*long*/ error) { + lock.lock(); + try { + return _g_file_read(file, cancellable, error); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_icon_to_string(int /*long*/ icon); +public static final int /*long*/ g_icon_to_string (int /*long*/ icon) { + lock.lock(); + try { + return _g_icon_to_string(icon); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ +public static final native int /*long*/ _g_icon_new_for_string(byte[] str, int /*long*/ error[]); +public static final int /*long*/ g_icon_new_for_string (byte[] str, int /*long*/ error[]) { + lock.lock(); + try { + return _g_icon_new_for_string(str, error); + } finally { + lock.unlock(); + } +} /** * @param signal_id cast=(guint) * @param detail cast=(GQuark) @@ -7042,6 +7303,42 @@ public static final int /*long*/ gtk_icon_set_render_icon(int /*long*/ icon_set, } } /** + * @method flags=dynamic + */ +public static final native int /*long*/ _gtk_icon_theme_get_default(); +public static final int /*long*/ gtk_icon_theme_get_default() { + lock.lock(); + try { + return _gtk_icon_theme_get_default (); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + */ +public static final native int /*long*/ _gtk_icon_theme_lookup_by_gicon(int /*long*/ icon_theme, int /*long*/ icon, int size, int flags); +public static final int /*long*/ gtk_icon_theme_lookup_by_gicon(int /*long*/ icon_theme, int /*long*/ icon, int size, int flags) { + lock.lock(); + try { + return _gtk_icon_theme_lookup_by_gicon (icon_theme, icon, size, flags); + } finally { + lock.unlock(); + } +} +/** + * @method flags=dynamic + */ +public static final native int /*long*/ _gtk_icon_info_load_icon(int /*long*/ icon_info, int /*long*/ error[]); +public static final int /*long*/ gtk_icon_info_load_icon(int /*long*/ icon_info, int /*long*/ error[]) { + lock.lock(); + try { + return _gtk_icon_info_load_icon(icon_info, error); + } finally { + lock.unlock(); + } +} +/** * @param context cast=(GtkIMContext *) * @param event cast=(GdkEventKey *) */ diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java index 57456d5c67..fabc46ced4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java @@ -36,12 +36,15 @@ public final class Program { String iconPath; Display display; - /* Gnome specific + /* Gnome & GIO specific * true if command expects a URI * false if expects a path */ boolean gnomeExpectUri; + static int modTime; + static Hashtable mimeTable; + static int /*long*/ cdeShell; static final String[] CDE_ICON_EXT = { ".m.pm", ".l.pm", ".s.pm", ".t.pm" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ @@ -53,7 +56,8 @@ public final class Program { static final int DESKTOP_UNKNOWN = 0; static final int DESKTOP_GNOME = 1; static final int DESKTOP_GNOME_24 = 2; - static final int DESKTOP_CDE = 3; + static final int DESKTOP_GIO = 3; + static final int DESKTOP_CDE = 4; static final int PREFERRED_ICON_SIZE = 16; /** @@ -107,19 +111,31 @@ static int getDesktop(final Display display) { * Note. gnome_icon_theme_new uses g_object_new to allocate the * data it returns. Use g_object_unref to free the pointer it returns. */ - if (gnomeIconTheme.value != 0) GNOME.g_object_unref(gnomeIconTheme.value); + if (gnomeIconTheme.value != 0) OS.g_object_unref(gnomeIconTheme.value); } }); - /* Check for libgnomevfs-2 version 2.4 */ - byte[] buffer = Converter.wcsToMbcs(null, "libgnomevfs-2.so.0", true); - int /*long*/ libgnomevfs = OS.dlopen(buffer, OS.RTLD_LAZY); - if (libgnomevfs != 0) { - buffer = Converter.wcsToMbcs(null, "gnome_vfs_url_show", true); - int /*long*/ gnome_vfs_url_show = OS.dlsym(libgnomevfs, buffer); - if (gnome_vfs_url_show != 0) { - desktop = DESKTOP_GNOME_24; + /* Check for the existence of libgio libraries */ + byte[] buffer = Converter.wcsToMbcs(null, "libgio-2.0.so.0", true); + int /*long*/ libgio = OS.dlopen(buffer, OS.RTLD_LAZY); + if (libgio != 0) { + buffer = Converter.wcsToMbcs(null, "g_app_info_launch_default_for_uri", true); + int /*long*/ g_app_info_launch_default_for_uri = OS.dlsym(libgio, buffer); + if (g_app_info_launch_default_for_uri != 0) { + desktop = DESKTOP_GIO; + } + OS.dlclose(libgio); + } else { + /* Check for libgnomevfs-2 version 2.4 */ + buffer = Converter.wcsToMbcs(null, "libgnomevfs-2.so.0", true); + int /*long*/ libgnomevfs = OS.dlopen(buffer, OS.RTLD_LAZY); + if (libgnomevfs != 0) { + buffer = Converter.wcsToMbcs(null, "gnome_vfs_url_show", true); + int /*long*/ gnome_vfs_url_show = OS.dlsym(libgnomevfs, buffer); + if (gnome_vfs_url_show != 0) { + desktop = DESKTOP_GNOME_24; + } + OS.dlclose(libgnomevfs); } - OS.dlclose(libgnomevfs); } } } @@ -562,6 +578,7 @@ static Program findProgram(Display display, String extension) { int desktop = getDesktop(display); String mimeType = null; switch (desktop) { + case DESKTOP_GIO: mimeType = gio_getMimeType(extension); break; case DESKTOP_GNOME_24: case DESKTOP_GNOME: mimeType = gnome_getMimeType(extension); break; case DESKTOP_CDE: mimeType = cde_getMimeType(extension); break; @@ -569,7 +586,8 @@ static Program findProgram(Display display, String extension) { if (mimeType == null) return null; Program program = null; switch (desktop) { - case DESKTOP_GNOME_24: + case DESKTOP_GIO: program = gio_getProgram(display, mimeType); break; + case DESKTOP_GNOME_24: case DESKTOP_GNOME: program = gnome_getProgram(display, mimeType); break; case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break; } @@ -595,6 +613,7 @@ static String[] getExtensions(Display display) { int desktop = getDesktop(display); Hashtable mimeInfo = null; switch (desktop) { + case DESKTOP_GIO: mimeInfo = gio_getMimeInfo(); break; case DESKTOP_GNOME_24: break; case DESKTOP_GNOME: mimeInfo = gnome_getMimeInfo(); break; case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; @@ -605,20 +624,15 @@ static String[] getExtensions(Display display) { Vector extensions = new Vector(); Enumeration keys = mimeInfo.keys(); while (keys.hasMoreElements()) { - String mimeType = (String)keys.nextElement(); - Vector mimeExts = (Vector)mimeInfo.get(mimeType); - for (int index = 0; index < mimeExts.size(); index++){ - if (!extensions.contains(mimeExts.elementAt(index))) { - extensions.addElement(mimeExts.elementAt(index)); - } - } + String extension = (String)keys.nextElement(); + extensions.add(extension); } /* Return the list of extensions. */ - String[] extStrings = new String[extensions.size()]; + String [] extStrings = new String[extensions.size()]; for (int index = 0; index < extensions.size(); index++) { extStrings[index] = (String)extensions.elementAt(index); - } + } return extStrings; } @@ -641,6 +655,7 @@ static Program[] getPrograms(Display display) { int desktop = getDesktop(display); Hashtable mimeInfo = null; switch (desktop) { + case DESKTOP_GIO: return gio_getPrograms(display); case DESKTOP_GNOME_24: break; case DESKTOP_GNOME: mimeInfo = gnome_getMimeInfo(); break; case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; @@ -664,6 +679,220 @@ static Program[] getPrograms(Display display) { return programList; } +ImageData gio_getImageData() { + if (iconPath == null) return null; + ImageData data = null; + try { + int /*long*/ icon_theme =OS.gtk_icon_theme_get_default(); + byte[] icon = Converter.wcsToMbcs (null, iconPath, true); + int /*long*/ gicon = OS.g_icon_new_for_string(icon, null); + int /*long*/ gicon_info = OS.gtk_icon_theme_lookup_by_gicon (icon_theme, gicon, 16/*size*/, 0); + int /*long*/ pixbuf = OS.gtk_icon_info_load_icon(gicon_info, null); + if (pixbuf != 0) { + int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); + int /*long*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf); + int height = OS.gdk_pixbuf_get_height(pixbuf); + int width = OS.gdk_pixbuf_get_width(pixbuf); + boolean hasAlpha = OS.gdk_pixbuf_get_has_alpha(pixbuf); + byte[] srcData = new byte[stride * height]; + OS.memmove(srcData, pixels, srcData.length); + OS.g_object_unref(pixbuf); + + if (hasAlpha) { + PaletteData palette = new PaletteData(0xFF000000, 0xFF0000, 0xFF00); + data = new ImageData(width, height, 32, palette, 4, srcData); + data.bytesPerLine = stride; + int s = 3, a = 0; + byte[] alphaData = new byte[width*height]; + for (int y=0; y<height; y++) { + for (int x=0; x<width; x++) { + alphaData[a++] = srcData[s]; + srcData[s] = 0; + s+=4; + } + } + data.alphaData = alphaData; + } else { + PaletteData palette = new PaletteData(0xFF0000, 0xFF00, 0xFF); + data = new ImageData(width, height, 24, palette, 4, srcData); + data.bytesPerLine = stride; + } + } + } catch (Exception e) {} + return data; +} + +static Hashtable gio_getMimeInfo() { + int /*long*/ mimeDatabase; + /* + * The file 'globs' contain the file extensions + * associated to the mime-types. Each line that has + * to be parsed corresponds to a different extension + * of a mime-type. The template of such line is - + * application/pdf:*.pdf + */ + byte[] buffer = Converter.wcsToMbcs (null, "/usr/share/mime/globs", true); + mimeDatabase = OS.g_file_new_for_path (buffer); + int /*long*/ fileInputStream = OS.g_file_read (mimeDatabase, 0, 0); + if (fileInputStream == 0) { + OS.g_object_unref (mimeDatabase); + return null; + } + int /*long*/ [] modTimestamp = new int /*long*/ [2]; + buffer = Converter.wcsToMbcs (null, "*", true); + int /*long*/ fileInfo = OS.g_file_query_info(mimeDatabase, buffer, 0, 0, 0); + OS.g_file_info_get_modification_time(fileInfo, modTimestamp); + if (modTime != 0 && modTimestamp[0] == modTime) { + return mimeTable; + } else { + mimeTable = new Hashtable(); + modTime = modTimestamp[0]; + int /*long*/ reader = OS.g_data_input_stream_new (fileInputStream); + int[] length = new int[1]; + + if (reader != 0) { + int /*long*/ linePtr = OS.g_data_input_stream_read_line (reader, length, 0, 0); + while (linePtr != 0) { + byte[] lineBytes = new byte[length[0]]; + OS.memmove(lineBytes, linePtr, length[0]); + String line = new String (Converter.mbcsToWcs (null, lineBytes)); + + int separatorIndex = line.indexOf (':'); + if (separatorIndex > 0) { + Vector mimeTypes = new Vector (); + String mimeType = line.substring (0, separatorIndex); + String extensionFormat = line.substring (separatorIndex+1); + int extensionIndex = extensionFormat.indexOf ("."); + if (extensionIndex > 0) { + String extension = extensionFormat.substring (extensionIndex); + mimeTypes.add (mimeType); + if (mimeTable.containsKey (extension)) { + /* + * If mimeType already exists, it is required to update + * the existing key (mime-type) with the new extension. + */ + Vector value = (Vector) mimeTable.get (extension); + mimeTypes.addAll (value); + } + mimeTable.put (extension, mimeTypes); + } + } + linePtr = OS.g_data_input_stream_read_line (reader, length, 0, 0); + } + } + return mimeTable; + } +} + +static String gio_getMimeType(String extension) { + String mimeType = null; + Hashtable h = gio_getMimeInfo(); + if (h != null && h.containsKey(extension)) { + Vector mimeTypes = (Vector) h.get(extension); + mimeType = (String) mimeTypes.get(0); + } + return mimeType; +} + +static Program gio_getProgram(Display display, String mimeType) { + Program program = null; + byte[] mimeTypeBuffer = Converter.wcsToMbcs (null, mimeType, true); + int /*long*/ application = OS.g_app_info_get_default_for_type (mimeTypeBuffer, false); + if (application != 0) { + if (OS.g_app_info_should_show(application)) { + program = gio_getProgram(display, application); + } + } + return program; +} + +static Program gio_getProgram (Display display, int /*long*/ application) { + Program program = new Program(); + program.display = display; + int /*long*/ applicationName = OS.g_app_info_get_name (application); + int length = OS.strlen (applicationName); + byte[] buffer = new byte [length]; + OS.memmove (buffer, applicationName, length); + program.name = new String (Converter.mbcsToWcs (null, buffer)); + int /*long*/ applicationCommand = OS.g_app_info_get_executable (application); + length = OS.strlen (applicationName); + buffer = new byte [length]; + OS.memmove (buffer, applicationCommand, length); + program.command = new String (Converter.mbcsToWcs (null, buffer)); + program.gnomeExpectUri = OS.g_app_info_supports_uris(application); + int /*long*/ applicationId = OS.g_app_info_get_id (application); + length = OS.strlen(applicationId); + buffer = new byte[length + 1]; + OS.memmove(buffer, applicationId, length); + int /*long*/ icon = OS.g_app_info_get_icon(application); + if (icon != 0) { + int /*long*/ icon_name = OS.g_icon_to_string(icon); + if (icon_name != 0) { + length = OS.strlen(icon_name); + if (length > 0) { + buffer = new byte[length]; + OS.memmove(buffer, icon_name, length); + program.iconPath = new String(Converter.mbcsToWcs(null, buffer)); + } + OS.g_free(icon_name); + } + } + return program; +} + +static Program[] gio_getPrograms(Display display) { + int /*long*/ applicationList = OS.g_app_info_get_all (); + Program program; + Vector programs = new Vector(); + while (applicationList != 0) { + int /*long*/ application = OS.g_list_data(applicationList); + if (application != 0) { + if (OS.g_app_info_should_show(application)) { + program = gio_getProgram(display, application); + if (program != null) programs.addElement(program); + } + } + applicationList = OS.g_list_next(applicationList); + } + Program[] programList = new Program[programs.size()]; + for (int index = 0; index < programList.length; index++) { + programList[index] = (Program)programs.elementAt(index); + } + return programList; +} + +/** + * GNOME 2.4 - Launch the default program for the given file. + */ +static boolean gio_launch(String fileName) { + byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); + int /*long*/ file = OS.g_file_new_for_path (fileNameBuffer); + int /*long*/ uri = OS.g_file_get_uri (file); + boolean result = OS.g_app_info_launch_default_for_uri (uri, 0, 0); + + OS.g_object_unref (file); + OS.g_free (uri); + return result; +} + +/** + * GIO - Execute the program for the given file. + */ +boolean gio_execute(String fileName) { + byte[] commandBuffer = Converter.wcsToMbcs (null, command, true); + byte[] nameBuffer = Converter.wcsToMbcs (null, name, true); + int /*long*/ application = OS.g_app_info_create_from_commandline(commandBuffer, nameBuffer, gnomeExpectUri ? OS.G_APP_INFO_CREATE_SUPPORTS_URIS : OS.G_APP_INFO_CREATE_NONE, 0); + byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); + int /*long*/ file = OS.g_file_new_for_path (fileNameBuffer); + int /*long*/ list = 0; + list = OS.g_list_append (list, file); + boolean result = OS.g_app_info_launch (application, list, 0, 0); + + OS.g_object_unref (file); + OS.g_object_unref (application); + return result; +} + /** * Launches the operating system executable associated with the file or * URL (http:// or https://). If the file is an executable then the @@ -688,6 +917,8 @@ public static boolean launch(String fileName) { static boolean launch (Display display, String fileName) { if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); switch (getDesktop (display)) { + case DESKTOP_GIO: + if (gio_launch (fileName)) return true; case DESKTOP_GNOME_24: if (gnome_24_launch (fileName)) return true; default: @@ -749,6 +980,7 @@ public boolean execute(String fileName) { if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int desktop = getDesktop(display); switch (desktop) { + case DESKTOP_GIO: return gio_execute(fileName); case DESKTOP_GNOME_24: return gnome_24_execute(fileName); case DESKTOP_GNOME: return gnome_execute(fileName); case DESKTOP_CDE: return cde_execute(fileName); @@ -765,6 +997,7 @@ public boolean execute(String fileName) { */ public ImageData getImageData() { switch (getDesktop(display)) { + case DESKTOP_GIO: return gio_getImageData(); case DESKTOP_GNOME_24: case DESKTOP_GNOME: return gnome_getImageData(); case DESKTOP_CDE: return cde_getImageData(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java index fbacfcf587..f9d6f06af7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java @@ -56,7 +56,7 @@ public abstract class Device implements Drawable { int /*long*/ logProc; Callback logCallback; //NOT DONE - get list of valid names - String [] log_domains = {"GLib-GObject", "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS"}; + String [] log_domains = {"GLib-GObject", "GLib", "GObject", "Pango", "ATK", "GdkPixbuf", "Gdk", "Gtk", "GnomeVFS", "GIO"}; int [] handler_ids = new int [log_domains.length]; int warningLevel; |