private void IconDataFunc(TreeViewColumn column,
                              CellRenderer renderer,
                              TreeModel model,
                              TreeIter iter)
    {
        GLib.Value value = new GLib.Value();
        Model.GetValue(iter, IdColumn, ref value);
        uint tag_id = (uint)value;
        Tag  tag    = tag_store.Get(tag_id) as Tag;

        SetBackground(renderer, tag);

        // FIXME I can't set the Pixbuf to null, not sure if it's a GTK# bug...
        if (tag.Icon != null)
        {
            if (FSpot.ColorManagement.IsEnabled)
            {
                //FIXME
                Gdk.Pixbuf temp = tag.SizedIcon.Copy();
                FSpot.ColorManagement.ApplyScreenProfile(temp);
                (renderer as CellRendererPixbuf).Pixbuf = temp;
            }
            else
            {
                (renderer as CellRendererPixbuf).Pixbuf = tag.SizedIcon;
            }
        }
        else
        {
            (renderer as CellRendererPixbuf).Pixbuf = empty_pixbuf;
        }
    }
Beispiel #2
0
		protected virtual bool OnNewWindowPolicyDecisionRequested (WebFrame frame, NetworkRequest request, WebNavigationAction action, WebPolicyDecision decision)
		{
			var val = new Value (GType.Int);
			var valueArray = new ValueArray (5u);
			var array = new Value[5];

			array [0] = new Value (this);
			valueArray.Append (array [0]);
			array [1] = new Value (frame);
			valueArray.Append (array [1]);
			array [2] = new Value (request);
			valueArray.Append (array [2]);
			array [3] = new Value (action);
			valueArray.Append (array [3]);
			array [4] = new Value (decision);
			valueArray.Append (array [4]);
			GLib.Object.g_signal_chain_from_overridden (valueArray.ArrayPtr, ref val);
			var array2 = array;
			for (int i = 0; i < array2.Length; i++) {
				var value = array2 [i];
				value.Dispose ();
			}
			bool result = (bool)val;
			val.Dispose ();
			return result;
		}
    void ExpandDefaults()
    {
        int [] tags = FSpot.Preferences.Get <int []> (FSpot.Preferences.EXPANDED_TAGS);
        if (tags == null)
        {
            ExpandAll();
            return;
        }

        TreeIter [] iters = ModelIters();
        if (iters == null || iters.Length == 0 || tags.Length == 0)
        {
            return;
        }

        foreach (TreeIter iter in iters)
        {
            GLib.Value v = new GLib.Value();
            Model.GetValue(iter, IdColumn, ref v);
            int tag_id = (int)(uint)v;
            if (Array.IndexOf(tags, tag_id) > -1)
            {
                ExpandRow(Model.GetPath(iter), false);
            }
        }
    }
Beispiel #4
0
        public void UpdateColumnText(string oldString, string newString, int column)
        {
            Gtk.TreeIter iter = new Gtk.TreeIter();

            store.GetIterFirst(out iter);
            // Check for a null Stamp (no initial entry in the list)
            if (iter.Stamp == 0)
            {
                return;
            }

            if (oldString == (string)store.GetValue(iter, column))
            {
                GLib.Value val = new GLib.Value(newString);
                store.SetValue(iter, column, val);
            }

            while (store.IterNext(ref iter))
            {
                if (oldString == (string)store.GetValue(iter, column))
                {
                    GLib.Value val1 = new GLib.Value(newString);
                    store.SetValue(iter, column, val1);
                }
            }
        }
Beispiel #5
0
        public void on_open1_activate(object o, EventArgs args)
        {
            FileSelection fs = new FileSelection("Select a PDF file...");

            // TODO: This doesn't filter the file list...
            fs.Complete("*.pdf");
            fs.Run();
            fs.Hide();

            appbar1.Push("Opening document...");
            m_doc = new Pdf(fs.Filename);
            appbar1.Push(m_doc.PageCount + " page document");

            // Populate the pages list
            Gtk.ListStore model = new Gtk.ListStore(typeof(string));
            Gtk.TreeIter  iter  = new Gtk.TreeIter();
            Console.WriteLine("List has " + model.NColumns + " columns");
            for (int i = 0; i < m_doc.PageCount; i++)
            {
                iter = model.Append();
                GLib.Value v = new GLib.Value((i + 1).ToString());
                model.SetValue(iter, 0, v);
            }
            pages.Model = model;
            pages.Show();
        }
Beispiel #6
0
        public Gst.IteratorResult Next(ref GLib.Value elem)
        {
            int raw_ret = gst_iterator_next(Handle, ref elem);

            Gst.IteratorResult ret = (Gst.IteratorResult)raw_ret;
            return(ret);
        }
    void ExpandDefaults()
    {
        object val = FSpot.Preferences.Get(FSpot.Preferences.EXPANDED_TAGS);

        if (val == null)
        {
            ExpandAll();
        }
        else
        {
            TreeIter [] iters = ModelIters();
            if (iters == null || iters.Length == 0)
            {
                return;
            }

            ArrayList expanded_tags = new ArrayList(val as int[]);
            if (expanded_tags.Count < 1)
            {
                return;
            }

            foreach (TreeIter iter in iters)
            {
                GLib.Value v = new GLib.Value();
                Model.GetValue(iter, IdColumn, ref v);
                int tag_id = (int)(uint)v;
                if (expanded_tags.Contains(tag_id))
                {
                    ExpandRow(Model.GetPath(iter), false);
                }
            }
        }
    }
    public void SaveExpandDefaults()
    {
        ArrayList expanded_tags = new ArrayList();

        TreeIter [] iters = ModelIters();
        if (iters == null)
        {
            return;
        }

        foreach (TreeIter iter in iters)
        {
            if (GetRowExpanded(Model.GetPath(iter)))
            {
                GLib.Value v = new GLib.Value();
                Model.GetValue(iter, IdColumn, ref v);
                expanded_tags.Add((int)(uint)v);
            }
        }

#if GCONF_SHARP_2_18
        FSpot.Preferences.Set(FSpot.Preferences.EXPANDED_TAGS, (int [])expanded_tags.ToArray(typeof(int)));
#else
        if (expanded_tags.Count == 0)
        {
            expanded_tags.Add(-1);
        }

        FSpot.Preferences.Set(FSpot.Preferences.EXPANDED_TAGS,
                              (int [])expanded_tags.ToArray(typeof(int)));
#endif
    }
Beispiel #9
0
        void OnDoubleClick()
        {
            TreeModel model;
            TreeIter  iter;

            if (!tree.Selection.GetSelected(out model, out iter))
            {
                return;
            }

            GLib.Value value = new GLib.Value();
            model.GetValue(iter, 4, ref value);
            object item = value.Val;

            if (item is MethodItem)
            {
                MethodItem   method     = (MethodItem)item;
                SourceWindow sourceView = ShowSourceFor(method.ParentClass);
                sourceView.CenterOnMethod(method);
            }
            else
            {
                TreePath treePath = model.GetPath(iter);

                if (tree.GetRowExpanded(treePath))
                {
                    tree.CollapseRow(treePath);
                }
                else
                {
                    tree.ExpandRow(treePath, false);
                }
            }
        }
Beispiel #10
0
        public Date(GLib.Value val)
        {
            IntPtr date = gst_value_get_date(ref val);

            this.Val = new DateTime(g_date_get_year(date), g_date_get_month(date), g_date_get_day(date));
            handle   = g_date_new_dmy((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);
        }
Beispiel #11
0
    void CollectionChanged(IImageCollection coll, EventArgs ea)
    {
        Console.WriteLine("collectionChanged! " + coll.ID);
        Gtk.TreeIter iter = new Gtk.TreeIter();
        bool         valid;

        valid = this.GetIterFirst(out iter);
        while (valid)
        {
            GLib.Value gv = new GLib.Value();
            this.GetValue(iter, (int)ColNames.InternalIDCol, ref gv);
            if ((string)gv == coll.ID)
            {
                // match
                break;
            }

            valid = this.IterNext(ref iter);
        }

        if (valid)
        {
            this.SetValue(iter, (int)ColNames.NameCol, new GLib.Value(coll.Name));
            this.SetValue(iter, (int)ColNames.CountCol, new GLib.Value(coll.Count));
        }
    }
        static void OnMarshal(IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr,
                              IntPtr ihint, IntPtr data)
        {
            object[] args = new object[argc - 1];
            object   o    = ((GLib.Value)Marshal.PtrToStructure(argsPtr, typeof(GLib.Value))).Val;

            for (int i = 1; i < argc; i++)
            {
                IntPtr     struct_ptr = (IntPtr)((long)argsPtr + (i * gvalue_struct_size));
                GLib.Value argument   = (GLib.Value)Marshal.PtrToStructure(struct_ptr, typeof(GLib.Value));
                args [i - 1] = argument.Val;
            }

            if (data == IntPtr.Zero)
            {
                Console.Error.WriteLine("No available data");
                return;
            }

            ObjectSignalKey k = (ObjectSignalKey)((GCHandle)data).Target;

            if (k != null)
            {
                SignalInfo      si  = (SignalInfo)SignalHandlers [k];
                GLib.SignalArgs arg = (GLib.SignalArgs)Activator.CreateInstance(si.ArgsType);
                arg.Args = args;
                si.RegisteredHandler.DynamicInvoke(new object[] { o, arg });
                if (arg.RetVal != null)
                {
                    retval.Val = arg.RetVal;
                }
            }
        }
Beispiel #13
0
        private void AddToStores(string fieldName, string fieldValue, string detailedValue, int iconValue)
        {
            GLib.Value fv = new GLib.Value(fieldName);
            GLib.Value vv = new GLib.Value(fieldValue);
            GLib.Value dv = new GLib.Value(detailedValue);
            GLib.Value iv = new GLib.Value(iconValue);
            switch (iconValue)
            {
            case 0:                     // X.509 version 1 fields
                AddToStore(v1Store, fv, vv, dv, iv);
                break;

            case 2:                     // extensions
                AddToStore(extensionsStore, fv, vv, dv, iv);
                break;

            case 3:                     // critical extensions
                AddToStore(extensionsStore, fv, vv, dv, iv);
                AddToStore(criticalStore, fv, vv, dv, iv);
                break;

            case 4:                     // properties
                AddToStore(propertiesStore, fv, vv, dv, iv);
                break;
            }
            // and we always add to allStore
            AddToStore(allStore, fv, vv, dv, iv);
        }
        void OnDoubleClick()
        {
            TreeModel model;
            TreeIter  iter;

            if (!tree.Selection.GetSelected(out model, out iter))
            {
                return;
            }

            GLib.Value value = new GLib.Value();
            model.GetValue(iter, 4, ref value);
            object item = value.Val;

            if (item is MethodItem)
            {
                MethodItem   method     = (MethodItem)item;
                SourceWindow sourceView = ShowSourceFor(method.ParentClass);
                sourceView.CenterOnMethod(method);
            }
            else
            {
                if (tree.ExpandRow(model.GetPath(iter), true))
                {
                    // LAME: This seems to collapse the entire tree...
                    tree.CollapseRow(model.GetPath(iter));
                }
                else
                {
                    tree.ExpandRow(model.GetPath(iter), false);
                }
            }
        }
    // Copy a branch of the tree to a new parent
    // (note, this doesn't work generically as it only copies the first value of each node)
    private void CopyBranch(TreeIter src, TreeIter dest, bool is_root, bool is_parent)
    {
        TreeIter copy, iter;

        GLib.Value value = new GLib.Value();
        TreeStore  store = Model as TreeStore;
        bool       valid;

        store.GetValue(src, IdColumn, ref value);
        Tag tag = (Tag)tag_store.Get((uint)value);

        if (is_parent)
        {
            // we need to figure out where to insert it in the correct order
            copy = InsertInOrder(dest, is_root, tag);
        }
        else
        {
            copy = store.AppendValues(dest, (uint)value, tag.Name);
        }

        valid = Model.IterChildren(out iter, src);
        while (valid)
        {
            // child nodes are already ordered
            CopyBranch(iter, copy, false, false);
            valid = Model.IterNext(ref iter);
        }
    }
Beispiel #16
0
		bool RowSeparatorFunc (Gtk.TreeModel model, Gtk.TreeIter iter)
		{
			GLib.Value val = new GLib.Value ();
			model.GetValue (iter, 0, ref val);
			bool sep = ((string)val) == "";
			val.Dispose ();
			return sep;
		}
Beispiel #17
0
 public void SetGValue(ref GLib.Value val)
 {
     GLib.Value min = new GLib.Value(Min);
     GLib.Value max = new GLib.Value(Max);
     gst_value_set_fraction_range(ref val, ref min, ref max);
     min.Dispose();
     max.Dispose();
 }
Beispiel #18
0
        public void SetGValue(ref GLib.Value val)
        {
            IntPtr date_ptr = g_date_new_dmy((byte)Val.Day, (int)Val.Month, (ushort)Val.Year);

            gst_value_set_date(ref val, date_ptr);

            GLib.Marshaller.Free(date_ptr);
        }
Beispiel #19
0
		public void Refresh () {
			store.Clear ();
			memberRecords.Clear ();
			if (factory != null && factory.Info != null) {
				Hashtable count = new Hashtable ();
				Hashtable parent = new Hashtable ();
				TreeIter iter;

				foreach (MemberRecord mr in factory.Info) {
					if (factory.HideDuplicates && count [mr.Name] != null) {
						if ((int) count [mr.Name] == 1) {
							TreeIter orig = (TreeIter) parent [mr.Name];
							TreeIter root;
							object name, value;
							GLib.Value image = new Value ();

							name = store.GetValue (orig, 0);
							value = store.GetValue (orig, 1);
							store.GetValue (orig, 2, image);
							store.Remove (out orig);

							store.Append (out root);
							store.SetValue (root, 0, new GLib.Value (mr.Name));
							store.SetValue (root, 1, new GLib.Value (mr.Name + " (2)"));

							parent [mr.Name] = root;

							store.Append (out orig, root);
							store.SetValue (orig, 0, name);
							store.SetValue (orig, 1, value);
							store.SetValue (orig, 2, image);

							store.Append (out iter, root);
							memberRecords [orig] = memberRecords [root];
							memberRecords [root] = null;
						} else {
							//Console.WriteLine ("4");
							store.Append (out iter, (TreeIter) parent [mr.Name]);
							store.SetValue ((TreeIter) parent [mr.Name], 0, new GLib.Value (mr.Name));
							store.SetValue ((TreeIter) parent [mr.Name], 1, new GLib.Value (mr.Name
															+ " (" + ((int) count [mr.Name] + 1) + ")"));
						}
						
						count [mr.Name] = 1 + (int) count [mr.Name];

					} else {
						store.Append (out iter);
						count [mr.Name] = 1;
						parent [mr.Name] = iter;
					}

					memberRecords [iter] = mr;
					store.SetValue (iter, 0, mr.Name);
					store.SetValue (iter, 1, mr.Label);
					store.SetValue (iter, 2, mr.Icon);
				}
			}
		}
Beispiel #20
0
        bool RowSeparatorFunc(Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            GLib.Value val = new GLib.Value();
            model.GetValue(iter, 0, ref val);
            bool sep = ((string)val) == "";

            val.Dispose();
            return(sep);
        }
	public Tag TagByIter (TreeIter iter)
	{
		GLib.Value val = new GLib.Value ();
 
		Model.GetValue (iter, IdColumn, ref val);
		uint tag_id = (uint) val;
 
		return tag_store.Get (tag_id) as Tag;
 	}
Beispiel #22
0
        private void AddToStore(ListStore store, GLib.Value field, GLib.Value value, GLib.Value details, GLib.Value icon)
        {
            TreeIter iter = store.Append();

            store.SetValue(iter, 0, field);
            store.SetValue(iter, 1, value);
            store.SetValue(iter, 2, details);
            store.SetValue(iter, 3, icon);
        }
    public Tag TagByIter(TreeIter iter)
    {
        GLib.Value val = new GLib.Value();

        Model.GetValue(iter, IdColumn, ref val);
        uint tag_id = (uint)val;

        return(tag_store.Get(tag_id) as Tag);
    }
Beispiel #24
0
 public void SetGValue(ref GLib.Value val)
 {
     foreach (object o in content)
     {
         GLib.Value v = new GLib.Value(o);
         gst_value_array_append_value(ref val, ref v);
         v.Dispose();
     }
 }
Beispiel #25
0
        public void GetValue(TreeIter iter, int col, ref GLib.Value val)
        {
            object node = NodeFromIter(iter);

            if (node == null)
            {
                val = GLib.Value.Empty;
                return;
            }
            val = new GLib.Value(node as Geocache);
        }
    // insert tag into the correct place in the tree, with parent. return the new TagIter in iter.
    private TreeIter InsertInOrder(TreeIter parent, bool is_root, Tag tag)
    {
        TreeStore store = Model as TreeStore;
        TreeIter  iter;
        Tag       compare;
        bool      valid;

        if (is_root)
        {
            valid = store.GetIterFirst(out iter);
        }
        else
        {
            valid = store.IterChildren(out iter, parent);
        }

        while (valid)
        {
            //I have no desire to figure out a more performant sort over this...
            GLib.Value value = new GLib.Value();
            store.GetValue(iter, IdColumn, ref value);
            compare = (Tag)tag_store.Get((uint)value);

            if (compare.CompareTo(tag) > 0)
            {
                iter = store.InsertNodeBefore(iter);
                store.SetValue(iter, IdColumn, tag.Id);
                store.SetValue(iter, NameColumn, tag.Name);

                if (!is_root)
                {
                    ExpandRow(Model.GetPath(parent), false);
                }
                return(iter);
            }
            valid = store.IterNext(ref iter);
        }

        if (is_root)
        {
            iter = store.AppendNode();
        }
        else
        {
            iter = store.AppendNode(parent);
            ExpandRow(Model.GetPath(parent), false);
        }

        store.SetValue(iter, IdColumn, tag.Id);
        store.SetValue(iter, NameColumn, tag.Name);
        return(iter);
    }
Beispiel #27
0
	public string GetCollectionAtPathString (string str_path)
	{
		Gtk.TreeIter iter = new Gtk.TreeIter ();

		if (!this.GetIterFromString (out iter, str_path)) {
			Console.WriteLine ("Spurious NameEditedHandler for unknown path " + str_path);
			return null;
		}

		GLib.Value gval = new GLib.Value ();
		this.GetValue (iter, (int) ColNames.InternalIDCol, ref gval);
		return (string) gval;
	}
Beispiel #28
0
        public Array(GLib.Value val)
        {
            this.content = new ArrayList();

            uint n = gst_value_array_get_size(ref val);

            for (uint i = 0; i < n; i++)
            {
                IntPtr     v_ptr = gst_value_array_get_value(ref val, i);
                GLib.Value v     = (GLib.Value)Marshal.PtrToStructure(v_ptr, typeof(GLib.Value));
                this.content.Add(v.Val);
            }
        }
Beispiel #29
0
 protected virtual void OnEos()
 {
     GLib.Value      ret             = GLib.Value.Empty;
     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();
     }
 }
Beispiel #30
0
        /// <summary>
        /// returns the nodevalue of given node
        /// </summary>
        /// <param name='iter'>
        /// Iter.
        /// </param>
        /// <param name='column'>
        /// Column.
        /// </param>
        /// <param name='val'>
        /// Value.
        /// </param>
        public void GetValue(TreeIter iter, int column, ref Value val)
        {
            object node = NodeFromIter(iter);

            if (node == null)
            {
                return;
            }

            if (node is XmlNode)
            {
                val = new GLib.Value((node as XmlNode).SelectSingleNode("data").InnerText);
            }
        }
Beispiel #31
0
    public string GetCollectionAtPath(Gtk.TreePath path)
    {
        Gtk.TreeIter iter = new Gtk.TreeIter();

        if (!this.GetIter(out iter, path))
        {
            Console.WriteLine("Spurious NameEditedHandler for unknown path " + path);
            return(null);
        }

        GLib.Value gval = new GLib.Value();
        this.GetValue(iter, (int)ColNames.InternalIDCol, ref gval);
        return((string)gval);
    }
Beispiel #32
0
        private void MemberSelectionChanged(object o, EventArgs args)
        {
            TreeSelection selection = (TreeSelection)o;
            TreeModel     model;
            TreeIter      iter;

            GLib.Value val = new GLib.Value();

            selection.GetSelected(out model, out iter);
            if (MemberSelectedEvent != null)
            {
                MemberSelectedEvent((MemberRecord)memberRecords [iter]);
            }
        }
Beispiel #33
0
        public FractionRange(GLib.Value val) : this()
        {
            IntPtr min_ptr, max_ptr;

            GLib.Value min, max;

            min_ptr = gst_value_get_fraction_range_min(ref val);
            max_ptr = gst_value_get_fraction_range_max(ref val);

            min      = (GLib.Value)Marshal.PtrToStructure(min_ptr, typeof(GLib.Value));
            max      = (GLib.Value)Marshal.PtrToStructure(max_ptr, typeof(GLib.Value));
            this.Min = (Fraction)min.Val;
            this.Max = (Fraction)max.Val;
        }
Beispiel #34
0
        public PropertyInfo(IntPtr pspec_ptr)
        {
            GParamSpec pspec = (GParamSpec)Marshal.PtrToStructure(pspec_ptr, typeof(GParamSpec));
            IntPtr     name  = g_param_spec_get_name(pspec_ptr);
            IntPtr     nick  = g_param_spec_get_nick(pspec_ptr);
            IntPtr     blurb = g_param_spec_get_blurb(pspec_ptr);

            this.name  = GLib.Marshaller.Utf8PtrToString(name);
            this.nick  = GLib.Marshaller.Utf8PtrToString(nick);
            this.blurb = GLib.Marshaller.Utf8PtrToString(blurb);

            this.readable     = ((pspec.Flags & (1 << 0)) != 0);
            this.writeable    = ((pspec.Flags & (1 << 1)) != 0);
            this.controllable = ((pspec.Flags & (1 << 9)) != 0);
            /* TODO: Add more flags later, like the mutable flags */

            this.gtype = new GLib.GType(pspec.ValueType);
            this.type  = (System.Type) this.gtype;

            this.dflt = this.min = this.max = null;

            try {
                GLib.Value v = new GLib.Value(new GLib.GType(pspec.ValueType));
                g_param_value_set_default(pspec_ptr, ref v);
                this.dflt = v.Val;
                v.Dispose();

                if (EnumInfo.IsEnumType(this.gtype))
                {
                    EnumInfo ei = new EnumInfo(this.gtype);
                    this.min = ei.Min;
                    this.max = ei.Max;
                }
                else
                {
                    GLib.Value min = new GLib.Value(new GLib.GType(pspec.ValueType));
                    GLib.Value max = new GLib.Value(new GLib.GType(pspec.ValueType));
                    if (gstsharp_g_param_spec_get_range(pspec_ptr, ref min, ref max))
                    {
                        this.min = (object)min.Val;
                        this.max = (object)max.Val;
                    }
                    min.Dispose();
                    max.Dispose();
                }
            } catch (Exception) {}
        }
    public void HandleTagNameEdited(object sender, EditedArgs args)
    {
        args.RetVal = false;

        TreeIter iter;

        if (!Model.GetIterFromString(out iter, args.Path))
        {
            return;
        }

        GLib.Value value = new GLib.Value();
        Model.GetValue(iter, IdColumn, ref value);
        uint tag_id = (uint)value;
        Tag  tag    = tag_store.Get(tag_id) as Tag;

        // Ignore if it hasn't changed
        if (tag.Name == args.NewText)
        {
            return;
        }

        // Check that the tag doesn't already exist
        if (String.Compare(args.NewText, tag.Name, true) != 0 &&
            tag_store.GetTagByName(args.NewText) != null)
        {
            HigMessageDialog md = new HigMessageDialog(MainWindow.Toplevel.Window,
                                                       DialogFlags.DestroyWithParent,
                                                       MessageType.Warning, ButtonsType.Ok,
                                                       Catalog.GetString("Error renaming tag"),
                                                       Catalog.GetString("This name is already in use"));

            md.Run();
            md.Destroy();
            this.GrabFocus();
            return;
        }

        tag.Name = args.NewText;
        tag_store.Commit(tag, true);

        text_render.Edited -= HandleTagNameEdited;

        args.RetVal = true;
        return;
    }
Beispiel #36
0
        public PropertyInfo(IntPtr pspec_ptr)
        {
            GParamSpec pspec = (GParamSpec) Marshal.PtrToStructure (pspec_ptr, typeof (GParamSpec));
              IntPtr name = g_param_spec_get_name (pspec_ptr);
              IntPtr nick = g_param_spec_get_nick (pspec_ptr);
              IntPtr blurb = g_param_spec_get_blurb (pspec_ptr);

              this.name = GLib.Marshaller.Utf8PtrToString (name);
              this.nick = GLib.Marshaller.Utf8PtrToString (nick);
              this.blurb = GLib.Marshaller.Utf8PtrToString (blurb);

              this.readable = ( (pspec.Flags & (1 << 0)) != 0);
              this.writeable = ( (pspec.Flags & (1 << 1)) != 0);
              this.controllable = ( (pspec.Flags & (1 << 9)) != 0);
              /* TODO: Add more flags later, like the mutable flags */

              this.gtype = new GLib.GType (pspec.ValueType);
              this.type = (System.Type) this.gtype;

              this.dflt = this.min = this.max = null;

              try {
            GLib.Value v = new GLib.Value (new GLib.GType (pspec.ValueType));
            g_param_value_set_default (pspec_ptr, ref v);
            this.dflt = v.Val;
            v.Dispose ();

            if (EnumInfo.IsEnumType (this.gtype)) {
              EnumInfo ei = new EnumInfo (this.gtype);
              this.min = ei.Min;
              this.max = ei.Max;
            } else {
              GLib.Value min = new GLib.Value (new GLib.GType (pspec.ValueType));
              GLib.Value max = new GLib.Value (new GLib.GType (pspec.ValueType));
              if (gstsharp_g_param_spec_get_range (pspec_ptr, ref min, ref max)) {
            this.min = (object) min.Val;
            this.max = (object) max.Val;
              }
              min.Dispose ();
              max.Dispose ();
            }
              } catch (Exception) {}
        }
Beispiel #37
0
    protected void HandleSend(object sender, EventArgs e)
    {
        if (txtRecipient.ActiveText == "all") {

            Gtk.TreeIter iter;
            if (txtRecipient.Model.GetIterFirst (out iter)) {
                do {
                    GLib.Value thisRow = new GLib.Value ();
                    txtRecipient.Model.GetValue (iter, 0, ref thisRow);
                    string recipient = (thisRow.Val as string);
                    Send (recipient, txtSubject.Text, txtMessage.Text);
                } while (txtRecipient.Model.IterNext (ref iter));
            }

        } else {

            Send (txtRecipient.ActiveText, txtSubject.Text, txtMessage.Text);

            bool conflict = false;
            Gtk.TreeIter iter;
            if (txtRecipient.Model.GetIterFirst (out iter)) {
                do {
                    GLib.Value thisRow = new GLib.Value ();
                    txtRecipient.Model.GetValue (iter, 0, ref thisRow);
                    if ((thisRow.Val as string).Equals (txtRecipient.ActiveText)) {
                        conflict = true;
                        break;
                    }
                } while (txtRecipient.Model.IterNext (ref iter));
            }
            if (!conflict) {
                txtRecipient.AppendText (txtRecipient.ActiveText);
            }

        }
        txtMessage.Text = "";
    }
Beispiel #38
0
		static extern bool glibsharp_value_holds_flags (ref Value val);
Beispiel #39
0
		static extern byte g_value_get_uchar (ref Value val);
Beispiel #40
0
		static extern int g_value_get_enum (ref Value val);
Beispiel #41
0
		static extern uint g_value_get_flags (ref Value val);
Beispiel #42
0
		static extern void g_value_set_flags (ref Value val, uint data);
Beispiel #43
0
		static extern uint g_value_get_uint (ref Value val);
Beispiel #44
0
 public void SetGValue(ref GLib.Value val)
 {
     GLib.Value min = new GLib.Value (Min);
     GLib.Value max = new GLib.Value (Max);
     gst_value_set_fraction_range (ref val, ref min, ref max);
     min.Dispose ();
     max.Dispose ();
 }
Beispiel #45
0
		static extern double g_value_get_double (ref Value val);
Beispiel #46
0
		static extern ulong g_value_get_uint64 (ref Value val);
Beispiel #47
0
		static extern sbyte g_value_get_char (ref Value val);
Beispiel #48
0
		static extern long g_value_get_int64 (ref Value val);
Beispiel #49
0
		static extern int g_value_get_int (ref Value val);
Beispiel #50
0
		static extern float g_value_get_float (ref Value val);
Beispiel #51
0
		static extern bool g_value_get_boolean (ref Value val);
Beispiel #52
0
 public void SetPathDef(CanvasPathDef path_def)
 {
     GLib.Value val = new GLib.Value(path_def, "GnomeCanvasPathDef");
     SetProperty("bpath", val);
 }
Beispiel #53
0
		static extern IntPtr g_value_get_object (ref Value val);
Beispiel #54
0
		static extern IntPtr g_value_get_boxed (ref Value val);
Beispiel #55
0
		static extern IntPtr g_value_get_param (ref Value val);
Beispiel #56
0
		static extern IntPtr g_value_get_pointer (ref Value val);
Beispiel #57
0
 public void SetGValue(ref GLib.Value val)
 {
     foreach (object o in content) {
         GLib.Value v = new GLib.Value (o);
         gst_value_list_append_value (ref val, ref v);
         v.Dispose ();
     }
 }
Beispiel #58
0
		static extern IntPtr g_value_get_string (ref Value val);
Beispiel #59
0
 protected GLib.Value GetProperty(string name)
 {
     Value val = new Value (this, name);
     IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
     g_object_get_property (Raw, native_name, ref val);
     GLib.Marshaller.Free (native_name);
     return val;
 }
Beispiel #60
0
		static extern void g_value_set_enum (ref Value val, int data);