Some more GIO interface cleanup
* generator/InterfaceGen.cs: don't grab the StreamWriter for consume-only. * generator/InterfaceVM.cs: don't bitch or fail validation when missing target on consume-only. * generator/ObjectBase.cs: support a target_method attr on vms to point the callback invocations at when the names don't match. * gio/Gio.metadata: marks a few more ifaces consume-only until somebody complains they need to implement one of them.
This commit is contained in:
parent
3ed7e0901e
commit
001956432c
4 changed files with 8 additions and 5 deletions
|
@ -272,10 +272,10 @@ namespace GtkSharp.Generation {
|
|||
|
||||
void GenerateImplementorIface (GenerationInfo gen_info)
|
||||
{
|
||||
StreamWriter sw = gen_info.Writer;
|
||||
if (IsConsumeOnly)
|
||||
return;
|
||||
|
||||
StreamWriter sw = gen_info.Writer;
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t[GLib.GInterface (typeof (" + Name + "Adapter))]");
|
||||
string access = IsInternal ? "internal" : "public";
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace GtkSharp.Generation {
|
|||
|
||||
public override bool Validate ()
|
||||
{
|
||||
if (target == null) {
|
||||
if (target == null && !(container_type as InterfaceGen).IsConsumeOnly) {
|
||||
Console.WriteLine ("Virtual method {0}->{1} has no matching target to invoke", container_type.CName, CName);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -124,9 +124,10 @@ namespace GtkSharp.Generation {
|
|||
VirtualMethod vm;
|
||||
if (is_signal_vm)
|
||||
vm = new DefaultSignalHandler (vm_elem, this);
|
||||
else if (is_interface)
|
||||
vm = new InterfaceVM (vm_elem, methods [vm_elem.GetAttribute ("name")] as Method, this);
|
||||
else
|
||||
else if (is_interface) {
|
||||
string target_name = vm_elem.HasAttribute ("target_method") ? vm_elem.GetAttribute ("target_method") : vm_elem.GetAttribute ("name");
|
||||
vm = new InterfaceVM (vm_elem, methods [target_name] as Method, this);
|
||||
} else
|
||||
vm = new GObjectVM (vm_elem, this);
|
||||
|
||||
if (vm_elem.GetAttribute ("padding") == "true" || vm_elem.GetAttribute ("hidden") == "1")
|
||||
|
|
|
@ -15,8 +15,10 @@
|
|||
<attr path="/api/namespace/interface[@cname='GAppInfo']/method[@name='SupportsFiles']" name="name">GetSupportsFiles</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GAppInfo']/method[@name='SupportsUris']" name="name">GetSupportsUris</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GDrive']" name="consume_only">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GFile']" name="consume_only">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GFile']/method[@name='GetParseName']" name="name">GetParsedName</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GFile']/method[@name='GetUri']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GIcon']" name="consume_only">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GMount']" name="consume_only">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GMount']/method[@name='CanUnmount']" name="name">GetCanUnmount</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GSeekable']/method[@cname='g_seekable_can_seek']" name="name">GetCanSeek</attr>
|
||||
|
|
Loading…
Reference in a new issue