Ryujinx-GtkSharp/gnome/Program.custom
Rachel Hestilow 967e3e9c5a 2002-07-30 Rachel Hestilow <hestilow@ximian.com>
* generator/ClassBase.cs: Change hasDefaultConstructor to protected,
	adjust now that it is an attr and not a subnode. Also add virtual
	property AssignToName (for ctors).

	* generator/Ctor.cs: Add property ForceStatic.
	(Generate): Optimize return code a bit for the static case.

	* generator/Method.cs: Assign to a "raw_ret" pointer before calling
	FromNativeReturn.

	* generator/Parameters.cs: Change "out ref" to "out", not "ref".

	* generator/Property.cs: Fix to work correctly with all object and
	struct types (mostly just some if-cases added).

	* generator/SignalHandler.cs: Remove args_type and argfields (unused).
	(Generate): Initialize struct if necessary.

	* generator/StructBase.cs: Massive reworking to support methods, ctors,
	etc.

	* generator/SymbolTable.cs: Add GdkAtom and gconstpointer simple types.

	* glib/Boxed.cs: Accept both IntPtr and object ctors. Add access for both.

	* glib/Opaque.cs: Fix copy/pasted copyright notice, remove data and event
	fields. Fix docs.

	* glib/Value.cs: Work correctly with boxed properties.

	* gnome/Modules.cs: Use new struct ctors.

	* gnome/Program.custom: Remove Get, this is being generated now.

	* parser/Gdk.metadata: Fix the drawable classes to inherit correctly.

	* parser/Metadata.pm: Change per-class attributes to actually be
	attributes.

	* parser/Gtk.metadata: Add a dummy attribute value for disabledefaultctor.

	* parser/gapi2xml.pl: Add hacks for the (broken) Drawable and Bitmap
	typedefs.

	* sample/test/TestColorSelection.cs: Display color string in hex format,
	update to use IsNull instead of == null, and size dialog to look pretty.

	* sample/Size.cs: Added.

svn path=/trunk/gtk-sharp/; revision=6264
2002-07-30 23:02:12 +00:00

68 lines
1.6 KiB
Plaintext

//
// Gnome.Program.custom - Gnome Program class customizations
//
// Author: Rachel Hestilow <hestilow@ximian.com>
//
// Copyright (C) 2002 Rachel Hestilow
//
// This code is inserted after the automatically generated code.
//
[DllImport("gobject-2.0")]
static extern void g_type_init ();
[StructLayout(LayoutKind.Sequential)]
struct PropertyArg {
public string name;
public IntPtr value;
}
[DllImport("gtksharpglue")]
static extern System.IntPtr
gtksharp_gnome_program_init (string app_id, string app_version, ref ModuleInfo module, int argc, string[] argv, int nargs, PropertyArg[] args);
public Program (string app_id, string app_version, ModuleInfo module,
string[] argv, params object[] props)
{
int nargs = props.Length / 2;
PropertyArg[] args = new PropertyArg[nargs];
GLib.Value[] vals = new GLib.Value[nargs];
string[] new_argv = new string[argv.Length + 1];
g_type_init ();
for (int i = 0; i < nargs; i++)
{
args[i].name = (string) props[i * 2];
GLib.Value value;
// FIXME: handle more types
object prop = props[i * 2 + 1];
Type type = prop.GetType ();
if (type == "hello".GetType ())
value = new GLib.Value ((string) prop);
else if (type == true.GetType ())
value = new GLib.Value ((bool) prop);
else
value = null;
vals[i] = value;
args[i].value = value.Handle;
}
/* FIXME: Is there a way to access this in .NET? */
new_argv[0] = app_id;
Array.Copy (argv, 0, new_argv, 1, argv.Length);
Raw = gtksharp_gnome_program_init (app_id, app_version, ref module, new_argv.Length, new_argv, nargs, args);
}
public void Run ()
{
Gtk.Application.Run ();
}
public void Quit ()
{
Gtk.Application.Quit ();
}