From bc9b9b95e0ad007a8d677e07f7e4aede2bd61dbd Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Fri, 26 Feb 2021 08:29:48 -0300 Subject: [PATCH] Add template getter --- plugins/windows-notification/api/include/gobject/winrt.h | 7 +++++++ plugins/windows-notification/api/src/gobject/winrt.cpp | 6 ++++++ .../vapi/winrt_windows_ui_notifications.vapi | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/plugins/windows-notification/api/include/gobject/winrt.h b/plugins/windows-notification/api/include/gobject/winrt.h index 28520e97..82d72e67 100644 --- a/plugins/windows-notification/api/include/gobject/winrt.h +++ b/plugins/windows-notification/api/include/gobject/winrt.h @@ -1,12 +1,19 @@ #ifndef __WINRT_GLIB_2_H__ #define __WINRT_GLIB_2_H__ +#if !defined(WINRT_GLIB_H_INSIDE) && !defined(WINRT_GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include "winrt-enums.h" + #ifdef __cplusplus extern "C" { #endif gboolean winrt_InitApartment(); +char* winrt_windows_ui_notifications_toast_notification_manager_GetTemplateContent(winrtWindowsUINotificationsToastTemplateType type); #ifdef __cplusplus } diff --git a/plugins/windows-notification/api/src/gobject/winrt.cpp b/plugins/windows-notification/api/src/gobject/winrt.cpp index 4cfe3b34..7c95bbae 100644 --- a/plugins/windows-notification/api/src/gobject/winrt.cpp +++ b/plugins/windows-notification/api/src/gobject/winrt.cpp @@ -22,4 +22,10 @@ gboolean winrt_InitApartment() } return false; +} + +char* winrt_windows_ui_notifications_toast_notification_manager_GetTemplateContent(winrtWindowsUINotificationsToastTemplateType type) +{ + using namespace winrt::Windows::UI::Notifications; + return wsview_to_char(ToastNotificationManager::GetTemplateContent(static_cast(type)).GetXml()); } \ No newline at end of file diff --git a/plugins/windows-notification/vapi/winrt_windows_ui_notifications.vapi b/plugins/windows-notification/vapi/winrt_windows_ui_notifications.vapi index 7226633e..7902bc3c 100644 --- a/plugins/windows-notification/vapi/winrt_windows_ui_notifications.vapi +++ b/plugins/windows-notification/vapi/winrt_windows_ui_notifications.vapi @@ -56,4 +56,10 @@ namespace winrt.Windows.UI.Notifications { public void Show(ToastNotification notification); public void Hide(ToastNotification notification); } + + [Compact] + [CCode] + public class ToastNotificationManager { + public static string GetTemplateContent(ToastTemplateType type); + } } \ No newline at end of file