clarify some entry points' names
This commit is contained in:
parent
b21066c89e
commit
2ad659f777
|
@ -10,7 +10,7 @@
|
||||||
#define NOEXCEPT
|
#define NOEXCEPT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN gboolean TryCreateShortcut(const gchar* aumid) NOEXCEPT;
|
EXTERN gboolean EnsureAumiddedShortcutExists(const gchar* aumid) NOEXCEPT;
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#undef NOEXCEPT
|
#undef NOEXCEPT
|
||||||
|
|
|
@ -19,8 +19,8 @@ std::optional<std::wstring> GetShortcutPath();
|
||||||
#define NOEXCEPT
|
#define NOEXCEPT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN gboolean SupportsModernNotifications() NOEXCEPT;
|
EXTERN gboolean IsWindows10() NOEXCEPT;
|
||||||
EXTERN gboolean SetAppModelID(const gchar* aumid) NOEXCEPT;
|
EXTERN gboolean SetProcessAumid(const gchar* aumid) NOEXCEPT;
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#undef NOEXCEPT
|
#undef NOEXCEPT
|
||||||
|
|
|
@ -125,7 +125,7 @@ int32_t ValidateShortcut(const std::wstring& shortcut_path, const std::wstring&
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TryCreateShortcutInternal(const char *const aumid)
|
bool ImplEnsureAumiddedShortcutExists(const char *const aumid)
|
||||||
{
|
{
|
||||||
auto waumid = sview_to_wstr(aumid);
|
auto waumid = sview_to_wstr(aumid);
|
||||||
if (waumid.empty())
|
if (waumid.empty())
|
||||||
|
@ -153,8 +153,8 @@ bool TryCreateShortcutInternal(const char *const aumid)
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
gboolean TryCreateShortcut(const gchar* aumid) noexcept
|
gboolean EnsureAumiddedShortcutExists(const gchar* aumid) noexcept
|
||||||
{
|
{
|
||||||
return g_try_invoke(TryCreateShortcutInternal, aumid);
|
return g_try_invoke(ImplEnsureAumiddedShortcutExists, aumid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ std::optional<std::wstring> GetShortcutPath()
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetAppModelIDInternal(const char *const aumid)
|
bool ImplSetProcessAumid(const char *const aumid)
|
||||||
{
|
{
|
||||||
auto waumid = sview_to_wstr(aumid);
|
auto waumid = sview_to_wstr(aumid);
|
||||||
if (waumid.empty())
|
if (waumid.empty())
|
||||||
|
@ -44,7 +44,7 @@ extern "C"
|
||||||
// Not available in mingw headers, but linking works.
|
// Not available in mingw headers, but linking works.
|
||||||
NTSTATUS NTAPI RtlGetVersion(PRTL_OSVERSIONINFOW);
|
NTSTATUS NTAPI RtlGetVersion(PRTL_OSVERSIONINFOW);
|
||||||
|
|
||||||
gboolean SupportsModernNotifications() noexcept
|
gboolean IsWindows10() noexcept
|
||||||
{
|
{
|
||||||
RTL_OSVERSIONINFOW rovi = { 0 };
|
RTL_OSVERSIONINFOW rovi = { 0 };
|
||||||
rovi.dwOSVersionInfoSize = sizeof(rovi);
|
rovi.dwOSVersionInfoSize = sizeof(rovi);
|
||||||
|
@ -55,9 +55,8 @@ extern "C"
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean SetAppModelID(const gchar* aumid) noexcept
|
gboolean SetProcessAumid(const gchar* aumid) noexcept
|
||||||
{
|
{
|
||||||
return g_try_invoke(SetAppModelIDInternal, aumid);
|
return g_try_invoke(ImplSetProcessAumid, aumid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ToastNotificationBuilder {
|
public class ToastNotificationBuilder {
|
||||||
private static bool _supportsModernFeatures = SupportsModernNotifications();
|
private static bool _supportsModernFeatures = IsWindows10();
|
||||||
private Gee.List<Button> _buttons = new Gee.ArrayList<Button>();
|
private Gee.List<Button> _buttons = new Gee.ArrayList<Button>();
|
||||||
private string _header = null;
|
private string _header = null;
|
||||||
private string _body = null;
|
private string _body = null;
|
||||||
|
|
|
@ -15,12 +15,12 @@ namespace Dino.Plugins.WindowsNotification {
|
||||||
// log error, return
|
// log error, return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Win32Api.SetAppModelID(AUMID))
|
if (!Win32Api.SetProcessAumid(AUMID))
|
||||||
{
|
{
|
||||||
// log error, return
|
// log error, return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ShortcutCreator.TryCreateShortcut(AUMID))
|
if (!ShortcutCreator.EnsureAumiddedShortcutExists(AUMID))
|
||||||
{
|
{
|
||||||
// log error, return
|
// log error, return
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[CCode (cheader_filename = "shortcutcreator.h")]
|
[CCode (cheader_filename = "shortcutcreator.h")]
|
||||||
namespace Dino.Plugins.WindowsNotification.Vapi.ShortcutCreator {
|
namespace Dino.Plugins.WindowsNotification.Vapi.ShortcutCreator {
|
||||||
[CCode (cname = "TryCreateShortcut")]
|
[CCode (cname = "EnsureAumiddedShortcutExists")]
|
||||||
public bool TryCreateShortcut(string aumid);
|
public bool EnsureAumiddedShortcutExists(string aumid);
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
[CCode (cheader_filename = "win32.h")]
|
[CCode (cheader_filename = "win32.h")]
|
||||||
namespace Dino.Plugins.WindowsNotification.Vapi.Win32Api {
|
namespace Dino.Plugins.WindowsNotification.Vapi.Win32Api {
|
||||||
[CCode (cname = "SupportsModernNotifications")]
|
[CCode (cname = "IsWindows10")]
|
||||||
public bool SupportsModernNotifications();
|
public bool IsWindows10();
|
||||||
|
|
||||||
[CCode (cname = "SetAppModelID")]
|
[CCode (cname = "SetProcessAumid")]
|
||||||
public bool SetAppModelID(string aumid);
|
public bool SetProcessAumid(string aumid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue