static void OverrideSendNotification(GLib.GType gtype, SendNotificationNativeDelegate callback)
 {
     unsafe {
         IntPtr *raw_ptr = (IntPtr *)(((long)gtype.GetClassPtr()) + (long)class_abi.GetFieldOffset("send_notification"));
         *raw_ptr = Marshal.GetFunctionPointerForDelegate((Delegate)callback);
     }
 }
Пример #2
0
        private void InternalSendNotification(string id, GLib.Notification notification)
        {
            SendNotificationNativeDelegate unmanaged = class_abi.BaseOverride <SendNotificationNativeDelegate>(this.LookupGType(), "send_notification");

            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_id = GLib.Marshaller.StringToPtrGStrdup(id);

            unmanaged(this.Handle, native_id, notification == null ? IntPtr.Zero : notification.Handle);
            GLib.Marshaller.Free(native_id);
        }
        private void InternalSendNotification(string id, GLib.Notification notification)
        {
            SendNotificationNativeDelegate unmanaged = null;

            unsafe {
                IntPtr *raw_ptr = (IntPtr *)(((long)this.LookupGType().GetThresholdType().GetClassPtr()) + (long)class_abi.GetFieldOffset("send_notification"));
                unmanaged = (SendNotificationNativeDelegate)Marshal.GetDelegateForFunctionPointer(*raw_ptr, typeof(SendNotificationNativeDelegate));
            }
            if (unmanaged == null)
            {
                return;
            }

            IntPtr native_id = GLib.Marshaller.StringToPtrGStrdup(id);

            unmanaged(this.Handle, native_id, notification == null ? IntPtr.Zero : notification.Handle);
            GLib.Marshaller.Free(native_id);
        }