Commit Graph

465 Commits

Author SHA1 Message Date
Bertrand Lorentz
499540dd6d glib: Add GIOCondition symbol to glib-api.xml
This fixes some generator warnings for gio.
2012-11-11 11:46:40 +01:00
Rickard Edström
8e07e7d225 Add a SynchronizationContext implementation for GLib (bnc#621444)
Create a GLibSynchronizationContext that sends code to be run on the
GLib main loop, and set it as the current SynchronizationContext in
Gtk.Init().

When you use the await keyword to do a task asynchronously, by default
the awaiter will capture the current SynchronizationContext, and if
there was one, when the task completes it’ll Post the supplied
continuation back to that context, rather than running it on whatever
thread it wants.

This means that if you use the async/await keywords in your Gtk# app,
things will now work as expected with the GTK main thread. For example:

static async void DoWork () // called in the GTK main thread
{
    // Do some stuff with the UI...
    label.Text = "Starting Work";

    // Run something asynchronously, UI is not frozen
    int res = await DoLongOperation ();

    // Do some more UI stuff, it'll run on the GTK main thread
    label.Text = "Work done";
}

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2012-11-08 22:33:46 +01:00
Bertrand Lorentz
df751f87ce glib: Switch to generic collections in Marshaller and ValueArray 2012-11-04 16:58:49 +01:00
Bertrand Lorentz
6e3e73e2ac glib: Use dictionaries to store type information in GType class
Yay, type safety when managing types...
2012-11-04 16:58:49 +01:00
Bertrand Lorentz
60612071c1 Add a MonoDevelop solution and projects for browsing the codebase
This is just to be able to use MonoDevelop to browse the codebase, both
custom and generated code. It is NOT intended to be used to build
anything.
2012-10-13 16:44:10 +02:00
Andrés G. Aragoneses
61b67120c2 glib: add missing lock statements for Objects collection
When accessing the static Objects collection in GLib.Object
class, a lock was held in some places but not all of them.
Brought up by Alan McGovern.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2012-10-13 15:54:50 +02:00
Michael Hutchinson
d686a4d6aa Added Object.TryGetObject that gets wrapper only if already surfaced 2012-10-13 15:06:51 +02:00
Andrés G. Aragoneses
85b84f99f6 glib: Remove redundant call to ToggleRef.QueueUnref()
In slow systems this redundant call was causing the following CRITICAL:

  GLib-GObject-CRITICAL **: g_object_remove_toggle_ref:
    assertion `G_IS_OBJECT (object)' failed

The GLib.Object.Dispose(bool) method already calls this function at the
end so there is no need to check for duplicates in the PendingDestroys
static field of ToggleRef class (thanks to Alan McGorvern for helping
tracking down the root cause), the double unref call is just prevented.

Fixes BXC#4909.
2012-05-08 20:35:36 +01:00
Andres G. Aragoneses
b008a626f8 glib: don't modify Makefile.am
The new -define flag DISABLE_GTHREAD_CHECK can be added at configure time to already existing $CSFLAGS, as Mike Kestner pointed out.
2012-05-04 22:20:14 +01:00
Andres G. Aragoneses
3862bc75ec glib: do not call g_thread_ functions in GLib >= 2.31
Based on downstream patch by by Christopher James Halse Rogers <raof@ubuntu.com>
Should fix BXC#2329 reported by Sergey Litvinov.
2012-05-03 23:45:07 +01:00
Mike Kestner
0e0d0ec94d Don't release const strings in GLib.Global. 2012-04-21 17:38:10 -05:00
Mike Kestner
b107fdd7c0 Improve MissingCtorException message. 2012-03-28 22:10:47 -05:00
Mike Kestner
1ec86832dd Remove empty file. 2012-03-28 22:10:47 -05:00
Bertrand Lorentz
0de6e9869d ParamSpec: Add override modifier to the ToString method
This remove a compilation warning.
2011-12-03 16:41:21 +01:00
Bertrand Lorentz
d239b5cc4e Object: Remove some trailing whitespace, no real code change 2011-12-03 16:41:17 +01:00
Bertrand Lorentz
91dda7f5be Object: Fix registration of inherited interface properties
We need to add inherited interface properties in the Properties hash, so
we remove the DeclaredOnly flag when looking for interface properties in
the type.

We also need to use the type itself as the hash key, and not the adapter
type.
2011-12-03 16:41:16 +01:00
Andres G. Aragoneses
1215ebc770 Object: Use the type as top-level key for properties hash
Types could use same param_spec object so their PropertyInfo
objects shouldn't be mixed, otherwise we could get type
mismatch errors like the one in:

http://mail.gnome.org/archives/banshee-list/2011-November/msg00141.html

This should be the final part of:
https://bugzilla.novell.com/show_bug.cgi?id=442068
2011-12-03 16:39:05 +01:00
Mike Kestner
9d319c8033 Merge pull request #26 from dufoli/master
ginterface properties support
2011-11-20 21:42:02 -08:00
Olivier Dufour
37d15305a3 GInterface: Add properties support 2011-11-20 19:41:56 +01:00
Mike Kestner
6fbd419c1d Remove source delegates by id.
* glib/Idle.cs: use g_source_remove and id in Remove(Delegate)
* glib/Timeout.cs: use g_source_remove and id in Remove(Delegate)
[Fixes #632765]
2011-10-13 05:23:39 -05:00
Bertrand Lorentz
18d1af6907 build: Specify assembly version when uninstalling from the GAC
We need to qualify the assembly name with the version, otherwise gacutil
uninstall all versions of the assembly.
Fixes http://bugzilla.xamarin.com/show_bug.cgi?id=207
2011-08-11 18:44:58 +02:00
Mike Kestner
4f42fb77fb Improve ToggleRef release overhead.
Candidate patch provided by Andres in pull request #17.

* glib/Object.cs: use ToggleRef.Dispose.
* glib/ToggleRef.cs: implement IDisposable and expose former Free
    functionality as Dispose().  Free is now private non-lock taking
    called by Dispose and the idle queue handler.
2011-07-29 13:37:39 -05:00
Andres G. Aragoneses
228a2b3da4 glib: Fix calling to Free() twice for the same ToggleRef
Apparently the recent changes in gtk-sharp master that changed
the destroy/dispose strategy caused a bug about calling
g_object_remove_toggle_ref() twice because now Dispose(true)
could call ToggleRef.Free() directly bypassing
ToggleRef.QueueUnref(). This change makes sure that
the ref is removed from the PendingDestroys list.
2011-07-29 18:21:27 +01:00
Mike Kestner
51d5faf651 Mark calling convention on GInterface callbacks
Fixes #583901.  Adapted from fix for 2.12 from Markus Henschel.

* glib/GInterfaceAdapter.cs: add UnmanagedFunctionPointer attrs
2011-07-24 18:29:04 -05:00
Bertrand Lorentz
680dd23965 Handle floating refs in InitiallyUnowned
When Gtk.Object was removed, most of the code was moved to Gtk.Widget.
But the part that deals with floating references actually belongs in
Glib.InitiallyUnowned.

This fixes various issues, in particular crashes in the TreeModelDemo
sample.
2011-06-11 19:08:21 +02:00
Mike Kestner
c6a3bf4b73 Fix TextBufferSerializeFunc signature
* generator/CallbackGen.cs: connect return value count parameters
* generator/ManagedCallString.cs: out count params aren't special
* generator/MethodBody.cs: don't finish hidden params
* generator/Parameters.cs: explicit IsCount setting support, with
    Parameters.GetCountParameter(name) interface. Clear IsCount
    values during validation if they have no associated array. Any
    remaining count params must be associated with a retval, so
    hide them.
* generator/ReturnValue.cs: support array_length_param attribute to
    associate a return value with a "count" param.  Use new helper
    methods to marshal these array retvals to IntPtr and back.
* glib/Marshaller.cs: support for byte[] marshaling to and from
    IntPtr using a count and type in the from native direction.
* gtk/Gtk.metadata: mark TextBufferSerializeFunc return type as
    an array with the length specific in the length param.
2011-04-28 18:38:07 -05:00
Mike Kestner
2e115e2aff * glib/Value.cs: revert to "working" GValue layout from 2-12 branch.
The replaced code fails because sizeof(GValue) is 20 on 32 bit
    linux but Marshal.SizeOf(GLib.Value) reported 24.  If it aint broke,
    don't fix it, and the long works on 32 and 64 in 2.12 and earlier.
2011-04-27 19:05:11 -05:00
Mike Kestner
6fafc52670 Guard against null native names.
* glib/GType.cs: null guarding for native names
2011-04-27 19:03:02 -05:00
Mike Kestner
d3d32c8ff0 GKeyFile binding
* glib/KeyFile.cs: new pseudo-hand-binding for GKeyFile
* glib/Makefile.am: add file
* glib/Marshaller.cs: add string[] to strv marshaler
* glib/glib-api.xml: expose GKeyFile mapping
2011-04-14 14:35:47 -05:00
Mike Kestner
1c980d6e71 Switch GLib.Object to Dispose(bool) pattern.
* glib/Object.cs: move finalization queue to ToggleRef and make
    Dispose() non-virtual with a protected virtual Dispose(bool).
    Also added a WarnOnFinalize static property to produce nags for
    undisposed objects.
* glib/ToggleRef.cs: add finalization queue and QueueUnref method.
* gtk/NodeStore.cs: override Dispose(bool)
* gtk/Widget.custom: override Dispose(bool)
2011-03-25 12:22:04 -05:00
Mike Kestner
6be0718ff2 Simplified Signal handling
* gdk/Display.custom: rework signal connection
* gdk/Window.custom: rework signal connection
* generator/Signal.cs: generate for new API.
* glib/Object.cs: add (Add|Remove)SignalHandler methods and use
them for the Notify connections.  Move to generic collections for
everything but the Data hash.
* glib/Signal.cs: kill Lookup methods and add delegate fields
* glib/ToggleRef.cs: remove Signals hash, it doesn't belong here.
* gtk/Clipboard.custom: rework signal connection
* gtk/ListStore.custom: rework signal connection
* gtk/TextView.custom: remove obsolete signal
* gtk/TreeModelAdapter.custom: rework signal connection
* gtk/TreeModelFilter.custom: rework signal connection
* gtk/TreeModelSort.custom: rework signal connection
* gtk/TreeStore.custom: rework signal connection
* gtk/Widget.custom: rework signal connection
* gtk/Window.custom: remove obsolete signal
2011-03-24 18:33:24 -05:00
Mike Kestner
db738c401b Make ToggleRef.Signals a Dictionary
* glib/Object.cs: don't bother with IsAlive check on tref
* glib/Signal.cs: remove unnecessary as usage
* glib/ToggleRef.cs: make Signals a generic dictionary
2011-03-24 18:33:19 -05:00
Mike Kestner
a56feb01e3 Some warning fixage.
* glib/GType.cs:
* glib/Makefile.am:
* glib/Object.cs:
* glib/ParamSpec.cs:
* glib/PtrArray.cs:
* glib/SignalClosure.cs:
* glib/Value.cs:
mark private struct fields public to avoid 0169, and remove the nowarn
from the csc command.  fixed one real warning, exposed a bunch of
obsolete usage still to fix.
2011-03-24 18:32:54 -05:00
Mike Kestner
c283aa425b Add SeekType symbol to glib-api.xml
* gio/Gio.metadata: remove it here
* gio/Makefile.am: include glib-api.xml
* glib/glib-api.xml: add GSeekType element.
2011-02-18 21:54:15 -06:00
Mike Kestner
88af56dd68 Implement GVariantType binding.
* generator/SymbolTable.cs: add GVariantType mapping.
* glib/Makefile.am: add file
* glib/Value.cs: add cast to VariantType.
* glib/VariantType.cs: hand binding for yet another ref counted glib
type system.
2011-02-11 13:52:13 -06:00
Mike Kestner
917a4abf7a Remove Glib.Boxed usage in Value.
* glib/Value.cs: GLib.Boxed is obsolete and removed.
2011-02-11 08:41:45 -06:00
Mike Kestner
08eda8b7c2 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
2011-02-10 21:16:05 -06:00
Mike Kestner
d33520b9c6 Kill UnwrappedObject obsolete code.
* glib/Makefile.am: remove file
* glib/UnwrappedObject.cs: remove
* glib/Value.cs: remove obsolete method
2011-02-10 21:16:05 -06:00
Mike Kestner
dc93b23acd Remove obsolete and broken code from Opaque.
* glib/Opaque.cs: remove bad ctor and noop finalizer
2011-02-10 21:16:05 -06:00
Mike Kestner
72cca1f93f Kill dead EnumWrapper type from the early days.
* glib/EnumWrapper.cs: remove
* glib/Makefile.am: remove file
* glib/Value.cs: remove obsolete EnumWrapper cast/ctor
2011-02-10 21:16:05 -06:00
Mike Kestner
22a83cc779 Move g_format_size_for_display to Global.
* glib/Format.cs: moved to Global.cs
* glib/Global.cs: moved from Format.cs
* glib/Makefile.am: update sources.
2011-02-09 10:48:19 -06:00
Mike Kestner
53fdda0f51 Kill the CDeclCallback attr.
* glib/CDeclCallbackAttribute.cs: kill, we now use UnmanagedFunctionPtr.
* glib/Makefile.am: remove file
2011-02-09 10:43:35 -06:00
Mike Kestner
3d8c4e25fd Kill some unneeded #if GTK_SHARP_N checks
* gdk/Event.cs
* glib/Format.cs
* gtk/Builder.custom
* gtk/IconTheme.custom
* pango/Attribute.cs
Remove versioned code since it's all there in 3.0.
2011-02-09 10:28:31 -06:00
Mike Kestner
7cdaf34aa2 Remove ClassInitializer attributes.
* AssemblyInfo.cs.in: remove the ignore attr from the assemblies.
* glib/ClassInitializerAttribute.cs: remove obsolete method target attr.
* glib/IgnoreClassInitializersAttribute.cs: remove.
* glib/Makefile.am: update sources and stop copying AssemblyInfo.cs around.
* glib/Object.cs: remove the obsolete ClassInitializer fallback mechanism.
2011-02-09 10:05:40 -06:00
Mike Kestner
8459ac5560 Initial support for GVariant
* generator/SymbolTable.cs : add GVariant type mapping.
* glib/Variant.cs: initial implementation of an opaque class to expose
the GVariant type from glib.  We won't make any attempt to combine managed
references since there is no "toggle" ref capability.  We'll do a one-to-one
ref_sink/unref pair on construction/dispose.
2011-01-22 12:52:38 -06:00
Mike Kestner
efefeb270c kill a couple warnings in GLib.Value
* glib/Value.cs: disable 0414 on the pad fields
2011-01-07 22:22:04 -06:00
Mike Kestner
ec77219ad5 Use -keyfile instead of deprecated attr.
* AssemblyInfo.cs.in: kill keyfile attr
* Makefile.am: moved mono.snk to cairo dir
* Makefile.include: no need to copy snk into builddir any longer.
* cairo/AssemblyInfo.cs: kill keyfile attr
* cairo/Makefile.am: snk relocated into here. use it directly.
* glib/Makefile.am: no need to copy snk into builddir any longer.
* gtkdotnet/Makefile.am: no need to copy snk into builddir any longer.
2011-01-07 22:15:04 -06:00
Mike Kestner
ea7c52bbf9 Kill libglibsharpglue.
* configure.ac: remove glib/glue/Makefile expansion
* glib/Makefile.am: remove glue SUBDIR
* glib/Thread.cs: move to non-glue supported check
* glib/glue: kill
2011-01-07 21:22:35 -06:00
Mike Kestner
fe2d4c311a Flatten the bootstrap and remove glade-sharp
2010-11-21  Mike Kestner  <mkestner@novell.com>

	* removed the glade dir from the build since libglade is
	no longer supported in gnome3.  removed the gapi2-compat stuff
	since it doesn't make much sense now.  Removed the bootstrap
	mechanism since we are unlikely to be releasing multiple API
	versions from the same tree going forward.  The build is now a
	straight autogen.sh like most autotools projects.
2010-11-21 21:18:06 -06:00
Mike Kestner
db6a3f8612 2009-12-28 Mike Kestner <mkestner@novell.com>
* glib/glue/Makefile.am: fix a copy/paste issue.
	* pango/glue/Makefile.am: move glue lib to -3 like the others.
	[Fixes #561148]

svn path=/trunk/gtk-sharp/; revision=148920
2009-12-28 17:00:58 +00:00