public BaconResize (Gtk.Window window) : base (IntPtr.Zero) { this.window = window; GLib.Value window_val = new GLib.Value (window); CreateNativeObject ( new string [] { "video-widget" }, new GLib.Value [] { window_val } ); window_val.Dispose (); }
public void TestUInt () { GLib.Value val = new GLib.Value ((uint)42); SetProperty ("my_uint", val); val.Dispose (); if (MyUInt != 42) { Console.Error.WriteLine ("uint Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_uint"); if ((uint)val2.Val != 42) { Console.Error.WriteLine ("uint Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("uint succeeded."); }
public TreeIter InsertValues(int location, Array values) { TreeIter iter = base.Insert (location); int col = 0; foreach (object value in values) { if (value != null) { GLib.Value val = new GLib.Value (value); base.SetValue (iter, col, val); val.Dispose (); } col++; } return iter; }
public static int Main (string[] args) { GLib.GType.Init (); TestObject obj = new TestObject (); GLib.Value val = new GLib.Value (42); obj.SetProperty ("my_prop", val); val.Dispose (); if (obj.MyProp != 42) { Console.Error.WriteLine ("Property setter did not run."); return 1; } GLib.Value val2 = obj.GetProperty ("my_prop"); if ((int)val2.Val != 42) { Console.Error.WriteLine ("Property set/get roundtrip failed."); return 1; } Console.WriteLine ("Round trip succeeded."); return 0; }
protected virtual Unique.Response OnMessageReceived(int command, Unique.MessageData message_data, uint time_) { GLib.Value ret = new GLib.Value(Unique.ResponseGType.GType); GLib.ValueArray inst_and_params = new GLib.ValueArray(4); GLib.Value[] vals = new GLib.Value [4]; vals [0] = new GLib.Value(this); inst_and_params.Append(vals [0]); vals [1] = new GLib.Value(command); inst_and_params.Append(vals [1]); vals [2] = new GLib.Value(message_data); inst_and_params.Append(vals [2]); vals [3] = new GLib.Value(time_); inst_and_params.Append(vals [3]); g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret); foreach (GLib.Value v in vals) { v.Dispose(); } Unique.Response result = (Unique.Response)(Enum) ret; ret.Dispose(); return(result); }
public static int Main(string[] args) { GLib.GType.Init(); TestObject obj = new TestObject(); GLib.Value val = new GLib.Value(42); obj.SetProperty("my_prop", val); val.Dispose(); if (obj.MyProp != 42) { Console.Error.WriteLine("Property setter did not run."); return(1); } GLib.Value val2 = obj.GetProperty("my_prop"); if ((int)val2.Val != 42) { Console.Error.WriteLine("Property set/get roundtrip failed."); return(1); } Console.WriteLine("Round trip succeeded."); return(0); }
public void TestIntPtr() { IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal(4); Console.WriteLine(ptr); GLib.Value val = new GLib.Value(ptr); SetProperty("my_intptr", val); val.Dispose(); if (MyIntPtr != ptr) { Console.Error.WriteLine("IntPtr Property setter did not run."); Environment.Exit(1); } GLib.Value val2 = GetProperty("my_intptr"); Console.WriteLine(val2.Val); if (!val2.Val.Equals(ptr)) { Console.Error.WriteLine("IntPtr Property set/get roundtrip failed."); Environment.Exit(1); } Console.WriteLine("IntPtr succeeded."); }
private bool InternalAccelActivate(GLib.Object acceleratable, uint keyval, Gdk.ModifierType modifier) { GLib.Value ret = new GLib.Value(GLib.GType.Boolean); GLib.ValueArray inst_and_params = new GLib.ValueArray(4); GLib.Value[] vals = new GLib.Value [4]; vals [0] = new GLib.Value(this); inst_and_params.Append(vals [0]); vals [1] = new GLib.Value(acceleratable); inst_and_params.Append(vals [1]); vals [2] = new GLib.Value(keyval); inst_and_params.Append(vals [2]); vals [3] = new GLib.Value(modifier); inst_and_params.Append(vals [3]); g_signal_chain_from_overridden(inst_and_params.ArrayPtr, ref ret); foreach (GLib.Value v in vals) { v.Dispose(); } bool result = (bool)ret; ret.Dispose(); return(result); }
public object this[string property] { get { if (PropertyExists(property)) { using (GLib.Value v = GetProperty(property)) { return(v.Val); } } else { throw new PropertyNotFoundException(); } } set { if (PropertyExists(property)) { if (value == null) { throw new ArgumentNullException(); } var type = value.GetType(); var gtype = (GLib.GType)type; if (gtype == null) { throw new Exception("Could not find a GType for type " + type.FullName); } GLib.Value v = new GLib.Value((GLib.GType)value.GetType()); v.Val = value; SetProperty(property, v); v.Dispose(); } else { throw new PropertyNotFoundException(); } } }
private void OnSelectionChanged(object o, EventArgs args) { Gtk.TreeSelection selection = (Gtk.TreeSelection)o; Gtk.TreeModel model; Gtk.TreeIter iter; string data; if (selection.GetSelected(out model, out iter)) { GLib.Value val = GLib.Value.Empty; model.GetValue(iter, 0, ref val); data = (string)val.Val; if (list.IterDepth(iter) == 0) { Connect(data); } else { ViewAlbum(data); } val.Dispose(); } }
private bool InternalAccelActivate (GLib.Object acceleratable, uint keyval, Gdk.ModifierType modifier) { GLib.Value ret = new GLib.Value (GLib.GType.Boolean); GLib.ValueArray inst_and_params = new GLib.ValueArray (4); GLib.Value[] vals = new GLib.Value [4]; vals [0] = new GLib.Value (this); inst_and_params.Append (vals [0]); vals [1] = new GLib.Value (acceleratable); inst_and_params.Append (vals [1]); vals [2] = new GLib.Value (keyval); inst_and_params.Append (vals [2]); vals [3] = new GLib.Value (modifier); inst_and_params.Append (vals [3]); g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret); foreach (GLib.Value v in vals) v.Dispose (); bool result = (bool) ret; ret.Dispose (); return result; }
public static void SetCellForegroundSet(this Gtk.CellRendererText cell, bool value) { GLib.Value val = new GLib.Value(value); cell.SetProperty("foreground-set", val); val.Dispose(); }
private Gtk.FileChooserConfirmation InternalConfirmOverwrite () { GLib.Value ret = new GLib.Value (Gtk.FileChooserConfirmationGType.GType); GLib.ValueArray inst_and_params = new GLib.ValueArray (1); GLib.Value[] vals = new GLib.Value [1]; vals [0] = new GLib.Value (this); inst_and_params.Append (vals [0]); g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret); foreach (GLib.Value v in vals) v.Dispose (); Gtk.FileChooserConfirmation result = (Gtk.FileChooserConfirmation) (Enum) ret; ret.Dispose (); return result; }
public void SetValue(Gtk.TreeIter iter, int column, uint value) { GLib.Value val = new GLib.Value(value); SetValue(iter, column, val); val.Dispose(); }
private bool InternalFocusHomeOrEnd (bool p0) { GLib.Value ret = new GLib.Value (GLib.GType.Boolean); 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 (p0); 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 (); bool result = (bool) ret; ret.Dispose (); return result; }
protected virtual bool OnNSApplicationBlockTermination () { GLib.Value ret = new GLib.Value (GLib.GType.Boolean); GLib.ValueArray inst_and_params = new GLib.ValueArray (1); GLib.Value[] vals = new GLib.Value [1]; vals [0] = new GLib.Value (this); inst_and_params.Append (vals [0]); g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret); foreach (GLib.Value v in vals) v.Dispose (); bool result = (bool) ret; ret.Dispose (); return result; }
protected virtual Unique.Response OnMessageReceived (int command, Unique.MessageData message_data, uint time_) { GLib.Value ret = new GLib.Value (Unique.ResponseGType.GType); GLib.ValueArray inst_and_params = new GLib.ValueArray (4); GLib.Value[] vals = new GLib.Value [4]; vals [0] = new GLib.Value (this); inst_and_params.Append (vals [0]); vals [1] = new GLib.Value (command); inst_and_params.Append (vals [1]); vals [2] = new GLib.Value (message_data); inst_and_params.Append (vals [2]); vals [3] = new GLib.Value (time_); inst_and_params.Append (vals [3]); g_signal_chain_from_overridden (inst_and_params.ArrayPtr, ref ret); foreach (GLib.Value v in vals) v.Dispose (); Unique.Response result = (Unique.Response) (Enum) ret; ret.Dispose (); return result; }
public void TestGObject () { Gtk.Window win = new Gtk.Window ("test"); GLib.Value val = new GLib.Value (win); SetProperty ("my_object", val); val.Dispose (); if (MyObject != win) { Console.Error.WriteLine ("GObject Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_object"); if ((GLib.Object)val2.Val != win) { Console.Error.WriteLine ("GObject Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("GObject succeeded."); }
public void TestIntPtr () { IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal (4); Console.WriteLine (ptr); GLib.Value val = new GLib.Value (ptr); SetProperty ("my_intptr", val); val.Dispose (); if (MyIntPtr != ptr) { Console.Error.WriteLine ("IntPtr Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_intptr"); Console.WriteLine (val2.Val); if (!val2.Val.Equals (ptr)) { Console.Error.WriteLine ("IntPtr Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("IntPtr succeeded."); }
public void SetValue (Gtk.TreeIter iter, int column, object value) { GLib.Value val = new GLib.Value (value); SetValue (iter, column, val); val.Dispose (); }
public void TestSByte () { GLib.Value val = new GLib.Value ((sbyte)42); SetProperty ("my_sbyte", val); val.Dispose (); if (MySByte != 42) { Console.Error.WriteLine ("sbyte Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_sbyte"); if ((sbyte)val2.Val != 42) { Console.Error.WriteLine ("sbyte Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("sbyte succeeded."); }
private bool OnBusMessage(Bus bus, Message msg) { switch (msg.Type) { case MessageType.Tag: TagList tag_list = msg.ParseTag(); foreach (var name in tag_list.Tags) { if (name == "beats-per-minute") { if (tag_list.GetTagSize(name) < 1) { continue; } tag_list.Foreach(delegate(TagList list, string tagname) { for (uint i = 0; i < tag_list.GetTagSize(tagname); i++) { GLib.Value val = tag_list.GetValueIndex(tagname, i); if (val.Val is double) { double bpm = (double)val; int rounded = (int)Math.Round(bpm); if (!bpm_histogram.ContainsKey(rounded)) { bpm_histogram [rounded] = 1; } else { bpm_histogram [rounded]++; } } val.Dispose(); } }); } } break; case MessageType.Error: string debug; GLib.GException error; msg.ParseError(out error, out debug); IsDetecting = false; Log.ErrorFormat("BPM Detection error: {0}", error.Message); break; case MessageType.Eos: IsDetecting = false; pipeline.SetState(State.Null); SafeUri uri = current_uri; int best_bpm = -1, best_bpm_count = 0; foreach (int bpm in bpm_histogram.Keys) { int count = bpm_histogram[bpm]; if (count > best_bpm_count) { best_bpm_count = count; best_bpm = bpm; } } Reset(); var handler = FileFinished; if (handler != null) { handler(this, new BpmEventArgs(uri, best_bpm)); } break; } return(true); }
public void TestBool () { GLib.Value val = new GLib.Value (true); SetProperty ("my_bool", val); val.Dispose (); if (!MyBool) { Console.Error.WriteLine ("bool Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_bool"); if (!((bool)val2.Val)) { Console.Error.WriteLine ("bool Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("bool succeeded."); }
public void TestLong () { GLib.Value val = new GLib.Value ((long)42); SetProperty ("my_long", val); val.Dispose (); if (MyLong != 42) { Console.Error.WriteLine ("long Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_long"); if ((long)val2.Val != 42) { Console.Error.WriteLine ("long Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("long succeeded."); }
public void TestFloat () { GLib.Value val = new GLib.Value (42.0f); SetProperty ("my_float", val); val.Dispose (); if (MyFloat != 42.0f) { Console.Error.WriteLine ("float Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_float"); if ((float)val2.Val != 42.0f) { Console.Error.WriteLine ("float Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("float succeeded."); }
public Gtk.TreeIter AppendValues(Array values) { Gtk.TreeIter iter = Append(); int col = 0; foreach (object value in values) { if (value != null) { GLib.Value val = new GLib.Value (value); SetValue (iter, col, val); val.Dispose (); } col++; } return iter; }
public void TestDouble () { GLib.Value val = new GLib.Value (42.0); SetProperty ("my_double", val); val.Dispose (); if (MyDouble != 42.0) { Console.Error.WriteLine ("double Property setter did not run."); Environment.Exit (1); } GLib.Value val2 = GetProperty ("my_double"); if ((double)val2.Val != 42.0) { Console.Error.WriteLine ("double Property set/get roundtrip failed."); Environment.Exit (1); } Console.WriteLine ("double succeeded."); }