Commit Graph

18 Commits

Author SHA1 Message Date
Bertrand Lorentz
7ea0c4afaf glib: Fix native GLib warnings when disposing SourceProxy objects
When an instance of SourceProxy was finalized, we would try to remove
the corresponding source, even if it was already removed. This now
causes native GLib to print out warnings because it can't find the
source ID.

Now Source.Remove only calls g_source_remove if we really had a handler
registered for the ID we're removing.
2014-07-05 16:16:58 +02:00
Bertrand Lorentz
f5211acb74 glib: Have SourceProxy implement the Dispose pattern
Its 2 subclasses, IdleProxy and TimeoutProxy, were already implementing
it, so we factor this implementation into the base class.
2014-07-05 16:07:39 +02:00
Bertrand Lorentz
813f56e00a glib: Refactor Source, Idle and Timeout classes
Turn Source.source_handlers into a private generic Dictionary, and add
the necessary methods to allow Idle and Timeout to add and remove
entries from it.

This improves the encapsulation of the Source class, and factors
into it some code that was previously duplicated in Idle and Timeout.
2014-07-05 16:07:28 +02:00
Bertrand Lorentz
11920f2add glib: Re-organize code in Source for better readability
Move stuff around to have them in a reasonable order: fields, then
constructors, then destructor, then static methods, then instance stuff.
Also remove a commented out method, which would not be correct anyway.

No real code change here, just cosmetic changes.
2014-07-05 13:00:50 +02:00
Andrés G. Aragoneses
f1005da47c glib: Make all DllImports in custom code use a common const
This way there's less redundancy, and if the library name changes in the
future, it will be changed only in one place.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-11-17 13:05:12 +01:00
Stephan Sundermann
6ab620d689 generator,glib: added GPollFD and GSource types
GSource type was already there (but was not mapped by
the generator yet) so then the autogenerated methods
have been added manually inside the class after the
custom methods.

Other Source-related class are also generated and added
(but not mapped in the SymbolTable) to glib.
2013-10-09 19:41:21 +02:00
Christian Hoff
7b752d233c 2009-09-03 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Kill the calling convention field again.
	It breaks GLib 2.x compatibility in the generator and there is
	probably no need to make the calling convention configurable.
	* .cs, *.custom: Hardcode Cdecl calling convention instead of
	using GLib's field.

svn path=/trunk/gtk-sharp/; revision=141283
2009-09-03 19:50:53 +00:00
Christian Hoff
58e97c087a 2009-09-02 Christian Hoff <christian_hoff@gmx.net>
* glib/Global.cs: Add a public constant field specifying the
	calling convention used by GLib and depending libraries.
	By now it's hardcoded to Cdecl as every non-Win32 runtime
	should ignore this attribute.
	* *.cs, *.custom: Use GLib.Global.CallingConvention for both
	pinvokes and callbacks. Plugs a stack leak on Win32. All
	pinvokes defaulted to StdCall and thus the stack was never
	cleaned up.

svn path=/trunk/gtk-sharp/; revision=141175
2009-09-02 20:17:37 +00:00
Mike Kestner
c949e6e8de 2008-02-21 Mike Kestner <mkestner@novell.com>
* glib/Source.cs: rework proxy removal to avoid boxing profile.
	* glib/Idle.cs: save src_id in proxy to facilitate removal.
	* glib/Timeout.cs: save src_id in proxy to facilitate removal.
	[Fixes #359561]

svn path=/trunk/gtk-sharp/; revision=96363
2008-02-21 16:32:03 +00:00
Mike Kestner
209f353fc8 2007-12-06 Mike Kestner <mkestner@novell.com>
* * : update to 2.12 API.

svn path=/trunk/gtk-sharp/; revision=90823
2007-12-06 17:23:28 +00:00
Mike Kestner
1fa0231217 2007-10-24 Mike Kestner <mkestner@novell.com>
* generator/SymbolTable.cs: mappings for GCallback and GSourceFunc.
	* glib/GCallback.cs: GCallback declaration.
	* glib/Source.cs: GSourceFunc declaration.

svn path=/trunk/gtk-sharp/; revision=88126
2007-10-24 20:13:08 +00:00
Mike Kestner
57972ab070 2005-02-28 Mike Kestner <mkestner@novell.com>
* glib/Idle.cs : add locking on the source_handlers.
	* glib/Source.cs : add locking on the source_handlers.
	* glib/Timeout.cs : add locking on the source_handlers.

svn path=/trunk/gtk-sharp/; revision=41290
2005-02-28 18:11:24 +00:00
Mike Kestner
6d70444302 2005-02-25 Mike Kestner <mkestner@novell.com>
* glib/Source.cs : remove from the hash by key.
	* glib/Idle.cs : remove from the hash by key.

svn path=/trunk/gtk-sharp/; revision=41208
2005-02-25 18:18:10 +00:00
Miguel de Icaza
95978e0ce7 2004-09-18 Miguel de Icaza <miguel@ximian.com>
* glib/Source.cs: Add new base class to hold the method to be
	called, and the proxy handler we use to keep references to them
	and avoid a collection.

	Exposes a new variables that references all the active Timeouts
	and Idle handlers to avoid collection/

	* glib/Timeout.cs: Implement TimeoutProxy that acts as a filter to
	remove the proxy when the timeout is removed.

	Register a TimeoutProxy when we create a timeout.

	* glib/Idle.cs: Implement IdleProxy that acts as a filter to
	remove the proxy when the idle handler is removed.

	Register an IdleProxy when we create a timeout.

svn path=/trunk/gtk-sharp/; revision=34094
2004-09-20 16:43:16 +00:00
Mike Kestner
7a6d6b2128 2004-06-25 Mike Kestner <mkestner@ximian.com>
* */*.cs : add lgpl license blurb and clean up (c)'s.
	* */*.custom : add lgpl license blurb and clean up (c)'s.
	* */glue/*.c : add lgpl license blurb and clean up (c)'s.
	file adds without license from now on are punishable by wedgie.

svn path=/trunk/gtk-sharp/; revision=30401
2004-06-25 18:42:19 +00:00
Miguel de Icaza
f1e095a87b 2003-11-27 Miguel de Icaza <miguel@ximian.com>
* glib/Log.cs: Make LogLevelFlags CLS compliant.

	* glib/SignalCallback.cs: Set the constructor protection level to
	protected, since it can not be instantiate.d

	* glib/Marshaller.cs: Do not allow instances of this class as it
	only exposes static methods.

	* glib/Source.cs, glib/FileUtils.cs, glib/Timeout.cs,
	glib/Thread.cs, glib/Markup.cs, glib/TypeConverter.cs: Ditto.

svn path=/trunk/gtk-sharp/; revision=20573
2003-11-28 05:29:34 +00:00
Mike Kestner
c0b574a686 2003-02-21 Mike Kestner <mkestner@speakeasy.net>
* mapdllnames.pl : a little whitespace action
	* api/*-api.xml : move to win32 dllnames
	* */makefile.win32 : remove the mapdllnames step
	* */*.cs : move to win32 dllnames
	* */*.custom : move to win32 dllnames
	* sources/gtk-sharp.sources : move to win32 dllnames

svn path=/trunk/gtk-sharp/; revision=11823
2003-02-22 04:34:56 +00:00
Duncan Mak
f94df39a18 2002-10-19 Duncan Mak <duncan@ximian.com>
* glib/Source.cs: Added.

svn path=/trunk/gtk-sharp/; revision=8412
2002-10-19 23:18:59 +00:00