From e0643ed5a82ed79fd874568dc726c2e7059afe48 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 21 Jul 2024 23:56:31 +0200 Subject: Revert "Test libnotify" This reverts commit 6121a88c6738a667e1a8466706a7caccacb07256. --- src/main.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f2ded20..a86f254 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,6 @@ extern "C" { #include #include #include -#include #include #include #include @@ -984,18 +983,11 @@ static void save_configs() { } static void show_notification(GtkApplication *app, const char *title, const char *body, GNotificationPriority priority) { - (void)app; fprintf(stderr, "Notification: title: %s, body: %s\n", title, body); - NotifyNotification *notification = notify_notification_new(title, body, "com.dec05eba.gpu_screen_recorder"); - if(notification) { - notify_notification_set_category(notification, "normal"); - notify_notification_set_timeout(notification, 2000); - notify_notification_show(notification, NULL); - } - // GNotification *notification = g_notification_new(title); - // g_notification_set_body(notification, body); - // g_notification_set_priority(notification, priority); - // g_application_send_notification(&app->parent, "gpu-screen-recorder", notification); + GNotification *notification = g_notification_new(title); + g_notification_set_body(notification, body); + g_notification_set_priority(notification, priority); + g_application_send_notification(&app->parent, "gpu-screen-recorder", notification); showing_notification = true; if(priority < G_NOTIFICATION_PRIORITY_URGENT) { @@ -3774,13 +3766,12 @@ static void handle_record_timer() { } static void handle_notification_timer(GtkApplication *app) { - (void)app; if(!showing_notification) return; const double now = clock_get_monotonic_seconds(); if(now - notification_start_seconds >= notification_timeout_seconds) { - //g_application_withdraw_notification(&app->parent, "gpu-screen-recorder"); + g_application_withdraw_notification(&app->parent, "gpu-screen-recorder"); showing_notification = false; } } @@ -4183,11 +4174,9 @@ int main(int argc, char **argv) { } } - notify_init("com.dec05eba.gpu_screen_recorder"); GtkApplication *app = gtk_application_new("com.dec05eba.gpu_screen_recorder", G_APPLICATION_NON_UNIQUE); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); int status = g_application_run(G_APPLICATION(app), argc, argv); g_object_unref(app); - notify_uninit(); return status; } -- cgit v1.2.3