Author: mkestner
Date: 2007-10-04 13:52:35 -0400 (Thu, 04 Oct 2007)
New Revision: 86897
Modified:
trunk/gtk-sharp/ChangeLog
trunk/gtk-sharp/gdk/Input.custom
trunk/gtk-sharp/glib/DestroyNotify.cs
trunk/gtk-sharp/glib/Signal.cs
trunk/gtk-sharp/gtk/Quit.custom
trunk/gtk-sharp/gtk/TreeModelFilter.custom
trunk/gtk-sharp/gtk/TreeViewColumn.custom
Log:
2007-10-04 Mike Kestner <[EMAIL PROTECTED]>
* glib/DestroyNotify.cs: add CDeclCallback to the delegate.
* glib/Signal.cs: use DestroyHelper.
* gdk/Input.custom: use DestroyHelper.
* gtk/Quit.custom: remove new on DestroyHelper handler.
* gtk/TreeModelFilter.custom: remove new on DestroyHelper handler.
* gtk/TreeViewColumn.custom: remove new on DestroyHelper handler.
Modified: trunk/gtk-sharp/ChangeLog
===================================================================
--- trunk/gtk-sharp/ChangeLog 2007-10-04 17:35:52 UTC (rev 86896)
+++ trunk/gtk-sharp/ChangeLog 2007-10-04 17:52:35 UTC (rev 86897)
@@ -1,3 +1,12 @@
+2007-10-04 Mike Kestner <[EMAIL PROTECTED]>
+
+ * glib/DestroyNotify.cs: add CDeclCallback to the delegate.
+ * glib/Signal.cs: use DestroyHelper.
+ * gdk/Input.custom: use DestroyHelper.
+ * gtk/Quit.custom: remove new on DestroyHelper handler.
+ * gtk/TreeModelFilter.custom: remove new on DestroyHelper handler.
+ * gtk/TreeViewColumn.custom: remove new on DestroyHelper handler.
+
2007-10-02 Mike Kestner <[EMAIL PROTECTED]>
* generator/*.cs: implement the interfaces on the adapters too.
Modified: trunk/gtk-sharp/gdk/Input.custom
===================================================================
--- trunk/gtk-sharp/gdk/Input.custom 2007-10-04 17:35:52 UTC (rev 86896)
+++ trunk/gtk-sharp/gdk/Input.custom 2007-10-04 17:52:35 UTC (rev 86897)
@@ -20,43 +20,21 @@
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
- [GLib.CDeclCallback]
- delegate void InputDestroyNotify (IntPtr data);
-
- static void ReleaseGCHandle (IntPtr data)
- {
- try {
- if (data == IntPtr.Zero)
- return;
-
- GCHandle gch = (GCHandle) data;
- gch.Free ();
- } catch (Exception e) {
- GLib.ExceptionManager.RaiseUnhandledException
(e, false);
- }
- }
-
- static InputDestroyNotify release_gchandle;
-
[DllImport("libgdk-win32-2.0-0.dll")]
- static extern int gdk_input_add_full (int source, int
condition, GdkSharp.InputFunctionNative function, IntPtr data,
InputDestroyNotify destroy);
+ static extern int gdk_input_add_full (int source, int
condition, GdkSharp.InputFunctionNative function, IntPtr data,
GLib.DestroyNotify destroy);
[Obsolete]
public static int AddFull (int source, Gdk.InputCondition
condition, Gdk.InputFunction function, IntPtr data, Gdk.DestroyNotify destroy)
{
- if (release_gchandle == null)
- release_gchandle = new InputDestroyNotify
(ReleaseGCHandle);
GdkSharp.InputFunctionWrapper function_wrapper = new
GdkSharp.InputFunctionWrapper (function);
GCHandle gch = GCHandle.Alloc (function_wrapper);
- return gdk_input_add_full (source, (int) condition,
function_wrapper.NativeDelegate, (IntPtr) gch, release_gchandle);
+ return gdk_input_add_full (source, (int) condition,
function_wrapper.NativeDelegate, (IntPtr) gch,
GLib.DestroyHelper.NotifyHandler);
}
[Obsolete]
public static int Add (int source, Gdk.InputCondition
condition, Gdk.InputFunction function)
{
- if (release_gchandle == null)
- release_gchandle = new InputDestroyNotify
(ReleaseGCHandle);
GdkSharp.InputFunctionWrapper function_wrapper = new
GdkSharp.InputFunctionWrapper (function);
GCHandle gch = GCHandle.Alloc (function_wrapper);
- return gdk_input_add_full (source, (int) condition,
function_wrapper.NativeDelegate, (IntPtr) gch, release_gchandle);
+ return gdk_input_add_full (source, (int) condition,
function_wrapper.NativeDelegate, (IntPtr) gch,
GLib.DestroyHelper.NotifyHandler);
}
Modified: trunk/gtk-sharp/glib/DestroyNotify.cs
===================================================================
--- trunk/gtk-sharp/glib/DestroyNotify.cs 2007-10-04 17:35:52 UTC (rev
86896)
+++ trunk/gtk-sharp/glib/DestroyNotify.cs 2007-10-04 17:52:35 UTC (rev
86897)
@@ -23,6 +23,7 @@
using System;
using System.Runtime.InteropServices;
+ [GLib.CDeclCallback]
public delegate void DestroyNotify (IntPtr data);
public class DestroyHelper {
Modified: trunk/gtk-sharp/glib/Signal.cs
===================================================================
--- trunk/gtk-sharp/glib/Signal.cs 2007-10-04 17:35:52 UTC (rev 86896)
+++ trunk/gtk-sharp/glib/Signal.cs 2007-10-04 17:52:35 UTC (rev 86897)
@@ -51,22 +51,6 @@
uint after_id = UInt32.MaxValue;
Delegate marshaler;
- static SignalDestroyNotify notify = new SignalDestroyNotify
(OnNativeDestroy);
- [CDeclCallback]
- delegate void SignalDestroyNotify (IntPtr data, IntPtr obj);
- static void OnNativeDestroy (IntPtr data, IntPtr obj)
- {
- try {
- GCHandle gch = (GCHandle) data;
- Signal s = gch.Target as Signal;
- s.DisconnectHandler (s.before_id);
- s.DisconnectHandler (s.after_id);
- gch.Free ();
- } catch (Exception e) {
- ExceptionManager.RaiseUnhandledException (e,
false);
- }
- }
-
private Signal (GLib.Object obj, string signal_name, Delegate
marshaler)
{
handle = obj.Handle;
@@ -75,7 +59,7 @@
gc_handle = GCHandle.Alloc (this);
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup
(name + "_signal_marshaler");
if (handle != IntPtr.Zero)
- g_object_set_data_full (handle, native_key,
(IntPtr) gc_handle, notify);
+ g_object_set_data_full (handle, native_key,
(IntPtr) gc_handle, DestroyHelper.NotifyHandler);
GLib.Marshaller.Free (native_key);
}
@@ -209,7 +193,7 @@
static extern void g_object_set_data (IntPtr instance, IntPtr
key, IntPtr data);
[DllImport("libgobject-2.0-0.dll")]
- static extern void g_object_set_data_full (IntPtr instance,
IntPtr key, IntPtr data, SignalDestroyNotify notify);
+ static extern void g_object_set_data_full (IntPtr instance,
IntPtr key, IntPtr data, DestroyNotify notify);
[DllImport("libgobject-2.0-0.dll")]
static extern uint g_signal_connect_data(IntPtr obj, IntPtr
name, Delegate cb, IntPtr gc_handle, IntPtr dummy, int flags);
Modified: trunk/gtk-sharp/gtk/Quit.custom
===================================================================
--- trunk/gtk-sharp/gtk/Quit.custom 2007-10-04 17:35:52 UTC (rev 86896)
+++ trunk/gtk-sharp/gtk/Quit.custom 2007-10-04 17:52:35 UTC (rev 86897)
@@ -69,6 +69,6 @@
{
GtkSharp.FunctionWrapper function_wrapper = new
GtkSharp.FunctionWrapper (function);
GCHandle gch = GCHandle.Alloc (function_wrapper);
- return gtk_quit_add_full (main_level,
function_wrapper.NativeDelegate, null, (IntPtr) gch, new GLib.DestroyNotify
(GLib.DestroyHelper.NotifyHandler));
+ return gtk_quit_add_full (main_level,
function_wrapper.NativeDelegate, null, (IntPtr) gch,
GLib.DestroyHelper.NotifyHandler);
}
Modified: trunk/gtk-sharp/gtk/TreeModelFilter.custom
===================================================================
--- trunk/gtk-sharp/gtk/TreeModelFilter.custom 2007-10-04 17:35:52 UTC (rev
86896)
+++ trunk/gtk-sharp/gtk/TreeModelFilter.custom 2007-10-04 17:52:35 UTC (rev
86897)
@@ -66,7 +66,7 @@
for (int i = 0; i < types.Length; i++)
native_types [i] = types [i].Val;
GCHandle gch = GCHandle.Alloc (func_wrapper);
- gtk_tree_model_filter_set_modify_func (Handle,
n_columns, native_types, func_wrapper.NativeDelegate, (IntPtr) gch, new
GLib.DestroyNotify (GLib.DestroyHelper.NotifyHandler));
+ gtk_tree_model_filter_set_modify_func (Handle,
n_columns, native_types, func_wrapper.NativeDelegate, (IntPtr) gch,
GLib.DestroyHelper.NotifyHandler);
}
[DllImport("libgtk-win32-2.0-0.dll")]
Modified: trunk/gtk-sharp/gtk/TreeViewColumn.custom
===================================================================
--- trunk/gtk-sharp/gtk/TreeViewColumn.custom 2007-10-04 17:35:52 UTC (rev
86896)
+++ trunk/gtk-sharp/gtk/TreeViewColumn.custom 2007-10-04 17:52:35 UTC (rev
86897)
@@ -75,7 +75,7 @@
NodeCellDataFuncWrapper func_wrapper = new
NodeCellDataFuncWrapper (func);
GCHandle gch = GCHandle.Alloc (func_wrapper);
- gtk_cell_layout_set_cell_data_func (Handle,
cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle,
func_wrapper.NativeDelegate, (IntPtr) gch, new GLib.DestroyNotify
(GLib.DestroyHelper.NotifyHandler));
+ gtk_cell_layout_set_cell_data_func (Handle,
cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle,
func_wrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
}
[Obsolete ("Replaced by SetCellDataFunc (CellRenderer,
TreeCellDataFunc) overload")]
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches