aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2016-07-25 05:29:14 -0400
committerAlexander Kurtakov2016-07-25 05:29:14 -0400
commit251f497bdeffeebeebb4acb1ac47f90244cf56cb (patch)
tree98c415adcba1711527935213d54a66e02022d238
parent904f2c8f40e0976185de69d1768aec16a94c3482 (diff)
downloadeclipse.platform.swt-251f497bdeffeebeebb4acb1ac47f90244cf56cb.tar.gz
eclipse.platform.swt-251f497bdeffeebeebb4acb1ac47f90244cf56cb.tar.xz
eclipse.platform.swt-251f497bdeffeebeebb4acb1ac47f90244cf56cb.zip
Bug 498415 - Unify Program to go through gio path where possible
SWT having min requirement of GTK 2.18 means GIO is generally available so methods that don't use functions added in later versions can go through it unconditionally. Found while debugging an issue with SWT trying to use gnome-vfs on Gtk 3.20. Program.[execute|getExtensions|launch] now go through gio unconditionally for both Gnome and GIO. Change-Id: If41df0ad869b7ea01c8dd26c69fd146f9c896499 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c66
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gnome/org/eclipse/swt/internal/gnome/GNOME.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Program/gtk/org/eclipse/swt/program/Program.java34
6 files changed, 6 insertions, 150 deletions
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
index 84a7788862..2eaccad287 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
+ * 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
@@ -145,30 +145,6 @@ fail:
}
#endif
-#ifndef NO__1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs
-JNIEXPORT jintLong JNICALL GNOME_NATIVE(_1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs)
- (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1)
-{
- jbyte *lparg0=NULL;
- jintLong rc = 0;
- GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs_FUNC);
- if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
-/*
- rc = (jintLong)gnome_vfs_make_uri_from_input_with_dirs((const char *)lparg0, arg1);
-*/
- {
- GNOME_LOAD_FUNCTION(fp, gnome_vfs_make_uri_from_input_with_dirs)
- if (fp) {
- rc = (jintLong)((jintLong (CALLING_CONVENTION*)(const char *, jint))fp)((const char *)lparg0, arg1);
- }
- }
-fail:
- if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
- GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs_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)
@@ -179,26 +155,6 @@ JNIEXPORT void JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1application_1free)
}
#endif
-#ifndef NO__1gnome_1vfs_1mime_1application_1launch
-JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1mime_1application_1launch)
- (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
-{
- jint rc = 0;
- GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1mime_1application_1launch_FUNC);
-/*
- rc = (jint)gnome_vfs_mime_application_launch((GnomeVFSMimeApplication *)arg0, (GList *)arg1);
-*/
- {
- GNOME_LOAD_FUNCTION(fp, gnome_vfs_mime_application_launch)
- if (fp) {
- rc = (jint)((jint (CALLING_CONVENTION*)(GnomeVFSMimeApplication *, GList *))fp)((GnomeVFSMimeApplication *)arg0, (GList *)arg1);
- }
- }
- GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1mime_1application_1launch_FUNC);
- return rc;
-}
-#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)
@@ -247,26 +203,6 @@ fail:
}
#endif
-#ifndef NO__1gnome_1vfs_1url_1show
-JNIEXPORT jint JNICALL GNOME_NATIVE(_1gnome_1vfs_1url_1show)
- (JNIEnv *env, jclass that, jintLong arg0)
-{
- jint rc = 0;
- GNOME_NATIVE_ENTER(env, that, _1gnome_1vfs_1url_1show_FUNC);
-/*
- rc = (jint)gnome_vfs_url_show((const char *)arg0);
-*/
- {
- GNOME_LOAD_FUNCTION(fp, gnome_vfs_url_show)
- if (fp) {
- rc = (jint)((jint (CALLING_CONVENTION*)(const char *))fp)((const char *)arg0);
- }
- }
- GNOME_NATIVE_EXIT(env, that, _1gnome_1vfs_1url_1show_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_memmove
JNIEXPORT void JNICALL GNOME_NATIVE(memmove)
(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
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
index fd77b8a6d0..69b7ec49c2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT Program/gnome/library/gnome.h
@@ -38,8 +38,4 @@
#define LIB_VFS "libgnomevfs-2.so.0"
#endif
-#define gnome_vfs_url_show_LIB LIB_VFS
-#define gnome_vfs_make_uri_from_input_with_dirs_LIB LIB_VFS
-#define gnome_vfs_mime_application_launch_LIB LIB_VFS
-
#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
index 857e003334..3be86404aa 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
+ * 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
@@ -27,13 +27,10 @@ char * GNOME_nativeFunctionNames[] = {
"_1gnome_1vfs_1init",
"_1gnome_1vfs_1is_1executable_1command_1string",
"_1gnome_1vfs_1make_1uri_1from_1input",
- "_1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs",
"_1gnome_1vfs_1mime_1application_1free",
- "_1gnome_1vfs_1mime_1application_1launch",
"_1gnome_1vfs_1mime_1get_1default_1application",
"_1gnome_1vfs_1mime_1type_1from_1name",
"_1gnome_1vfs_1mime_1type_1get_1equivalence",
- "_1gnome_1vfs_1url_1show",
"memmove",
};
#define NATIVE_FUNCTION_COUNT sizeof(GNOME_nativeFunctionNames) / sizeof(char*)
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
index 4004fae457..019918bd82 100644
--- 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved.
+ * 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
@@ -37,12 +37,9 @@ typedef enum {
_1gnome_1vfs_1init_FUNC,
_1gnome_1vfs_1is_1executable_1command_1string_FUNC,
_1gnome_1vfs_1make_1uri_1from_1input_FUNC,
- _1gnome_1vfs_1make_1uri_1from_1input_1with_1dirs_FUNC,
_1gnome_1vfs_1mime_1application_1free_FUNC,
- _1gnome_1vfs_1mime_1application_1launch_FUNC,
_1gnome_1vfs_1mime_1get_1default_1application_FUNC,
_1gnome_1vfs_1mime_1type_1from_1name_FUNC,
_1gnome_1vfs_1mime_1type_1get_1equivalence_FUNC,
- _1gnome_1vfs_1url_1show_FUNC,
memmove_FUNC,
} GNOME_FUNCS;
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
index 6692716568..bdbd7a851a 100644
--- 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
@@ -28,7 +28,6 @@ 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_OK = 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;
@@ -111,19 +110,6 @@ public static final long /*int*/ gnome_vfs_make_uri_from_input(byte[] uri) {
lock.unlock();
}
}
-/**
- * @method flags=dynamic
- * @param uri cast=(const char *)
- */
-public static final native long /*int*/ _gnome_vfs_make_uri_from_input_with_dirs(byte[] uri, int dirs);
-public static final long /*int*/ gnome_vfs_make_uri_from_input_with_dirs(byte[] uri, int dirs) {
- lock.lock();
- try {
- return _gnome_vfs_make_uri_from_input_with_dirs(uri, dirs);
- } 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) {
@@ -144,21 +130,6 @@ public static final boolean gnome_vfs_is_executable_command_string(byte[] comman
lock.unlock();
}
}
-/**
- * @method flags=dynamic
- * @param application cast=(GnomeVFSMimeApplication *)
- * @param uris cast=(GList *)
- */
-public static final native int _gnome_vfs_mime_application_launch(long /*int*/ application, long /*int*/ uris);
-public static final int gnome_vfs_mime_application_launch(long /*int*/ application, long /*int*/ uris) {
- lock.lock();
- try {
- return _gnome_vfs_mime_application_launch(application, uris);
- } 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) {
@@ -194,19 +165,6 @@ public static final long /*int*/ gnome_vfs_mime_type_get_equivalence(long /*int*
}
}
/**
- * @method flags=dynamic
- * @param url cast=(const char *)
- */
-public static final native int _gnome_vfs_url_show(long /*int*/ url);
-public static final int gnome_vfs_url_show(long /*int*/ url) {
- lock.lock();
- try {
- return _gnome_vfs_url_show(url);
- } finally {
- lock.unlock();
- }
-}
-/**
* @param dest cast=(void *),flags=no_in
* @param src cast=(const void *)
* @param count cast=(size_t)
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 7653f809df..b59bd96b11 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
@@ -368,33 +368,6 @@ static String[] parseCommand(String cmd) {
}
/**
- * GNOME 2.4 - Execute the program for the given file.
- */
-boolean gnome_execute(String fileName) {
- byte[] mimeTypeBuffer = Converter.wcsToMbcs(null, name, true);
- long /*int*/ ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer);
- byte[] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
- long /*int*/ uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT);
- long /*int*/ list = OS.g_list_append(0, uri);
- int result = GNOME.gnome_vfs_mime_application_launch(ptr, list);
- GNOME.gnome_vfs_mime_application_free(ptr);
- OS.g_free(uri);
- OS.g_list_free(list);
- return result == GNOME.GNOME_VFS_OK;
-}
-
-/**
- * GNOME 2.4 - Launch the default program for the given file.
- */
-static boolean gnome_launch(String fileName) {
- byte[] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true);
- long /*int*/ uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT);
- int result = GNOME.gnome_vfs_url_show(uri);
- OS.g_free(uri);
- return (result == GNOME.GNOME_VFS_OK);
-}
-
-/**
* GNOME - Get Image Data
*
*/
@@ -555,8 +528,8 @@ 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_GNOME: break;
case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break;
}
if (mimeInfo == null) return new String[0];
@@ -945,10 +918,9 @@ static boolean launch (Display display, String fileName, String workingDir) {
}
}
switch (getDesktop (display)) {
+ case DESKTOP_GNOME:
case DESKTOP_GIO:
if (gio_launch (fileName)) return true;
- case DESKTOP_GNOME:
- if (gnome_launch (fileName)) return true;
default:
int index = fileName.lastIndexOf ('.');
if (index != -1) {
@@ -1010,8 +982,8 @@ 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_GNOME: return gnome_execute(fileName);
case DESKTOP_CDE: return cde_execute(fileName);
}
return false;