Merge branch 'develop' into style-properties
This commit is contained in:
commit
786f79e037
52 changed files with 622 additions and 256 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
[![Build Status](https://dev.azure.com/cra0zy/GtkSharp/_apis/build/status/GtkSharp.GtkSharp?branchName=develop)](https://dev.azure.com/cra0zy/GtkSharp/_build/latest?definitionId=1&branchName=develop)
|
||||
|
||||
GtkSharp is a C# wrapper for Gtk and its related components. The component list includes the following libraries: glib, gio, cairo, pango, atk, gdk. This is a fork of https://github.com/mono/gtk-sharp and is maintained completly separatly from that project.
|
||||
GtkSharp is a C# wrapper for Gtk and its related components. The component list includes the following libraries: glib, gio, cairo, pango, atk, gdk. This is a fork of https://github.com/mono/gtk-sharp and is maintained completely separately from that project.
|
||||
|
||||
Differences can be seen with the following table:
|
||||
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
<attr path="/api/namespace/struct[@cname='AtkAttribute']/method[@name='SetFree']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkText']/*[@name='GetRunAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkText']/*[@name='GetDefaultAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkEditableText']/*[@name='GetRunAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
<attr path="/api/namespace/interface[@cname='AtkEditableText']/*[@name='GetDefaultAttributes']/return-type" name="element_type">AtkAttribute*</attr>
|
||||
|
||||
<!-- below is a workaround for an ABI break in recent ATK: https://git.gnome.org/browse/atk/commit/?id=b1f70e81ef1d7287dcb2cafa9a115ff5752ece55 -->
|
||||
<remove-node path="/api/namespace/interface//field[@cname='pad1' or @cname='pad2' or @cname='pad3' or @cname='pad4']" />
|
||||
|
|
|
@ -26,11 +26,15 @@ namespace GLib {
|
|||
|
||||
public class GException : Exception
|
||||
{
|
||||
IntPtr errptr;
|
||||
|
||||
public GException (IntPtr errptr) : base ()
|
||||
string msg;
|
||||
|
||||
public GException (IntPtr errptr)
|
||||
{
|
||||
this.errptr = errptr;
|
||||
var err = (GError)Marshal.PtrToStructure(errptr, typeof(GError));
|
||||
Domain = err.Domain;
|
||||
Code = err.Code;
|
||||
msg = Marshaller.Utf8PtrToString(err.Msg);
|
||||
g_clear_error(ref errptr);
|
||||
}
|
||||
|
||||
struct GError {
|
||||
|
@ -39,34 +43,14 @@ namespace GLib {
|
|||
public IntPtr Msg;
|
||||
}
|
||||
|
||||
public int Code {
|
||||
get {
|
||||
GError err = (GError) Marshal.PtrToStructure (errptr, typeof (GError));
|
||||
return err.Code;
|
||||
}
|
||||
}
|
||||
public int Code { get; private set; }
|
||||
|
||||
public int Domain {
|
||||
get {
|
||||
GError err = (GError) Marshal.PtrToStructure (errptr, typeof (GError));
|
||||
return err.Domain;
|
||||
}
|
||||
}
|
||||
public int Domain { get; private set; }
|
||||
|
||||
public override string Message => msg;
|
||||
|
||||
public override string Message {
|
||||
get {
|
||||
GError err = (GError) Marshal.PtrToStructure (errptr, typeof (GError));
|
||||
return Marshaller.Utf8PtrToString (err.Msg);
|
||||
}
|
||||
}
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate void d_g_clear_error(ref IntPtr errptr);
|
||||
static d_g_clear_error g_clear_error = FuncLoader.LoadFunction<d_g_clear_error>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GLib), "g_clear_error"));
|
||||
~GException ()
|
||||
{
|
||||
g_clear_error (ref errptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace GLib {
|
|||
{
|
||||
lock (this)
|
||||
{
|
||||
Remove ();
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
return cont;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace GLib {
|
|||
|
||||
IntPtr handle;
|
||||
ToggleRef tref;
|
||||
bool disposed = false;
|
||||
bool disposed;
|
||||
static uint idx = 1;
|
||||
static Dictionary<IntPtr, ToggleRef> Objects = new Dictionary<IntPtr, ToggleRef>();
|
||||
static Dictionary<IntPtr, Dictionary<IntPtr, GLib.Value>> PropertiesToSet = new Dictionary<IntPtr, Dictionary<IntPtr, GLib.Value>>();
|
||||
|
@ -41,7 +41,7 @@ namespace GLib {
|
|||
~Object ()
|
||||
{
|
||||
if (WarnOnFinalize)
|
||||
Console.Error.WriteLine ("Unexpected finalization of " + GetType() + " instance. Consider calling Dispose.");
|
||||
Console.Error.WriteLine ("Unexpected finalization of " + GetType() + " instance. Consider calling Dispose. (" + handle.ToInt64 () + ")");
|
||||
|
||||
Dispose (false);
|
||||
}
|
||||
|
@ -51,9 +51,10 @@ namespace GLib {
|
|||
if (disposed)
|
||||
return;
|
||||
|
||||
GC.SuppressFinalize (this);
|
||||
|
||||
Dispose (true);
|
||||
disposed = true;
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose (bool disposing)
|
||||
|
@ -70,19 +71,25 @@ namespace GLib {
|
|||
return;
|
||||
|
||||
if (disposing)
|
||||
tref.Dispose ();
|
||||
else
|
||||
tref.QueueUnref ();
|
||||
|
||||
// Free all internal signals, else the garbage collector is not
|
||||
// able to free the object.
|
||||
if (signals != null)
|
||||
{
|
||||
foreach (var sig in signals.Keys)
|
||||
signals[sig].Free ();
|
||||
tref.Dispose ();
|
||||
|
||||
if (signals != null)
|
||||
{
|
||||
foreach (var sig in signals.Keys)
|
||||
signals[sig].Free ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (signals != null)
|
||||
QueueSignalFree ();
|
||||
|
||||
tref.QueueUnref ();
|
||||
}
|
||||
|
||||
signals = null;
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
public static bool WarnOnFinalize { get; set; }
|
||||
|
@ -807,6 +814,9 @@ namespace GLib {
|
|||
GLib.Marshaller.Free (native_name);
|
||||
}
|
||||
|
||||
public static List<Signal> PendingSignalFrees = new List<Signal> ();
|
||||
static bool idle_queued;
|
||||
|
||||
Dictionary<string, Signal> signals;
|
||||
Dictionary<string, Signal> Signals {
|
||||
get {
|
||||
|
@ -853,6 +863,34 @@ namespace GLib {
|
|||
sig.RemoveDelegate (handler);
|
||||
}
|
||||
|
||||
public void QueueSignalFree ()
|
||||
{
|
||||
lock (PendingSignalFrees) {
|
||||
PendingSignalFrees.AddRange (signals.Values);
|
||||
if (!idle_queued){
|
||||
Timeout.Add (50, new TimeoutHandler (PerformQueuedSignalFrees));
|
||||
idle_queued = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool PerformQueuedSignalFrees ()
|
||||
{
|
||||
Signal[] qsignals;
|
||||
|
||||
lock (PendingSignalFrees){
|
||||
qsignals = new Signal[PendingSignalFrees.Count];
|
||||
PendingSignalFrees.CopyTo (qsignals, 0);
|
||||
PendingSignalFrees.Clear ();
|
||||
idle_queued = false;
|
||||
}
|
||||
|
||||
foreach (Signal s in qsignals)
|
||||
s.Free ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected static void OverrideVirtualMethod (GType gtype, string name, Delegate cb)
|
||||
{
|
||||
Signal.OverrideDefaultHandler (gtype, name, cb);
|
||||
|
|
|
@ -211,11 +211,10 @@ namespace GLib {
|
|||
|
||||
public Delegate Handler {
|
||||
get {
|
||||
InvocationHint hint = (InvocationHint) Marshal.PtrToStructure (g_signal_get_invocation_hint (obj.Handle), typeof (InvocationHint));
|
||||
if (hint.run_type == Flags.RunFirst)
|
||||
return before_handler;
|
||||
else
|
||||
return after_handler;
|
||||
var hint = (InvocationHint) Marshal.PtrToStructure (g_signal_get_invocation_hint (obj.Handle), typeof (InvocationHint));
|
||||
return hint.run_type.HasFlag(Flags.RunFirst)
|
||||
? before_handler
|
||||
: after_handler;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace GLib {
|
|||
{
|
||||
lock (this)
|
||||
{
|
||||
Remove ();
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
return cont;
|
||||
|
|
|
@ -71,8 +71,12 @@ namespace GLib {
|
|||
g_object_unref (handle);
|
||||
else
|
||||
g_object_remove_toggle_ref (handle, ToggleNotifyCallback, (IntPtr) gch);
|
||||
|
||||
reference = null;
|
||||
gch.Free ();
|
||||
|
||||
QueueGCHandleFree ();
|
||||
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
|
||||
internal void Harden ()
|
||||
|
@ -97,7 +101,8 @@ namespace GLib {
|
|||
reference = new WeakReference (reference);
|
||||
else if (!is_last_ref && reference is WeakReference) {
|
||||
WeakReference weak = reference as WeakReference;
|
||||
reference = weak.Target;
|
||||
if (weak.IsAlive)
|
||||
reference = weak.Target;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,6 +129,37 @@ namespace GLib {
|
|||
}
|
||||
}
|
||||
|
||||
static List<GCHandle> PendingGCHandleFrees = new List<GCHandle> ();
|
||||
static bool gc_idle_queued;
|
||||
|
||||
public void QueueGCHandleFree ()
|
||||
{
|
||||
lock (PendingGCHandleFrees) {
|
||||
PendingGCHandleFrees.Add (gch);
|
||||
if (!gc_idle_queued){
|
||||
Timeout.Add (50, new TimeoutHandler (PerformGCHandleFrees));
|
||||
gc_idle_queued = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool PerformGCHandleFrees ()
|
||||
{
|
||||
GCHandle[] handles;
|
||||
|
||||
lock (PendingGCHandleFrees){
|
||||
handles = new GCHandle [PendingGCHandleFrees.Count];
|
||||
PendingGCHandleFrees.CopyTo (handles, 0);
|
||||
PendingGCHandleFrees.Clear ();
|
||||
gc_idle_queued = false;
|
||||
}
|
||||
|
||||
foreach (GCHandle r in handles)
|
||||
r.Free ();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static List<ToggleRef> PendingDestroys = new List<ToggleRef> ();
|
||||
static bool idle_queued;
|
||||
|
||||
|
|
|
@ -76,6 +76,9 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkDeviceManager']/virtual_method[@name='ListDevices']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='GetPointer']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='ListDevices']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='ListSeats']/return-type" name="element_type">GdkSeat*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='ListSeats']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='ListSeats']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='SupportsComposite']" name="name">GetSupportsComposite</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='SupportsInputShapes']" name="name">GetSupportsInputShapes</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkDisplay']/method[@name='SupportsShapes']" name="name">GetSupportsShapes</attr>
|
||||
|
@ -84,8 +87,15 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkKeymap']/method[@name='GetEntriesForKeycode']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkKeymap']/method[@name='GetEntriesForKeyval']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_data']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file']" name="preferred">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file_utf8']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file_at_scale']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file_at_scale_utf8']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file_at_size']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_file_at_size_utf8']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_inline']/*/*[@name='data']" name="array">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_resource']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_resource_at_scale']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/constructor[@cname='gdk_pixbuf_new_from_xpm_data']/*/*[@name='data']" name="array">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='AddAlpha']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='ApplyEmbeddedOrientation']/return-type" name="owned">true</attr>
|
||||
|
@ -94,6 +104,7 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='GetPixels']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Save']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='Savev']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SavevUtf8']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBuffer']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToBufferv']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/method[@name='SaveToCallback']" name="hidden">1</attr>
|
||||
|
@ -104,6 +115,9 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property" name="readable">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property" name="writeable">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbuf']/property" name="construct-only">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufAnimation']/constructor[@cname='gdk_pixbuf_animation_new_from_file']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufAnimation']/constructor[@cname='gdk_pixbuf_animation_new_from_file_utf8']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufAnimation']/constructor[@cname='gdk_pixbuf_animation_new_from_resource']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkPixbufLoader']/method[@name='Write']/*/*[@name='buf']" name="array">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/method[@name='GetFontOptions']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/method[@name='GetMonitorGeometry']/*/*[@type='GdkRectangle*']" name="pass_as">out</attr>
|
||||
|
@ -117,10 +131,21 @@
|
|||
<attr path="/api/namespace/object[@cname='GdkScreen']/method[@name='GetWindowStack']/return-type" name="element_type">GdkWindow*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/method[@name='GetWindowStack']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/method[@name='GetWindowStack']/return-type" name="elements_owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/property[@name='FontOptions']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/virtual_method[@name='GetWindowStack']/return-type" name="element_type">GdkWindow*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/virtual_method[@name='GetWindowStack']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkScreen']/virtual_method[@name='GetWindowStack']/return-type" name="elements_owned">true</attr>
|
||||
<remove-node path="/api/namespace/object[@cname='GdkScreen']/class_struct/signal[@vm='size_changed']" />
|
||||
<remove-node path="/api/namespace/object[@cname='GdkScreen']/class_struct/signal[@vm='composited_changed']" />
|
||||
<remove-node path="/api/namespace/object[@cname='GdkScreen']/class_struct/signal[@vm='monitors_changed']" />
|
||||
<add-node path="/api/namespace/object[@cname='GdkScreen']/class_struct"><method signal_vm="size_changed" /></add-node>
|
||||
<add-node path="/api/namespace/object[@cname='GdkScreen']/class_struct"><method signal_vm="composited_changed" /></add-node>
|
||||
<add-node path="/api/namespace/object[@cname='GdkScreen']/class_struct"><method signal_vm="monitors_changed" /></add-node>
|
||||
<attr path="/api/namespace/object[@cname='GdkSeat']/method[@name='GetSlaves']/return-type" name="element_type">GdkDevice*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkSeat']/method[@name='GetSlaves']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkSeat']/method[@name='GetSlaves']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkSeat']/virtual_method[@name='GetSlaves']/return-type" name="element_type">GdkDevice*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkSeat']/virtual_method[@name='GetSlaves']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkSeat']/virtual_method[@name='GetSlaves']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkWindow']/method[@name='AddFilter']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkWindow']/method[@name='Destroy']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GdkWindow']/method[@name='FreezeToplevelUpdatesLibgtkOnly']" name="hidden">1</attr>
|
||||
|
@ -160,14 +185,10 @@
|
|||
<attr path="/api/namespace/struct[@cname='GdkEventSetting']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkEventVisibility']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkEventWindowState']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixdata']/method[@name='Deserialize']/*/*[@name='stream']" name="array">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixdata']/method[@name='Serialize']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkPixdata']/method[@name='ToCsource']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkSeatDefault']" name="parent">GdkSeat</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GdkTimeCoord']/field[@cname='axes']" name="array_len">128</attr>
|
||||
<remove-node path="/api/namespace/object[@cname='GdkCursor']/method[@name='Ref']" />
|
||||
<remove-node path="/api/namespace/object[@cname='GdkCursor']/method[@name='Unref']" />
|
||||
<remove-node path="/api/namespace/object[@name='Pixbuf']/method[@name='Gettext']" />
|
||||
<remove-node path="/api/namespace/alias[@name='Rectangle']" />
|
||||
<remove-node path="/api/namespace/class[@cname='GdkRectangle_']" />
|
||||
</metadata>
|
||||
|
|
|
@ -39,6 +39,48 @@ namespace Gdk {
|
|||
|
||||
public partial class Pixbuf {
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gdk_pixbuf_new_from_file(IntPtr filename, out IntPtr error);
|
||||
static d_gdk_pixbuf_new_from_file gdk_pixbuf_new_from_file = FuncLoader.LoadFunction<d_gdk_pixbuf_new_from_file>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf),
|
||||
FuncLoader.IsWindows ? "gdk_pixbuf_new_from_file_utf8" : "gdk_pixbuf_new_from_file"));
|
||||
|
||||
public Pixbuf(string filename) : base(IntPtr.Zero)
|
||||
{
|
||||
IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename);
|
||||
IntPtr error = IntPtr.Zero;
|
||||
Raw = gdk_pixbuf_new_from_file(native_filename, out error);
|
||||
GLib.Marshaller.Free(native_filename);
|
||||
if (error != IntPtr.Zero) throw new GLib.GException(error);
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gdk_pixbuf_new_from_file_at_scale(IntPtr filename, int width, int height, bool preserve_aspect_ratio, out IntPtr error);
|
||||
static d_gdk_pixbuf_new_from_file_at_scale gdk_pixbuf_new_from_file_at_scale = FuncLoader.LoadFunction<d_gdk_pixbuf_new_from_file_at_scale>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf),
|
||||
FuncLoader.IsWindows ? "gdk_pixbuf_new_from_file_at_scale_utf8" : "gdk_pixbuf_new_from_file_at_scale"));
|
||||
|
||||
public Pixbuf(string filename, int width, int height, bool preserve_aspect_ratio) : base(IntPtr.Zero)
|
||||
{
|
||||
IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename);
|
||||
IntPtr error = IntPtr.Zero;
|
||||
Raw = gdk_pixbuf_new_from_file_at_scale(native_filename, width, height, preserve_aspect_ratio, out error);
|
||||
GLib.Marshaller.Free(native_filename);
|
||||
if (error != IntPtr.Zero) throw new GLib.GException(error);
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gdk_pixbuf_new_from_file_at_size(IntPtr filename, int width, int height, out IntPtr error);
|
||||
static d_gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size = FuncLoader.LoadFunction<d_gdk_pixbuf_new_from_file_at_size>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf),
|
||||
FuncLoader.IsWindows ? "gdk_pixbuf_new_from_file_at_size_utf8" : "gdk_pixbuf_new_from_file_at_size"));
|
||||
|
||||
public Pixbuf(string filename, int width, int height) : base(IntPtr.Zero)
|
||||
{
|
||||
IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename);
|
||||
IntPtr error = IntPtr.Zero;
|
||||
Raw = gdk_pixbuf_new_from_file_at_size(native_filename, width, height, out error);
|
||||
GLib.Marshaller.Free(native_filename);
|
||||
if (error != IntPtr.Zero) throw new GLib.GException(error);
|
||||
}
|
||||
|
||||
public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero)
|
||||
{
|
||||
using (PixbufLoader pl = new PixbufLoader (stream)) {
|
||||
|
@ -202,12 +244,12 @@ namespace Gdk {
|
|||
delegate IntPtr d_gdk_pixbuf_get_pixels(IntPtr raw);
|
||||
static d_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels = FuncLoader.LoadFunction<d_gdk_pixbuf_get_pixels>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_get_pixels"));
|
||||
|
||||
public IntPtr Pixels {
|
||||
get {
|
||||
IntPtr ret = gdk_pixbuf_get_pixels (Handle);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
public IntPtr Pixels {
|
||||
get {
|
||||
IntPtr ret = gdk_pixbuf_get_pixels (Handle);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gdk_pixbuf_get_formats();
|
||||
static d_gdk_pixbuf_get_formats gdk_pixbuf_get_formats = FuncLoader.LoadFunction<d_gdk_pixbuf_get_formats>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_get_formats"));
|
||||
|
@ -226,7 +268,8 @@ namespace Gdk {
|
|||
}
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate bool d_gdk_pixbuf_save(IntPtr raw, IntPtr filename, IntPtr type, out IntPtr error, IntPtr dummy);
|
||||
static d_gdk_pixbuf_save gdk_pixbuf_save = FuncLoader.LoadFunction<d_gdk_pixbuf_save>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_save"));
|
||||
static d_gdk_pixbuf_save gdk_pixbuf_save = FuncLoader.LoadFunction<d_gdk_pixbuf_save>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf),
|
||||
FuncLoader.IsWindows ? "gdk_pixbuf_save_utf8" : "gdk_pixbuf_save"));
|
||||
|
||||
public unsafe bool Save(string filename, string type) {
|
||||
IntPtr error = IntPtr.Zero;
|
||||
|
@ -312,7 +355,8 @@ namespace Gdk {
|
|||
}
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate bool d_gdk_pixbuf_savev(IntPtr raw, IntPtr filename, IntPtr type, IntPtr[] option_keys, IntPtr[] option_values, out IntPtr error);
|
||||
static d_gdk_pixbuf_savev gdk_pixbuf_savev = FuncLoader.LoadFunction<d_gdk_pixbuf_savev>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf), "gdk_pixbuf_savev"));
|
||||
static d_gdk_pixbuf_savev gdk_pixbuf_savev = FuncLoader.LoadFunction<d_gdk_pixbuf_savev>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf),
|
||||
FuncLoader.IsWindows ? "gdk_pixbuf_savev_utf8" : "gdk_pixbuf_savev"));
|
||||
|
||||
public unsafe bool Savev(string filename, string type, string[] option_keys, string[] option_values) {
|
||||
IntPtr error = IntPtr.Zero;
|
||||
|
@ -332,5 +376,3 @@ namespace Gdk {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,9 +21,24 @@
|
|||
namespace Gdk {
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public partial class PixbufAnimation {
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gdk_pixbuf_animation_new_from_file(IntPtr filename, out IntPtr error);
|
||||
static d_gdk_pixbuf_animation_new_from_file gdk_pixbuf_animation_new_from_file = FuncLoader.LoadFunction<d_gdk_pixbuf_animation_new_from_file>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GdkPixbuf),
|
||||
FuncLoader.IsWindows ? "gdk_pixbuf_animation_new_from_file_utf8" : "gdk_pixbuf_animation_new_from_file"));
|
||||
|
||||
public PixbufAnimation(string filename) : base(IntPtr.Zero)
|
||||
{
|
||||
IntPtr native_filename = GLib.Marshaller.StringToPtrGStrdup(filename);
|
||||
IntPtr error = IntPtr.Zero;
|
||||
Raw = gdk_pixbuf_animation_new_from_file(native_filename, out error);
|
||||
GLib.Marshaller.Free(native_filename);
|
||||
if (error != IntPtr.Zero) throw new GLib.GException(error);
|
||||
}
|
||||
|
||||
public PixbufAnimation (System.IO.Stream stream) : base (new PixbufLoader (stream).AnimationHandle) {}
|
||||
|
||||
public PixbufAnimation (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero)
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Gdk {
|
|||
|
||||
internal IntPtr PixbufHandle {
|
||||
get {
|
||||
return gdk_pixbuf_loader_get_pixbuf (Handle);
|
||||
return g_object_ref (gdk_pixbuf_loader_get_pixbuf (Handle));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,12 @@
|
|||
<attr path="/api/namespace/interface[@cname='GActionGroup']/method[@name='ActionEnabledChanged']" name="name">EmitActionEnabledChanged</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/method[@name='ActionRemoved']" name="name">EmitActionRemoved</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/method[@name='ActionStateChanged']" name="name">EmitActionStateChanged</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/method[@name='ListActions']/return-type" name="null_term_array">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/method[@name='ListActions']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/method[@name='ListActions']/return-type" name="elements_owned">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/virtual_method[@name='ListActions']/return-type" name="null_term_array">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/virtual_method[@name='ListActions']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GActionGroup']/virtual_method[@name='ListActions']/return-type" name="elements_owned">true</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GAppInfo']" name="consume_only">1</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GAppInfo']/method[@name='CanRemoveSupportsType']" name="name">GetCanRemoveSupportsType</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GAppInfo']/method[@name='GetAll']" name="hidden">1</attr>
|
||||
|
|
|
@ -151,6 +151,16 @@ namespace Gtk {
|
|||
GLib.Marshaller.Free (native_name);
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_g_object_ref(IntPtr raw);
|
||||
static d_g_object_ref g_object_ref = FuncLoader.LoadFunction<d_g_object_ref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_object_ref"));
|
||||
|
||||
public IntPtr GetRawOwnedObject(string name) {
|
||||
IntPtr raw_ret = GetRawObject (name);
|
||||
g_object_ref (raw_ret);
|
||||
return raw_ret;
|
||||
}
|
||||
|
||||
public Builder (System.IO.Stream s) : this (s, null)
|
||||
{
|
||||
|
|
27
Source/Libs/GtkSharp/CssProvider.cs
Normal file
27
Source/Libs/GtkSharp/CssProvider.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
namespace Gtk
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
public partial class CssProvider
|
||||
{
|
||||
public bool LoadFromResource(string resource) => LoadFromResource(Assembly.GetCallingAssembly(), resource);
|
||||
|
||||
public bool LoadFromResource(Assembly assembly, string resource)
|
||||
{
|
||||
if (assembly == null)
|
||||
assembly = Assembly.GetCallingAssembly();
|
||||
|
||||
Stream stream = assembly.GetManifestResourceStream(resource);
|
||||
if (stream == null)
|
||||
throw new ArgumentException("'" + resource + "' is not a valid resource name of assembly '" + assembly + "'.", nameof(resource));
|
||||
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
string data = reader.ReadToEnd();
|
||||
return LoadFromData(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -28289,7 +28289,6 @@
|
|||
<method vm="_gtk_reserved7" />
|
||||
</class_struct>
|
||||
<field name="Priv" cname="priv" type="GtkWidgetPrivate*" />
|
||||
<property name="FALSE); GtkWidgetChildPropertyPool = gParamSpecPoolNew (TRUE" cname="FALSE); _gtk_widget_child_property_pool = g_param_spec_pool_new (TRUE" type="pool_new" />
|
||||
<property name="Name" cname="name" type="gchar*" readable="true" writeable="true" />
|
||||
<property name="Parent" cname="parent" type="GtkContainer" readable="true" writeable="true" />
|
||||
<property name="WidthRequest" cname="width-request" type="gint" readable="true" writeable="true" />
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
<attr path="/api/namespace/boxed[@cname='GtkGradient']/method[@cname='gtk_gradient_add_color_stop']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkGradient']/method[@cname='gtk_gradient_resolve']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkGradient']/method[@cname='gtk_gradient_resolve_for_context']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkIconInfo']/method[@name='Free']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='GetSizes']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='Ref']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkIconSet']/method[@name='Unref']" name="deprecated">1</attr>
|
||||
|
@ -50,7 +49,9 @@
|
|||
<attr path="/api/namespace/boxed[@cname='GtkTextIter']/method[@name='GetToggledTags']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreeIter']/method[@name='Copy']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/constructor[@cname='gtk_tree_path_new_from_indices']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/constructor[@cname='gtk_tree_path_new_from_indicesv']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/method[@name='GetIndices']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/method[@name='GetIndicesWithDepth']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreePath']/method[@name='Free']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreeRowReference']/method[@name='Free']" name="deprecated">1</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkTreeRowReference']/method[@name='GetPath']/return-type" name="owned">true</attr>
|
||||
|
@ -75,7 +76,6 @@
|
|||
<attr path="/api/namespace/class[@cname='GtkGlobal']/method[@name='EventsPending']" name="name">GetEventsPending</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkGlobal']/method[@name='CheckVersion']/return-type" name="type">const-gchar*</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkGlobal']/method[@name='EnumeratePrinters']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkIcon_']/method[@cname='gtk_icon_size_lookup_for_settings']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkInit_']/method[@name='Check']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkInit_']/method[@name='CheckAbiCheck']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/class[@cname='GtkInit_']/method[@name='AbiCheck']" name="hidden">1</attr>
|
||||
|
@ -104,7 +104,6 @@
|
|||
<attr path="/api/namespace/enum[@cname='GtkJunctionSides']/member[@name='Bottom']" name="value">CornerBottomLeft | CornerBottomRight</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GtkJunctionSides']/member[@name='Left']" name="value">CornerTopLeft | CornerBottomLeft</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GtkJunctionSides']/member[@name='Right']" name="value">CornerTopRight | CornerBottomRight</attr>
|
||||
<attr path="/api/namespace/enum[@cname='OperationMode']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GtkPathPriorityType']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GtkPathType']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/enum[@cname='GtkRcFlags']" name="hidden">1</attr>
|
||||
|
@ -280,7 +279,6 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkCellArea']/*[@name='Foreach']/*/*[@name='callback']" name="scope">call</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkCellArea']/*[@name='ForeachAlloc']/*/*[@name='callback']" name="scope">call</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkCellArea']/method[@name='GetFocusSiblings']/return-type" name="element_type">GtkCellRenderer*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkCellArea']/signal[@name='ApplyAttributes']" name="name">AttributesApplied</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='StartEditing']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/method[@name='GetSize']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkCellRenderer']/property[@name='CellBackgroundRgba']" name="type">GdkRGBA</attr>
|
||||
|
@ -364,6 +362,8 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkEntry']/property[@name='Editable']" name="hidden">1</attr>
|
||||
<remove-node path="/api/namespace/object[@cname='GtkEntry']/property[@name='InvisibleChar']" />
|
||||
<remove-node path="/api/namespace/object[@cname='GtkEntry']/property[@name='InnerBorder']" />
|
||||
<attr path="/api/namespace/object[@cname='GtkEntry']/method[@name='GetIconArea']/parameters/parameter[@name='icon_area']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkEntry']/method[@name='GetTextArea']/parameters/parameter[@name='text_area']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkEntry']/signal[@name='Activate']" name="name">Activated</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkEntry']/signal[@name='CopyClipboard']" name="name">ClipboardCopied</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkEntry']/signal[@name='CutClipboard']" name="name">ClipboardCut</attr>
|
||||
|
@ -375,11 +375,18 @@
|
|||
<remove-node path="/api/namespace/object[@cname='GtkFileChooserWidget']/implements/interface[@cname='GtkFileChooserEmbed']" />
|
||||
<attr path="/api/namespace/object[@cname='GtkFlowBox']/signal[@cname='select-all']" name="name">SelectedAll</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFlowBox']/signal[@cname='unselect-all']" name="name">UnselectedAll</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFlowBox']/method[@name='SelectedForeach']/*/*[@name='func']" name="scope">call</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFlowBox']/method[@name='GetSelectedChildren']/return-type" name="element_type">GtkFlowBoxChild*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFlowBox']/method[@name='GetSelectedChildren']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFlowBox']/method[@name='GetSelectedChildren']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFontSelectionDialog']/method[@name='GetCancelButton']/return-type" name="type">GtkButton*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFontSelectionDialog']/method[@name='GetOkButton']/return-type" name="type">GtkButton*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFrame']/method[@name='GetLabelAlign']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkFrame']/method[@name='SetLabelAlign']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkGesture']/method[@cname='gtk_gesture_get_group']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkGesture']/method[@cname='gtk_gesture_get_sequences']/return-type" name="element_type">GdkEventSequence*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkGesture']/method[@cname='gtk_gesture_get_sequences']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkGesture']/method[@cname='gtk_gesture_get_sequences']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkHandleBox']/property[@name='ChildDetached']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkHandleBox']/property[@name='ShadowType']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkHandleBox']/method[@name='GetChildDetached']" name="name">IsChildDetached</attr>
|
||||
|
@ -454,6 +461,10 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkListBox']/signal[@cname='select-all']" name="name">SelectedAll</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListBox']/signal[@cname='unselect-all']" name="name">UnselectedAll</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListBox']/signal[@cname='row-activated']" name="name">ListRowActivated</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListBox']/method[@name='SelectedForeach']/*/*[@name='func']" name="scope">call</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListBox']/method[@name='GetSelectedRows']/return-type" name="element_type">GtkListBoxRow*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListBox']/method[@name='GetSelectedRows']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListBox']/method[@name='GetSelectedRows']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListStore']/constructor[@cname='gtk_list_store_new']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListStore']/constructor[@cname='gtk_list_store_newv']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkListStore']/method[@name='Append']/*/*[@name='iter']" name="pass_as">out</attr>
|
||||
|
@ -494,6 +505,9 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkPlacesSidebar']/signal[@cname='show-connect-to-server']" name="name">ShowedConnectToServer</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlacesSidebar']/signal[@cname='show-enter-location']" name="name">ShowEnteredLocation</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlacesSidebar']/signal[@cname='show-other-locations']" name="name">ShowedOtherLocations</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlacesSidebar']/method[@name='ListShortcuts']/return-type" name="element_type">GFile*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlacesSidebar']/method[@name='ListShortcuts']/return-type" name="elements_owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlacesSidebar']/method[@name='ListShortcuts']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlug']/constructor[@cname='gtk_plug_new']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlug']/constructor[@cname='gtk_plug_new_for_display']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkPlug']/property[@name='Embedded']" name="name">IsEmbedded</attr>
|
||||
|
@ -643,7 +657,6 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkStatusIcon']/method[@name='SetFromGicon']" name="name">SetIcon</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkStatusIcon']/method[@name='GetGicon']" name="name">GetIcon</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkStatusIcon']/property[@cname='gicon']" name="name">Icon</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkStyle']/method[@name='LookupColor']/*/*[@name='color']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkStyleContext']/method[@name='Get']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkStyleContext']/method[@name='GetBackgroundColor']/*/parameter[@name='color']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkStyleContext']/method[@name='GetBorder']/*/parameter[@name='border']" name="pass_as">out</attr>
|
||||
|
@ -852,6 +865,7 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Destroy']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Destroyed']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Event']" name="name">ProcessEvent</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetAllocatedSize']/parameters/parameter[@name='allocation']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetAllocation']/parameters/parameter[@name='allocation']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetClip']/parameters/parameter[@name='clip']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetChildRequisition']/*/*[@name='requisition']" name="pass_as">out</attr>
|
||||
|
@ -860,7 +874,6 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetPath']" name="name">GetWidgetPath</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetPreferredSize']/*/*[@type='GtkRequisition*']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetRealized']" name="name">GetIsRealized</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='GetRequisition']/*/parameter[@name='requisition']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='HasDefault']" name="name">GetHasDefault</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='HasFocus']" name="name">GetHasFocus</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/method[@name='Intersect']/*/*[@name='intersection']" name="pass_as">out</attr>
|
||||
|
@ -904,6 +917,7 @@
|
|||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetDefaultSize']/*/*[@type='gint*']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetIconList']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetPosition']/*/*[@type='gint*']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetResizeGripArea']/parameters/parameter[@name='rect']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='GetSize']/*/*[@type='gint*']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='HasToplevelFocus']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/method[@name='IsActive']" name="hidden">1</attr>
|
||||
|
@ -942,8 +956,6 @@
|
|||
<attr path="/api/namespace/object/class_struct[@cname='GtkRangeClass']/field[@name='SliderDetail']" name="cname">slider_detail</attr>
|
||||
|
||||
<attr path="/api/namespace/object/class_struct[@cname='GtkRangeClass']/field[@name='Gchar']" name="name">StepperDetail</attr>
|
||||
<attr path="/api/namespace/object/class_struct[@cname='GtkRangeClass']/field[@name='StepperDetail']" name="type">gchar*</attr>
|
||||
<attr path="/api/namespace/object/class_struct[@cname='GtkRangeClass']/field[@name='StepperDetail']" name="cname">stepper_detail</attr>
|
||||
|
||||
<attr path="/api/namespace/struct[@cname='GtkBindingArg']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkBindingEntry']" name="hidden">1</attr>
|
||||
|
@ -952,10 +964,6 @@
|
|||
<attr path="/api/namespace/struct[@cname='GtkBoxChild']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkFixedChild']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkIMContextInfo']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkImageAnimationData']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkImageIconSetData']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkImagePixbufData']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkImageStockData']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkKeyHash']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkLabelSelectionInfo']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkNotebookPage']/method[@name='Num']" name="hidden">1</attr>
|
||||
|
@ -977,7 +985,6 @@
|
|||
<attr path="/api/namespace/struct[@cname='GtkTextAppearance']/field[@cname='is_text']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkTextBTree']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkTextLogAttrCache']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkWidgetAuxInfo']" name="hidden">1</attr>
|
||||
<attr path="/api/namespace/struct[@cname='GtkWindowGeometryInfo']" name="hidden">1</attr>
|
||||
|
||||
<attr path="/api/namespace/interface[@cname='GtkScrollable']/method[@name='GetBorder']/*/parameter[@name='border']" name="pass_as">out</attr>
|
||||
|
@ -1006,6 +1013,12 @@
|
|||
<remove-node path="/api/namespace/struct[@cname='IconSize']" />
|
||||
<remove-node path="/api/namespace/struct[@cname='Range']" />
|
||||
|
||||
<attr path="/api/namespace/object[@cname='GtkIconInfo']/method[@name='LoadIconAsync']/*/*[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkIconInfo']/method[@name='LoadSymbolicAsync']/*/*[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkIconInfo']/method[@name='LoadSymbolicForContextAsync']/*/*[@name='callback']" name="scope">async</attr>
|
||||
|
||||
<attr path="/api/namespace/object[@cname='GtkCssProvider']/method[@name='LoadFromResource']" name="hidden">1</attr>
|
||||
|
||||
<!-- Mark reserved fields as padding -->
|
||||
<attr path="//*[contains(@cname, 'gtk_reserved')]" name="padding">true</attr>
|
||||
<attr path="//*[contains(@vm, 'gtk_reserved')]" name="padding">true</attr>
|
||||
|
@ -1101,5 +1114,4 @@
|
|||
|
||||
<attr path="/api/namespace/object[@cname='GtkWindow']/property[@name='DecorationButtonLayout']" name="style">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkWidget']/property[@name='DecorationResizeHandle']" name="style">true</attr>
|
||||
|
||||
</metadata>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<GtkUrl Condition=" '$(GtkUrl)' == '' ">https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.20.zip</GtkUrl>
|
||||
<GtkDir Condition=" '$(GtkDir)' == '' ">$(LOCALAPPDATA)\Gtk\3.24.20</GtkDir>
|
||||
<GtkUrl Condition=" '$(GtkUrl)' == '' ">https://github.com/GtkSharp/Dependencies/raw/master/gtk-3.24.24.zip</GtkUrl>
|
||||
<GtkDir Condition=" '$(GtkDir)' == '' ">$(LOCALAPPDATA)\Gtk\3.24.24</GtkDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="InstallGtk" BeforeTargets="Build" Condition=" '$(SkipGtkInstall)' != 'True' and '$(OS)' == 'Windows_NT' and !Exists('$(GtkDir)/libgtk-3-0.dll') ">
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Gtk {
|
|||
delegate IntPtr d_gtk_message_dialog_new_with_markup(IntPtr parent_window, DialogFlags flags, MessageType type, ButtonsType bt, IntPtr msg, IntPtr args);
|
||||
static d_gtk_message_dialog_new_with_markup gtk_message_dialog_new_with_markup = FuncLoader.LoadFunction<d_gtk_message_dialog_new_with_markup>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_message_dialog_new_with_markup"));
|
||||
|
||||
public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args)
|
||||
public MessageDialog (Gtk.Window parent_window, DialogFlags flags, MessageType type, ButtonsType bt, bool use_markup, string format, params object[] args) : base (IntPtr.Zero)
|
||||
{
|
||||
IntPtr p = (parent_window != null) ? parent_window.Handle : IntPtr.Zero;
|
||||
|
||||
|
|
|
@ -20,24 +20,27 @@ namespace Gtk {
|
|||
|
||||
public partial class TreePath {
|
||||
|
||||
// Patch submitted by malte on bug #49518
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gtk_tree_path_get_indices(IntPtr raw);
|
||||
static d_gtk_tree_path_get_indices gtk_tree_path_get_indices = FuncLoader.LoadFunction<d_gtk_tree_path_get_indices>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_path_get_indices"));
|
||||
delegate IntPtr d_gtk_tree_path_get_indices_with_depth(IntPtr raw, out int depth);
|
||||
static d_gtk_tree_path_get_indices_with_depth gtk_tree_path_get_indices_with_depth = FuncLoader.LoadFunction<d_gtk_tree_path_get_indices_with_depth>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_path_get_indices_with_depth"));
|
||||
|
||||
public int [] Indices {
|
||||
get {
|
||||
IntPtr ptr = gtk_tree_path_get_indices(Handle);
|
||||
int [] arr = new int [Depth];
|
||||
Marshal.Copy (ptr, arr, 0, Depth);
|
||||
IntPtr arrPtr = gtk_tree_path_get_indices_with_depth(Handle, out int depth);
|
||||
int[] arr = new int[depth];
|
||||
if (arrPtr != IntPtr.Zero)
|
||||
Marshal.Copy(arrPtr, arr, 0, depth);
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
public TreePath (int[] indices) : this ()
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_gtk_tree_path_new_from_indicesv(int[] indices, UIntPtr length);
|
||||
static d_gtk_tree_path_new_from_indicesv gtk_tree_path_new_from_indicesv = FuncLoader.LoadFunction<d_gtk_tree_path_new_from_indicesv>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_tree_path_new_from_indicesv"));
|
||||
|
||||
public TreePath (int[] indices)
|
||||
{
|
||||
foreach (int i in indices)
|
||||
AppendIndex (i);
|
||||
Raw = gtk_tree_path_new_from_indicesv(indices, (UIntPtr)indices.Length);
|
||||
}
|
||||
|
||||
public override bool Equals (object o)
|
||||
|
|
|
@ -370,6 +370,7 @@ namespace Gtk {
|
|||
Gtk.Widget widget = o as Gtk.Widget;
|
||||
if (widget == null)
|
||||
return;
|
||||
|
||||
widget.OnDestroyed ();
|
||||
}
|
||||
|
||||
|
@ -387,20 +388,41 @@ namespace Gtk {
|
|||
base.CreateNativeObject (names, vals);
|
||||
}
|
||||
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
delegate IntPtr d_g_object_ref(IntPtr raw);
|
||||
static d_g_object_ref g_object_ref = FuncLoader.LoadFunction<d_g_object_ref>(FuncLoader.GetProcAddress(GLibrary.Load(Library.GObject), "g_object_ref"));
|
||||
|
||||
private bool destroyed;
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (Handle == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
if (disposing && !destroyed && IsToplevel)
|
||||
{
|
||||
//If this is a TopLevel widget, then we do not hold a ref, only a toggle ref.
|
||||
//Freeing our toggle ref expects a normal ref to exist, and therefore does not check if the object still exists.
|
||||
//Take a ref here and let our toggle ref unref it.
|
||||
g_object_ref (Handle);
|
||||
gtk_widget_destroy (Handle);
|
||||
destroyed = true;
|
||||
}
|
||||
|
||||
InternalDestroyed -= NativeDestroyHandler;
|
||||
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
|
||||
protected override IntPtr Raw {
|
||||
protected override IntPtr Raw {
|
||||
get {
|
||||
return base.Raw;
|
||||
}
|
||||
set {
|
||||
if (Handle == value)
|
||||
return;
|
||||
|
||||
base.Raw = value;
|
||||
|
||||
if (value != IntPtr.Zero)
|
||||
InternalDestroyed += NativeDestroyHandler;
|
||||
}
|
||||
|
@ -409,11 +431,18 @@ namespace Gtk {
|
|||
delegate void d_gtk_widget_destroy(IntPtr raw);
|
||||
static d_gtk_widget_destroy gtk_widget_destroy = FuncLoader.LoadFunction<d_gtk_widget_destroy>(FuncLoader.GetProcAddress(GLibrary.Load(Library.Gtk), "gtk_widget_destroy"));
|
||||
|
||||
|
||||
public virtual void Destroy ()
|
||||
{
|
||||
if (Handle == IntPtr.Zero)
|
||||
return;
|
||||
|
||||
if (destroyed)
|
||||
return;
|
||||
|
||||
gtk_widget_destroy (Handle);
|
||||
destroyed = true;
|
||||
|
||||
InternalDestroyed -= NativeDestroyHandler;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,26 +14,51 @@
|
|||
<attr path="/api/namespace/interface[@cname='GtkSourceCompletionProposal']/signal[@name='Changed']" name="name">EmitChanged</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GtkSourceUndoManager']/signal[@name='CanRedoChanged']" name="name">EmitCanRedoChanged</attr>
|
||||
<attr path="/api/namespace/interface[@cname='GtkSourceUndoManager']/signal[@name='CanUndoChanged']" name="name">EmitCanUndoChanged</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='match_start']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='match_end']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='match_start']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='match_end']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Backward']/*/*[@name='has_wrapped_around']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='match_start']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='match_end']" name="pass_as">ref</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='match_start']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='match_end']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='Forward']/*/*[@name='has_wrapped_around']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='ForwardFinish']/*/*[@name='match_start']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='ForwardFinish']/*/*[@name='match_end']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='ForwardFinish']/*/*[@name='has_wrapped_around']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='BackwardFinish']/*/*[@name='match_start']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='BackwardFinish']/*/*[@name='match_end']" name="pass_as">out</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@name='BackwardFinish']/*/*[@name='has_wrapped_around']" name="pass_as">out</attr>
|
||||
<remove-node path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_can_undo']" />
|
||||
<remove-node path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_can_redo']" />
|
||||
<remove-node path="/api/namespace/interface[@cname='GtkSourceStyleSchemeChooser']/property[@cname='style-scheme']" />
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_iter']/return-type" name="element_type">Mark</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_line']/return-type" name="element_type">Mark</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletion']/method[@cname='gtk_source_completion_get_providers']/return-type" name="element_type">CompletionProvider</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_all']/return-type" name="element_type">Encoding</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_default_candidates']/return-type" name="element_type">Encoding</attr>
|
||||
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_iter']/return-type" name="element_type">GtkSourceMark*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_iter']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_iter']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_line']/return-type" name="element_type">GtkSourceMark*</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_line']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceBuffer']/method[@cname='gtk_source_buffer_get_source_marks_at_line']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceCompletion']/method[@cname='gtk_source_completion_get_providers']/return-type" name="element_type">GtkSourceCompletionProvider*</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_all']/return-type" name="element_type">GtkSourceEncoding*</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_all']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_all']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_default_candidates']/return-type" name="element_type">GtkSourceEncoding*</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_default_candidates']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/boxed[@cname='GtkSourceEncoding']/method[@cname='gtk_source_encoding_get_default_candidates']/return-type" name="elements_owned">false</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileLoader']/method[@cname='gtk_source_file_loader_load_async']/parameters/parameter[@name='progress_callback']" name="scope">notify</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileLoader']/method[@cname='gtk_source_file_loader_load_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileSaver']/method[@cname='gtk_source_file_saver_save_async']/parameters/parameter[@name='progress_callback']" name="scope">notify</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceFileSaver']/method[@cname='gtk_source_file_saver_save_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@cname='gtk_source_search_context_backward_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceSearchContext']/method[@cname='gtk_source_search_context_forward_async']/parameters/parameter[@name='callback']" name="scope">async</attr>
|
||||
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceLanguageManager']/method[@name='GetLanguageIds']/return-type" name="null_term_array">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceLanguageManager']/method[@name='GetLanguageIds']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceLanguageManager']/method[@name='GetLanguageIds']/return-type" name="elements_owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceLanguage']/method[@name='GetGlobs']/return-type" name="null_term_array">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceLanguage']/method[@name='GetGlobs']/return-type" name="owned">true</attr>
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceLanguage']/method[@name='GetGlobs']/return-type" name="elements_owned">true</attr>
|
||||
|
||||
<!-- Rename View to SourceView -->
|
||||
<attr path="/api/namespace/object[@cname='GtkSourceView']" name="name">SourceView</attr>
|
||||
<!-- This is a variadic function. Unsure how we're supposed to handle it in the binding. For now I've removed it. -->
|
||||
|
|
|
@ -42,7 +42,7 @@ class GLibrary
|
|||
|
||||
if (ret == IntPtr.Zero)
|
||||
{
|
||||
SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24.20"));
|
||||
SetDllDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Gtk", "3.24.24"));
|
||||
ret = FuncLoader.LoadLibrary(_libraryDefinitions[library][0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,7 @@
|
|||
<xs:attribute name="cname" type="xs:string"/>
|
||||
<xs:attribute name="hidden" type="xs:boolean" use="optional"/>
|
||||
<xs:attribute name="parent" type="xs:string" use="optional"/>
|
||||
<xs:attribute name="disable_void_ctor" type="xs:boolean" use="optional"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="structType">
|
||||
|
@ -188,6 +189,7 @@
|
|||
</xs:element>
|
||||
</xs:choice>
|
||||
<xs:attribute name="cname" type="xs:string"/>
|
||||
<xs:attribute name="private" type="xs:boolean" use="optional"/>
|
||||
</xs:complexType>
|
||||
|
||||
<xs:complexType name="constructorType">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>..\..\BuildOutput\Samples</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
@ -10,7 +10,9 @@
|
|||
<EmbeddedResource Include="**\*.glade">
|
||||
<LogicalName>%(Filename)%(Extension)</LogicalName>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Testpic.png" />
|
||||
<EmbeddedResource Include="Testpic.png">
|
||||
<LogicalName>Testpic</LogicalName>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Sections\**\*.cs" Visible="false">
|
||||
|
|
95
Source/Samples/Sections/Miscellaneous/PixbufSection.cs
Normal file
95
Source/Samples/Sections/Miscellaneous/PixbufSection.cs
Normal file
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using Gdk;
|
||||
using Gtk;
|
||||
|
||||
namespace Samples
|
||||
{
|
||||
|
||||
[Section (ContentType = typeof(PixbufDemo), Category = Category.Miscellaneous)]
|
||||
class PixbufSection : ListSection
|
||||
{
|
||||
|
||||
public PixbufSection ()
|
||||
{
|
||||
AddItem ($"Press button to run / stop {nameof(PixbufDemo)} :", new PixbufDemo ("Press me"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class PixbufDemo : Button
|
||||
{
|
||||
|
||||
public PixbufDemo (string text) : base (text) { }
|
||||
|
||||
private bool running = false;
|
||||
|
||||
public void DispatchPendingEvents ()
|
||||
{
|
||||
// The loop is limited to 1000 iterations as a workaround for an issue that some users
|
||||
// have experienced. Sometimes EventsPending starts return 'true' for all iterations,
|
||||
// causing the loop to never end.
|
||||
|
||||
int n = 1000;
|
||||
Gdk.Threads.Enter ();
|
||||
|
||||
while (Gtk.Application.EventsPending () && --n > 0) {
|
||||
Gtk.Application.RunIteration (false);
|
||||
}
|
||||
|
||||
Gdk.Threads.Leave ();
|
||||
}
|
||||
|
||||
protected override void OnPressed ()
|
||||
{
|
||||
base.OnPressed ();
|
||||
var count = 0;
|
||||
|
||||
if (running) {
|
||||
running = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var startmem = GC.GetTotalMemory (true);
|
||||
var testfile = "Textpic.png";
|
||||
|
||||
using var teststream = typeof(ImageSection).Assembly.GetManifestResourceStream("Testpic");
|
||||
using (var writeTestFile = new FileStream(testfile, FileMode.Create)) {
|
||||
teststream.CopyTo(writeTestFile);
|
||||
}
|
||||
|
||||
using (var heatup = new Pixbuf (testfile)) {
|
||||
ApplicationOutput.WriteLine ($"{nameof(heatup)}.{nameof(Pixbuf.ByteLength)}\t{heatup.ByteLength:N0}");
|
||||
}
|
||||
|
||||
startmem = GC.GetTotalMemory (true);
|
||||
ApplicationOutput.WriteLine ($"{nameof(GC.GetTotalMemory)} at start: {startmem:N}");
|
||||
running = true;
|
||||
|
||||
var memAllocated = 0UL;
|
||||
|
||||
while (running) {
|
||||
|
||||
using (var source = new Pixbuf (typeof(ImageSection).Assembly, "Testpic")) {
|
||||
memAllocated += source.ByteLength;
|
||||
count++;
|
||||
}
|
||||
|
||||
DispatchPendingEvents ();
|
||||
|
||||
if (!running)
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
var endmem = GC.GetTotalMemory (true);
|
||||
ApplicationOutput.WriteLine ($"Leak:\t{(endmem - startmem):N0}\t{nameof(memAllocated)}");
|
||||
ApplicationOutput.WriteLine ($"{nameof(GC.GetTotalMemory)} at start: {startmem:N0}\tat end: {endmem:N0}\t{nameof(Pixbuf)} created: {count}");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -21,29 +21,9 @@ namespace Samples
|
|||
|
||||
public (string, Widget) CreateContainer()
|
||||
{
|
||||
Stream GetResourceStream(Assembly assembly, string name)
|
||||
{
|
||||
var resources = assembly.GetManifestResourceNames();
|
||||
var resourceName = resources.SingleOrDefault(str => str == name);
|
||||
|
||||
// try harder:
|
||||
if (resourceName == default) {
|
||||
resourceName = resources.SingleOrDefault(str => str.EndsWith(name));
|
||||
}
|
||||
|
||||
if (resourceName == default)
|
||||
return default;
|
||||
var stream = assembly.GetManifestResourceStream(resourceName);
|
||||
return stream;
|
||||
}
|
||||
Pixbuf image = default;
|
||||
using (var stream = GetResourceStream(typeof(ImageSection).Assembly, "Testpic.png")) {
|
||||
image = new Pixbuf(stream);
|
||||
}
|
||||
|
||||
var image = new Pixbuf(typeof(ImageSection).Assembly, "Testpic");
|
||||
var container = new ImageBox(image);
|
||||
|
||||
|
||||
return ($"{nameof(ImageBox)}:", container);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
"symbols": {
|
||||
"targetframework": {
|
||||
"type": "parameter",
|
||||
"defaultValue": "netcoreapp2.0",
|
||||
"replaces": "netcoreapp2.0"
|
||||
"defaultValue": "net5.0",
|
||||
"replaces": "net5.0"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -13,7 +13,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GtkSharp" Version="3.22.25.*" />
|
||||
<PackageReference Include="GtkSharp" Version="3.24.24.*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace GtkNamespace
|
|||
|
||||
public MainWindow() : this(new Builder("MainWindow.glade")) { }
|
||||
|
||||
private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle)
|
||||
private MainWindow(Builder builder) : base(builder.GetRawOwnedObject("MainWindow"))
|
||||
{
|
||||
builder.Autoconnect(this);
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace GtkNamespace
|
|||
{
|
||||
public Gtk_Dialog() : this(new Builder("Gtk_Dialog.glade")) { }
|
||||
|
||||
private Gtk_Dialog(Builder builder) : base(builder.GetObject("Gtk_Dialog").Handle)
|
||||
private Gtk_Dialog(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Dialog"))
|
||||
{
|
||||
builder.Autoconnect(this);
|
||||
DefaultResponse = ResponseType.Cancel;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace GtkNamespace
|
|||
{
|
||||
public Gtk_Widget() : this(new Builder("Gtk_Widget.glade")) { }
|
||||
|
||||
private Gtk_Widget(Builder builder) : base(builder.GetObject("Gtk_Widget").Handle)
|
||||
private Gtk_Widget(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Widget"))
|
||||
{
|
||||
builder.Autoconnect(this);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace GtkNamespace
|
|||
{
|
||||
public Gtk_Window() : this(new Builder("Gtk_Window.glade")) { }
|
||||
|
||||
private Gtk_Window(Builder builder) : base(builder.GetObject("Gtk_Window").Handle)
|
||||
private Gtk_Window(Builder builder) : base(builder.GetRawOwnedObject("Gtk_Window"))
|
||||
{
|
||||
builder.Autoconnect(this);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
"symbols": {
|
||||
"targetframework": {
|
||||
"type": "parameter",
|
||||
"defaultValue": "netcoreapp2.0",
|
||||
"replaces": "netcoreapp2.0"
|
||||
"defaultValue": "net5.0",
|
||||
"replaces": "net5.0"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -18,7 +18,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GtkSharp" Version="3.22.25.*" />
|
||||
<PackageReference Include="GtkSharp" Version="3.24.24.*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace GtkNamespace
|
|||
open Gtk
|
||||
|
||||
type MainWindow (builder : Builder) as this =
|
||||
inherit Window(builder.GetObject("MainWindow").Handle)
|
||||
inherit Window(builder.GetRawOwnedObject("MainWindow"))
|
||||
|
||||
let mutable _label1 : Label = null
|
||||
let mutable _button1 : Button = null
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace GtkNamespace
|
|||
open Gtk
|
||||
|
||||
type Gtk_Dialog (builder : Builder) as this =
|
||||
inherit Dialog(builder.GetObject("Gtk_Dialog").Handle)
|
||||
inherit Dialog(builder.GetRawOwnedObject("Gtk_Dialog"))
|
||||
do
|
||||
this.DefaultResponse <- ResponseType.Cancel;
|
||||
this.Response.Add(fun _ ->
|
||||
|
|
|
@ -3,6 +3,6 @@ namespace GtkNamespace
|
|||
open Gtk
|
||||
|
||||
type Gtk_Widget (builder : Builder) =
|
||||
inherit Box(builder.GetObject("Gtk_Widget").Handle)
|
||||
inherit Box(builder.GetRawOwnedObject("Gtk_Widget"))
|
||||
|
||||
new() = new Gtk_Widget(new Builder("Gtk_Widget.glade"))
|
||||
|
|
|
@ -3,6 +3,6 @@ namespace GtkNamespace
|
|||
open Gtk
|
||||
|
||||
type Gtk_Window (builder : Builder) =
|
||||
inherit Window(builder.GetObject("Gtk_Window").Handle)
|
||||
inherit Window(builder.GetRawOwnedObject("Gtk_Window"))
|
||||
|
||||
new() = new Gtk_Window(new Builder("Gtk_Window.glade"))
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
"symbols": {
|
||||
"targetframework": {
|
||||
"type": "parameter",
|
||||
"defaultValue": "netcoreapp2.0",
|
||||
"replaces": "netcoreapp2.0"
|
||||
"defaultValue": "net5.0",
|
||||
"replaces": "net5.0"
|
||||
}
|
||||
},
|
||||
"primaryOutputs": [
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -13,7 +13,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GtkSharp" Version="3.22.25.*" />
|
||||
<PackageReference Include="GtkSharp" Version="3.24.24.*" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -11,7 +11,7 @@ Namespace GtkNamespace
|
|||
<UI>Private _button1 As Button
|
||||
|
||||
Public Sub New (builder as Builder)
|
||||
MyBase.New(builder.GetObject("MainWindow").Handle)
|
||||
MyBase.New(builder.GetRawOwnedObject("MainWindow"))
|
||||
|
||||
builder.Autoconnect (Me)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Namespace GtkNamespace
|
|||
Inherits Dialog
|
||||
|
||||
Public Sub New (builder as Builder)
|
||||
MyBase.New (builder.GetObject("Gtk_Dialog").Handle)
|
||||
MyBase.New (builder.GetRawOwnedObject("Gtk_Dialog"))
|
||||
|
||||
builder.Autoconnect (Me)
|
||||
DefaultResponse = ResponseType.Cancel
|
||||
|
|
|
@ -7,7 +7,7 @@ Namespace GtkNamespace
|
|||
Inherits Box
|
||||
|
||||
Public Sub New (builder as Builder)
|
||||
MyBase.New (builder.GetObject("Gtk_Widget").Handle)
|
||||
MyBase.New (builder.GetRawOwnedObject("Gtk_Widget"))
|
||||
|
||||
builder.Autoconnect (Me)
|
||||
End Sub
|
||||
|
|
|
@ -7,7 +7,7 @@ Namespace GtkNamespace
|
|||
Inherits Window
|
||||
|
||||
Public Sub New (builder as Builder)
|
||||
MyBase.New (builder.GetObject("Gtk_Window").Handle)
|
||||
MyBase.New (builder.GetRawOwnedObject("Gtk_Window"))
|
||||
|
||||
builder.Autoconnect (Me)
|
||||
End Sub
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<OutputPath>..\..\..\BuildOutput\Tools</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<OutputPath>..\..\..\BuildOutput\Tools</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
variables:
|
||||
versionbase: 3.22.25
|
||||
versionbase: 3.24.24
|
||||
increment: $[counter(variables['versionbase'], 1)]
|
||||
version: $(versionbase).$(increment)
|
||||
|
||||
|
@ -16,9 +16,6 @@ steps:
|
|||
- script: echo "##vso[build.updatebuildnumber]$(version)"
|
||||
displayName: 'Set Build Number'
|
||||
|
||||
- script: sudo apt install -y monodevelop
|
||||
displayName: 'Install MonoDevelop'
|
||||
|
||||
- script: ./build.sh --BuildTarget=FullBuild --BuildVersion=$(version)
|
||||
displayName: 'CAKE Script'
|
||||
|
||||
|
@ -42,10 +39,3 @@ steps:
|
|||
pathtoPublish: BuildOutput/Samples
|
||||
artifactName: Samples
|
||||
publishLocation: container
|
||||
|
||||
- task: PublishBuildArtifacts@1
|
||||
displayName: Publish MonoDevelop Addin
|
||||
inputs:
|
||||
pathtoPublish: BuildOutput/Addins/MonoDevelop/MonoDevelop.GtkSharp.Addin_$(version).mpack
|
||||
artifactName: MonoDevelop Addin
|
||||
publishLocation: container
|
43
build.cake
43
build.cake
|
@ -1,12 +1,12 @@
|
|||
#load CakeScripts\GAssembly.cake
|
||||
#load CakeScripts\Settings.cake
|
||||
#addin "Cake.FileHelpers&version=3.2.0"
|
||||
#addin "Cake.Incubator&version=5.0.1"
|
||||
#addin "Cake.FileHelpers&version=4.0.0"
|
||||
#addin "Cake.Incubator&version=6.0.0"
|
||||
|
||||
// VARS
|
||||
|
||||
Settings.Cake = Context;
|
||||
Settings.Version = Argument("BuildVersion", "3.22.24.30");
|
||||
Settings.Version = Argument("BuildVersion", "3.24.24.1");
|
||||
Settings.BuildTarget = Argument("BuildTarget", "Default");
|
||||
Settings.Assembly = Argument("Assembly", "");
|
||||
var configuration = Argument("Configuration", "Release");
|
||||
|
@ -63,7 +63,10 @@ Task("FullClean")
|
|||
.IsDependentOn("Clean")
|
||||
.Does(() =>
|
||||
{
|
||||
DeleteDirectory("BuildOutput", true);
|
||||
DeleteDirectory("BuildOutput", new DeleteDirectorySettings {
|
||||
Recursive = true,
|
||||
Force = true
|
||||
});
|
||||
});
|
||||
|
||||
Task("Build")
|
||||
|
@ -136,35 +139,6 @@ Task("PackageTemplates")
|
|||
NuGetPack("Source/Templates/GtkSharp.Template.VBNet/GtkSharp.Template.VBNet.nuspec", settings);
|
||||
});
|
||||
|
||||
Task("PackageAddin")
|
||||
.IsDependentOn("PackageTemplates")
|
||||
.Does(() =>
|
||||
{
|
||||
// Copy the current version nuget templates
|
||||
CopyFile(
|
||||
"BuildOutput/NugetPackages/GtkSharp.Template.CSharp." + Settings.Version + ".nupkg",
|
||||
"Source/Addins/MonoDevelop.GtkSharp.Addin/Templates/GtkSharp.Template.CSharp.nupkg"
|
||||
);
|
||||
CopyFile(
|
||||
"BuildOutput/NugetPackages/GtkSharp.Template.FSharp." + Settings.Version + ".nupkg",
|
||||
"Source/Addins/MonoDevelop.GtkSharp.Addin/Templates/GtkSharp.Template.FSharp.nupkg"
|
||||
);
|
||||
|
||||
// Generate version code info
|
||||
var versionline = "[assembly: Mono.Addins.Addin(\"MonoDevelop.GtkSharp.Addin\", Version = \"" + Settings.Version + "\")]";
|
||||
FileWriteText("Source/Addins/MonoDevelop.GtkSharp.Addin/Properties/AddinInfo.Version.cs", versionline);
|
||||
|
||||
// Build MonoDevelop addin
|
||||
var msbuildsettings = new MSBuildSettings
|
||||
{
|
||||
Configuration = configuration,
|
||||
};
|
||||
msbuildsettings = msbuildsettings.WithProperty("Version", Settings.Version);
|
||||
msbuildsettings = msbuildsettings.WithTarget("PackageAddin");
|
||||
|
||||
MSBuild("Source/Addins/MonoDevelop.GtkSharp.Addin/MonoDevelop.GtkSharp.Addin.sln", msbuildsettings);
|
||||
});
|
||||
|
||||
// TASK TARGETS
|
||||
|
||||
Task("Default")
|
||||
|
@ -172,8 +146,7 @@ Task("Default")
|
|||
|
||||
Task("FullBuild")
|
||||
.IsDependentOn("PackageNuGet")
|
||||
.IsDependentOn("PackageTemplates")
|
||||
.IsDependentOn("PackageAddin");
|
||||
.IsDependentOn("PackageTemplates");
|
||||
|
||||
// EXECUTION
|
||||
|
||||
|
|
184
build.ps1
184
build.ps1
|
@ -5,14 +5,11 @@
|
|||
##########################################################################
|
||||
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
This is a Powershell script to bootstrap a Cake build.
|
||||
|
||||
.DESCRIPTION
|
||||
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
||||
and execute your Cake build script with the parameters you provide.
|
||||
|
||||
.PARAMETER Script
|
||||
The build script to execute.
|
||||
.PARAMETER Target
|
||||
|
@ -21,40 +18,55 @@ The build script target to run.
|
|||
The build configuration to use.
|
||||
.PARAMETER Verbosity
|
||||
Specifies the amount of information to be displayed.
|
||||
.PARAMETER Experimental
|
||||
Tells Cake to use the latest Roslyn release.
|
||||
.PARAMETER WhatIf
|
||||
Performs a dry run of the build script.
|
||||
No tasks will be executed.
|
||||
.PARAMETER Mono
|
||||
Tells Cake to use the Mono scripting engine.
|
||||
.PARAMETER ShowDescription
|
||||
Shows description about tasks.
|
||||
.PARAMETER DryRun
|
||||
Performs a dry run.
|
||||
.PARAMETER SkipToolPackageRestore
|
||||
Skips restoring of packages.
|
||||
.PARAMETER ScriptArgs
|
||||
Remaining arguments are added here.
|
||||
|
||||
.LINK
|
||||
https://cakebuild.net
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$Script = "build.cake",
|
||||
[string]$Target = "Default",
|
||||
[ValidateSet("Release", "Debug")]
|
||||
[string]$Configuration = "Release",
|
||||
[string]$Script,
|
||||
[string]$Target,
|
||||
[string]$Configuration,
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Verbose",
|
||||
[switch]$Experimental,
|
||||
[Alias("DryRun","Noop")]
|
||||
[switch]$WhatIf,
|
||||
[switch]$Mono,
|
||||
[string]$Verbosity,
|
||||
[switch]$ShowDescription,
|
||||
[Alias("WhatIf", "Noop")]
|
||||
[switch]$DryRun,
|
||||
[switch]$SkipToolPackageRestore,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
# This is an automatic variable in PowerShell Core, but not in Windows PowerShell 5.x
|
||||
if (-not (Test-Path variable:global:IsCoreCLR)) {
|
||||
$IsCoreCLR = $false
|
||||
}
|
||||
|
||||
# Attempt to set highest encryption available for SecurityProtocol.
|
||||
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
|
||||
# will typically produce a message for PowerShell v2 (just an info
|
||||
# message though)
|
||||
try {
|
||||
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
|
||||
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
|
||||
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
|
||||
# installed (.NET 4.5 is an in-place upgrade).
|
||||
# PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
|
||||
if (-not $IsCoreCLR) {
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
|
||||
}
|
||||
} catch {
|
||||
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
|
||||
}
|
||||
|
||||
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
|
||||
function MD5HashFile([string] $filePath)
|
||||
{
|
||||
|
@ -80,49 +92,52 @@ function MD5HashFile([string] $filePath)
|
|||
}
|
||||
}
|
||||
|
||||
function GetProxyEnabledWebClient
|
||||
{
|
||||
$wc = New-Object System.Net.WebClient
|
||||
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
|
||||
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
|
||||
$wc.Proxy = $proxy
|
||||
return $wc
|
||||
}
|
||||
|
||||
Write-Host "Preparing to run build script..."
|
||||
|
||||
if(!$PSScriptRoot){
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
}
|
||||
|
||||
if(!$Script){
|
||||
$Script = Join-Path $PSScriptRoot "build.cake"
|
||||
}
|
||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
||||
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
|
||||
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
|
||||
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
|
||||
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
|
||||
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
|
||||
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
|
||||
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
|
||||
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
|
||||
|
||||
# Should we use mono?
|
||||
$UseMono = "";
|
||||
if($Mono.IsPresent) {
|
||||
Write-Verbose -Message "Using the Mono based scripting engine."
|
||||
$UseMono = "-mono"
|
||||
}
|
||||
|
||||
# Should we use the new Roslyn?
|
||||
$UseExperimental = "";
|
||||
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
|
||||
Write-Verbose -Message "Using experimental version of Roslyn."
|
||||
$UseExperimental = "-experimental"
|
||||
}
|
||||
|
||||
# Is this a dry run?
|
||||
$UseDryRun = "";
|
||||
if($WhatIf.IsPresent) {
|
||||
$UseDryRun = "-dryrun"
|
||||
}
|
||||
$env:CAKE_PATHS_TOOLS = $TOOLS_DIR
|
||||
$env:CAKE_PATHS_ADDINS = $ADDINS_DIR
|
||||
$env:CAKE_PATHS_MODULES = $MODULES_DIR
|
||||
|
||||
# Make sure tools folder exists
|
||||
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
|
||||
Write-Verbose -Message "Creating tools directory..."
|
||||
New-Item -Path $TOOLS_DIR -Type directory | out-null
|
||||
New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
|
||||
}
|
||||
|
||||
# Make sure that packages.config exist.
|
||||
if (!(Test-Path $PACKAGES_CONFIG)) {
|
||||
Write-Verbose -Message "Downloading packages.config..."
|
||||
try { (New-Object System.Net.WebClient).DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
|
||||
try {
|
||||
$wc = GetProxyEnabledWebClient
|
||||
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
|
||||
} catch {
|
||||
Throw "Could not download packages.config."
|
||||
}
|
||||
}
|
||||
|
@ -142,14 +157,26 @@ if (!(Test-Path $NUGET_EXE)) {
|
|||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Downloading NuGet.exe..."
|
||||
try {
|
||||
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
|
||||
$wc = GetProxyEnabledWebClient
|
||||
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
|
||||
} catch {
|
||||
Throw "Could not download NuGet.exe."
|
||||
}
|
||||
}
|
||||
|
||||
# These are automatic variables in PowerShell Core, but not in Windows PowerShell 5.x
|
||||
if (-not (Test-Path variable:global:ismacos)) {
|
||||
$IsLinux = $false
|
||||
$IsMacOS = $false
|
||||
}
|
||||
|
||||
# Save nuget.exe path to environment to be available to child processed
|
||||
$ENV:NUGET_EXE = $NUGET_EXE
|
||||
$env:NUGET_EXE = $NUGET_EXE
|
||||
$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
|
||||
"mono `"$NUGET_EXE`""
|
||||
} else {
|
||||
"`"$NUGET_EXE`""
|
||||
}
|
||||
|
||||
# Restore tools from NuGet?
|
||||
if(-Not $SkipToolPackageRestore.IsPresent) {
|
||||
|
@ -157,24 +184,61 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
|
|||
Set-Location $TOOLS_DIR
|
||||
|
||||
# Check for changes in packages.config and remove installed tools if true.
|
||||
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
|
||||
[string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
|
||||
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
|
||||
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
|
||||
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
|
||||
Write-Verbose -Message "Missing or changed package.config hash..."
|
||||
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
|
||||
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
|
||||
Remove-Item -Recurse -Force
|
||||
}
|
||||
|
||||
Write-Verbose -Message "Restoring tools from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
||||
|
||||
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occured while restoring NuGet tools."
|
||||
Throw "An error occurred while restoring NuGet tools."
|
||||
}
|
||||
else
|
||||
{
|
||||
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
|
||||
}
|
||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
||||
Write-Verbose -Message ($NuGetOutput | Out-String)
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Restore addins from NuGet
|
||||
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
|
||||
Push-Location
|
||||
Set-Location $ADDINS_DIR
|
||||
|
||||
Write-Verbose -Message "Restoring addins from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occurred while restoring NuGet addins."
|
||||
}
|
||||
|
||||
Write-Verbose -Message ($NuGetOutput | Out-String)
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Restore modules from NuGet
|
||||
if (Test-Path $MODULES_PACKAGES_CONFIG) {
|
||||
Push-Location
|
||||
Set-Location $MODULES_DIR
|
||||
|
||||
Write-Verbose -Message "Restoring modules from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Throw "An error occurred while restoring NuGet modules."
|
||||
}
|
||||
|
||||
Write-Verbose -Message ($NuGetOutput | Out-String)
|
||||
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
|
@ -183,7 +247,23 @@ if (!(Test-Path $CAKE_EXE)) {
|
|||
Throw "Could not find Cake.exe at $CAKE_EXE"
|
||||
}
|
||||
|
||||
$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
|
||||
"mono `"$CAKE_EXE`""
|
||||
} else {
|
||||
"`"$CAKE_EXE`""
|
||||
}
|
||||
|
||||
# Build an array (not a string) of Cake arguments to be joined later
|
||||
$cakeArguments = @()
|
||||
if ($Script) { $cakeArguments += "`"$Script`"" }
|
||||
if ($Target) { $cakeArguments += "--target=`"$Target`"" }
|
||||
if ($Configuration) { $cakeArguments += "--configuration=$Configuration" }
|
||||
if ($Verbosity) { $cakeArguments += "--verbosity=$Verbosity" }
|
||||
if ($ShowDescription) { $cakeArguments += "--showdescription" }
|
||||
if ($DryRun) { $cakeArguments += "--dryrun" }
|
||||
$cakeArguments += $ScriptArgs
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
|
||||
exit $LASTEXITCODE
|
||||
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
|
||||
exit $LASTEXITCODE
|
||||
|
|
6
build.sh
6
build.sh
|
@ -56,7 +56,7 @@ if [ ! -f "$TOOLS_DIR/packages.config" ]; then
|
|||
echo "Downloading packages.config..."
|
||||
curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while downloading packages.config."
|
||||
echo "An error occurred while downloading packages.config."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -66,7 +66,7 @@ if [ ! -f "$NUGET_EXE" ]; then
|
|||
echo "Downloading NuGet..."
|
||||
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while downloading nuget.exe."
|
||||
echo "An error occurred while downloading nuget.exe."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
@ -97,5 +97,5 @@ fi
|
|||
if $SHOW_VERSION; then
|
||||
exec mono "$CAKE_EXE" -version
|
||||
else
|
||||
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
|
||||
exec mono "$CAKE_EXE" $SCRIPT --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
|
||||
fi
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Cake" version="0.37.0" />
|
||||
<package id="Cake" version="1.1.0" />
|
||||
</packages>
|
||||
|
|
Loading…
Reference in a new issue