anotherim-desktop/plugins/windows-notification/src/plugin.vala

67 lines
1.7 KiB
Vala
Raw Normal View History

2020-10-24 22:05:35 +00:00
using Gee;
using Dino.Entities;
2021-02-18 09:24:53 +00:00
using Dino.Plugins.WindowsNotification.Vapi;
2020-10-24 22:05:35 +00:00
namespace Dino.Plugins.WindowsNotification {
public class Plugin : RootInterface, Object {
2021-02-18 09:24:53 +00:00
private static string AUMID = "org.dino.Dino";
public int m { get; set; }
2020-10-24 22:05:35 +00:00
public void registered(Dino.Application app) {
2021-02-18 09:24:53 +00:00
if (!WinRTApi.Initialize())
2021-03-26 11:22:55 +00:00
{
2021-02-18 09:24:53 +00:00
// log error, return
2020-10-24 22:30:57 +00:00
}
2021-03-26 11:22:55 +00:00
2021-02-18 09:24:53 +00:00
if (!Win32Api.SetAppModelID(AUMID))
{
// log error, return
}
2021-03-26 11:22:55 +00:00
2021-02-18 09:24:53 +00:00
if (!ShortcutCreator.TryCreateShortcut(AUMID))
2021-03-26 11:22:55 +00:00
{
2021-02-18 09:24:53 +00:00
// log error, return
2021-03-26 11:22:55 +00:00
}
2021-02-18 09:24:53 +00:00
var notification = new ToastNotification.ToastNotification();
int test = 2;
notification.Activated = new Callbacks.SimpleNotificationCallback()
{
callback = () => {
test = 3;
}
};
notification.ActivatedWithIndex = new Callbacks.ActivatedWithActionIndexNotificationCallback()
{
callback = (index) => {
test = index;
}
};
notification.Dismissed = new Callbacks.DismissedNotificationCallback()
{
callback = (reason) => {
var m = reason;
}
};
notification.Failed = new Callbacks.SimpleNotificationCallback()
{
callback = () => {
var m = 2;
}
};
// var provider = new WindowsNotificationProvider(app, Win32Api.SupportsModernNotifications());
// app.stream_interactor.get_module(NotificationEvents.IDENTITY).register_notification_provider(provider);
2020-10-24 22:05:35 +00:00
}
public void shutdown() {
2020-10-25 11:07:31 +00:00
}
2020-10-24 22:05:35 +00:00
}
}