Browse Source

[GTK3] Workaround for SafeHandle not allowed to be null

pull/1047/head
Nikita Tsukanov 9 years ago
parent
commit
6ea0635c7f
  1. 2
      src/Gtk/Avalonia.Gtk3/Interop/GObject.cs
  2. 4
      src/Gtk/Avalonia.Gtk3/SystemDialogs.cs

2
src/Gtk/Avalonia.Gtk3/Interop/GObject.cs

@ -41,7 +41,7 @@ namespace Avalonia.Gtk3.Interop
class GtkWindow : GtkWidget
{
public static GtkWindow Null { get; } = new GtkWindow();
}
class GtkImContext : GObject

4
src/Gtk/Avalonia.Gtk3/SystemDialogs.cs

@ -78,14 +78,14 @@ namespace Avalonia.Gtk3
public Task<string[]> ShowFileDialogAsync(FileDialog dialog, IWindowImpl parent)
{
return ShowDialog(dialog.Title, ((WindowBaseImpl) parent)?.GtkWidget,
return ShowDialog(dialog.Title, ((WindowBaseImpl) parent)?.GtkWidget ?? GtkWindow.Null,
dialog is OpenFileDialog ? GtkFileChooserAction.Open : GtkFileChooserAction.Save,
(dialog as OpenFileDialog)?.AllowMultiple ?? false, dialog.InitialFileName);
}
public async Task<string> ShowFolderDialogAsync(OpenFolderDialog dialog, IWindowImpl parent)
{
var res = await ShowDialog(dialog.Title, ((WindowBaseImpl) parent)?.GtkWidget,
var res = await ShowDialog(dialog.Title, ((WindowBaseImpl) parent)?.GtkWidget ?? GtkWindow.Null,
GtkFileChooserAction.SelectFolder, false, dialog.InitialDirectory);
return res?.FirstOrDefault();
}

Loading…
Cancel
Save