Fixed some Windows not appearing when opening file
This commit is contained in:
parent
25673ab145
commit
03f17b8f39
|
@ -61,6 +61,9 @@ public interface Application : GLib.Application {
|
||||||
});
|
});
|
||||||
shutdown.connect(() => {
|
shutdown.connect(() => {
|
||||||
stream_interactor.connection_manager.make_offline_all();
|
stream_interactor.connection_manager.make_offline_all();
|
||||||
|
#if _WIN32
|
||||||
|
Dino.Util.CoUninitialize();
|
||||||
|
#endif
|
||||||
});
|
});
|
||||||
open.connect((files, hint) => {
|
open.connect((files, hint) => {
|
||||||
if (files.length != 1) {
|
if (files.length != 1) {
|
||||||
|
|
|
@ -7,8 +7,15 @@ public class Util {
|
||||||
[CCode (cname = "ShellExecuteA")]
|
[CCode (cname = "ShellExecuteA")]
|
||||||
private static extern int ShellExecuteA(int* hwnd, string operation, string file, string parameters, string directory, int showCmd);
|
private static extern int ShellExecuteA(int* hwnd, string operation, string file, string parameters, string directory, int showCmd);
|
||||||
|
|
||||||
private static int ShellExecute(string file) {
|
[CCode (cname = "CoInitialize")]
|
||||||
return ShellExecuteA(null, null, file, null, null, 0);
|
public static extern int CoInitialize(void* reserved);
|
||||||
|
|
||||||
|
[CCode (cname = "CoUninitialize")]
|
||||||
|
public static extern void CoUninitialize();
|
||||||
|
|
||||||
|
private static int ShellExecute(string operation, string file) {
|
||||||
|
CoInitialize(null);
|
||||||
|
return ShellExecuteA(null, operation, file, null, null, 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -39,7 +46,7 @@ public class Util {
|
||||||
public static void launch_default_for_uri(string file_uri)
|
public static void launch_default_for_uri(string file_uri)
|
||||||
{
|
{
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
Dino.Util.ShellExecute(file_uri);
|
Dino.Util.ShellExecute("open", file_uri);
|
||||||
#else
|
#else
|
||||||
AppInfo.launch_default_for_uri(file_uri, null);
|
AppInfo.launch_default_for_uri(file_uri, null);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue