Merge pull request #65 from knocte/datamarshal_interface_fix

This commit is contained in:
Bertrand Lorentz 2013-08-25 10:57:09 -07:00
commit 4125b1e820
4 changed files with 62 additions and 50 deletions

View file

@ -42,7 +42,6 @@
<Compile Include="TextAdapter.cs" />
<Compile Include="TextChangedDetail.cs" />
<Compile Include="Util.cs" />
<Compile Include="generated\Action.cs" />
<Compile Include="generated\ActionAdapter.cs" />
<Compile Include="generated\ActiveDescendantChangedHandler.cs" />
<Compile Include="generated\AtkSharp.EventListenerInitNative.cs" />
@ -56,12 +55,9 @@
<Compile Include="generated\ChildrenChangedHandler.cs" />
<Compile Include="generated\ColumnDeletedHandler.cs" />
<Compile Include="generated\ColumnInsertedHandler.cs" />
<Compile Include="generated\Component.cs" />
<Compile Include="generated\ComponentAdapter.cs" />
<Compile Include="generated\CoordType.cs" />
<Compile Include="generated\Document.cs" />
<Compile Include="generated\DocumentAdapter.cs" />
<Compile Include="generated\EditableText.cs" />
<Compile Include="generated\EditableTextAdapter.cs" />
<Compile Include="generated\EventListener.cs" />
<Compile Include="generated\EventListenerInit.cs" />
@ -71,14 +67,10 @@
<Compile Include="generated\FocusTracker.cs" />
<Compile Include="generated\Function.cs" />
<Compile Include="generated\GObjectAccessible.cs" />
<Compile Include="generated\HyperlinkImpl.cs" />
<Compile Include="generated\HyperlinkImplAdapter.cs" />
<Compile Include="generated\HyperlinkStateFlags.cs" />
<Compile Include="generated\Hypertext.cs" />
<Compile Include="generated\HypertextAdapter.cs" />
<Compile Include="generated\Image.cs" />
<Compile Include="generated\ImageAdapter.cs" />
<Compile Include="generated\Implementor.cs" />
<Compile Include="generated\ImplementorAdapter.cs" />
<Compile Include="generated\KeyEventStruct.cs" />
<Compile Include="generated\KeyEventType.cs" />
@ -101,17 +93,13 @@
<Compile Include="generated\Role.cs" />
<Compile Include="generated\RowDeletedHandler.cs" />
<Compile Include="generated\RowInsertedHandler.cs" />
<Compile Include="generated\Selection.cs" />
<Compile Include="generated\Socket.cs" />
<Compile Include="generated\StateChangeHandler.cs" />
<Compile Include="generated\StateManager.cs" />
<Compile Include="generated\StateSet.cs" />
<Compile Include="generated\StateType.cs" />
<Compile Include="generated\StreamableContent.cs" />
<Compile Include="generated\StreamableContentAdapter.cs" />
<Compile Include="generated\Table.cs" />
<Compile Include="generated\TableAdapter.cs" />
<Compile Include="generated\Text.cs" />
<Compile Include="generated\TextAttribute.cs" />
<Compile Include="generated\TextBoundary.cs" />
<Compile Include="generated\TextCaretMovedHandler.cs" />
@ -119,7 +107,32 @@
<Compile Include="generated\TextClipType.cs" />
<Compile Include="generated\TextRange.cs" />
<Compile Include="generated\TextRectangle.cs" />
<Compile Include="generated\Value.cs" />
<Compile Include="generated\ValueAdapter.cs" />
<Compile Include="generated\Global.cs" />
<Compile Include="generated\Hyperlink.cs" />
<Compile Include="generated\IAction.cs" />
<Compile Include="generated\IComponent.cs" />
<Compile Include="generated\IDocument.cs" />
<Compile Include="generated\IEditableText.cs" />
<Compile Include="generated\IHyperlinkImpl.cs" />
<Compile Include="generated\IHypertext.cs" />
<Compile Include="generated\IImage.cs" />
<Compile Include="generated\IImplementor.cs" />
<Compile Include="generated\ISelection.cs" />
<Compile Include="generated\IStreamableContent.cs" />
<Compile Include="generated\ITable.cs" />
<Compile Include="generated\IText.cs" />
<Compile Include="generated\IValue.cs" />
<Compile Include="generated\Misc.cs" />
<Compile Include="generated\Object.cs" />
<Compile Include="generated\SelectionAdapter.cs" />
<Compile Include="generated\Util.cs" />
<Compile Include="generated\TextAdapter.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\glib\glib.csproj">
<Project>{3BF1D531-8840-4F15-8066-A9788D8C398B}</Project>
<Name>glib</Name>
</ProjectReference>
</ItemGroup>
</Project>

View file

@ -42,16 +42,13 @@
<Compile Include="FileFactory.cs" />
<Compile Include="GioStream.cs" />
<Compile Include="generated\AcceptCertificateHandler.cs" />
<Compile Include="generated\Action.cs" />
<Compile Include="generated\ActionAdapter.cs" />
<Compile Include="generated\ActionAddedHandler.cs" />
<Compile Include="generated\ActionEnabledChangedHandler.cs" />
<Compile Include="generated\ActionGroup.cs" />
<Compile Include="generated\ActionGroupAdapter.cs" />
<Compile Include="generated\ActionRemovedHandler.cs" />
<Compile Include="generated\ActionStateChangedHandler.cs" />
<Compile Include="generated\ActivatedHandler.cs" />
<Compile Include="generated\AppInfo.cs" />
<Compile Include="generated\AppInfoAdapter.cs" />
<Compile Include="generated\AppInfoCreateFlags.cs" />
<Compile Include="generated\AppLaunchContext.cs" />
@ -62,10 +59,8 @@
<Compile Include="generated\AskPasswordFlags.cs" />
<Compile Include="generated\AskPasswordHandler.cs" />
<Compile Include="generated\AskQuestionHandler.cs" />
<Compile Include="generated\AsyncInitable.cs" />
<Compile Include="generated\AsyncInitableAdapter.cs" />
<Compile Include="generated\AsyncReadyCallback.cs" />
<Compile Include="generated\AsyncResult.cs" />
<Compile Include="generated\AsyncResultAdapter.cs" />
<Compile Include="generated\AuthenticatedPeerAuthorizedHandler.cs" />
<Compile Include="generated\BufferedInputStream.cs" />
@ -87,7 +82,6 @@
<Compile Include="generated\Chunk.cs" />
<Compile Include="generated\ClosedHandler.cs" />
<Compile Include="generated\CommandLineHandler.cs" />
<Compile Include="generated\Converter.cs" />
<Compile Include="generated\ConverterAdapter.cs" />
<Compile Include="generated\ConverterFlags.cs" />
<Compile Include="generated\ConverterInputStream.cs" />
@ -145,7 +139,6 @@
<Compile Include="generated\DataStreamByteOrder.cs" />
<Compile Include="generated\DataStreamNewlineType.cs" />
<Compile Include="generated\DesktopAppInfo.cs" />
<Compile Include="generated\Drive.cs" />
<Compile Include="generated\DriveAdapter.cs" />
<Compile Include="generated\DriveChangedHandler.cs" />
<Compile Include="generated\DriveConnectedHandler.cs" />
@ -164,7 +157,6 @@
<Compile Include="generated\EmblemedIcon.cs" />
<Compile Include="generated\ExportedObject.cs" />
<Compile Include="generated\ExportedSubtree.cs" />
<Compile Include="generated\File.cs" />
<Compile Include="generated\FileAdapter.cs" />
<Compile Include="generated\FileAttributeInfo.cs" />
<Compile Include="generated\FileAttributeInfoFlags.cs" />
@ -175,7 +167,6 @@
<Compile Include="generated\FileChange.cs" />
<Compile Include="generated\FileCopyFlags.cs" />
<Compile Include="generated\FileCreateFlags.cs" />
<Compile Include="generated\FileDescriptorBased.cs" />
<Compile Include="generated\FileDescriptorBasedAdapter.cs" />
<Compile Include="generated\FileEnumerator.cs" />
<Compile Include="generated\FileIOStream.cs" />
@ -240,7 +231,6 @@
<Compile Include="generated\InitableAdapter.cs" />
<Compile Include="generated\InputStream.cs" />
<Compile Include="generated\InputVector.cs" />
<Compile Include="generated\LoadableIcon.cs" />
<Compile Include="generated\LoadableIconAdapter.cs" />
<Compile Include="generated\LocalDirectoryMonitor.cs" />
<Compile Include="generated\LocalFileEnumerator.cs" />
@ -248,7 +238,6 @@
<Compile Include="generated\MemoryInputStream.cs" />
<Compile Include="generated\MemoryOutputStream.cs" />
<Compile Include="generated\MessageToWriteData.cs" />
<Compile Include="generated\Mount.cs" />
<Compile Include="generated\MountAdapter.cs" />
<Compile Include="generated\MountAddedHandler.cs" />
<Compile Include="generated\MountChangedHandler.cs" />
@ -268,16 +257,12 @@
<Compile Include="generated\OutputVector.cs" />
<Compile Include="generated\PasswordSave.cs" />
<Compile Include="generated\Permission.cs" />
<Compile Include="generated\PollableInputStream.cs" />
<Compile Include="generated\PollableInputStreamAdapter.cs" />
<Compile Include="generated\PollableOutputStream.cs" />
<Compile Include="generated\PollableOutputStreamAdapter.cs" />
<Compile Include="generated\PollableSourceFunc.cs" />
<Compile Include="generated\Proxy.cs" />
<Compile Include="generated\ProxyAdapter.cs" />
<Compile Include="generated\ProxyAddress.cs" />
<Compile Include="generated\ProxyAddressEnumerator.cs" />
<Compile Include="generated\ProxyResolver.cs" />
<Compile Include="generated\ProxyResolverAdapter.cs" />
<Compile Include="generated\ReallocFunc.cs" />
<Compile Include="generated\RemoteActionInfo.cs" />
@ -286,7 +271,6 @@
<Compile Include="generated\ResolverError.cs" />
<Compile Include="generated\RunHandler.cs" />
<Compile Include="generated\SchemaState.cs" />
<Compile Include="generated\Seekable.cs" />
<Compile Include="generated\SeekableAdapter.cs" />
<Compile Include="generated\Settings.cs" />
<Compile Include="generated\SettingsBackend.cs" />
@ -307,7 +291,6 @@
<Compile Include="generated\SocketAddress.cs" />
<Compile Include="generated\SocketAddressEnumerator.cs" />
<Compile Include="generated\SocketClient.cs" />
<Compile Include="generated\SocketConnectable.cs" />
<Compile Include="generated\SocketConnectableAdapter.cs" />
<Compile Include="generated\SocketConnection.cs" />
<Compile Include="generated\SocketControlMessage.cs" />
@ -330,14 +313,12 @@
<Compile Include="generated\TlsAuthenticationMode.cs" />
<Compile Include="generated\TlsCertificate.cs" />
<Compile Include="generated\TlsCertificateFlags.cs" />
<Compile Include="generated\TlsClientConnection.cs" />
<Compile Include="generated\TlsClientConnectionAdapter.cs" />
<Compile Include="generated\TlsClientContext.cs" />
<Compile Include="generated\TlsConnection.cs" />
<Compile Include="generated\TlsContext.cs" />
<Compile Include="generated\TlsError.cs" />
<Compile Include="generated\TlsRehandshakeMode.cs" />
<Compile Include="generated\TlsServerConnection.cs" />
<Compile Include="generated\TlsServerConnectionAdapter.cs" />
<Compile Include="generated\TlsServerContext.cs" />
<Compile Include="generated\UnixConnection.cs" />
@ -349,7 +330,6 @@
<Compile Include="generated\UnixSocketAddress.cs" />
<Compile Include="generated\UnixSocketAddressType.cs" />
<Compile Include="generated\Vfs.cs" />
<Compile Include="generated\Volume.cs" />
<Compile Include="generated\VolumeAdapter.cs" />
<Compile Include="generated\VolumeAddedHandler.cs" />
<Compile Include="generated\VolumeChangedHandler.cs" />
@ -366,6 +346,21 @@
<Compile Include="generated\SocketFamily.cs" />
<Compile Include="generated\SocketMsgFlags.cs" />
<Compile Include="generated\DBus.cs" />
<Compile Include="generated\GLibSharp.SocketSourceFuncNative.cs" />
<Compile Include="generated\IAction.cs" />
<Compile Include="generated\IActionGroup.cs" />
<Compile Include="generated\IAppInfo.cs" />
<Compile Include="generated\IAsyncInitable.cs" />
<Compile Include="generated\IAsyncResult.cs" />
<Compile Include="generated\IPollableInputStream.cs" />
<Compile Include="generated\IPollableOutputStream.cs" />
<Compile Include="generated\IProxy.cs" />
<Compile Include="generated\IProxyResolver.cs" />
<Compile Include="generated\ISeekable.cs" />
<Compile Include="generated\ISocketConnectable.cs" />
<Compile Include="generated\ITlsClientConnection.cs" />
<Compile Include="generated\ITlsServerConnection.cs" />
<Compile Include="generated\IVolume.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\glib\glib.csproj">

View file

@ -168,7 +168,7 @@ namespace GLib {
else if (element_type.IsValueType)
ret = Marshal.PtrToStructure (data, element_type);
else if (element_type.IsInterface) {
Type adapter_type = element_type.Assembly.GetType (element_type.FullName + "Adapter");
Type adapter_type = element_type.Assembly.GetType (InterfaceToAdapterTypeName (element_type));
System.Reflection.MethodInfo method = adapter_type.GetMethod ("GetObject", new Type[] {typeof(IntPtr), typeof(bool)});
ret = method.Invoke (null, new object[] {data, false});
} else
@ -180,6 +180,16 @@ namespace GLib {
return ret;
}
static string InterfaceToAdapterTypeName (Type type)
{
string fullname = type.Namespace;
if (!String.IsNullOrEmpty (fullname)) {
fullname += ".";
}
fullname += type.Name.Substring (1); // IActivatable -> Activatable
return fullname + "Adapter";
}
[DllImport ("libglib-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_free (IntPtr item);

View file

@ -161,7 +161,6 @@
<Compile Include="generated\Action.cs" />
<Compile Include="generated\ActionActivatedHandler.cs" />
<Compile Include="generated\ActionGroup.cs" />
<Compile Include="generated\Activatable.cs" />
<Compile Include="generated\ActivatableAdapter.cs" />
<Compile Include="generated\ActivateCurrentHandler.cs" />
<Compile Include="generated\ActivateCursorItemHandler.cs" />
@ -175,7 +174,6 @@
<Compile Include="generated\Alignment.cs" />
<Compile Include="generated\AnimationDescription.cs" />
<Compile Include="generated\AnimationInfo.cs" />
<Compile Include="generated\AppChooser.cs" />
<Compile Include="generated\AppChooserAdapter.cs" />
<Compile Include="generated\AppChooserButton.cs" />
<Compile Include="generated\AppChooserDialog.cs" />
@ -226,10 +224,8 @@
<Compile Include="generated\CellAreaBoxContextClass.cs" />
<Compile Include="generated\CellAreaContext.cs" />
<Compile Include="generated\CellCallback.cs" />
<Compile Include="generated\CellEditable.cs" />
<Compile Include="generated\CellEditableAdapter.cs" />
<Compile Include="generated\CellEditableEventBox.cs" />
<Compile Include="generated\CellLayout.cs" />
<Compile Include="generated\CellLayoutAdapter.cs" />
<Compile Include="generated\CellLayoutDataFunc.cs" />
<Compile Include="generated\CellRenderer.cs" />
@ -330,7 +326,6 @@
<Compile Include="generated\DrawPageHandler.cs" />
<Compile Include="generated\DrawingArea.cs" />
<Compile Include="generated\DrawnHandler.cs" />
<Compile Include="generated\Editable.cs" />
<Compile Include="generated\EditableAdapter.cs" />
<Compile Include="generated\EditedHandler.cs" />
<Compile Include="generated\EditingStartedHandler.cs" />
@ -348,7 +343,6 @@
<Compile Include="generated\ExpandCollapseCursorRowHandler.cs" />
<Compile Include="generated\Expander.cs" />
<Compile Include="generated\ExpanderStyle.cs" />
<Compile Include="generated\FileChooser.cs" />
<Compile Include="generated\FileChooserAction.cs" />
<Compile Include="generated\FileChooserAdapter.cs" />
<Compile Include="generated\FileChooserButton.cs" />
@ -558,7 +552,6 @@
<Compile Include="generated\NumberUpLayout.cs" />
<Compile Include="generated\NumerableIcon.cs" />
<Compile Include="generated\OffscreenWindow.cs" />
<Compile Include="generated\Orientable.cs" />
<Compile Include="generated\OrientableAdapter.cs" />
<Compile Include="generated\Orientation.cs" />
<Compile Include="generated\OrientationChangedHandler.cs" />
@ -609,7 +602,6 @@
<Compile Include="generated\PrintJobCompleteFunc.cs" />
<Compile Include="generated\PrintOperation.cs" />
<Compile Include="generated\PrintOperationAction.cs" />
<Compile Include="generated\PrintOperationPreview.cs" />
<Compile Include="generated\PrintOperationPreviewAdapter.cs" />
<Compile Include="generated\PrintOperationResult.cs" />
<Compile Include="generated\PrintPages.cs" />
@ -642,7 +634,6 @@
<Compile Include="generated\RcStyle.cs" />
<Compile Include="generated\ReadyHandler.cs" />
<Compile Include="generated\RecentAction.cs" />
<Compile Include="generated\RecentChooser.cs" />
<Compile Include="generated\RecentChooserAdapter.cs" />
<Compile Include="generated\RecentChooserDefault.cs" />
<Compile Include="generated\RecentChooserDialog.cs" />
@ -699,7 +690,6 @@
<Compile Include="generated\ScrollEventHandler.cs" />
<Compile Include="generated\ScrollStep.cs" />
<Compile Include="generated\ScrollType.cs" />
<Compile Include="generated\Scrollable.cs" />
<Compile Include="generated\ScrollableAdapter.cs" />
<Compile Include="generated\ScrollablePolicy.cs" />
<Compile Include="generated\Scrollbar.cs" />
@ -770,7 +760,6 @@
<Compile Include="generated\StyleProperties.cs" />
<Compile Include="generated\StylePropertyParser.cs" />
<Compile Include="generated\StylePropertyValue.cs" />
<Compile Include="generated\StyleProvider.cs" />
<Compile Include="generated\StyleProviderAdapter.cs" />
<Compile Include="generated\StyleProviderData.cs" />
<Compile Include="generated\StyleSetHandler.cs" />
@ -855,7 +844,6 @@
<Compile Include="generated\ToolPalette.cs" />
<Compile Include="generated\ToolPaletteDragData.cs" />
<Compile Include="generated\ToolPaletteDragTargets.cs" />
<Compile Include="generated\ToolShell.cs" />
<Compile Include="generated\ToolShellAdapter.cs" />
<Compile Include="generated\Toolbar.cs" />
<Compile Include="generated\ToolbarContent.cs" />
@ -866,15 +854,12 @@
<Compile Include="generated\Tree.cs" />
<Compile Include="generated\TreeCellDataFunc.cs" />
<Compile Include="generated\TreeDestroyCountFunc.cs" />
<Compile Include="generated\TreeDragDest.cs" />
<Compile Include="generated\TreeDragDestAdapter.cs" />
<Compile Include="generated\TreeDragSource.cs" />
<Compile Include="generated\TreeDragSourceAdapter.cs" />
<Compile Include="generated\TreeIter.cs" />
<Compile Include="generated\TreeIterCompareFunc.cs" />
<Compile Include="generated\TreeMenu.cs" />
<Compile Include="generated\TreeMenuHeaderFunc.cs" />
<Compile Include="generated\TreeModel.cs" />
<Compile Include="generated\TreeModelAdapter.cs" />
<Compile Include="generated\TreeModelFilter.cs" />
<Compile Include="generated\TreeModelFilterModifyFunc.cs" />
@ -888,7 +873,6 @@
<Compile Include="generated\TreeSelection.cs" />
<Compile Include="generated\TreeSelectionForeachFunc.cs" />
<Compile Include="generated\TreeSelectionFunc.cs" />
<Compile Include="generated\TreeSortable.cs" />
<Compile Include="generated\TreeSortableAdapter.cs" />
<Compile Include="generated\TreeStore.cs" />
<Compile Include="generated\TreeView.cs" />
@ -936,6 +920,12 @@
<Compile Include="generated\WrapMode.cs" />
<Compile Include="generated\XEmbedMessage.cs" />
<Compile Include="RadioAction.cs" />
<Compile Include="generated\IActivatable.cs" />
<Compile Include="generated\IAppChooser.cs" />
<Compile Include="generated\ICellEditable.cs" />
<Compile Include="generated\ICellLayout.cs" />
<Compile Include="generated\IEditable.cs" />
<Compile Include="generated\IFileChooser.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
@ -949,5 +939,9 @@
<Project>{58346CC6-DE93-45B4-8093-3508BD5DAA12}</Project>
<Name>gdk</Name>
</ProjectReference>
<ProjectReference Include="..\atk\atk.csproj">
<Project>{42FE871A-D8CF-4B29-9AFF-B02454E6C976}</Project>
<Name>atk</Name>
</ProjectReference>
</ItemGroup>
</Project>