src/solaris/native/sun/xawt/awt_Desktop.c
Print this page
*** 22,87 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <jni.h>
! #include <dlfcn.h>
!
! typedef int gboolean;
!
! typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **);
! typedef gboolean (GNOME_VFS_INIT_TYPE)(void);
!
! GNOME_URL_SHOW_TYPE *gnome_url_show;
! GNOME_VFS_INIT_TYPE *gnome_vfs_init;
int init(){
! void *vfs_handle;
! void *gnome_handle;
! const char *errmsg;
!
! vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY);
! if (vfs_handle == NULL) {
! #ifdef INTERNAL_BUILD
! fprintf(stderr, "can not load libgnomevfs-2.so\n");
! #endif
! return 0;
! }
! dlerror(); /* Clear errors */
! gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
! if (gnome_vfs_init == NULL){
! #ifdef INTERNAL_BUILD
! fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
! #endif
! return 0;
! }
! if ((errmsg = dlerror()) != NULL) {
! #ifdef INTERNAL_BUILD
! fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
! #endif
! return 0;
! }
! // call gonme_vfs_init()
! (*gnome_vfs_init)();
!
! gnome_handle = dlopen("libgnome-2.so.0", RTLD_LAZY);
! if (gnome_handle == NULL) {
! #ifdef INTERNAL_BUILD
! fprintf(stderr, "can not load libgnome-2.so\n");
! #endif
! return 0;
! }
! dlerror(); /* Clear errors */
! gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
! if ((errmsg = dlerror()) != NULL) {
! #ifdef INTERNAL_BUILD
! fprintf(stderr, "can not find symble gnome_url_show\n");
! #endif
! return 0;
! }
!
! return 1;
}
/*
* Class: sun_awt_X11_XDesktopPeer
* Method: init
--- 22,36 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <jni.h>
! #include "gtk2_interface.h"
! #include "gnome_interface.h"
int init(){
! return (gtk2_load() && gtk2_show_uri_load()) || gnome_load();
}
/*
* Class: sun_awt_X11_XDesktopPeer
* Method: init
*** 101,118 ****
*/
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show
(JNIEnv *env, jobject obj, jbyteArray url_j)
{
gboolean success;
! const char* url_c;
!
! if (gnome_url_show == NULL) {
! return JNI_FALSE;
! }
url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
// call gnome_url_show(const char* , GError**)
success = (*gnome_url_show)(url_c, NULL);
(*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
return success ? JNI_TRUE : JNI_FALSE;
}
--- 50,72 ----
*/
JNIEXPORT jboolean JNICALL Java_sun_awt_X11_XDesktopPeer_gnome_1url_1show
(JNIEnv *env, jobject obj, jbyteArray url_j)
{
gboolean success;
! const gchar* url_c;
url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
+
+ if (fp_gtk_show_uri != NULL) {
+ fp_gdk_threads_enter();
+ success = fp_gtk_show_uri(NULL, url_c, GDK_CURRENT_TIME, NULL);
+ fp_gdk_threads_leave();
+ } else if (gnome_url_show != NULL) {
// call gnome_url_show(const char* , GError**)
success = (*gnome_url_show)(url_c, NULL);
+ }
+
+
(*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
return success ? JNI_TRUE : JNI_FALSE;
}