[Banshee-List] gtk3 branch
- From: olivier dufour <olivier duff gmail com>
- To: banshee-list <banshee-list gnome org>
- Subject: [Banshee-List] gtk3 branch
- Date: Mon, 21 Nov 2011 22:44:40 +0100
Hello,
Great news!
I have successfully launched banshee GTK3 version.
But in order to do so, I have patch gtk# with a quick hack to fix issue because we can not cast propertyInfo of a subtype with is generic from a derived class non generic.
Anyway it work but slow because I get PropertyInfo each time I call it.
Best is to do a cache as Properties in Object.cs but for interface properties. But done a cache system just for that is very ugly.
Anyway, my patch make things works but I have 2 NRE hiden and a quick hack witch slow done things.
If people want to test or even fix my patch to make a better one to commit to ofiicial gtk# branch.
Olivier Dufour
diff --git a/glib/Object.cs b/glib/Object.cs
index 06ed9e4..5990e7a 100644
--- a/glib/Object.cs
+++ b/glib/Object.cs
@@ -325,7 +325,16 @@ namespace GLib {
return;
GLib.Object obj = GLib.Object.GetObject (handle, false);
- value.Val = Properties [param_spec].GetValue (obj, new object [0]);
+ try {
+ value.Val = Properties [param_spec].GetValue (obj, new object [0]);
+ } catch {
+ Type t = obj.GetType ();
+ PropertyInfo p = t.GetProperty (Properties [param_spec].Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
+ if (p != null)
+ value.Val = p.GetValue (obj, new object [0]);
+ else
+ Console.WriteLine (String.Format ("get prop {0}, null ref", Properties [param_spec].Name));
+ }
}
static GetPropertyDelegate get_property_handler;
@@ -356,7 +365,13 @@ namespace GLib {
return;
GLib.Object obj = GLib.Object.GetObject (handle, false);
- Properties [param_spec].SetValue (obj, value.Val, new object [0]);
+ try {
+ Properties [param_spec].SetValue (obj, value.Val, new object [0]);
+ } catch {
+ Type t = obj.GetType ();
+ PropertyInfo p = t.GetProperty (Properties [param_spec].Name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
+ p.SetValue (obj, value.Val, new object [0]);
+ }
}
static SetPropertyDelegate set_property_handler;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]