+
Skip to content

Conversation

fsobolev
Copy link
Contributor

@fsobolev fsobolev commented Jul 20, 2023

  • I agree that my contribution may be licensed either under MIT or any version of LGPL license.

Added:

  • Gtk.FileDialog.OpenAsync
  • Gtk.FileDialog.SaveAsync
  • Gtk.FileDialog.SelectFolderAsync
  • Gtk.FileLauncher.LaunchAsync
  • Gtk.FileLauncher.OpenContainingFolderAsync
  • Gtk.UriLauncher.LaunchAsync

I don't think that throwing an exception on error like it's done in WebView is desired behavior, error is set even if a dialog was simply cancelled by the user, which is definitely not a critical error and I think just checking for null/false makes more sense:

Related: #900

@fsobolev
Copy link
Contributor Author

/home/runner/work/gir.core/gir.core/src/Libs/Gtk-4.0/Public/FileDialog.cs(1,1): error CHARSET: Fix file encoding. [/home/runner/work/gir.core/gir.core/src/Libs/Gtk-4.0/Gtk-4.0.csproj]
/home/runner/work/gir.core/gir.core/src/Libs/Gtk-4.0/Public/FileLauncher.cs(1,1): error CHARSET: Fix file encoding. [/home/runner/work/gir.core/gir.core/src/Libs/Gtk-4.0/Gtk-4.0.csproj]
/home/runner/work/gir.core/gir.core/src/Libs/Gtk-4.0/Public/UriLauncher.cs(1,1): error CHARSET: Fix file encoding. [/home/runner/work/gir.core/gir.core/src/Libs/Gtk-4.0/Gtk-4.0.csproj]

Ugh... What does that mean? 😓 Files are just ASCII text.

@badcel
Copy link
Member

badcel commented Jul 22, 2023

You should be able to run dotnet format GirCore.Libs.slnf in folder src which should fix those things. If it does not work you can try to specify the csproj from GTK directly to only Format the GTK project.

@badcel
Copy link
Member

badcel commented Jul 22, 2023

One more thing is necessary. If the ...Finish method can return null (see documentation) then it is necessary to check the return value for IntPtr.Zero after the GLib.Error.ThrowOnError:

Rough sample:

if(result == IntPtr.Zero)
{
tcs.SetResult(null);
}
else
{
//here original code to get and set the result in the task completion source.
}

@fsobolev
Copy link
Contributor Author

Added Gtk.FileLauncher.OpenContainingFolderAsync

@badcel badcel merged commit 6c95f0b into gircore:main Jul 23, 2023
@badcel
Copy link
Member

badcel commented Jul 23, 2023

Looks good to me. Thanks for your contribution 🚀

@fsobolev fsobolev deleted the async branch July 23, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载