More dead code removal.
* glib/Makefile.am: remove files * glib/Boxed.cs: remove * glib/DelegateWrapper.cs: remove * glib/SignalCallback.cs: remove * glib/TypeConverter.cs: remove
This commit is contained in:
parent
d33520b9c6
commit
08eda8b7c2
5 changed files with 0 additions and 319 deletions
|
@ -1,62 +0,0 @@
|
||||||
// GtkSharp.Boxed.cs - Base class for deriving marshallable structures.
|
|
||||||
//
|
|
||||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
|
||||||
//
|
|
||||||
// Copyright (c) 2001-2002 Mike Kestner
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of version 2 of the Lesser GNU General
|
|
||||||
// Public License as published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this program; if not, write to the
|
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
namespace GLib {
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
[Obsolete]
|
|
||||||
public class Boxed {
|
|
||||||
object obj;
|
|
||||||
IntPtr raw;
|
|
||||||
|
|
||||||
public Boxed (object o)
|
|
||||||
{
|
|
||||||
this.obj = o;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boxed (IntPtr ptr)
|
|
||||||
{
|
|
||||||
this.raw = ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual IntPtr Handle {
|
|
||||||
get {
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
raw = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static explicit operator System.IntPtr (Boxed boxed) {
|
|
||||||
return boxed.Handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual object Obj {
|
|
||||||
get {
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
obj = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,111 +0,0 @@
|
||||||
// DelegateWrapper.cs - Delegate wrapper implementation
|
|
||||||
//
|
|
||||||
// Authors:
|
|
||||||
// Rachel Hestilow <hestilow@ximian.com>
|
|
||||||
// Gonzalo Panigua Javier <gonzalo@ximian.com>
|
|
||||||
//
|
|
||||||
// Copyright (c) 2002 Rachel Hestilow
|
|
||||||
// Copyright (c) 2003 Ximian, Inc.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of version 2 of the Lesser GNU General
|
|
||||||
// Public License as published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this program; if not, write to the
|
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
|
|
||||||
namespace GLib {
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
public class DelegateWrapper
|
|
||||||
{
|
|
||||||
// Keys in the hashtable are instances of classes derived from this one.
|
|
||||||
// Values are each instance's destroy notification delegate
|
|
||||||
static Hashtable instances = new Hashtable ();
|
|
||||||
|
|
||||||
// This list holds references to wrappers for static
|
|
||||||
// methods. These will never expire.
|
|
||||||
static ArrayList static_instances = new ArrayList ();
|
|
||||||
|
|
||||||
static int notify_count = 0;
|
|
||||||
|
|
||||||
// The object 'o' is the object that creates the instance of the DelegateWrapper
|
|
||||||
// derived class or null if created from a static method.
|
|
||||||
// Note that the instances will never be disposed if they are created in a static
|
|
||||||
// method.
|
|
||||||
[Obsolete ("Callback wrappers should be manually managed for persistence.")]
|
|
||||||
protected DelegateWrapper (object o)
|
|
||||||
{
|
|
||||||
if (o != null) {
|
|
||||||
// If o is a GObject, we can get
|
|
||||||
// destroy notification. Otherwise
|
|
||||||
// no additional references to
|
|
||||||
// the wrapper are kept.
|
|
||||||
// FIXME: This should work because
|
|
||||||
// currently only GObjects store
|
|
||||||
// callbacks over the long-term
|
|
||||||
|
|
||||||
if (o is GLib.Object) {
|
|
||||||
AddDestroyNotify ((GLib.Object) o);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If o is null, we cannot ask for a destroy
|
|
||||||
// notification, so the wrapper never expires.
|
|
||||||
|
|
||||||
lock (typeof (DelegateWrapper)) {
|
|
||||||
static_instances.Add (this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
|
||||||
private delegate void DestroyNotify (IntPtr data);
|
|
||||||
|
|
||||||
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
private static extern void g_object_set_data_full (IntPtr obj, IntPtr name, IntPtr data, DestroyNotify destroy);
|
|
||||||
|
|
||||||
private void AddDestroyNotify (GLib.Object o) {
|
|
||||||
// This is a bit of an ugly hack. There is no
|
|
||||||
// way of getting a destroy notification
|
|
||||||
// explicitly, so we set some data and ask
|
|
||||||
// for notification when it is removed
|
|
||||||
|
|
||||||
IntPtr name = Marshaller.StringToPtrGStrdup (String.Format ("_GtkSharpDelegateWrapper_{0}", notify_count));
|
|
||||||
DestroyNotify destroy = new DestroyNotify (this.OnDestroy);
|
|
||||||
|
|
||||||
g_object_set_data_full (o.Handle, name, IntPtr.Zero, destroy);
|
|
||||||
Marshaller.Free (name);
|
|
||||||
lock (typeof (DelegateWrapper)) {
|
|
||||||
instances[this] = destroy;
|
|
||||||
notify_count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This callback is invoked by GLib to indicate that the
|
|
||||||
// object that owned the native delegate wrapper no longer
|
|
||||||
// exists and the instance of the delegate itself is removed from the hash table.
|
|
||||||
private void OnDestroy (IntPtr data) {
|
|
||||||
try {
|
|
||||||
lock (typeof (DelegateWrapper)) {
|
|
||||||
if (instances.ContainsKey (this)) {
|
|
||||||
instances.Remove (this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
ExceptionManager.RaiseUnhandledException (e, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,10 +20,8 @@ references =
|
||||||
|
|
||||||
sources = \
|
sources = \
|
||||||
Argv.cs \
|
Argv.cs \
|
||||||
Boxed.cs \
|
|
||||||
ConnectBeforeAttribute.cs \
|
ConnectBeforeAttribute.cs \
|
||||||
DefaultSignalHandlerAttribute.cs \
|
DefaultSignalHandlerAttribute.cs \
|
||||||
DelegateWrapper.cs \
|
|
||||||
DestroyNotify.cs \
|
DestroyNotify.cs \
|
||||||
ExceptionManager.cs \
|
ExceptionManager.cs \
|
||||||
FileUtils.cs \
|
FileUtils.cs \
|
||||||
|
@ -58,7 +56,6 @@ sources = \
|
||||||
Signal.cs \
|
Signal.cs \
|
||||||
SignalArgs.cs \
|
SignalArgs.cs \
|
||||||
SignalAttribute.cs \
|
SignalAttribute.cs \
|
||||||
SignalCallback.cs \
|
|
||||||
SignalClosure.cs \
|
SignalClosure.cs \
|
||||||
SList.cs \
|
SList.cs \
|
||||||
Source.cs \
|
Source.cs \
|
||||||
|
@ -66,7 +63,6 @@ sources = \
|
||||||
Thread.cs \
|
Thread.cs \
|
||||||
Timeout.cs \
|
Timeout.cs \
|
||||||
ToggleRef.cs \
|
ToggleRef.cs \
|
||||||
TypeConverter.cs \
|
|
||||||
TypeFundamentals.cs \
|
TypeFundamentals.cs \
|
||||||
TypeInitializerAttribute.cs \
|
TypeInitializerAttribute.cs \
|
||||||
ValueArray.cs \
|
ValueArray.cs \
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
// GLib.SignalCallback.cs - Signal callback base class implementation
|
|
||||||
//
|
|
||||||
// Authors: Mike Kestner <mkestner@ximian.com>
|
|
||||||
//
|
|
||||||
// Copyright (c) 2001 Mike Kestner
|
|
||||||
// Copyright (c) 2004 Novell, Inc.
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of version 2 of the Lesser GNU General
|
|
||||||
// Public License as published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this program; if not, write to the
|
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
|
|
||||||
namespace GLib {
|
|
||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
[Obsolete ("Replaced by GLib.Signal.")]
|
|
||||||
public abstract class SignalCallback : IDisposable {
|
|
||||||
|
|
||||||
// A counter used to produce unique keys for instances.
|
|
||||||
protected static int _NextKey = 0;
|
|
||||||
|
|
||||||
// Hashtable containing refs to all current instances.
|
|
||||||
protected static Hashtable _Instances = new Hashtable ();
|
|
||||||
|
|
||||||
// protected instance members
|
|
||||||
protected GLib.Object _obj;
|
|
||||||
protected Delegate _handler;
|
|
||||||
protected int _key;
|
|
||||||
protected System.Type _argstype;
|
|
||||||
protected uint _HandlerID;
|
|
||||||
|
|
||||||
protected SignalCallback (GLib.Object obj, Delegate eh, System.Type argstype)
|
|
||||||
{
|
|
||||||
_key = _NextKey++;
|
|
||||||
_obj = obj;
|
|
||||||
_handler = eh;
|
|
||||||
_argstype = argstype;
|
|
||||||
_Instances [_key] = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddDelegate (Delegate d)
|
|
||||||
{
|
|
||||||
_handler = Delegate.Combine (_handler, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveDelegate (Delegate d)
|
|
||||||
{
|
|
||||||
_handler = Delegate.Remove (_handler, d);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
static extern uint g_signal_connect_data(IntPtr obj, IntPtr name, Delegate cb, int key, IntPtr p, int flags);
|
|
||||||
|
|
||||||
protected void Connect (string name, Delegate cb, int flags)
|
|
||||||
{
|
|
||||||
IntPtr native_name = Marshaller.StringToPtrGStrdup (name);
|
|
||||||
_HandlerID = g_signal_connect_data(_obj.Handle, native_name, cb, _key, new IntPtr(0), flags);
|
|
||||||
Marshaller.Free (native_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
static extern void g_signal_handler_disconnect (IntPtr instance, uint handler);
|
|
||||||
|
|
||||||
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
static extern bool g_signal_handler_is_connected (IntPtr instance, uint handler);
|
|
||||||
|
|
||||||
protected void Disconnect ()
|
|
||||||
{
|
|
||||||
if (g_signal_handler_is_connected (_obj.Handle, _HandlerID))
|
|
||||||
g_signal_handler_disconnect (_obj.Handle, _HandlerID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose ()
|
|
||||||
{
|
|
||||||
Dispose (true);
|
|
||||||
GC.SuppressFinalize (this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void Dispose (bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing) {
|
|
||||||
_obj = null;
|
|
||||||
_handler = null;
|
|
||||||
_argstype = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
~SignalCallback ()
|
|
||||||
{
|
|
||||||
Dispose (false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
// GLib.TypeConverter.cs : Convert between fundamental and .NET types
|
|
||||||
//
|
|
||||||
// Author: Rachel Hestilow <hestilow@ximian.com>
|
|
||||||
//
|
|
||||||
// Copyright (c) 2002 Rachel Hestilow
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or
|
|
||||||
// modify it under the terms of version 2 of the Lesser GNU General
|
|
||||||
// Public License as published by the Free Software Foundation.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this program; if not, write to the
|
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
|
|
||||||
namespace GLib {
|
|
||||||
using System;
|
|
||||||
|
|
||||||
public class TypeConverter {
|
|
||||||
|
|
||||||
private TypeConverter () {}
|
|
||||||
|
|
||||||
[Obsolete ("Replaced by explicit (GType) cast")]
|
|
||||||
public static GType LookupType (System.Type type)
|
|
||||||
{
|
|
||||||
return (GType) type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue