Skip to content

Commit

Permalink
Workaround parallel constructor chains (#22)
Browse files Browse the repository at this point in the history
* Workaround for: dotnet/roslyn#32358
  • Loading branch information
badcel authored Jun 1, 2020
1 parent 4c9dd52 commit f36c452
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
12 changes: 7 additions & 5 deletions Libs/Gtk/Core/Classes/Combobox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ namespace Gtk.Core
{
public class GCombobox : GBin
{
public Property<string> ActiveId { get; private set; } = default!;
private Property<string> activeId;
public Property<string> ActiveId => activeId;

internal GCombobox(string template, string obj, Assembly assembly) : base(template, obj, assembly)
{
InitProperties();
InitProperties(out activeId);
}
internal GCombobox(IntPtr handle) : base(handle)
{
InitProperties();
InitProperties(out activeId);
}

private void InitProperties()
//Workaround for: https://github.com/dotnet/roslyn/issues/32358
private void InitProperties(out Property<string> activeId)
{
ActiveId = PropertyOfString("active-id");
activeId = PropertyOfString("active-id");
}
}
}
25 changes: 15 additions & 10 deletions Libs/Gtk/Core/Classes/Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,37 @@ namespace Gtk.Core
public class GWindow : GContainer
{
#region Properties
public Property<int> DefaultHeight { get; private set;} = default!;
public Property<int> DefaultWidth { get; private set; } = default!;
public Property<GApplication?> Application {get; private set; } = default!;
private Property<int> defaultHeight;
public Property<int> DefaultHeight => defaultHeight;

private Property<int> defaultWith;
public Property<int> DefaultWidth => defaultWith;

private Property<GApplication?> application;
public Property<GApplication?> Application => application;

#endregion Properties

public GWindow() : this(Gtk.Window.@new(Gtk.WindowType.toplevel)) {}
public GWindow(string template, string obj = "root") : base(template, obj, Assembly.GetCallingAssembly())
{
InitProperties();
InitProperties(out defaultHeight, out defaultWith, out application);
}
internal GWindow(string template, string obj, Assembly assembly) : base(template, obj, assembly)
{
InitProperties();
InitProperties(out defaultHeight, out defaultWith, out application);
}
internal GWindow(IntPtr handle) : base(handle)
{
InitProperties();
InitProperties(out defaultHeight, out defaultWith, out application);
}

private void InitProperties()
private void InitProperties(out Property<int> defaultHeight, out Property<int> defaultWidth, out Property<GApplication?> application)
{
DefaultHeight = PropertyOfInt("default-height");
DefaultWidth = PropertyOfInt("default-width");
defaultHeight = PropertyOfInt("default-height");
defaultWidth = PropertyOfInt("default-width");

Application = Property<GApplication?>("application",
application = Property<GApplication?>("application",
get : GetObject<GApplication?>,
set: Set
);
Expand Down

0 comments on commit f36c452

Please sign in to comment.