diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-05-11 14:21:42 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-05-11 14:21:42 -0400 |
commit | 947d452c5315fc57055c1eb4142da8e6ca27798e (patch) | |
tree | fbfc069bf595467ce3585b13ac07ea04fb9c4a81 /bundles | |
parent | 523cfe8f03b47eb57d09eba7390e82723bb777f8 (diff) | |
download | eclipse.platform.swt-947d452c5315fc57055c1eb4142da8e6ca27798e.tar.gz eclipse.platform.swt-947d452c5315fc57055c1eb4142da8e6ca27798e.tar.xz eclipse.platform.swt-947d452c5315fc57055c1eb4142da8e6ca27798e.zip |
Bug 378482 - g_object_get() emits console warnings in ToolItem#gtk_create_menu_proxy
Diffstat (limited to 'bundles')
5 files changed, 39 insertions, 12 deletions
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 108e4a7500..1c8c5a54fb 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 @@ -3695,6 +3695,22 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1malloc) } #endif +#ifndef NO__1g_1object_1class_1find_1property +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1class_1find_1property) + (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) +{ + jbyte *lparg1=NULL; + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1object_1class_1find_1property_FUNC); + if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail; + rc = (jintLong)g_object_class_find_property((GObjectClass *)arg0, (const gchar *)lparg1); +fail: + if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0); + OS_NATIVE_EXIT(env, that, _1g_1object_1class_1find_1property_FUNC); + return rc; +} +#endif + #if (!defined(NO__1g_1object_1get__I_3B_3II) && !defined(JNI64)) || (!defined(NO__1g_1object_1get__J_3B_3IJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1get__I_3B_3II)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jintArray arg2, jintLong arg3) 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 c53a3435a4..f444a423e7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1401; -int OS_nativeFunctionCallCount[1401]; +int OS_nativeFunctionCount = 1402; +int OS_nativeFunctionCallCount[1402]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -291,6 +291,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1main_1context_1query", "_1g_1main_1context_1release", "_1g_1malloc", + "_1g_1object_1class_1find_1property", #ifndef JNI64 "_1g_1object_1get__I_3B_3II", #else 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 fc085b89b6..f7321e2d6a 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 @@ -299,6 +299,7 @@ typedef enum { _1g_1main_1context_1query_FUNC, _1g_1main_1context_1release_FUNC, _1g_1malloc_FUNC, + _1g_1object_1class_1find_1property_FUNC, #ifndef JNI64 _1g_1object_1get__I_3B_3II_FUNC, #else 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 62bc7a8b47..8827bda6b3 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 @@ -2729,6 +2729,19 @@ public static final int /*long*/ g_malloc(int /*long*/ size) { } } /** + * @param oclass cast=(GObjectClass *) + * @param property_name cast=(const gchar *) + */ +public static final native int /*long*/ _g_object_class_find_property(int /*long*/ oclass, byte[] property_name); +public static final int /*long*/ g_object_class_find_property(int /*long*/ oclass, byte[] property_name) { + lock.lock(); + try { + return _g_object_class_find_property(oclass, property_name); + } finally { + lock.unlock(); + } +} +/** * @param object cast=(GObject *) * @param first_property_name cast=(const gchar *),flags=no_out * @param terminator cast=(const gchar *),flags=sentinel diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java index 845d3ec6f6..bc01024fd6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java @@ -584,16 +584,12 @@ int /*long*/ gtk_create_menu_proxy (int /*long*/ widget) { if (index != -1) { int /*long*/ pixbuf = imageList.getPixbuf (index); byte[] label = null; - int [] showImages = new int [1]; - /* - * This code is intentionally commented out because it is outputting - * warnings to the console. If there is no text then the tooltip text - * will be used for overflow menu items. - */ -// int /*long*/ settings = OS.gtk_settings_get_default(); -// if (settings != 0) { -// OS.g_object_get (settings, OS.gtk_menu_images, showImages, 0); -// } + int [] showImages = new int []{1}; + int /*long*/ settings = OS.gtk_settings_get_default(); + if (settings != 0) { + int /*long*/ property = OS.g_object_class_find_property(OS.G_OBJECT_GET_CLASS(settings), OS.gtk_menu_images); + if (property != 0) OS.g_object_get (settings, OS.gtk_menu_images, showImages, 0); + } /* * GTK tool items with only image appear as blank items |