/usr/share/gtk-sharp3-examples/NativeInstantiationTest.cs is in gtk-sharp3-examples 2.99.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | // Author: Mike Kestner <mkestner@novell.com>
//
// Copyright (c) 2009 Novell, Inc.
namespace GtkSharp {
using Gtk;
using System;
using System.Runtime.InteropServices;
public class InstantiationTest : Gtk.Window {
[DllImport ("libgobject-2.0.so.0")]
static extern IntPtr g_object_new (IntPtr gtype, string prop, string val, IntPtr dummy);
[DllImport ("libgtk-3.so.0")]
static extern void gtk_widget_show (IntPtr handle);
public static int Main (string[] args)
{
Application.Init ();
GLib.GType gtype = LookupGType (typeof (InstantiationTest));
GLib.GType.Register (gtype, typeof (InstantiationTest));
Console.WriteLine ("Instantiating using managed constructor");
new InstantiationTest ("Managed Instantiation Test").ShowAll ();
Console.WriteLine ("Managed Instantiation complete");
Console.WriteLine ("Instantiating using unmanaged construction");
IntPtr handle = g_object_new (gtype.Val, "title", "Unmanaged Instantiation Test", IntPtr.Zero);
gtk_widget_show (handle);
Console.WriteLine ("Unmanaged Instantiation complete");
Application.Run ();
return 0;
}
public InstantiationTest (IntPtr raw) : base (raw)
{
Console.WriteLine ("IntPtr ctor invoked");
DefaultWidth = 400;
DefaultHeight = 200;
}
public InstantiationTest (string title) : base (title)
{
DefaultWidth = 200;
DefaultHeight = 400;
}
protected override bool OnDeleteEvent (Gdk.Event ev)
{
Application.Quit ();
return true;
}
}
}
|