diff options
author | Anatoly Spektor <aspektor@redhat.com> | 2012-07-10 10:25:46 -0400 |
---|---|---|
committer | Anatoly Spektor <aspektor@redhat.com> | 2012-07-10 10:25:46 -0400 |
commit | 8d78e57a9d36dde24d0137b69eac0326bca95ebc (patch) | |
tree | a1c4642615eff826ac6d863f64fcde3ac486a612 | |
parent | e3a2594d93baac57c5e342d2c7769e2b4dd79d71 (diff) | |
download | eclipse.platform.swt-gtk_object_sink.tar.gz eclipse.platform.swt-gtk_object_sink.tar.xz eclipse.platform.swt-gtk_object_sink.zip |
Use g_object_ref_sink() method instead of deprecated gtk_object_sink()gtk_object_sink
11 files changed, 77 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..9f610ea4d7 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) @@ -10387,7 +10407,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..879b54344f 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 = 1316; +int OS_nativeFunctionCallCount[1316]; 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 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..63e9baf8b6 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 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..0fcd46a0cf 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 @@ -7994,7 +7994,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 +8005,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..aea2bec3c0 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,11 @@ 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); + if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { + OS.g_object_ref_sink(groupHandle); + }else{ + OS.gtk_object_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..c6afb833d4 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,11 @@ 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); + if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { + OS.g_object_ref_sink(labelHandle); + }else{ + OS.gtk_object_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..b685d1866f 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,11 @@ 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); + if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { + OS.g_object_ref_sink(groupHandle); + }else{ + OS.gtk_object_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..82c5569d71 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,11 @@ 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); + if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { + OS.g_object_ref_sink(tooltipsHandle); + }else{ + OS.gtk_object_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..36701640cb 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 @@ -257,6 +257,7 @@ void configure () { } void createHandle (int index) { + state |= HANDLE; if ((style & SWT.BALLOON) != 0) { handle = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); @@ -278,7 +279,11 @@ void createHandle (int index) { OS.gtk_tooltips_force_window (handle); } OS.g_object_ref (handle); - OS.gtk_object_sink (handle); + if (OS.GTK_VERSION <= OS.VERSION (2, 1, 0)) { + OS.g_object_ref_sink(handle); + }else{ + OS.gtk_object_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..56c2da12f5 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,11 @@ 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); + if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { + OS.g_object_ref_sink(tooltipsHandle); + }else{ + OS.gtk_object_sink (tooltipsHandle); + } } if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { OS.gtk_status_icon_set_tooltip (handle, buffer); |