mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-03-21 09:18:00 +00:00
[Rework of a patch from Ben Maurer to turn GLib.Value into a valuetype.] * generator/BoxedGen.cs : fix operators for new valuetype GValues. * generator/ByRefGen.cs : new generatable for byref value types. * generator/Makefile.am : add ByRefGen.cs. * generator/MethodBody.cs : remove GValue special casing. * generator/Property.cs : rework value handling. * generator/Signal.cs : fix base virtual method value passing. * generator/SymbolTable.cs : map GValue to ByRefGen. * glib/Object.cs : rework GetProperty and SetProperty. * glib/Value.cs : make it a value type. * glib/ValueArray.cs : fix GValue passing. * glib/glue/value.c : rework for valuetype GValues. * gnome/Program.custom : fix GValue passing * gtk/Gtk.metadata : make TreeModel.GetValue value param pass_as=ref. * gtk/ListStore.custom : fix GValue passing * gtk/NodeStore.cs : fix GValue passing * gtk/TextTag.custom : fix GValue passing * gtk/TreeModelSort.custom : fix GValue passing * gtk/TreeStore.custom : fix GValue passing svn path=/trunk/gtk-sharp/; revision=25368
78 lines
2 KiB
Plaintext
78 lines
2 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 GLib.Value value;
|
|
}
|
|
|
|
[DllImport("gnomesharpglue")]
|
|
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) : base (IntPtr.Zero)
|
|
{
|
|
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 = GLib.Value.Empty;
|
|
vals[i] = value;
|
|
args[i].value = value;
|
|
}
|
|
|
|
/* 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);
|
|
|
|
//
|
|
// Dynamically reset the signal handlers, because Gnome overwrites them
|
|
//
|
|
Type mono_runtime_type = Type.GetType ("Mono.Runtime");
|
|
if (mono_runtime_type != null){
|
|
object [] iargs = new object [0];
|
|
System.Reflection.MethodInfo mi = mono_runtime_type.GetMethod ("InstallSignalHandlers");
|
|
|
|
mi.Invoke (null, iargs);
|
|
}
|
|
}
|
|
|
|
public void Run ()
|
|
{
|
|
Gtk.Application.Run ();
|
|
}
|
|
|
|
public void Quit ()
|
|
{
|
|
Gtk.Application.Quit ();
|
|
}
|
|
|
|
|