Skip to content

Instantly share code, notes, and snippets.

@duncanmak
Created November 16, 2012 19:40
Show Gist options
  • Save duncanmak/4090219 to your computer and use it in GitHub Desktop.
Save duncanmak/4090219 to your computer and use it in GitHub Desktop.
diff --git a/glib/Log.cs b/glib/Log.cs
index aa31bc1..4221cfa 100644
--- a/glib/Log.cs
+++ b/glib/Log.cs
@@ -28,8 +28,13 @@ namespace GLib {
using System.Collections;
using System.Runtime.InteropServices;
+ [Obsolete]
public delegate void LogFunc (string log_domain, LogLevelFlags log_level, string message);
+ [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
+ public delegate void LogFunc2 (string log_domain, LogLevelFlags log_level, string message, IntPtr user_data);
+
+ [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
public delegate void PrintFunc (string message);
[Flags]
@@ -81,7 +86,7 @@ namespace GLib {
[DllImport("libglib-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
static extern uint g_log_set_handler (IntPtr log_domain, LogLevelFlags flags, LogFunc log_func, IntPtr user_data);
- public static uint SetLogHandler (string logDomain, LogLevelFlags flags, LogFunc logFunc)
+ public static uint SetLogHandler (string logDomain, LogLevelFlags flags, LogFunc2 logFunc)
{
IntPtr ndom = Marshaller.StringToPtrGStrdup (logDomain);
uint result = g_log_set_handler (ndom, flags, logFunc, IntPtr.Zero);
@@ -92,6 +97,12 @@ namespace GLib {
return result;
}
+ [Obsolete]
+ public static uint SetLogHandler (string logDomain, LogLevelFlags flags, LogFunc logFunc)
+ {
+ throw new ArgumentException ("Use SetLogHandler (string, LogLevelFlags, LogFunc2) instead");
+ }
+
[DllImport("libglib-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
static extern uint g_log_remove_handler (IntPtr log_domain, uint handler_id);
@@ -188,4 +199,3 @@ namespace GLib {
}
}
}
-
diff --git a/gtk/Toolbar.custom b/gtk/Toolbar.custom
index 61c0e98..592a37f 100644
--- a/gtk/Toolbar.custom
+++ b/gtk/Toolbar.custom
@@ -23,6 +23,7 @@
[DllImport("libgobject-2.0-0.dll", CallingConvention=CallingConvention.Cdecl)]
static extern void g_object_weak_ref (IntPtr raw, WeakNotify cb, IntPtr data);
+ [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate void WeakNotify (IntPtr handle, IntPtr obj);
static void ReleaseDelegateCB (IntPtr handle, IntPtr obj)
@@ -214,4 +215,3 @@
}
return ret;
}
-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment