diff options
author | Christophe Cornu <ccornu> | 2004-03-02 22:53:32 +0000 |
---|---|---|
committer | Christophe Cornu <ccornu> | 2004-03-02 22:53:32 +0000 |
commit | 0e6fd9fd38f9e1fcc9f2e95d4219009e605e7ee9 (patch) | |
tree | df4a6f6060178d3d6cba5c744a38e173b324297d | |
parent | fffc5db7dc2fbaf0f92da5a368e61d1c94d61c7d (diff) | |
download | eclipse.platform.swt-0e6fd9fd38f9e1fcc9f2e95d4219009e605e7ee9.tar.gz eclipse.platform.swt-0e6fd9fd38f9e1fcc9f2e95d4219009e605e7ee9.tar.xz eclipse.platform.swt-0e6fd9fd38f9e1fcc9f2e95d4219009e605e7ee9.zip |
53549
16 files changed, 390 insertions, 666 deletions
diff --git a/bundles/org.eclipse.swt/.classpath_gtk b/bundles/org.eclipse.swt/.classpath_gtk index 0ca6f5650a..bf76b3b332 100644 --- a/bundles/org.eclipse.swt/.classpath_gtk +++ b/bundles/org.eclipse.swt/.classpath_gtk @@ -18,6 +18,7 @@ <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 Custom Widgets/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/mozilla"/> diff --git a/bundles/org.eclipse.swt/.classpath_motif b/bundles/org.eclipse.swt/.classpath_motif index e1db1f101b..9f3b38cae3 100755 --- a/bundles/org.eclipse.swt/.classpath_motif +++ b/bundles/org.eclipse.swt/.classpath_motif @@ -21,6 +21,7 @@ <classpathentry kind="src" path="Eclipse SWT Printing/common"/> <classpathentry kind="src" path="Eclipse SWT Program/motif"/> <classpathentry kind="src" path="Eclipse SWT Program/common"/> + <classpathentry kind="src" path="Eclipse SWT Program/gnome"/> <classpathentry kind="src" path="Eclipse SWT Custom Widgets/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/common"/> <classpathentry kind="src" path="Eclipse SWT Browser/motif"/> diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gnome.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gnome.c deleted file mode 100644 index 30d40ece0a..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/gnome.c +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - - -/** - * SWT GNOME natives implementation. - */ - -/* #define PRINT_FAILED_RCODES */ -#define NDEBUG - -#include "swt.h" - -#include <string.h> -#include <stdio.h> -#include <assert.h> -#include <libgnome/libgnome.h> -#include <libgnome/gnome-program.h> -#include <libgnomeui/libgnomeui.h> -#include <libgnomevfs/gnome-vfs.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> - -#ifndef NO_GnomeVFSMimeApplication -typedef struct GnomeVFSMimeApplication_FID_CACHE { - int cached; - jclass clazz; - jfieldID requires_terminal, supported_uri_schemes, expects_uris, can_open_multiple_files, command, name, id; -} GnomeVFSMimeApplication_FID_CACHE; - -GnomeVFSMimeApplication_FID_CACHE GnomeVFSMimeApplicationFc; - -void cacheGnomeVFSMimeApplicationFids(JNIEnv *env, jobject lpObject) -{ - if (GnomeVFSMimeApplicationFc.cached) return; - GnomeVFSMimeApplicationFc.clazz = (*env)->GetObjectClass(env, lpObject); - GnomeVFSMimeApplicationFc.requires_terminal = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "requires_terminal", "Z"); - GnomeVFSMimeApplicationFc.supported_uri_schemes = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "supported_uri_schemes", "I"); - GnomeVFSMimeApplicationFc.expects_uris = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "expects_uris", "I"); - GnomeVFSMimeApplicationFc.can_open_multiple_files = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "can_open_multiple_files", "Z"); - GnomeVFSMimeApplicationFc.command = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "command", "I"); - GnomeVFSMimeApplicationFc.name = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "name", "I"); - GnomeVFSMimeApplicationFc.id = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "id", "I"); - GnomeVFSMimeApplicationFc.cached = 1; -} - -GnomeVFSMimeApplication *getGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct) -{ - if (!GnomeVFSMimeApplicationFc.cached) cacheGnomeVFSMimeApplicationFids(env, lpObject); - lpStruct->requires_terminal = (gboolean)(*env)->GetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.requires_terminal); - lpStruct->supported_uri_schemes = (GList *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes); - lpStruct->expects_uris = (GnomeVFSMimeApplicationArgumentType)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.expects_uris); - lpStruct->can_open_multiple_files = (gboolean)(*env)->GetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.can_open_multiple_files); - lpStruct->command = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.command); - lpStruct->name = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.name); - lpStruct->id = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.id); - return lpStruct; -} - -void setGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct) -{ - if (!GnomeVFSMimeApplicationFc.cached) cacheGnomeVFSMimeApplicationFids(env, lpObject); - (*env)->SetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.requires_terminal, (jboolean)lpStruct->requires_terminal); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes, (jint)lpStruct->supported_uri_schemes); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.expects_uris, (jint)lpStruct->expects_uris); - (*env)->SetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.can_open_multiple_files, (jboolean)lpStruct->can_open_multiple_files); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.command, (jint)lpStruct->command); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.name, (jint)lpStruct->name); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.id, (jint)lpStruct->id); -} -#endif /* NO_GnomeVFSMimeApplication */ - -#ifndef NO_LIBGNOME_1MODULE -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_LIBGNOME_1MODULE - (JNIEnv *env, jclass that) -{ - jint rc; - /* custom */ - rc = (jint)LIBGNOME_MODULE; - return rc; -} -#endif - -#ifndef NO_GnomeVFSMimeApplication_1sizeof -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_GnomeVFSMimeApplication_1sizeof - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("GnomeVFSMimeApplication_1sizeof\n") - return (jint)sizeof(GnomeVFSMimeApplication); -} -#endif - -#ifndef NO_gnome_1icon_1lookup -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1icon_1lookup - (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jbyteArray arg3, jint arg4, jbyteArray arg5, jint arg6, jintArray arg7) -{ - jbyte *lparg2=NULL; - jbyte *lparg3=NULL; - jbyte *lparg5=NULL; - jint *lparg7=NULL; - jint rc; - DEBUG_CALL("gnome_1icon_1lookup\n") - if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); - if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL); - if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL); - if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL); - rc = (jint)gnome_icon_lookup((GnomeIconTheme *)arg0, (GnomeThumbnailFactory *)arg1, (const char *)lparg2, (const char *)lparg3, (GnomeVFSFileInfo *)arg4, (const char *)lparg5, arg6, (GnomeIconLookupResultFlags *)lparg7); - if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0); - if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); - if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); - if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1icon_1theme_1lookup_1icon -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1icon_1theme_1lookup_1icon - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3, jintArray arg4) -{ - jint *lparg3=NULL; - jint *lparg4=NULL; - jint rc; - DEBUG_CALL("gnome_1icon_1theme_1lookup_1icon\n") - if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); - if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); - rc = (jint)gnome_icon_theme_lookup_icon((GnomeIconTheme *)arg0, (const char *)arg1, arg2, (const GnomeIconData **)lparg3, lparg4); - if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1icon_1theme_1new -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1icon_1theme_1new - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("gnome_1icon_1theme_1new\n") - - return (jint)gnome_icon_theme_new(); -} -#endif - -#ifndef NO_gnome_1vfs_1get_1registered_1mime_1types -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1get_1registered_1mime_1types - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("gnome_1vfs_1get_1registered_1mime_1types\n") - - return (jint)gnome_vfs_get_registered_mime_types(); -} -#endif - -#ifndef NO_gnome_1vfs_1init -JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1init - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("gnome_1vfs_1init\n") - - return (jboolean)gnome_vfs_init(); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1application_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1mime_1application_1free - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1application_1free\n") - - gnome_vfs_mime_application_free((GnomeVFSMimeApplication *)arg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1extensions_1list_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1mime_1extensions_1list_1free - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1extensions_1list_1free\n") - - gnome_vfs_mime_extensions_list_free((GList*)arg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1registered_1mime_1type_1list_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1mime_1registered_1mime_1type_1list_1free - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1registered_1mime_1type_1list_1free\n") - - gnome_vfs_mime_registered_mime_type_list_free((GList *)arg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1get_1default_1application -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1mime_1get_1default_1application - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jint rc; - - DEBUG_CALL("gnome_1vfs_1mime_1get_1default_1application\n") - - if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); - rc = (jint)gnome_vfs_mime_get_default_application(lparg0); - if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1get_1extensions_1list -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1mime_1get_1extensions_1list - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1get_1extensions_1list\n") - - return (jint)gnome_vfs_mime_get_extensions_list((const char *)arg0); -} -#endif - -#ifndef NO_memmove -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_memmove - (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2) -{ - GnomeVFSMimeApplication _arg0, *lparg0=NULL; - - DEBUG_CALL("memmove\n") - - if (arg0) lparg0 = getGnomeVFSMimeApplicationFields(env, arg0, &_arg0); - memmove((void *)lparg0, (void *)arg1, arg2); - if (arg0) setGnomeVFSMimeApplicationFields(env, arg0, lparg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1get_1icon -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1vfs_1mime_1get_1icon - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jint rc; - - DEBUG_CALL("gnome_1vfs_1mime_1get_1icon\n") - if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); - rc = (jint)gnome_vfs_mime_get_icon(lparg0); - if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1program_1init -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1program_1init - (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2, jint arg3, jintArray arg4, jint arg5) -{ - jbyte *lparg0=NULL; - jbyte *lparg1=NULL; - jint *lparg4=NULL; - jint rc; - if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); - if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); - if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); - rc = (jint)gnome_program_init((const char *)lparg0, (const char *)lparg1, (const GnomeModuleInfo *)arg2, arg3, (char **)lparg4, (void *)arg5); - if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); - if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1program_1locate_1file -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_gtk_GNOME_gnome_1program_1locate_1file - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jboolean arg3, jint arg4) -{ - jint rc; - rc = (jint)gnome_program_locate_file((GnomeProgram *)arg0, arg1, (const gchar *)arg2, (gboolean)arg3, (GSList **)arg4); - return rc; -} -#endif diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak index d4d942b3e2..4ab43dd245 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/make_gtk.mak @@ -72,7 +72,7 @@ SWT_OBJECTS = callback.o AWT_OBJECTS = swt_awt.o SWTPI_OBJECTS = os.o os_structs.o os_custom.o ATK_OBJECTS = atk.o atk_structs.o atk_custom.o -GNOME_OBJECTS = gnome.o +GNOME_OBJECTS = gnome.o gnome_structs.o MOZILLA_OBJECTS = xpcom.o CFLAGS = -O -Wall \ @@ -145,6 +145,9 @@ $(GNOME_LIB): $(GNOME_OBJECTS) gnome.o: gnome.c $(CC) $(CFLAGS) $(GNOMECFLAGS) -c gnome.c +gnome_structs.o: gnome_structs.c + $(CC) $(CFLAGS) $(GNOMECFLAGS) -c gnome_structs.c + # # Mozilla lib # diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c deleted file mode 100644 index 213f92c708..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/gnome.c +++ /dev/null @@ -1,310 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ - -/** - * SWT GNOME natives implementation. - */ - -/* #define PRINT_FAILED_RCODES */ -#define NDEBUG - -#include "swt.h" - -#include <stdio.h> -#include <assert.h> -#include <libgnome/libgnome.h> -#include <libgnome/gnome-program.h> -#include <libgnomeui/libgnomeui.h> -#include <libgnomevfs/gnome-vfs.h> -#include <libgnomevfs/gnome-vfs-mime-handlers.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> - -#ifndef NO_GnomeVFSMimeApplication -typedef struct GnomeVFSMimeApplication_FID_CACHE { - int cached; - jclass clazz; - jfieldID requires_terminal, supported_uri_schemes, expects_uris, can_open_multiple_files, command, name, id; -} GnomeVFSMimeApplication_FID_CACHE; - -GnomeVFSMimeApplication_FID_CACHE GnomeVFSMimeApplicationFc; - -void cacheGnomeVFSMimeApplicationFids(JNIEnv *env, jobject lpObject) -{ - if (GnomeVFSMimeApplicationFc.cached) return; - GnomeVFSMimeApplicationFc.clazz = (*env)->GetObjectClass(env, lpObject); - GnomeVFSMimeApplicationFc.requires_terminal = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "requires_terminal", "Z"); - GnomeVFSMimeApplicationFc.supported_uri_schemes = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "supported_uri_schemes", "I"); - GnomeVFSMimeApplicationFc.expects_uris = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "expects_uris", "I"); - GnomeVFSMimeApplicationFc.can_open_multiple_files = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "can_open_multiple_files", "Z"); - GnomeVFSMimeApplicationFc.command = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "command", "I"); - GnomeVFSMimeApplicationFc.name = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "name", "I"); - GnomeVFSMimeApplicationFc.id = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "id", "I"); - GnomeVFSMimeApplicationFc.cached = 1; -} - -GnomeVFSMimeApplication *getGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct) -{ - if (!GnomeVFSMimeApplicationFc.cached) cacheGnomeVFSMimeApplicationFids(env, lpObject); - lpStruct->requires_terminal = (gboolean)(*env)->GetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.requires_terminal); - lpStruct->supported_uri_schemes = (GList *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes); - lpStruct->expects_uris = (GnomeVFSMimeApplicationArgumentType)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.expects_uris); - lpStruct->can_open_multiple_files = (gboolean)(*env)->GetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.can_open_multiple_files); - lpStruct->command = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.command); - lpStruct->name = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.name); - lpStruct->id = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.id); - return lpStruct; -} - -void setGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct) -{ - if (!GnomeVFSMimeApplicationFc.cached) cacheGnomeVFSMimeApplicationFids(env, lpObject); - (*env)->SetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.requires_terminal, (jboolean)lpStruct->requires_terminal); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes, (jint)lpStruct->supported_uri_schemes); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.expects_uris, (jint)lpStruct->expects_uris); - (*env)->SetBooleanField(env, lpObject, GnomeVFSMimeApplicationFc.can_open_multiple_files, (jboolean)lpStruct->can_open_multiple_files); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.command, (jint)lpStruct->command); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.name, (jint)lpStruct->name); - (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.id, (jint)lpStruct->id); -} -#endif /* NO_GnomeVFSMimeApplication */ - -#ifndef NO_LIBGNOME_1MODULE -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_LIBGNOME_1MODULE - (JNIEnv *env, jclass that) -{ - jint rc; - /* custom */ - rc = (jint)LIBGNOME_MODULE; - return rc; -} -#endif - -#ifndef NO_g_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_g_1free - (JNIEnv *env, jclass that, jint arg0) -{ - g_free((gpointer)arg0); -} -#endif - -#ifndef NO_g_1list_1next__I -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_g_1list_1next__I - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("g_1list_1next__I\n") - - return (jint)g_list_next(arg0); -} -#endif - -#ifndef NO_g_1malloc -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_g_1malloc - (JNIEnv *env, jclass that, jint arg0) -{ - jint rc; - rc = (jint)g_malloc((gulong)arg0); - return rc; -} -#endif - -#ifndef NO_g_1object_1unref -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_g_1object_1unref - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("g_1object_1unref\n") - g_object_unref((gpointer)arg0); -} -#endif - -#ifndef NO_gnome_1icon_1lookup -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1icon_1lookup - (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jbyteArray arg3, jint arg4, jbyteArray arg5, jint arg6, jintArray arg7) -{ - jbyte *lparg2=NULL; - jbyte *lparg3=NULL; - jbyte *lparg5=NULL; - jint *lparg7=NULL; - jint rc; - DEBUG_CALL("gnome_1icon_1lookup\n") - if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); - if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL); - if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL); - if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL); - rc = (jint)gnome_icon_lookup((GnomeIconTheme *)arg0, (GnomeThumbnailFactory *)arg1, (const char *)lparg2, (const char *)lparg3, (GnomeVFSFileInfo *)arg4, (const char *)lparg5, arg6, (GnomeIconLookupResultFlags *)lparg7); - if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0); - if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); - if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); - if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1icon_1theme_1lookup_1icon -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1icon_1theme_1lookup_1icon - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3, jintArray arg4) -{ - jint *lparg3=NULL; - jint *lparg4=NULL; - jint rc; - DEBUG_CALL("gnome_1icon_1theme_1lookup_1icon\n") - if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); - if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); - rc = (jint)gnome_icon_theme_lookup_icon((GnomeIconTheme *)arg0, (const char *)arg1, arg2, (const GnomeIconData **)lparg3, lparg4); - if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1icon_1theme_1new -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1icon_1theme_1new - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("gnome_1icon_1theme_1new\n") - - return (jint)gnome_icon_theme_new(); -} -#endif - -#ifndef NO_gnome_1vfs_1get_1registered_1mime_1types -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1get_1registered_1mime_1types - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("gnome_1vfs_1get_1registered_1mime_1types\n") - - return (jint)gnome_vfs_get_registered_mime_types(); -} -#endif - -#ifndef NO_gnome_1vfs_1init -JNIEXPORT jboolean JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1init - (JNIEnv *env, jclass that) -{ - DEBUG_CALL("gnome_1vfs_1init\n") - - return (jboolean)gnome_vfs_init(); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1application_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1mime_1application_1free - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1application_1free\n") - - gnome_vfs_mime_application_free((GnomeVFSMimeApplication *)arg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1extensions_1list_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1mime_1extensions_1list_1free - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1extensions_1list_1free\n") - - gnome_vfs_mime_extensions_list_free((GList*)arg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1registered_1mime_1type_1list_1free -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1mime_1registered_1mime_1type_1list_1free - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1registered_1mime_1type_1list_1free\n") - - gnome_vfs_mime_registered_mime_type_list_free((GList*)arg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1get_1default_1application -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1mime_1get_1default_1application - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jint rc; - - DEBUG_CALL("gnome_1vfs_1mime_1get_1default_1application\n") - - if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); - rc = (jint)gnome_vfs_mime_get_default_application(lparg0); - if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1get_1extensions_1list -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1mime_1get_1extensions_1list - (JNIEnv *env, jclass that, jint arg0) -{ - DEBUG_CALL("gnome_1vfs_1mime_1get_1extensions_1list\n") - - return (jint)gnome_vfs_mime_get_extensions_list((const char *)arg0); -} -#endif - -#ifndef NO_memmove -JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_motif_GNOME_memmove - (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2) -{ - GnomeVFSMimeApplication _arg0, *lparg0=NULL; - - DEBUG_CALL("memmove\n") - - if (arg0) lparg0 = getGnomeVFSMimeApplicationFields(env, arg0, &_arg0); - memmove((void *)lparg0, (void *)arg1, arg2); - if (arg0) setGnomeVFSMimeApplicationFields(env, arg0, lparg0); -} -#endif - -#ifndef NO_gnome_1vfs_1mime_1get_1icon -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1vfs_1mime_1get_1icon - (JNIEnv *env, jclass that, jbyteArray arg0) -{ - jbyte *lparg0=NULL; - jint rc; - - DEBUG_CALL("gnome_1vfs_1mime_1get_1icon\n") - if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); - rc = (jint)gnome_vfs_mime_get_icon(lparg0); - if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1program_1init -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1program_1init - (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2, jint arg3, jintArray arg4, jint arg5) -{ - jbyte *lparg0=NULL; - jbyte *lparg1=NULL; - jint *lparg4=NULL; - jint rc; - if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); - if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); - if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); - rc = (jint)gnome_program_init((const char *)lparg0, (const char *)lparg1, (const GnomeModuleInfo *)arg2, arg3, (char **)lparg4, (void *)arg5); - if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); - if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); - if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); - return rc; -} -#endif - -#ifndef NO_gnome_1program_1locate_1file -JNIEXPORT jint JNICALL Java_org_eclipse_swt_internal_motif_GNOME_gnome_1program_1locate_1file - (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jboolean arg3, jint arg4) -{ - jint rc; - rc = (jint)gnome_program_locate_file((GnomeProgram *)arg0, arg1, (const gchar *)arg2, (gboolean)arg3, (GSList **)arg4); - return rc; -} -#endif - diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak index c434ce3851..c8a140f7b5 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/library/make_linux.mak @@ -37,7 +37,7 @@ SWT_LIB = -L$(MOTIF_HOME)/lib -lXm -L/usr/lib -L/usr/X11R6/lib \ GNOME_PREFIX = swt-gnome GNOME_DLL = lib$(GNOME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so -GNOME_OBJ = gnome.o +GNOME_OBJECTS= gnome.o gnome_structs.o GNOME_CFLAGS = `pkg-config --cflags gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` GNOME_LIB = -shared -fpic -fPIC `pkg-config --libs gnome-vfs-module-2.0 libgnome-2.0 libgnomeui-2.0` @@ -82,12 +82,15 @@ $(SWT_DLL): $(SWT_OBJ) make_gnome: $(GNOME_DLL) -$(GNOME_DLL): $(GNOME_OBJ) - gcc -o $@ $(GNOME_OBJ) $(GNOME_LIB) +$(GNOME_DLL): $(GNOME_OBJECTS) + gcc -o $@ $(GNOME_OBJECTS) $(GNOME_LIB) -$(GNOME_OBJ): gnome.c +gnome.o: gnome.c gcc -O -Wall -DSWT_VERSION=$(SWT_VERSION) -DLINUX -DGTK -I$(JAVA_HOME)/include $(GNOME_CFLAGS) -c -o gnome.o gnome.c +gnome_structs.o: gnome_structs.c + gcc -O -Wall -DSWT_VERSION=$(SWT_VERSION) -DLINUX -DGTK -I$(JAVA_HOME)/include $(GNOME_CFLAGS) -c -o gnome_structs.o gnome_structs.c + make_kde: $(KDE_DLL) $(KDE_DLL): $(KDE_OBJ) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java deleted file mode 100644 index 6fb0f3621b..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GNOME.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.motif; - - -public class GNOME extends OS { - -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 synchronized native int LIBGNOME_MODULE(); -public static final synchronized native void g_free(int mem); -public static final synchronized native int g_list_next(int list); -public static final synchronized native int g_malloc(int size); -public static final synchronized native void g_object_unref(int object); -public static final synchronized native int gnome_icon_lookup(int icon_theme, int thumbnail_factory, byte[] file_uri, byte[] custom_icon, int file_info, byte[] mime_type, int flags, int[] result); -public static final synchronized native int gnome_icon_theme_lookup_icon(int theme, int icon_name, int size, int[] icon_data, int[] base_size); -public static final synchronized native int gnome_icon_theme_new(); -public static final synchronized native int gnome_program_init(byte[] app_id, byte[] app_version, int module_info, int argc, int[] argv, int first_property_name); -public static final synchronized native int gnome_program_locate_file(int program, int domain, int file_name, boolean only_if_exists, int ret_location); -public static final synchronized native int gnome_vfs_get_registered_mime_types(); -public static final synchronized native boolean gnome_vfs_init(); -public static final synchronized native void gnome_vfs_mime_application_free(int application); -public static final synchronized native void gnome_vfs_mime_extensions_list_free(int list); -public static final synchronized native int gnome_vfs_mime_get_default_application(byte[] mimeType); -public static final synchronized native int gnome_vfs_mime_get_extensions_list(int mime_type); -public static final synchronized native int gnome_vfs_mime_get_icon(byte[] mime_type); -public static final synchronized native void gnome_vfs_mime_registered_mime_type_list_free(int list); -public static final synchronized native void memmove (GnomeVFSMimeApplication dest, int src, int count); - -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GnomeVFSMimeApplication.java b/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GnomeVFSMimeApplication.java deleted file mode 100644 index efc4b6a37c..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/motif/org/eclipse/swt/internal/motif/GnomeVFSMimeApplication.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.swt.internal.motif; - - -public class GnomeVFSMimeApplication { - public int id; - public int name; - public int command; - public boolean can_open_multiple_files; - public int expects_uris; - public int supported_uri_schemes; - public boolean requires_terminal; - public static final int sizeof = 28; -} 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 new file mode 100644 index 0000000000..d683740cce --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c @@ -0,0 +1,256 @@ +/******************************************************************************* +* Copyright (c) 2000, 2003 IBM Corporation and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Common Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/cpl-v10.html +* +* Contributors: +* IBM Corporation - initial API and implementation +*******************************************************************************/ + +#include "swt.h" +#include "gnome_structs.h" + +#define GNOME_NATIVE(func) Java_org_eclipse_swt_internal_gnome_GNOME_##func + +#ifndef NO_GnomeVFSMimeApplication_1sizeof +JNIEXPORT jint JNICALL GNOME_NATIVE(GnomeVFSMimeApplication_1sizeof) + (JNIEnv *env, jclass that) +{ + jint rc; + NATIVE_ENTER(env, that, "GnomeVFSMimeApplication_1sizeof\n") + rc = (jint)GnomeVFSMimeApplication_sizeof(); + NATIVE_EXIT(env, that, "GnomeVFSMimeApplication_1sizeof\n") + return rc; +} +#endif + +#ifndef NO_g_1free +JNIEXPORT void JNICALL GNOME_NATIVE(g_1free) + (JNIEnv *env, jclass that, jint arg0) +{ + NATIVE_ENTER(env, that, "g_1free\n") + g_free((gpointer)arg0); + NATIVE_EXIT(env, that, "g_1free\n") +} +#endif + +#ifndef NO_g_1list_1next +JNIEXPORT jint JNICALL GNOME_NATIVE(g_1list_1next) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc; + NATIVE_ENTER(env, that, "g_1list_1next\n") + rc = (jint)g_list_next(arg0); + NATIVE_EXIT(env, that, "g_1list_1next\n") + return rc; +} +#endif + +#ifndef NO_g_1object_1unref +JNIEXPORT void JNICALL GNOME_NATIVE(g_1object_1unref) + (JNIEnv *env, jclass that, jint arg0) +{ + NATIVE_ENTER(env, that, "g_1object_1unref\n") + g_object_unref((gpointer)arg0); + NATIVE_EXIT(env, that, "g_1object_1unref\n") +} +#endif + +#ifndef NO_gnome_1icon_1lookup +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1icon_1lookup) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jbyteArray arg2, jbyteArray arg3, jint arg4, jbyteArray arg5, jint arg6, jintArray arg7) +{ + jbyte *lparg2=NULL; + jbyte *lparg3=NULL; + jbyte *lparg5=NULL; + jint *lparg7=NULL; + jint rc; + NATIVE_ENTER(env, that, "gnome_1icon_1lookup\n") + if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); + if (arg3) lparg3 = (*env)->GetByteArrayElements(env, arg3, NULL); + if (arg5) lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL); + if (arg7) lparg7 = (*env)->GetIntArrayElements(env, arg7, NULL); + rc = (jint)gnome_icon_lookup((GnomeIconTheme *)arg0, (GnomeThumbnailFactory *)arg1, (const char *)lparg2, (const char *)lparg3, (GnomeVFSFileInfo *)arg4, (const char *)lparg5, (GnomeIconLookupFlags)arg6, (GnomeIconLookupResultFlags *)lparg7); + if (arg7) (*env)->ReleaseIntArrayElements(env, arg7, lparg7, 0); + if (arg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0); + if (arg3) (*env)->ReleaseByteArrayElements(env, arg3, lparg3, 0); + if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); + NATIVE_EXIT(env, that, "gnome_1icon_1lookup\n") + return rc; +} +#endif + +#ifndef NO_gnome_1icon_1theme_1lookup_1icon +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1icon_1theme_1lookup_1icon) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jintArray arg3, jintArray arg4) +{ + jint *lparg3=NULL; + jint *lparg4=NULL; + jint rc; + NATIVE_ENTER(env, that, "gnome_1icon_1theme_1lookup_1icon\n") + if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); + if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); + rc = (jint)gnome_icon_theme_lookup_icon((GnomeIconTheme *)arg0, (const char *)arg1, arg2, (const GnomeIconData **)lparg3, lparg4); + if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); + if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); + NATIVE_EXIT(env, that, "gnome_1icon_1theme_1lookup_1icon\n") + return rc; +} +#endif + +#ifndef NO_gnome_1icon_1theme_1new +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1icon_1theme_1new) + (JNIEnv *env, jclass that) +{ + jint rc; + NATIVE_ENTER(env, that, "gnome_1icon_1theme_1new\n") + rc = (jint)gnome_icon_theme_new(); + NATIVE_EXIT(env, that, "gnome_1icon_1theme_1new\n") + return rc; +} +#endif + +#ifndef NO_gnome_1program_1init +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1program_1init) + (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2, jint arg3, jintArray arg4, jint arg5) +{ + jbyte *lparg0=NULL; + jbyte *lparg1=NULL; + jint *lparg4=NULL; + jint rc; + NATIVE_ENTER(env, that, "gnome_1program_1init\n") + if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); + if (arg1) lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL); + if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); + rc = (jint)gnome_program_init((const char *)lparg0, (const char *)lparg1, (const GnomeModuleInfo *)arg2, arg3, (char **)lparg4, (void *)arg5); + if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); + if (arg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + NATIVE_EXIT(env, that, "gnome_1program_1init\n") + return rc; +} +#endif + +#ifndef NO_gnome_1program_1locate_1file +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1program_1locate_1file) + (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jboolean arg3, jint arg4) +{ + jint rc; + NATIVE_ENTER(env, that, "gnome_1program_1locate_1file\n") + rc = (jint)gnome_program_locate_file((GnomeProgram *)arg0, arg1, (const gchar *)arg2, (gboolean)arg3, (GSList **)arg4); + NATIVE_EXIT(env, that, "gnome_1program_1locate_1file\n") + return rc; +} +#endif + +#ifndef NO_gnome_1vfs_1get_1registered_1mime_1types +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1vfs_1get_1registered_1mime_1types) + (JNIEnv *env, jclass that) +{ + jint rc; + NATIVE_ENTER(env, that, "gnome_1vfs_1get_1registered_1mime_1types\n") + rc = (jint)gnome_vfs_get_registered_mime_types(); + NATIVE_EXIT(env, that, "gnome_1vfs_1get_1registered_1mime_1types\n") + return rc; +} +#endif + +#ifndef NO_gnome_1vfs_1init +JNIEXPORT jboolean JNICALL GNOME_NATIVE(gnome_1vfs_1init) + (JNIEnv *env, jclass that) +{ + jboolean rc; + NATIVE_ENTER(env, that, "gnome_1vfs_1init\n") + rc = (jboolean)gnome_vfs_init(); + NATIVE_EXIT(env, that, "gnome_1vfs_1init\n") + return rc; +} +#endif + +#ifndef NO_gnome_1vfs_1mime_1application_1free +JNIEXPORT void JNICALL GNOME_NATIVE(gnome_1vfs_1mime_1application_1free) + (JNIEnv *env, jclass that, jint arg0) +{ + NATIVE_ENTER(env, that, "gnome_1vfs_1mime_1application_1free\n") + gnome_vfs_mime_application_free((GnomeVFSMimeApplication *)arg0); + NATIVE_EXIT(env, that, "gnome_1vfs_1mime_1application_1free\n") +} +#endif + +#ifndef NO_gnome_1vfs_1mime_1extensions_1list_1free +JNIEXPORT void JNICALL GNOME_NATIVE(gnome_1vfs_1mime_1extensions_1list_1free) + (JNIEnv *env, jclass that, jint arg0) +{ + NATIVE_ENTER(env, that, "gnome_1vfs_1mime_1extensions_1list_1free\n") + gnome_vfs_mime_extensions_list_free((GList *)arg0); + NATIVE_EXIT(env, that, "gnome_1vfs_1mime_1extensions_1list_1free\n") +} +#endif + +#ifndef NO_gnome_1vfs_1mime_1get_1default_1application +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1vfs_1mime_1get_1default_1application) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jint rc; + NATIVE_ENTER(env, that, "gnome_1vfs_1mime_1get_1default_1application\n") + if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); + rc = (jint)gnome_vfs_mime_get_default_application(lparg0); + if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + NATIVE_EXIT(env, that, "gnome_1vfs_1mime_1get_1default_1application\n") + return rc; +} +#endif + +#ifndef NO_gnome_1vfs_1mime_1get_1extensions_1list +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1vfs_1mime_1get_1extensions_1list) + (JNIEnv *env, jclass that, jint arg0) +{ + jint rc; + NATIVE_ENTER(env, that, "gnome_1vfs_1mime_1get_1extensions_1list\n") + rc = (jint)gnome_vfs_mime_get_extensions_list((const char *)arg0); + NATIVE_EXIT(env, that, "gnome_1vfs_1mime_1get_1extensions_1list\n") + return rc; +} +#endif + +#ifndef NO_gnome_1vfs_1mime_1get_1icon +JNIEXPORT jint JNICALL GNOME_NATIVE(gnome_1vfs_1mime_1get_1icon) + (JNIEnv *env, jclass that, jbyteArray arg0) +{ + jbyte *lparg0=NULL; + jint rc; + NATIVE_ENTER(env, that, "gnome_1vfs_1mime_1get_1icon\n") + if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); + rc = (jint)gnome_vfs_mime_get_icon(lparg0); + if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); + NATIVE_EXIT(env, that, "gnome_1vfs_1mime_1get_1icon\n") + return rc; +} +#endif + +#ifndef NO_gnome_1vfs_1mime_1registered_1mime_1type_1list_1free +JNIEXPORT void JNICALL GNOME_NATIVE(gnome_1vfs_1mime_1registered_1mime_1type_1list_1free) + (JNIEnv *env, jclass that, jint arg0) +{ + NATIVE_ENTER(env, that, "gnome_1vfs_1mime_1registered_1mime_1type_1list_1free\n") + gnome_vfs_mime_registered_mime_type_list_free((GList *)arg0); + NATIVE_EXIT(env, that, "gnome_1vfs_1mime_1registered_1mime_1type_1list_1free\n") +} +#endif + +#ifndef NO_memmove +JNIEXPORT void JNICALL GNOME_NATIVE(memmove) + (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2) +{ + GnomeVFSMimeApplication _arg0, *lparg0=NULL; + NATIVE_ENTER(env, that, "memmove\n") + if (arg0) lparg0 = &_arg0; + memmove((void *)lparg0, (const void *)arg1, (size_t)arg2); + if (arg0) setGnomeVFSMimeApplicationFields(env, arg0, lparg0); + NATIVE_EXIT(env, that, "memmove\n") +} +#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 new file mode 100644 index 0000000000..6ee6464936 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 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 <string.h> +#include <stdio.h> +#include <assert.h> +#include <libgnome/libgnome.h> +#include <libgnome/gnome-program.h> +#include <libgnomeui/libgnomeui.h> +#include <libgnomevfs/gnome-vfs.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> +#include <libgnomevfs/gnome-vfs-mime-info.h> + +#define NATIVE_ENTER(env,clazz,func) +#define NATIVE_EXIT(env,clazz,func) 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 new file mode 100644 index 0000000000..32d9560b56 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.c @@ -0,0 +1,63 @@ +/******************************************************************************* +* Copyright (c) 2000, 2003 IBM Corporation and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Common Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/cpl-v10.html +* +* 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"); + GnomeVFSMimeApplicationFc.name = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "name", "I"); + GnomeVFSMimeApplicationFc.command = (*env)->GetFieldID(env, GnomeVFSMimeApplicationFc.clazz, "command", "I"); + 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"); + 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)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.id); + lpStruct->name = (char *)(*env)->GetIntField(env, lpObject, GnomeVFSMimeApplicationFc.name); + lpStruct->command = (char *)(*env)->GetIntField(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)->GetIntField(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)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.id, (jint)lpStruct->id); + (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.name, (jint)lpStruct->name); + (*env)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.command, (jint)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)->SetIntField(env, lpObject, GnomeVFSMimeApplicationFc.supported_uri_schemes, (jint)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 new file mode 100644 index 0000000000..92627d43ca --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_structs.h @@ -0,0 +1,23 @@ +/******************************************************************************* +* Copyright (c) 2000, 2003 IBM Corporation and others. +* All rights reserved. This program and the accompanying materials +* are made available under the terms of the Common Public License v1.0 +* which accompanies this distribution, and is available at +* http://www.eclipse.org/legal/cpl-v10.html +* +* Contributors: +* IBM Corporation - initial API and implementation +*******************************************************************************/ + +#include "gnome.h" + +#ifndef NO_GnomeVFSMimeApplication +GnomeVFSMimeApplication *getGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct); +void setGnomeVFSMimeApplicationFields(JNIEnv *env, jobject lpObject, GnomeVFSMimeApplication *lpStruct); +#define GnomeVFSMimeApplication_sizeof() sizeof(GnomeVFSMimeApplication) +#else +#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 PI/gtk/org/eclipse/swt/internal/gtk/GNOME.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java index a2299fa9b9..3267184b61 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GNOME.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java @@ -9,11 +9,11 @@ * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. *******************************************************************************/ -package org.eclipse.swt.internal.gtk; +package org.eclipse.swt.internal.gnome; import org.eclipse.swt.internal.Library; -public class GNOME extends OS { +public class GNOME { static { Library.loadLibrary("swt-gnome"); } @@ -24,7 +24,9 @@ public static final int GNOME_PARAM_NONE = 0; public static final int GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS = 0; public static final synchronized native int GnomeVFSMimeApplication_sizeof(); -public static final synchronized native int LIBGNOME_MODULE(); +public static final synchronized native void g_free(int /*long*/ mem); +public static final synchronized native int /*long*/ g_list_next(int /*long*/ list); +public static final synchronized native void g_object_unref(int /*long*/ object); public static final synchronized native int gnome_icon_lookup(int icon_theme, int thumbnail_factory, byte[] file_uri, byte[] custom_icon, int file_info, byte[] mime_type, int flags, int[] result); public static final synchronized native int gnome_icon_theme_lookup_icon(int theme, int icon_name, int size, int[] icon_data, int[] base_size); public static final synchronized native int gnome_icon_theme_new(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GnomeVFSMimeApplication.java b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java index 063c8da21b..e1d5bc9c05 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GnomeVFSMimeApplication.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GnomeVFSMimeApplication.java @@ -9,7 +9,7 @@ * between the two license versions, the terms of the LGPL accompanying * this distribution shall govern. *******************************************************************************/ -package org.eclipse.swt.internal.gtk; +package org.eclipse.swt.internal.gnome; public class GnomeVFSMimeApplication { 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 3ea71a801c..b05d4dae99 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 @@ -15,6 +15,7 @@ import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gtk.*; +import org.eclipse.swt.internal.gnome.*; import org.eclipse.swt.widgets.*; import java.io.*; diff --git a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java index 64944434c2..a331834572 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Program/motif/org/eclipse/swt/program/Program.java @@ -15,6 +15,7 @@ import java.util.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; +import org.eclipse.swt.internal.gnome.*; import org.eclipse.swt.internal.motif.*; import org.eclipse.swt.widgets.*; |