diff --git a/ChangeLog b/ChangeLog index 42ffab055..1a45ef055 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-01-02 Mike Kestner + + * gtk/MoveFocusHandler.cs: obsolete event types. + * gtk/TextView.custom: obsolete move-focus signal. + * gtk/Window.custom: obsolete move-focus signal. + Compat fixes for removal of signals from gtk+ API. [Fixes #350770] + 2007-12-17 Mike Kestner * parser/gapi_pp.pl: parse 'typedef struct\n{' properly. diff --git a/gtk/Makefile.am b/gtk/Makefile.am index bf9fda467..63e02b8da 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -16,6 +16,7 @@ sources = \ BindingAttribute.cs \ ChildPropertyAttribute.cs \ ITreeNode.cs \ + MoveFocusHandler.cs \ NodeCellDataFunc.cs \ NodeSelection.cs \ NodeStore.cs \ diff --git a/gtk/MoveFocusHandler.cs b/gtk/MoveFocusHandler.cs new file mode 100644 index 000000000..ea877b99b --- /dev/null +++ b/gtk/MoveFocusHandler.cs @@ -0,0 +1,20 @@ +// This file was generated by the Gtk# code generator. +// Any changes made will be lost if regenerated. + +namespace Gtk { + + using System; + + [Obsolete ("Events using this type were replaced by Gtk.Widget keybinding signal")] + public delegate void MoveFocusHandler(object o, MoveFocusArgs args); + + [Obsolete ("Events using this type were replaced by Gtk.Widget keybinding signal")] + public class MoveFocusArgs : GLib.SignalArgs { + public Gtk.DirectionType Direction{ + get { + return (Gtk.DirectionType) Args[0]; + } + } + + } +} diff --git a/gtk/TextView.custom b/gtk/TextView.custom index 0698c01ad..6ffebf4c4 100644 --- a/gtk/TextView.custom +++ b/gtk/TextView.custom @@ -35,3 +35,74 @@ Raw = gtk_text_view_new_with_buffer (buffer.Handle); } + [GLib.CDeclCallback] + delegate void MoveFocusSignalDelegate (IntPtr arg0, int arg1, IntPtr gch); + + static void MoveFocusSignalCallback (IntPtr arg0, int arg1, IntPtr gch) + { + Gtk.MoveFocusArgs args = new Gtk.MoveFocusArgs (); + 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[1]; + args.Args[0] = (Gtk.DirectionType) arg1; + Gtk.MoveFocusHandler handler = (Gtk.MoveFocusHandler) sig.Handler; + handler (GLib.Object.GetObject (arg0), args); + } catch (Exception e) { + GLib.ExceptionManager.RaiseUnhandledException (e, false); + } + } + + [GLib.CDeclCallback] + delegate void MoveFocusVMDelegate (IntPtr text_view, int direction); + + static MoveFocusVMDelegate MoveFocusVMCallback; + + static void movefocus_cb (IntPtr text_view, int direction) + { + try { + TextView text_view_managed = GLib.Object.GetObject (text_view, false) as TextView; + text_view_managed.OnMoveFocus ((Gtk.DirectionType) direction); + } catch (Exception e) { + GLib.ExceptionManager.RaiseUnhandledException (e, false); + } + } + + private static void OverrideMoveFocus (GLib.GType gtype) + { + if (MoveFocusVMCallback == null) + MoveFocusVMCallback = new MoveFocusVMDelegate (movefocus_cb); + OverrideVirtualMethod (gtype, "move_focus", MoveFocusVMCallback); + } + + [Obsolete ("Replaced by keybinding signal on Gtk.Widget")] + [GLib.DefaultSignalHandler(Type=typeof(Gtk.TextView), ConnectionMethod="OverrideMoveFocus")] + protected virtual void OnMoveFocus (Gtk.DirectionType direction) + { + GLib.Value ret = GLib.Value.Empty; + GLib.ValueArray inst_and_params = new GLib.ValueArray (2); + GLib.Value[] vals = new GLib.Value [2]; + vals [0] = new GLib.Value (this); + inst_and_params.Append (vals [0]); + vals [1] = new GLib.Value (direction); + inst_and_params.Append (vals [1]); + g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret); + foreach (GLib.Value v in vals) + v.Dispose (); + } + + [Obsolete ("Replaced by keybinding signal on Gtk.Widget")] + [GLib.Signal("move_focus")] + public event Gtk.MoveFocusHandler MoveFocus { + add { + GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback)); + sig.AddDelegate (value); + } + remove { + GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback)); + sig.RemoveDelegate (value); + } + } + diff --git a/gtk/Window.custom b/gtk/Window.custom index 93ef67761..81a218500 100755 --- a/gtk/Window.custom +++ b/gtk/Window.custom @@ -86,3 +86,74 @@ } } + [GLib.CDeclCallback] + delegate void MoveFocusSignalDelegate (IntPtr arg0, int arg1, IntPtr gch); + + static void MoveFocusSignalCallback (IntPtr arg0, int arg1, IntPtr gch) + { + Gtk.MoveFocusArgs args = new Gtk.MoveFocusArgs (); + 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[1]; + args.Args[0] = (Gtk.DirectionType) arg1; + Gtk.MoveFocusHandler handler = (Gtk.MoveFocusHandler) sig.Handler; + handler (GLib.Object.GetObject (arg0), args); + } catch (Exception e) { + GLib.ExceptionManager.RaiseUnhandledException (e, false); + } + } + + [GLib.CDeclCallback] + delegate void MoveFocusVMDelegate (IntPtr window, int direction); + + static MoveFocusVMDelegate MoveFocusVMCallback; + + static void movefocus_cb (IntPtr window, int direction) + { + try { + Window window_managed = GLib.Object.GetObject (window, false) as Window; + window_managed.OnMoveFocus ((Gtk.DirectionType) direction); + } catch (Exception e) { + GLib.ExceptionManager.RaiseUnhandledException (e, false); + } + } + + private static void OverrideMoveFocus (GLib.GType gtype) + { + if (MoveFocusVMCallback == null) + MoveFocusVMCallback = new MoveFocusVMDelegate (movefocus_cb); + OverrideVirtualMethod (gtype, "move_focus", MoveFocusVMCallback); + } + + [Obsolete ("Replaced by Keybinding signal on Gtk.Widget")] + [GLib.DefaultSignalHandler(Type=typeof(Gtk.Window), ConnectionMethod="OverrideMoveFocus")] + protected virtual void OnMoveFocus (Gtk.DirectionType direction) + { + GLib.Value ret = GLib.Value.Empty; + GLib.ValueArray inst_and_params = new GLib.ValueArray (2); + GLib.Value[] vals = new GLib.Value [2]; + vals [0] = new GLib.Value (this); + inst_and_params.Append (vals [0]); + vals [1] = new GLib.Value (direction); + inst_and_params.Append (vals [1]); + g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret); + foreach (GLib.Value v in vals) + v.Dispose (); + } + + [Obsolete ("Replaced by Keybinding signal on Gtk.Widget")] + [GLib.Signal("move_focus")] + public event Gtk.MoveFocusHandler MoveFocus { + add { + GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback)); + sig.AddDelegate (value); + } + remove { + GLib.Signal sig = GLib.Signal.Lookup (this, "move_focus", new MoveFocusSignalDelegate(MoveFocusSignalCallback)); + sig.RemoveDelegate (value); + } + } +