Permalink
Browse files

Mad props to alp for this one. Cleaned up a bit of the

cruft in signals.  Please test this one out and see if it 
works for you.


svn path=/trunk/gtkmozembed-sharp/; revision=44185
  • Loading branch information...
1 parent a3f67dd commit 368a8138de69b00fe638873874e31d806a9714f2 Mark Crichton committed May 7, 2005
View
@@ -1,3 +1,11 @@
+2005-05-06 Mark Crichton <crichton@gimp.org>
+
+ * gtkmozembed/gtksharp.metadata: Finally get around to fixing
+ signals
+ * gtkmozembed/NewWindow*.cs, Single.custom: Removed, for they
+ are junk now
+ * gtkmozembed/WebControl.custom: Removed more new_window hackery
+
2005-05-01 Mark Crichton <crichton@gimp.org>
* Makefile.am:
View
@@ -14,11 +14,7 @@ CODEGEN=gapi2-codegen
FIXUP=gapi2-fixup
endif
-sources = NewWindowOrphan_handler.cs \
- NewWindow_delegate.cs \
- NewWindow_handler.cs
-
-build_sources = $(addprefix $(srcdir)/, $(sources)) AssemblyInfo.cs
+build_sources = AssemblyInfo.cs
customs = Single.custom WebControl.custom
@@ -1,24 +0,0 @@
-// This file was generated by the Gtk# Code generator.
-// Any changes made will be lost if regenerated.
-
-namespace Gecko {
-
- using System;
-
- public delegate void NewWindowOrphanHandler(object o, NewWindowArgs args);
-
- public class NewWindowOrphanArgs : GLib.SignalArgs {
- public WebControl NewEmbed{
- set {
- Args[0] = (WebControl) value;
- }
- }
-
- public uint Chromemask{
- get {
- return (uint) Args[1];
- }
- }
-
- }
-}
@@ -1,71 +0,0 @@
-// This file was generated by the Gtk# code generator.
-// Any changes made will be lost if regenerated.
-
-namespace GtkSharp {
-
- using System;
- using System.Runtime.InteropServices;
- using GLib;
-
- internal delegate void voidObjectObjectuintDelegate(IntPtr arg0, IntPtr arg1, uint arg2, int key);
-
- internal class voidObjectObjectuintSignal : SignalCallback {
-
- private static voidObjectObjectuintDelegate _Delegate;
-
- private IntPtr _raw;
- private uint _HandlerID;
-
- private static void voidObjectObjectuintCallback(IntPtr arg0, IntPtr arg1, uint arg2, int key)
- {
- if (!_Instances.Contains(key))
- throw new Exception("Unexpected signal key " + key);
-
- voidObjectObjectuintSignal inst = (voidObjectObjectuintSignal) _Instances[key];
- SignalArgs args = (SignalArgs) Activator.CreateInstance (inst._argstype);
- args.Args = new object[2];
-
- // Ok, so arg1 is set by the signal handler...
- // We can pass a null, and get an object back
-
- args.Args[0] = null;
- args.Args[1] = arg2;
-
- object[] argv = new object[2];
- argv[0] = inst._obj;
- argv[1] = args;
- inst._handler.DynamicInvoke(argv);
- // And put the object back...
- arg1 = ((GLib.Object)args.Args[0]).Handle;
- }
-
- [DllImport("libgobject-2.0-0.dll")]
- static extern uint g_signal_connect_data(IntPtr obj, string name, voidObjectObjectuintDelegate cb, int key, IntPtr p, int flags);
-
- public voidObjectObjectuintSignal(GLib.Object obj, IntPtr raw, string name, Delegate eh, Type argstype, int connect_flags) : base(obj, eh, argstype)
- {
- if (_Delegate == null) {
- _Delegate = new voidObjectObjectuintDelegate(voidObjectObjectuintCallback);
- }
- _raw = raw;
- _HandlerID = g_signal_connect_data(raw, name, _Delegate, _key, new IntPtr(0), connect_flags);
- }
-
- [DllImport("libgobject-2.0-0.dll")]
- static extern void g_signal_handler_disconnect (IntPtr instance, uint handler);
-
- [DllImport("libgobject-2.0-0.dll")]
- static extern bool g_signal_handler_is_connected (IntPtr instance, uint handler);
-
- protected override void Dispose (bool disposing)
- {
- _Instances.Remove(_key);
- if(_Instances.Count == 0)
- _Delegate = null;
-
- if (g_signal_handler_is_connected (_raw, _HandlerID))
- g_signal_handler_disconnect (_raw, _HandlerID);
- base.Dispose (disposing);
- }
- }
-}
@@ -1,24 +0,0 @@
-// This file was generated by the Gtk# code generator.
-// Any changes made will be lost if regenerated.
-
-namespace Gecko {
-
- using System;
-
- public delegate void NewWindowHandler(object o, NewWindowArgs args);
-
- public class NewWindowArgs : GLib.SignalArgs {
- public Gecko.WebControl NewEmbed{
- set {
- Args[0] = (Gecko.WebControl) value;
- }
- }
-
- public uint Chromemask{
- get {
- return (uint) Args[1];
- }
- }
-
- }
-}
View
@@ -1,25 +0,0 @@
-/*
- [GLib.Signal("new_window_orphan")]
- public event GtkMozEmbedSharp.NewWindowOrphanHandler NewWindowOrphan {
- add {
- if (EventList["new_window_orphan"] == null)
- Signals["new_window_orphan"] = new GtkMozEmbedSharp.voidObjectObjectuintSignal(this, Handle, "new_window_orphan", value, System.Type.GetType("GtkMozEmbedSharp.NewWindowOrphanArgs,gtkmozembed-sharp"));
- else
- ((GtkSharp.SignalCallback) Signals ["new_window_orphan"]).AddDelegate (value);
- EventList.AddHandler("new_window_orphan", value);
- }
- remove {
- EventList.RemoveHandler("new_window_orphan", value);
- GtkSharp.SignalCallback cb = Signals ["new_window_orphan"] as GtkSharp.SignalCallback;
- if (cb == null)
- return;
-
- cb.RemoveDelegate (value);
-
- if (EventList["new_window_orphan"] == null) {
- Signals.Remove("new_window_orphan");
- cb.Dispose ();
- }
- }
- }
-*/
@@ -1,72 +1,3 @@
- delegate void NewWindowDelegate (IntPtr embed, IntPtr newEmbed, uint chromemask);
-
- static NewWindowDelegate NewWindowCallback;
-
- static void newwindow_cb (IntPtr embed, IntPtr newEmbed, uint chromemask)
- {
- WebControl obj = GLib.Object.GetObject (embed, false) as WebControl;
- obj.OnNewWindow ((Gecko.WebControl) GLib.Object.GetObject(newEmbed), chromemask);
- }
-
- protected static void OverrideNewWindow (GLib.GType gtype)
- {
- if (NewWindowCallback == null)
- NewWindowCallback = new NewWindowDelegate (newwindow_cb);
- OverrideVirtualMethod (gtype, "new_window", NewWindowCallback);
- }
-
- [GLib.DefaultSignalHandler(Type=typeof(Gecko.WebControl), ConnectionMethod="OverrideNewWindow")]
- protected virtual void OnNewWindow (Gecko.WebControl newEmbed, uint chromemask)
- {
- 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 (newEmbed);
- inst_and_params.Append (vals [1]);
- vals [2] = new GLib.Value (chromemask);
- inst_and_params.Append (vals [2]);
- g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref GLib.Value.Empty);
- }
-
- [GLib.Signal("new_window")]
- public event Gecko.NewWindowHandler NewWindow {
- add {
- if (value.Method.GetCustomAttributes(typeof(GLib.ConnectBeforeAttribute), false).Length > 0) {
- if (BeforeHandlers["new_window"] == null)
- BeforeSignals["new_window"] = new GtkSharp.voidObjectObjectuintSignal(this, Handle, "new_window", value, System.Type.GetType("Gtk.NewWindowArgs,gtkmozembed-sharp"), 0);
- else
- ((GLib.SignalCallback) BeforeSignals ["new_window"]).AddDelegate (value);
- BeforeHandlers.AddHandler("new_window", value);
- } else {
- if (AfterHandlers["new_window"] == null)
- AfterSignals["new_window"] = new GtkSharp.voidObjectObjectuintSignal(this, Handle, "new_window", value, System.Type.GetType("Gtk.NewWindowArgs,gtkmozembed-sharp"), 1);
- else
- ((GLib.SignalCallback) AfterSignals ["new_window"]).AddDelegate (value);
- AfterHandlers.AddHandler("new_window", value);
- }
- }
- remove {
- System.ComponentModel.EventHandlerList event_list = AfterHandlers;
- Hashtable signals = AfterSignals;
- if (value.Method.GetCustomAttributes(typeof(GLib.ConnectBeforeAttribute), false).Length > 0) {
- event_list = BeforeHandlers;
- signals = BeforeSignals;
- }
- GLib.SignalCallback cb = signals ["new_window"] as GLib.SignalCallback;
- event_list.RemoveHandler("new_window", value);
- if (cb == null)
- return;
-
- cb.RemoveDelegate (value);
-
- if (event_list["new_window"] == null) {
- signals.Remove("new_window");
- cb.Dispose ();
- }
- }
- }
-
[DllImport("gtkembedmoz.dll")]
static extern IntPtr gtk_moz_embed_new();
@@ -11,8 +11,10 @@
<attr path="/api/namespace/object[@cname='GtkMozEmbed']/method[@name='ChromeFlagsGetType']" name="hidden">1</attr>
-<!-- Hide new_window, since it needs special marshalling -->
- <attr path="/api/namespace/object[@cname='GtkMozEmbed']/signal[@cname='new_window']" name="hidden">1</attr>
+<!-- Fixup new_window, since it needs special marshalling -->
+ <attr path="/api/namespace/object[@cname='GtkMozEmbed']/signal[@cname='new_window']/*/*[@type='GtkMozEmbed**']" name="pass_as">out</attr>
+
+<!-- Useless, really... -->
<attr path="/api/namespace/object[@cname='GtkMozEmbedSingle']/signal[@cname='new_window_orphan']" name="hidden">1</attr>
<!-- Fix the open_uri signal slightly -->

0 comments on commit 368a813

Please sign in to comment.