diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-08-02 15:15:35 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-08-02 15:15:35 -0400 |
commit | 3805aa1b127f5769811b8f4818b7d3c1c43c2848 (patch) | |
tree | 9f22fd240ae9a0e530b9b46f1a19947b184187c6 | |
parent | e3a2594d93baac57c5e342d2c7769e2b4dd79d71 (diff) | |
download | eclipse.platform.swt-g_object_ref_sink.tar.gz eclipse.platform.swt-g_object_ref_sink.tar.xz eclipse.platform.swt-g_object_ref_sink.zip |
Use g_object_ref_sink() method instead of deprecated gtk_object_sink()g_object_ref_sink
12 files changed, 133 insertions, 10 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 155872e3dd..6bdc5925b6 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 @@ -3592,6 +3592,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1ref) } #endif +#ifndef NO__1g_1object_1ref_1sink +JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1object_1ref_1sink) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1g_1object_1ref_1sink_FUNC); +/* + rc = (jintLong)g_object_ref_sink(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, g_object_ref_sink) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } + OS_NATIVE_EXIT(env, that, _1g_1object_1ref_1sink_FUNC); + return rc; +} +#endif + #if (!defined(NO__1g_1object_1set__I_3BFI) && !defined(JNI64)) || (!defined(NO__1g_1object_1set__J_3BFJ) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(_1g_1object_1set__I_3BFI)(JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1, jfloat arg2, jintLong arg3) @@ -7209,6 +7229,42 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1x11_1window_1lookup_1for_1display) } #endif +#ifndef NO__1glib_1major_1version +JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1major_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1glib_1major_1version_FUNC); + rc = (jint)glib_major_version; + OS_NATIVE_EXIT(env, that, _1glib_1major_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1glib_1micro_1version +JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1micro_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1glib_1micro_1version_FUNC); + rc = (jint)glib_micro_version; + OS_NATIVE_EXIT(env, that, _1glib_1micro_1version_FUNC); + return rc; +} +#endif + +#ifndef NO__1glib_1minor_1version +JNIEXPORT jint JNICALL OS_NATIVE(_1glib_1minor_1version) + (JNIEnv *env, jclass that) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1glib_1minor_1version_FUNC); + rc = (jint)glib_minor_version; + OS_NATIVE_EXIT(env, that, _1glib_1minor_1version_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1accel_1group_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1accel_1group_1new) (JNIEnv *env, jclass that) @@ -10387,7 +10443,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1object_1sink) (JNIEnv *env, jclass that, jintLong arg0) { OS_NATIVE_ENTER(env, that, _1gtk_1object_1sink_FUNC); - gtk_object_sink((GtkObject *)arg0); +/* + gtk_object_sink(arg0); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_object_sink) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1object_1sink_FUNC); } #endif 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 f21e8ca75a..b2f322ef8e 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 @@ -229,6 +229,7 @@ #define gdk_cairo_region_LIB LIB_GDK #define gdk_cairo_create_LIB LIB_GDK #define gtk_enumerate_printers_LIB LIB_GTK +#define gtk_object_sink_LIB LIB_GTK #define gtk_orientable_set_orientation_LIB LIB_GTK #define gtk_page_setup_get_bottom_margin_LIB LIB_GTK #define gtk_page_setup_get_left_margin_LIB LIB_GTK @@ -333,6 +334,7 @@ #define g_icon_to_string_LIB LIB_GIO #define g_icon_new_for_string_LIB LIB_GIO #define g_file_query_info_LIB LIB_GIO +#define g_object_ref_sink_LIB LIB_GIO /* Field accessors */ #define G_OBJECT_CLASS_CONSTRUCTOR(arg0) (arg0)->constructor 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 b8074eb1de..df44bc9c21 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 = 1315; -int OS_nativeFunctionCallCount[1315]; +int OS_nativeFunctionCount = 1319; +int OS_nativeFunctionCallCount[1319]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -294,6 +294,7 @@ char * OS_nativeFunctionNames[] = { "_1g_1object_1new", "_1g_1object_1notify", "_1g_1object_1ref", + "_1g_1object_1ref_1sink", #ifndef JNI64 "_1g_1object_1set__I_3BFI", #else @@ -582,6 +583,9 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1x11_1screen_1lookup_1visual", "_1gdk_1x11_1visual_1get_1xvisual", "_1gdk_1x11_1window_1lookup_1for_1display", + "_1glib_1major_1version", + "_1glib_1micro_1version", + "_1glib_1minor_1version", "_1gtk_1accel_1group_1new", "_1gtk_1accel_1label_1set_1accel_1widget", "_1gtk_1accelerator_1get_1default_1mod_1mask", 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 75194be58b..e2f25ef2de 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 @@ -302,6 +302,7 @@ typedef enum { _1g_1object_1new_FUNC, _1g_1object_1notify_FUNC, _1g_1object_1ref_FUNC, + _1g_1object_1ref_1sink_FUNC, #ifndef JNI64 _1g_1object_1set__I_3BFI_FUNC, #else @@ -590,6 +591,9 @@ typedef enum { _1gdk_1x11_1screen_1lookup_1visual_FUNC, _1gdk_1x11_1visual_1get_1xvisual_FUNC, _1gdk_1x11_1window_1lookup_1for_1display_FUNC, + _1glib_1major_1version_FUNC, + _1glib_1micro_1version_FUNC, + _1glib_1minor_1version_FUNC, _1gtk_1accel_1group_1new_FUNC, _1gtk_1accel_1label_1set_1accel_1widget_FUNC, _1gtk_1accelerator_1get_1default_1mod_1mask_FUNC, 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 0a5969cade..ddc30f8433 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 @@ -581,6 +581,7 @@ public class OS extends C { public static final byte[] GTK_STOCK_CLEAR = ascii("gtk-clear"); public static final int GTK_VERSION = VERSION(gtk_major_version(), gtk_minor_version(), gtk_micro_version()); + public static final int GLIB_VERSION = VERSION(glib_major_version(), glib_minor_version(), glib_micro_version()); public static final boolean USE_CAIRO, INIT_CAIRO; static { boolean useCairo = false; @@ -7686,6 +7687,36 @@ public static final int gtk_micro_version() { lock.unlock(); } } +/** @method flags=const */ +public static final native int _glib_major_version(); +public static final int glib_major_version() { + lock.lock(); + try { + return _glib_major_version(); + } finally { + lock.unlock(); + } +} +/** @method flags=const */ +public static final native int _glib_minor_version(); +public static final int glib_minor_version() { + lock.lock(); + try { + return _glib_minor_version(); + } finally { + lock.unlock(); + } +} +/** @method flags=const */ +public static final native int _glib_micro_version(); +public static final int glib_micro_version() { + lock.lock(); + try { + return _glib_micro_version(); + } finally { + lock.unlock(); + } +} public static final native void _gtk_main(); public static final void gtk_main() { lock.lock(); @@ -7994,7 +8025,7 @@ public static final void gtk_notebook_set_tab_pos(int /*long*/ notebook, int pos lock.unlock(); } } -/** @param object cast=(GtkObject *) */ +/** @method flags=dynamic */ public static final native void _gtk_object_sink(int /*long*/ object); public static final void gtk_object_sink(int /*long*/ object) { lock.lock(); @@ -8005,6 +8036,16 @@ public static final void gtk_object_sink(int /*long*/ object) { } } /** @method flags=dynamic */ +public static final native int /*long*/ _g_object_ref_sink(int /*long*/ object); +public static final int /*long*/ g_object_ref_sink(int /*long*/ object) { + lock.lock(); + try { + return _g_object_ref_sink(object); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native void _gtk_orientable_set_orientation(int /*long*/ orientable, int orientation); public static final void gtk_orientable_set_orientation(int /*long*/ orientable, int orientation) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java index 77d5d6b13d..1ff010bfd8 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java @@ -294,7 +294,7 @@ void createHandle (int index) { groupHandle = OS.gtk_radio_button_new (0); if (groupHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (groupHandle); - OS.gtk_object_sink (groupHandle); + g_object_ref_sink(groupHandle); handle = OS.gtk_radio_button_new (OS.gtk_radio_button_get_group (groupHandle)); if (handle == 0) error (SWT.ERROR_NO_HANDLES); break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java index 40e6c20bc5..08a15d7c10 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Group.java @@ -128,7 +128,7 @@ void createHandle(int index) { labelHandle = OS.gtk_label_new (null); if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (labelHandle); - OS.gtk_object_sink (labelHandle); + g_object_ref_sink (labelHandle); clientHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0); if (clientHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.gtk_container_add (fixedHandle, handle); 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 69f6ae0f87..26e46e4c7b 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 @@ -257,7 +257,7 @@ void createHandle (int index) { groupHandle = OS.gtk_radio_menu_item_new (0); if (groupHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (groupHandle); - OS.gtk_object_sink (groupHandle); + g_object_ref_sink(groupHandle); int /*long*/ group = OS.gtk_radio_menu_item_get_group (groupHandle); handle = OS.gtk_radio_menu_item_new_with_label (group, buffer); break; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index deed81c947..426bbc4b52 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -2461,7 +2461,7 @@ void setToolTipText (int /*long*/ rootWidget, int /*long*/ tipWidget, String str tooltipsHandle = OS.gtk_tooltips_new (); if (tooltipsHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (tooltipsHandle); - OS.gtk_object_sink (tooltipsHandle); + g_object_ref_sink(tooltipsHandle); } /* diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java index c7da6c4393..4550f3869a 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java @@ -278,7 +278,7 @@ void createHandle (int index) { OS.gtk_tooltips_force_window (handle); } OS.g_object_ref (handle); - OS.gtk_object_sink (handle); + g_object_ref_sink(handle); } } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java index 2a82fb8e45..5506a95dc2 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java @@ -591,7 +591,7 @@ public void setToolTipText (String string) { tooltipsHandle = OS.gtk_tooltips_new (); if (tooltipsHandle == 0) error (SWT.ERROR_NO_HANDLES); OS.g_object_ref (tooltipsHandle); - OS.gtk_object_sink (tooltipsHandle); + g_object_ref_sink(tooltipsHandle); } if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { OS.gtk_status_icon_set_tooltip (handle, buffer); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java index eb3bbcd8c5..824d4e47b9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java @@ -1673,6 +1673,14 @@ int /*long*/ sizeAllocateProc (int /*long*/ handle, int /*long*/ arg0, int /*lon int /*long*/ sizeRequestProc (int /*long*/ handle, int /*long*/ arg0, int /*long*/ user_data) { return 0; } +int /*long*/ g_object_ref_sink (int /*long*/ object) { + if (OS.GLIB_VERSION >= OS.VERSION (2, 10, 0)) { + return OS.g_object_ref_sink (object); + } else { + OS.gtk_object_sink (object); + } + return 0; +} /** * Returns a string containing a concise, human-readable |