2008-10-21 Mike Kestner <mkestner@novell.com>

* gtkhtml/HTML.custom: copy in previously generated signal marshaler
	from 2-16 branch since url-requested signal exposes a G_TYPE_POINTER
	parameter that can't be marshaled automatically by SignalClosure.
	[Fixes #436298]

svn path=/trunk/gnome-desktop-sharp/; revision=116682
This commit is contained in:
Mike Kestner 2008-10-21 22:08:47 +00:00
Родитель c5061a76a1
Коммит ca1df83585
5 изменённых файлов: 106 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,10 @@
2008-10-21 Mike Kestner <mkestner@novell.com>
* gtkhtml/HTML.custom: copy in previously generated signal marshaler
from 2-16 branch since url-requested signal exposes a G_TYPE_POINTER
parameter that can't be marshaled automatically by SignalClosure.
[Fixes #436298]
2008-09-08 Mike Kestner <mkestner@novell.com>
* configure.in: make gnome-sharp-2.0 an unconditional dependency.

Просмотреть файл

@ -55,3 +55,75 @@
Write (handle, buffer, (ulong) size);
}
[GLib.CDeclCallback]
delegate void UrlRequestedSignalDelegate (IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr gch);
static void UrlRequestedSignalCallback (IntPtr arg0, IntPtr arg1, IntPtr arg2, IntPtr gch)
{
Gtk.UrlRequestedArgs args = new Gtk.UrlRequestedArgs ();
try {
GLib.Signal sig = ((GCHandle) gch).Target as GLib.Signal;
if (sig == null)
throw new Exception("Unknown signal GC handle received " + gch);
args.Args = new object[2];
args.Args[0] = GLib.Marshaller.Utf8PtrToString (arg1);
args.Args[1] = arg2 == IntPtr.Zero ? null : (Gtk.HTMLStream) GLib.Opaque.GetOpaque (arg2, typeof (Gtk.HTMLStream), false);
Gtk.UrlRequestedHandler handler = (Gtk.UrlRequestedHandler) sig.Handler;
handler (GLib.Object.GetObject (arg0), args);
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
[GLib.CDeclCallback]
delegate void UrlRequestedVMDelegate (IntPtr html, IntPtr url, IntPtr handle);
static UrlRequestedVMDelegate UrlRequestedVMCallback;
static void urlrequested_cb (IntPtr html, IntPtr url, IntPtr handle)
{
try {
HTML html_managed = GLib.Object.GetObject (html, false) as HTML;
html_managed.OnUrlRequested (GLib.Marshaller.Utf8PtrToString (url), handle == IntPtr.Zero ? null : (Gtk.HTMLStream) GLib.Opaque.GetOpaque (handle, typeof (Gtk.HTMLStream), false));
} catch (Exception e) {
GLib.ExceptionManager.RaiseUnhandledException (e, false);
}
}
private static void OverrideUrlRequested (GLib.GType gtype)
{
if (UrlRequestedVMCallback == null)
UrlRequestedVMCallback = new UrlRequestedVMDelegate (urlrequested_cb);
OverrideVirtualMethod (gtype, "url_requested", UrlRequestedVMCallback);
}
[GLib.DefaultSignalHandler(Type=typeof(Gtk.HTML), ConnectionMethod="OverrideUrlRequested")]
protected virtual void OnUrlRequested (string url, Gtk.HTMLStream handle)
{
GLib.Value ret = GLib.Value.Empty;
GLib.ValueArray inst_and_params = new GLib.ValueArray (3);
GLib.Value[] vals = new GLib.Value [3];
vals [0] = new GLib.Value (this);
inst_and_params.Append (vals [0]);
vals [1] = new GLib.Value (url);
inst_and_params.Append (vals [1]);
vals [2] = new GLib.Value (handle);
inst_and_params.Append (vals [2]);
g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret);
foreach (GLib.Value v in vals)
v.Dispose ();
}
[GLib.Signal("url_requested")]
public event Gtk.UrlRequestedHandler UrlRequested {
add {
GLib.Signal sig = GLib.Signal.Lookup (this, "url_requested", new UrlRequestedSignalDelegate(UrlRequestedSignalCallback));
sig.AddDelegate (value);
}
remove {
GLib.Signal sig = GLib.Signal.Lookup (this, "url_requested", new UrlRequestedSignalDelegate(UrlRequestedSignalCallback));
sig.RemoveDelegate (value);
}
}

Просмотреть файл

@ -16,7 +16,8 @@ METADATA = metadata
references =
glue_args = --glue-includes=gtkhtml/gtkhtml.h,gtkhtml/gtkhtml-embedded.h --gluelib-name=gtkhtmlsharpglue-2 --glue-filename=glue/generated.c
sources =
sources = \
UrlRequestedHandler.cs
customs = \
HTML.custom \

Просмотреть файл

@ -0,0 +1,24 @@
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gtk {
using System;
public delegate void UrlRequestedHandler(object o, UrlRequestedArgs args);
public class UrlRequestedArgs : GLib.SignalArgs {
public string Url{
get {
return (string) Args[0];
}
}
public Gtk.HTMLStream Handle{
get {
return (Gtk.HTMLStream) Args[1];
}
}
}
}

Просмотреть файл

@ -4,6 +4,7 @@
<attr path="/api/namespace/object[@cname='GtkHTML']/constructor[@cname='gtk_html_new']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/constructor[@cname='gtk_html_new_from_string']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/signal[@name='Command']" name="name">OnCommand</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/signal[@name='UrlRequested']" name="hidden">1</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/method[@name='BeginContent']" name="name">Begin</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/method[@name='BeginFull']" name="name">Begin</attr>
<attr path="/api/namespace/object[@cname='GtkHTML']/method[@name='EngineSearch']" name="name">Search</attr>