diff options
14 files changed, 12 insertions, 891 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk index d14438ba10..6f102c8b43 100644 --- a/bundles/org.eclipse.swt/.classpath_gtk +++ b/bundles/org.eclipse.swt/.classpath_gtk @@ -26,7 +26,6 @@ <classpathentry kind="src" path="Eclipse SWT Printing/common"/> <classpathentry kind="src" path="Eclipse SWT Program/gtk"/> <classpathentry kind="src" path="Eclipse SWT Program/common"/> - <classpathentry kind="src" path="Eclipse SWT Program/gnome"/> <classpathentry kind="src" path="Eclipse SWT Program/cde"/> <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> 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 e94261087a..5c943ef4b9 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 @@ -1542,22 +1542,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1XKeysymToKeycode) } #endif -#ifndef NO__1XListProperties -JNIEXPORT jintLong JNICALL OS_NATIVE(_1XListProperties) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintArray arg2) -{ - jint *lparg2=NULL; - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1XListProperties_FUNC); - if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail; - rc = (jintLong)XListProperties((Display *)arg0, (Window)arg1, (int *)lparg2); -fail: - if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); - OS_NATIVE_EXIT(env, that, _1XListProperties_FUNC); - return rc; -} -#endif - #ifndef NO__1XQueryPointer JNIEXPORT jint JNICALL OS_NATIVE(_1XQueryPointer) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2, jintLongArray arg3, jintArray arg4, jintArray arg5, jintArray arg6, jintArray arg7, jintArray arg8) 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 7428de5455..767ac35444 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 @@ -155,7 +155,6 @@ char * OS_nativeFunctionNames[] = { "_1XGetWindowProperty", "_1XInternAtom", "_1XKeysymToKeycode", - "_1XListProperties", "_1XQueryPointer", "_1XRenderComposite", "_1XRenderCreatePicture", 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 b5a3d7c489..45b54684ee 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 @@ -165,7 +165,6 @@ typedef enum { _1XGetWindowProperty_FUNC, _1XInternAtom_FUNC, _1XKeysymToKeycode_FUNC, - _1XListProperties_FUNC, _1XQueryPointer_FUNC, _1XRenderComposite_FUNC, _1XRenderCreatePicture_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 fd3a352b08..ce72ce7dcc 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 @@ -1102,20 +1102,6 @@ public static final int XKeysymToKeycode(long /*int*/ display, long /*int*/ keys lock.unlock(); } } -/** - * @param display cast=(Display *) - * @param window cast=(Window) - * @param num_prop_return cast=(int *) - */ -public static final native long /*int*/ _XListProperties(long /*int*/ display, long /*int*/ window, int[] num_prop_return); -public static final long /*int*/ XListProperties(long /*int*/ display, long /*int*/ window, int[] num_prop_return) { - lock.lock(); - try { - return _XListProperties(display, window, num_prop_return); - } finally { - lock.unlock(); - } -} /** @param handler cast=(XIOErrorHandler) */ public static final native long /*int*/ _XSetIOErrorHandler(long /*int*/ handler); public static final long /*int*/ XSetIOErrorHandler(long /*int*/ handler) { diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c deleted file mode 100644 index 2eaccad287..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2016 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "gnome_structs.h" -#include "gnome_stats.h" - -#ifndef GNOME_NATIVE -#define GNOME_NATIVE(func) Java_org_eclipse_swt_internal_gnome_GNOME_##func -#endif - -#ifndef NO_GnomeVFSMimeApplication_1sizeof -JNIEXPORT jint JNICALL GNOME_NATIVE(GnomeVFSMimeApplication_1sizeof) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - GNOME_NATIVE_ENTER(env, that, GnomeVFSMimeApplication_1sizeof_FUNC); - rc = (jint)GnomeVFSMimeApplication_sizeof(); - GNOME_NATIVE_EXIT(env, that, GnomeVFSMimeApplication_1sizeof_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1icon_1lookup -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1icon_1lookup) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jbyteArray arg2, jbyteArray arg3, jintLong arg4, jbyteArray arg5, jint arg6, jintArray arg7) -{ - jbyte *lparg2=NULL; - jbyte *lparg3=NULL; - jbyte *lparg5=NULL; - jint *lparg7=NULL; - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1icon_1lookup_FUNC); - if (arg2) if ((lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL)) == NULL) goto fail; - if (arg3) if ((lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL)) == NULL) goto fail; - if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail; - if (arg7) if ((lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL)) == NULL) goto fail; - rc = (jintLong)gnome_icon_lookup((GnomeIconTheme *)arg0, (GnomeThumbnailFactory *)arg1, (const char *)lparg2, (const char *)lparg3, (GnomeVFSFileInfo *)arg4, (const char *)lparg5, (GnomeIconLookupFlags)arg6, (GnomeIconLookupResultFlags *)lparg7); -fail: - if (arg7 && lparg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0); - if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); - if (arg3 && lparg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); - if (arg2 && lparg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1icon_1lookup_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1icon_1theme_1lookup_1icon -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1icon_1theme_1lookup_1icon) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2, jintLongArray arg3, jintArray arg4) -{ - jintLong *lparg3=NULL; - jint *lparg4=NULL; - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1icon_1theme_1lookup_1icon_FUNC); - if (arg3) if ((lparg3 = (*env)->GetIntLongArrayElements(env, arg3, NULL)) == NULL) goto fail; - if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail; - rc = (jintLong)gnome_icon_theme_lookup_icon((GnomeIconTheme *)arg0, (const char *)arg1, arg2, (const GnomeIconData **)lparg3, lparg4); -fail: - if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - if (arg3 && lparg3) (*env)->ReleaseIntLongArrayElements(env, arg3, lparg3, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1icon_1theme_1lookup_1icon_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1icon_1theme_1new -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1icon_1theme_1new) - (JNIEnv *env, jclass that) -{ - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1icon_1theme_1new_FUNC); - rc = (jintLong)gnome_icon_theme_new(); - GNOME_NATIVE_EXIT(env, that, _1gnome_1icon_1theme_1new_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1get_1mime_1type -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1get_1mime_1type) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1get_1mime_1type_FUNC); - rc = (jintLong)gnome_vfs_get_mime_type((const char *)arg0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1get_1mime_1type_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1init -JNIEXPORT jboolean JNICALL GNOME_NATIVE(_1gnome_1vfs_1init) - (JNIEnv *env, jclass that) -{ - jboolean rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1init_FUNC); - rc = (jboolean)gnome_vfs_init(); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1init_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1is_1executable_1command_1string -JNIEXPORT jboolean JNICALL GNOME_NATIVE(_1gnome_1vfs_1is_1executable_1command_1string) - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jboolean rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1is_1executable_1command_1string_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - rc = (jboolean)gnome_vfs_is_executable_command_string((const char *)lparg0); -fail: - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1is_1executable_1command_1string_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1make_1uri_1from_1input -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input) - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1make_1uri_1from_1input_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - rc = (jintLong)gnome_vfs_make_uri_from_input((const char *)lparg0); -fail: - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1make_1uri_1from_1input_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1mime_1application_1free -JNIEXPORT void JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1application_1free) - (JNIEnv *env, jclass that, jintLong arg0) -{ - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1application_1free_FUNC); - gnome_vfs_mime_application_free((GnomeVFSMimeApplication *)arg0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1application_1free_FUNC); -} -#endif - -#ifndef NO__1gnome_1vfs_1mime_1get_1default_1application -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1get_1default_1application) - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1get_1default_1application_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - rc = (jintLong)gnome_vfs_mime_get_default_application((const char *)lparg0); -fail: - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1get_1default_1application_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1mime_1type_1from_1name -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1type_1from_1name) - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1type_1from_1name_FUNC); - if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail; - rc = (jintLong)gnome_vfs_mime_type_from_name((const char *)lparg0); -fail: - if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1type_1from_1name_FUNC); - return rc; -} -#endif - -#ifndef NO__1gnome_1vfs_1mime_1type_1get_1equivalence -JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1type_1get_1equivalence) - (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) -{ - jbyte *lparg1=NULL; - jintLong rc = 0; - GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC); - if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; - rc = (jintLong)gnome_vfs_mime_type_get_equivalence((const char *)arg0, (const char *)lparg1); -fail: - if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); - GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC); - return rc; -} -#endif - -#ifndef NO_memmove -JNIEXPORT void JNICALL GNOME_NATIVE(memmove) - (JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2) -{ - GnomeVFSMimeApplication _arg0, *lparg0=NULL; - GNOME_NATIVE_ENTER(env, that, memmove_FUNC); - if (arg0) if ((lparg0 = &_arg0) == NULL) goto fail; - memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); -fail: - if (arg0 && lparg0) setGnomeVFSMimeApplicationFields(env, arg0, lparg0); - GNOME_NATIVE_EXIT(env, that, memmove_FUNC); -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h deleted file mode 100644 index 69b7ec49c2..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2000, 2011 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 -* available at http://www.gnu.org/licenses/lgpl.html. If the version -* of the LGPL at http://www.gnu.org is different to the version of -* the LGPL accompanying this distribution and there is any conflict -* between the two license versions, the terms of the LGPL accompanying -* this distribution shall govern. -* -* Contributors: -* IBM Corporation - initial API and implementation -*******************************************************************************/ - -#ifndef INC_gnome_H -#define INC_gnome_H - -#include <string.h> -#include <stdio.h> -#include <assert.h> -#include <dlfcn.h> -#include <libgnome/libgnome.h> -#include <libgnome/gnome-program.h> -#include <libgnomeui/libgnomeui.h> -#include <libgnomevfs/gnome-vfs.h> -#include <libgnomevfs/gnome-vfs-mime.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> - -#define GNOME_LOAD_FUNCTION LOAD_FUNCTION - -#ifdef AIX -#define LIB_VFS "libgnomevfs-2.a(libgnomevfs-2.so.0)" -#elif HPUX -#define LIB_VFS "libgnomevfs-2.so" -#else -#define LIB_VFS "libgnomevfs-2.so.0" -#endif - -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c deleted file mode 100644 index 3be86404aa..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2016 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "gnome_stats.h" - -#ifdef NATIVE_STATS - -char * GNOME_nativeFunctionNames[] = { - "GnomeVFSMimeApplication_1sizeof", - "_1gnome_1icon_1lookup", - "_1gnome_1icon_1theme_1lookup_1icon", - "_1gnome_1icon_1theme_1new", - "_1gnome_1vfs_1get_1mime_1type", - "_1gnome_1vfs_1init", - "_1gnome_1vfs_1is_1executable_1command_1string", - "_1gnome_1vfs_1make_1uri_1from_1input", - "_1gnome_1vfs_1mime_1application_1free", - "_1gnome_1vfs_1mime_1get_1default_1application", - "_1gnome_1vfs_1mime_1type_1from_1name", - "_1gnome_1vfs_1mime_1type_1get_1equivalence", - "memmove", -}; -#define NATIVE_FUNCTION_COUNT sizeof(GNOME_nativeFunctionNames) / sizeof(char*) -int GNOME_nativeFunctionCount = NATIVE_FUNCTION_COUNT; -int GNOME_nativeFunctionCallCount[NATIVE_FUNCTION_COUNT]; - -#define STATS_NATIVE(func) Java_org_eclipse_swt_tools_internal_NativeStats_##func - -JNIEXPORT jint JNICALL STATS_NATIVE(GNOME_1GetFunctionCount) - (JNIEnv *env, jclass that) -{ - return GNOME_nativeFunctionCount; -} - -JNIEXPORT jstring JNICALL STATS_NATIVE(GNOME_1GetFunctionName) - (JNIEnv *env, jclass that, jint index) -{ - return (*env)->NewStringUTF(env, GNOME_nativeFunctionNames[index]); -} - -JNIEXPORT jint JNICALL STATS_NATIVE(GNOME_1GetFunctionCallCount) - (JNIEnv *env, jclass that, jint index) -{ - return GNOME_nativeFunctionCallCount[index]; -} - -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h deleted file mode 100644 index 019918bd82..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2016 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#ifdef NATIVE_STATS -extern int GNOME_nativeFunctionCount; -extern int GNOME_nativeFunctionCallCount[]; -extern char* GNOME_nativeFunctionNames[]; -#define GNOME_NATIVE_ENTER(env, that, func) GNOME_nativeFunctionCallCount[func]++; -#define GNOME_NATIVE_EXIT(env, that, func) -#else -#ifndef GNOME_NATIVE_ENTER -#define GNOME_NATIVE_ENTER(env, that, func) -#endif -#ifndef GNOME_NATIVE_EXIT -#define GNOME_NATIVE_EXIT(env, that, func) -#endif -#endif - -typedef enum { - GnomeVFSMimeApplication_1sizeof_FUNC, - _1gnome_1icon_1lookup_FUNC, - _1gnome_1icon_1theme_1lookup_1icon_FUNC, - _1gnome_1icon_1theme_1new_FUNC, - _1gnome_1vfs_1get_1mime_1type_FUNC, - _1gnome_1vfs_1init_FUNC, - _1gnome_1vfs_1is_1executable_1command_1string_FUNC, - _1gnome_1vfs_1make_1uri_1from_1input_FUNC, - _1gnome_1vfs_1mime_1application_1free_FUNC, - _1gnome_1vfs_1mime_1get_1default_1application_FUNC, - _1gnome_1vfs_1mime_1type_1from_1name_FUNC, - _1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC, - memmove_FUNC, -} GNOME_FUNCS; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.c b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.c deleted file mode 100644 index c6426d43e8..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.c +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "swt.h" -#include "gnome_structs.h" - -#ifndef NO_GnomeVFSMimeApplication -typedef struct GnomeVFSMimeApplication_FID_CACHE { - int cached; - jclass clazz; - jfieldID id, name, command, can_open_multiple_files, expects_uris, supported_uri_schemes, requires_terminal; -} GnomeVFSMimeApplication_FID_CACHE; - -GnomeVFSMimeApplication_FID_CACHE GnomeVFSMimeApplicationFc; - -void cacheGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject) -{ - if (GnomeVFSMimeApplicationFc.cached) return; - GnomeVFSMimeApplicationFc.clazz = (*env)->GetObjectClass(env, lpObject); - GnomeVFSMimeApplicationFc.id = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "id", I_J); - GnomeVFSMimeApplicationFc.name = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "name", I_J); - GnomeVFSMimeApplicationFc.command = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "command", I_J); - GnomeVFSMimeApplicationFc.can_open_multiple_files = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "can_open_multiple_files", "Z"); - GnomeVFSMimeApplicationFc.expects_uris = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "expects_uris", "I"); - GnomeVFSMimeApplicationFc.supported_uri_schemes = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "supported_uri_schemes", I_J); - GnomeVFSMimeApplicationFc.requires_terminal = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "requires_terminal", "Z"); - GnomeVFSMimeApplicationFc.cached = 1; -} - -GnomeVFSMimeApplication *getGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct) -{ - if (!GnomeVFSMimeApplicationFc.cached) cacheGnomeVFSMimeApplicationFields(env, lpObject); - lpStruct->id = (char *)(*env)->GetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.id); - lpStruct->name = (char *)(*env)->GetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.name); - lpStruct->command = (char *)(*env)->GetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.command); - lpStruct->can_open_multiple_files = (gboolean)(*env)->GetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.can_open_multiple_files); - lpStruct->expects_uris = (GnomeVFSMimeApplicationArgumentType)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.expects_uris); - lpStruct->supported_uri_schemes = (GList *)(*env)->GetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes); - lpStruct->requires_terminal = (gboolean)(*env)->GetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.requires_terminal); - return lpStruct; -} - -void setGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct) -{ - if (!GnomeVFSMimeApplicationFc.cached) cacheGnomeVFSMimeApplicationFields(env, lpObject); - (*env)->SetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.id, (jintLong)lpStruct->id); - (*env)->SetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.name, (jintLong)lpStruct->name); - (*env)->SetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.command, (jintLong)lpStruct->command); - (*env)->SetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.can_open_multiple_files, (jboolean)lpStruct->can_open_multiple_files); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.expects_uris, (jint)lpStruct->expects_uris); - (*env)->SetIntLongField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes, (jintLong)lpStruct->supported_uri_schemes); - (*env)->SetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.requires_terminal, (jboolean)lpStruct->requires_terminal); -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.h b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.h deleted file mode 100644 index 6b6521f4f7..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.h +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -#include "gnome.h" - -#ifndef NO_GnomeVFSMimeApplication -void cacheGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject); -GnomeVFSMimeApplication *getGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct); -void setGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct); -#define GnomeVFSMimeApplication_sizeof() sizeof(GnomeVFSMimeApplication) -#else -#define cacheGnomeVFSMimeApplicationFields(a,b) -#define getGnomeVFSMimeApplicationFields(a,b,c) NULL -#define setGnomeVFSMimeApplicationFields(a,b,c) -#define GnomeVFSMimeApplication_sizeof() 0 -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java deleted file mode 100644 index bdbd7a851a..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2013 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.gnome; - -import org.eclipse.swt.internal.*; - -public class GNOME extends Platform { - static { - Library.loadLibrary("swt-gnome"); - } - -public static final int GNOME_FILE_DOMAIN_PIXMAP = 4; -public static final int GNOME_ICON_LOOKUP_FLAGS_NONE = 0; -public static final int GNOME_PARAM_NONE = 0; -public static final int GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS = 0; -public static final int GNOME_VFS_MIME_IDENTICAL = 1; -public static final int GNOME_VFS_MIME_PARENT = 2; -public static final int GNOME_VFS_MIME_UNRELATED = 0; -public static final int GNOME_VFS_MAKE_URI_DIR_NONE = 0; -public static final int GNOME_VFS_MAKE_URI_DIR_HOMEDIR = 1<<0; -public static final int GNOME_VFS_MAKE_URI_DIR_CURRENT = 1<<1; - -/** 64 bit */ -public static final native int GnomeVFSMimeApplication_sizeof(); - -/** Natives */ - -/** - * @param icon_theme cast=(GnomeIconTheme *) - * @param thumbnail_factory cast=(GnomeThumbnailFactory *) - * @param file_uri cast=(const char *) - * @param custom_icon cast=(const char *) - * @param file_info cast=(GnomeVFSFileInfo *) - * @param mime_type cast=(const char *) - * @param flags cast=(GnomeIconLookupFlags) - * @param result cast=(GnomeIconLookupResultFlags *) - */ -public static final native long /*int*/ _gnome_icon_lookup(long /*int*/ icon_theme, long /*int*/ thumbnail_factory, byte[] file_uri, byte[] custom_icon, long /*int*/ file_info, byte[] mime_type, int flags, int[] result); -public static final long /*int*/ gnome_icon_lookup(long /*int*/ icon_theme, long /*int*/ thumbnail_factory, byte[] file_uri, byte[] custom_icon, long /*int*/ file_info, byte[] mime_type, int flags, int[] result) { - lock.lock(); - try { - return _gnome_icon_lookup(icon_theme, thumbnail_factory, file_uri, custom_icon, file_info, mime_type, flags, result); - } finally { - lock.unlock(); - } -} -/** - * @param theme cast=(GnomeIconTheme *) - * @param icon_name cast=(const char *) - * @param icon_data cast=(const GnomeIconData **) - */ -public static final native long /*int*/ _gnome_icon_theme_lookup_icon(long /*int*/ theme, long /*int*/ icon_name, int size, long /*int*/[] icon_data, int[] base_size); -public static final long /*int*/ gnome_icon_theme_lookup_icon(long /*int*/ theme, long /*int*/ icon_name, int size, long /*int*/[] icon_data, int[] base_size) { - lock.lock(); - try { - return _gnome_icon_theme_lookup_icon(theme, icon_name, size, icon_data, base_size); - } finally { - lock.unlock(); - } -} -public static final native long /*int*/ _gnome_icon_theme_new(); -public static final long /*int*/ gnome_icon_theme_new() { - lock.lock(); - try { - return _gnome_icon_theme_new(); - } finally { - lock.unlock(); - } -} - -/** @param uri cast=(const char *) */ -public static final native long /*int*/ _gnome_vfs_get_mime_type(long /*int*/ uri); -public static final long /*int*/ gnome_vfs_get_mime_type(long /*int*/ uri) { - lock.lock(); - try { - return _gnome_vfs_get_mime_type(uri); - } finally { - lock.unlock(); - } -} - -public static final native boolean _gnome_vfs_init(); -public static final boolean gnome_vfs_init() { - lock.lock(); - try { - return _gnome_vfs_init(); - } finally { - lock.unlock(); - } -} -/** @param uri cast=(const char *) */ -public static final native long /*int*/ _gnome_vfs_make_uri_from_input(byte[] uri); -public static final long /*int*/ gnome_vfs_make_uri_from_input(byte[] uri) { - lock.lock(); - try { - return _gnome_vfs_make_uri_from_input(uri); - } finally { - lock.unlock(); - } -} -/** @param application cast=(GnomeVFSMimeApplication *) */ -public static final native void _gnome_vfs_mime_application_free(long /*int*/ application); -public static final void gnome_vfs_mime_application_free(long /*int*/ application) { - lock.lock(); - try { - _gnome_vfs_mime_application_free(application); - } finally { - lock.unlock(); - } -} -/** @param command_string cast=(const char *) */ -public static final native boolean _gnome_vfs_is_executable_command_string(byte[] command_string); -public static final boolean gnome_vfs_is_executable_command_string(byte[] command_string) { - lock.lock(); - try { - return _gnome_vfs_is_executable_command_string(command_string); - } finally { - lock.unlock(); - } -} -/** @param mimeType cast=(const char *) */ -public static final native long /*int*/ _gnome_vfs_mime_get_default_application(byte[] mimeType); -public static final long /*int*/ gnome_vfs_mime_get_default_application(byte[] mimeType) { - lock.lock(); - try { - return _gnome_vfs_mime_get_default_application(mimeType); - } finally { - lock.unlock(); - } -} - -/** @param file cast=(const char *) */ -public static final native long /*int*/ _gnome_vfs_mime_type_from_name(byte[] file); -public static final long /*int*/ gnome_vfs_mime_type_from_name(byte[] file) { - lock.lock(); - try { - return _gnome_vfs_mime_type_from_name(file); - } finally { - lock.unlock(); - } -} -/** - * @param mime_type cast=(const char *) - * @param base_mime_type cast=(const char *) - */ -public static final native long /*int*/ _gnome_vfs_mime_type_get_equivalence(long /*int*/ mime_type, byte [] base_mime_type); -public static final long /*int*/ gnome_vfs_mime_type_get_equivalence(long /*int*/ mime_type, byte [] base_mime_type) { - lock.lock(); - try { - return _gnome_vfs_mime_type_get_equivalence(mime_type, base_mime_type); - } finally { - lock.unlock(); - } -} -/** - * @param dest cast=(void *),flags=no_in - * @param src cast=(const void *) - * @param count cast=(size_t) - */ -public static final native void memmove (GnomeVFSMimeApplication dest, long /*int*/ src, long /*int*/ count); -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java deleted file mode 100644 index df9385a82f..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 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 - * available at http://www.gnu.org/licenses/lgpl.html. If the version - * of the LGPL at http://www.gnu.org is different to the version of - * the LGPL accompanying this distribution and there is any conflict - * between the two license versions, the terms of the LGPL accompanying - * this distribution shall govern. - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.gnome; - - -public class GnomeVFSMimeApplication { - /** @field cast=(char *) */ - public long /*int*/ id; - /** @field cast=(char *) */ - public long /*int*/ name; - /** @field cast=(char *) */ - public long /*int*/ command; - /** @field cast=(gboolean) */ - public boolean can_open_multiple_files; - /** @field cast=(GnomeVFSMimeApplicationArgumentType) */ - public int expects_uris; - /** @field cast=(GList *) */ - public long /*int*/ supported_uri_schemes; - /** @field cast=(gboolean) */ - public boolean requires_terminal; - public static final int sizeof = GNOME.GnomeVFSMimeApplication_sizeof(); -} 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 b59bd96b11..ac6e7f3153 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 @@ -21,7 +21,6 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.cde.*; -import org.eclipse.swt.internal.gnome.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.widgets.*; @@ -39,11 +38,11 @@ public final class Program { String iconPath; Display display; - /* Gnome & GIO specific + /* GIO specific * true if command expects a URI * false if expects a path */ - boolean gnomeExpectUri; + boolean gioExpectUri; static long modTime; static Map<String, List<String>> mimeTable; @@ -53,11 +52,9 @@ public final class Program { 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$ static final String[] CDE_MASK_EXT = { ".m_m.bm", ".l_m.bm", ".s_m.bm", ".t_m.bm" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ static final String DESKTOP_DATA = "Program_DESKTOP"; //$NON-NLS-1$ - static final String ICON_THEME_DATA = "Program_GNOME_ICON_THEME"; //$NON-NLS-1$ static final String PREFIX_HTTP = "http://"; //$NON-NLS-1$ static final String PREFIX_HTTPS = "https://"; //$NON-NLS-1$ static final int DESKTOP_UNKNOWN = 0; - static final int DESKTOP_GNOME = 1; static final int DESKTOP_GIO = 2; static final int DESKTOP_CDE = 3; static final int PREFERRED_ICON_SIZE = 16; @@ -75,85 +72,16 @@ static int getDesktop(final Display display) { if (desktopValue != null) return desktopValue.intValue(); int desktop = DESKTOP_UNKNOWN; - if (!OS.isX11 ()) { - desktop = DESKTOP_GIO; - display.setData(DESKTOP_DATA, Integer.valueOf(desktop)); - return desktop; - } - - /* Get the list of properties on the root window. */ - long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()); - long /*int*/ rootWindow = OS.XDefaultRootWindow(xDisplay); - int[] numProp = new int[1]; - long /*int*/ propList = OS.XListProperties(xDisplay, rootWindow, numProp); - long /*int*/ [] property = new long /*int*/ [numProp[0]]; - if (propList != 0) { - OS.memmove(property, propList, (property.length * OS.PTR_SIZEOF)); - OS.XFree(propList); - } - - /* - * Feature in Linux Desktop. There is currently no official way to - * determine whether the Gnome window manager or gnome-vfs is - * available. Earlier versions including Red Hat 9 and Suse 9 provide - * a documented Gnome specific property on the root window - * WIN_SUPPORTING_WM_CHECK. This property is no longer supported in newer - * versions such as Fedora Core 2. - * The workaround is to simply check that the window manager is a - * compliant one (property _NET_SUPPORTING_WM_CHECK) and to attempt to load - * our native library that depends on gnome-vfs. - * - * Note: GIO is used when available instead of gnome-vfs. - */ - if (desktop == DESKTOP_UNKNOWN) { - byte[] gnomeName = Converter.wcsToMbcs(null, "_NET_SUPPORTING_WM_CHECK", true); - long /*int*/ gnome = OS.XInternAtom(xDisplay, gnomeName, true); - if (gnome != OS.None) { - /* Check for the existence of libgio libraries first */ - byte[] buffer; - int flags = OS.RTLD_LAZY; - if (OS.IsAIX) { - buffer = Converter.wcsToMbcs(null, "libgio-2.0.a(libgio-2.0.so.0)", true); - flags |= OS.RTLD_MEMBER; - } else if (OS.IsHPUX) { - buffer = Converter.wcsToMbcs(null, "libgio-2.0.so", true); - } else { - buffer = Converter.wcsToMbcs(null, "libgio-2.0.so.0", true); - } - long /*int*/ libgio = OS.dlopen(buffer, flags); - if (libgio != 0) { - buffer = Converter.wcsToMbcs(null, "g_app_info_launch_default_for_uri", true); - long /*int*/ 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); - } - - if (desktop == DESKTOP_UNKNOWN && gnome_init()) { - desktop = DESKTOP_GNOME; - long /*int*/ icon_theme = GNOME.gnome_icon_theme_new(); - display.setData(ICON_THEME_DATA, new LONG(icon_theme)); - display.addListener(SWT.Dispose, event -> { - LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA); - if (gnomeIconTheme == null) return; - display.setData(ICON_THEME_DATA, null); - /* - * 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) OS.g_object_unref(gnomeIconTheme.value); - }); - } - } - } - /* * On CDE, the atom below may exist without DTWM running. If the atom * below is defined, the CDE database exists and the available * applications can be queried. */ if (desktop == DESKTOP_UNKNOWN) { + /* Get the list of properties on the root window. */ + long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()); + int[] numProp = new int[1]; + long /*int*/ [] property = new long /*int*/ [numProp[0]]; byte[] cdeName = Converter.wcsToMbcs(null, "_DT_SM_PREFERENCES", true); long /*int*/ cde = OS.XInternAtom(xDisplay, cdeName, true); for (int index = 0; desktop == DESKTOP_UNKNOWN && index < property.length; index++) { @@ -162,6 +90,10 @@ static int getDesktop(final Display display) { } } + if (desktop == DESKTOP_UNKNOWN) { + desktop = DESKTOP_GIO; + } + display.setData(DESKTOP_DATA, Integer.valueOf(desktop)); return desktop; } @@ -368,106 +300,6 @@ static String[] parseCommand(String cmd) { } /** - * GNOME - Get Image Data - * - */ -ImageData gnome_getImageData() { - if (iconPath == null) return null; - try { - return new ImageData(iconPath); - } catch (Exception e) {} - return null; -} - - -static String gnome_getMimeType(String extension) { - String mimeType = null; - String fileName = "swt" + extension; - byte[] extensionBuffer = Converter.wcsToMbcs(null, fileName, true); - long /*int*/ typeName = GNOME.gnome_vfs_mime_type_from_name(extensionBuffer); - if (typeName != 0) { - int length = OS.strlen(typeName); - if (length > 0) { - byte [] buffer = new byte[length]; - OS.memmove(buffer, typeName, length); - mimeType = new String(Converter.mbcsToWcs(null, buffer)); - } - } - return mimeType; -} - -static Program gnome_getProgram(Display display, String mimeType) { - Program program = null; - byte[] mimeTypeBuffer = Converter.wcsToMbcs(null, mimeType, true); - long /*int*/ ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer); - if (ptr != 0) { - program = new Program(); - program.display = display; - program.name = mimeType; - GnomeVFSMimeApplication application = new GnomeVFSMimeApplication(); - GNOME.memmove(application, ptr, GnomeVFSMimeApplication.sizeof); - if (application.command != 0) { - int length = OS.strlen(application.command); - if (length > 0) { - byte[] buffer = new byte[length]; - OS.memmove(buffer, application.command, length); - program.command = new String(Converter.mbcsToWcs(null, buffer)); - } - } - program.gnomeExpectUri = application.expects_uris == GNOME.GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS; - - int length = OS.strlen(application.id); - byte[] buffer = new byte[length + 1]; - OS.memmove(buffer, application.id, length); - LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA); - long /*int*/ icon_name = GNOME.gnome_icon_lookup(gnomeIconTheme.value, 0, null, buffer, 0, mimeTypeBuffer, - GNOME.GNOME_ICON_LOOKUP_FLAGS_NONE, null); - long /*int*/ path = 0; - if (icon_name != 0) path = GNOME.gnome_icon_theme_lookup_icon(gnomeIconTheme.value, icon_name, PREFERRED_ICON_SIZE, null, null); - if (path != 0) { - length = OS.strlen(path); - if (length > 0) { - buffer = new byte[length]; - OS.memmove(buffer, path, length); - program.iconPath = new String(Converter.mbcsToWcs(null, buffer)); - } - OS.g_free(path); - } - if (icon_name != 0) OS.g_free(icon_name); - GNOME.gnome_vfs_mime_application_free(ptr); - } - - return program != null && program.command != null ? program : null; -} - -static boolean gnome_init() { - try { - return GNOME.gnome_vfs_init(); - } catch (Throwable e) { - return false; - } -} - -static boolean gnome_isExecutable(String fileName) { - /* check if the file is executable */ - byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); - if (!GNOME.gnome_vfs_is_executable_command_string(fileNameBuffer)) return false; - - /* check if the mime type is executable */ - long /*int*/ uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer); - long /*int*/ mimeType = GNOME.gnome_vfs_get_mime_type(uri); - OS.g_free(uri); - - byte[] exeType = Converter.wcsToMbcs (null, "application/x-executable", true); //$NON-NLS-1$ - boolean result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, exeType) != GNOME.GNOME_VFS_MIME_UNRELATED; - if (!result) { - byte [] shellType = Converter.wcsToMbcs (null, "application/x-shellscript", true); //$NON-NLS-1$ - result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, shellType) == GNOME.GNOME_VFS_MIME_IDENTICAL; - } - return result; -} - -/** * Finds the program that is associated with an extension. * The extension may or may not begin with a '.'. Note that * a <code>Display</code> must already exist to guarantee that @@ -496,14 +328,12 @@ static Program findProgram(Display display, String extension) { String mimeType = null; switch (desktop) { case DESKTOP_GIO: mimeType = gio_getMimeType(extension); break; - case DESKTOP_GNOME: mimeType = gnome_getMimeType(extension); break; case DESKTOP_CDE: mimeType = cde_getMimeType(extension); break; } if (mimeType == null) return null; Program program = null; switch (desktop) { case DESKTOP_GIO: program = gio_getProgram(display, mimeType); break; - case DESKTOP_GNOME: program = gnome_getProgram(display, mimeType); break; case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break; } return program; @@ -528,7 +358,6 @@ static String[] getExtensions(Display display) { int desktop = getDesktop(display); Map<String, List<String>> mimeInfo = null; switch (desktop) { - case DESKTOP_GNOME: case DESKTOP_GIO: return gio_getExtensions(); case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; } @@ -571,7 +400,6 @@ static Program[] getPrograms(Display display) { Map<String, List<String>> mimeInfo = null; switch (desktop) { case DESKTOP_GIO: return gio_getPrograms(display); - case DESKTOP_GNOME: break; case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; } if (mimeInfo == null) return new Program[0]; @@ -728,7 +556,7 @@ static Program gio_getProgram (Display display, long /*int*/ application) { program.command = new String (Converter.mbcsToWcs (null, buffer)); } } - program.gnomeExpectUri = OS.g_app_info_supports_uris(application); + program.gioExpectUri = OS.g_app_info_supports_uris(application); long /*int*/ icon = OS.g_app_info_get_icon(application); if (icon != 0) { long /*int*/ icon_name = OS.g_icon_to_string(icon); @@ -821,7 +649,7 @@ boolean gio_execute(String fileName) { boolean result = false; byte[] commandBuffer = Converter.wcsToMbcs (null, command, true); byte[] nameBuffer = Converter.wcsToMbcs (null, name, true); - long /*int*/ application = OS.g_app_info_create_from_commandline(commandBuffer, nameBuffer, gnomeExpectUri + long /*int*/ application = OS.g_app_info_create_from_commandline(commandBuffer, nameBuffer, gioExpectUri ? OS.G_APP_INFO_CREATE_SUPPORTS_URIS : OS.G_APP_INFO_CREATE_NONE, 0); if (application != 0) { byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); @@ -857,7 +685,6 @@ static String[] gio_getExtensions() { static boolean isExecutable(Display display, String fileName) { switch(getDesktop(display)) { case DESKTOP_GIO: return gio_isExecutable(fileName); - case DESKTOP_GNOME: return gnome_isExecutable(fileName); case DESKTOP_CDE: return false; //cde_isExecutable() } return false; @@ -918,7 +745,6 @@ static boolean launch (Display display, String fileName, String workingDir) { } } switch (getDesktop (display)) { - case DESKTOP_GNOME: case DESKTOP_GIO: if (gio_launch (fileName)) return true; default: @@ -982,7 +808,6 @@ public boolean execute(String fileName) { if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int desktop = getDesktop(display); switch (desktop) { - case DESKTOP_GNOME: case DESKTOP_GIO: return gio_execute(fileName); case DESKTOP_CDE: return cde_execute(fileName); } @@ -999,7 +824,6 @@ public boolean execute(String fileName) { public ImageData getImageData() { switch (getDesktop(display)) { case DESKTOP_GIO: return gio_getImageData(); - case DESKTOP_GNOME: return gnome_getImageData(); case DESKTOP_CDE: return cde_getImageData(); } return null; @@ -1042,6 +866,4 @@ public int hashCode() { public String toString() { return "Program {" + name + "}"; } - - } |