mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-12-26 07:25:41 +00:00
c9f1eadc11
[Derived from a patch by Ben Maurer] * generator/Ctor.cs : generate code to detect subclassing and handle GType registration and native object creation properly. * generator/Parameters.cs : add PropertyName accessor for param attr. * generator/Property.cs : use a new GLib.Value ctor. * glib/ObjectManager.cs : redo hash access. * glib/Object.cs : CreateNativeObject method to invoke g_object_newv and some refactoring of RegisterGType and LookupGType. * glib/Value.cs : make gtype field an IntPtr. * glib/glue/object.c : glue for g_object_newv use. * glib/glue/value.c : new glue for value creation. * gtk/Dialog.custom : fix a ctor declaration for auto-reg. * gtk/Gtk.metadata : mark a couple property_name attrs as examples. * sample/Subclass.cs : use auto-GType-registration now. svn path=/trunk/gtk-sharp/; revision=26916
42 lines
774 B
C
42 lines
774 B
C
/* object.c : Glue to clean up GtkObject references.
|
|
*
|
|
* Author: Mike Kestner <mkestner@speakeasy.net>
|
|
*
|
|
* <c> 2002 Mike Kestner
|
|
*/
|
|
|
|
#include <glib-object.h>
|
|
|
|
/* Forward declarations */
|
|
int gtksharp_object_get_ref_count (GObject *obj);
|
|
GObject *gtksharp_object_newv (GType type, gint cnt, gchar **names, GValue *vals);
|
|
/* */
|
|
|
|
int
|
|
gtksharp_object_get_ref_count (GObject *obj)
|
|
{
|
|
return obj->ref_count;
|
|
}
|
|
|
|
GObject *
|
|
gtksharp_object_newv (GType type, gint cnt, gchar **names, GValue *vals)
|
|
{
|
|
int i;
|
|
GParameter *parms = NULL;
|
|
GObject *result;
|
|
|
|
if (cnt > 0)
|
|
parms = g_new0 (GParameter, cnt);
|
|
|
|
for (i = 0; i < cnt; i++) {
|
|
parms[i].name = names[i];
|
|
parms[i].value = vals[i];
|
|
}
|
|
|
|
result = g_object_newv (type, cnt, parms);
|
|
|
|
g_free (parms);
|
|
return result;
|
|
}
|
|
|