From 1e698e4998cd0a3f8cc1c64d6ce4255ae7daf591 Mon Sep 17 00:00:00 2001 From: Silenio Quarti Date: Fri, 7 Sep 2012 12:09:23 -0400 Subject: Bug 386893 - Omit use of deprecated GTK_ACCEL_LABEL_SET_ACCEL_STRING and GTK_ACCEL_LABEL_GET_ACCEL_STRING --- .../Eclipse SWT PI/gtk/library/os_custom.h | 5 +++++ .../gtk/org/eclipse/swt/widgets/MenuItem.java | 16 +++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 5bfcd14321..b258d51b75 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -378,8 +378,13 @@ /* Field accessors */ #define G_OBJECT_CLASS_CONSTRUCTOR(arg0) (arg0)->constructor #define G_OBJECT_CLASS_SET_CONSTRUCTOR(arg0, arg1) (arg0)->constructor = (GObject* (*) (GType, guint, GObjectConstructParam *))arg1 +#if GTK_CHECK_VERSION(3,0,0) +#define GTK_ACCEL_LABEL_SET_ACCEL_STRING(arg0, arg1) +#define GTK_ACCEL_LABEL_GET_ACCEL_STRING(arg0) 0 +#else #define GTK_ACCEL_LABEL_SET_ACCEL_STRING(arg0, arg1) (arg0)->accel_string = arg1 #define GTK_ACCEL_LABEL_GET_ACCEL_STRING(arg0) (arg0)->accel_string +#endif #if GTK_CHECK_VERSION(2,20,0) #define GTK_RANGE_SLIDER_START(arg0) 0 #else diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java index 40c3504191..f05769a34c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/MenuItem.java @@ -884,13 +884,15 @@ public void setText (String string) { int /*long*/ label = OS.gtk_bin_get_child (handle); if (label != 0 && OS.GTK_IS_LABEL(label)) { OS.gtk_label_set_text_with_mnemonic (label, buffer); - buffer = Converter.wcsToMbcs (null, accelString, true); - int /*long*/ ptr = OS.g_malloc (buffer.length); - OS.memmove (ptr, buffer, buffer.length); - if (OS.GTK_IS_ACCEL_LABEL(label)) { - int /*long*/ oldPtr = OS.GTK_ACCEL_LABEL_GET_ACCEL_STRING (label); - OS.GTK_ACCEL_LABEL_SET_ACCEL_STRING (label, ptr); - if (oldPtr != 0) OS.g_free (oldPtr); + if (OS.GTK_VERSION < OS.VERSION(3, 0, 0)) { + if (OS.GTK_IS_ACCEL_LABEL(label)) { + buffer = Converter.wcsToMbcs (null, accelString, true); + int /*long*/ ptr = OS.g_malloc (buffer.length); + OS.memmove (ptr, buffer, buffer.length); + int /*long*/ oldPtr = OS.GTK_ACCEL_LABEL_GET_ACCEL_STRING (label); + OS.GTK_ACCEL_LABEL_SET_ACCEL_STRING (label, ptr); + if (oldPtr != 0) OS.g_free (oldPtr); + } } } } -- cgit