mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-25 13:55:31 +00:00
f1a77c0e62
* glib/ManagedValue.cs, TypeConverter.cs: Added. * glib/Value.cs: Make Value inherit from IDisposable, and move dtor to Dispose. Add generic object constructor with support for ManagedValue. Add a new Val property which will call the appropriate explicit cast. * glue/value.c: Add new glue function gtksharp_value_get_value_type. * gtk/TreeViewColumn.custom: Added. * gtk/ListStore.custom, TreeStore.custom: Add a number of SetValue overloads. Add convenience functtion AppendValues. Add new ctor that takes System.Type instead of GLib.TypeFundamentals. Add a GetValue convenience wrapper. * gtk/TreeView.custom: Add AppendColumn convenience functions. * sample/ManagedTreeViewDemo.cs: Added. * sample/Makefile.in: Update. * sample/TreeViewDemo.cs: Update to use new convenience APIs. svn path=/trunk/gtk-sharp/; revision=14691
39 lines
911 B
C
39 lines
911 B
C
/* value.c : Glue to allocate GValues on the heap.
|
|
*
|
|
* Author: Mike Kestner <mkestner@speakeasy.net>
|
|
*
|
|
* <c> 2002 Mike Kestner
|
|
*/
|
|
|
|
#include <glib-object.h>
|
|
|
|
/* Forward declarations */
|
|
GValue *gtksharp_value_create (GType g_type);
|
|
GValue *gtksharp_value_create_from_property (GObject *obj, const gchar* name);
|
|
/* */
|
|
|
|
GValue *
|
|
gtksharp_value_create (GType g_type)
|
|
{
|
|
GValue *val = g_new0 (GValue, 1);
|
|
if (g_type != G_TYPE_INVALID)
|
|
val = g_value_init (val, g_type);
|
|
return val;
|
|
}
|
|
|
|
GValue *
|
|
gtksharp_value_create_from_property (GObject *obj, const gchar* name)
|
|
{
|
|
GParamSpec *spec = g_object_class_find_property (
|
|
G_OBJECT_GET_CLASS (obj), name);
|
|
return gtksharp_value_create (spec->value_type);
|
|
}
|
|
|
|
GType
|
|
gtksharp_value_get_value_type (GValue *value) {
|
|
g_return_val_if_fail (value != NULL, G_TYPE_INVALID);
|
|
g_return_val_if_fail (G_IS_VALUE (value), G_TYPE_INVALID);
|
|
return G_VALUE_TYPE (value);
|
|
}
|
|
|