Mercurial > dwindows
comparison gtk/dw.c @ 2115:79e5842fb609
GTK: Fixes for building with GTK after the notification image changes.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 23 Jun 2020 08:13:24 +0000 |
parents | 251d050d306b |
children | 37060de79102 |
comparison
equal
deleted
inserted
replaced
2114:251d050d306b | 2115:79e5842fb609 |
---|---|
12365 * or NULL if it fails or notifications are not supported by the system. | 12365 * or NULL if it fails or notifications are not supported by the system. |
12366 * Remarks: | 12366 * Remarks: |
12367 * This will create a system notification that will show in the notifaction panel | 12367 * This will create a system notification that will show in the notifaction panel |
12368 * on supported systems, which may be clicked to perform another task. | 12368 * on supported systems, which may be clicked to perform another task. |
12369 */ | 12369 */ |
12370 HWND dw_notification_new(const char *title, HPIXMAP pixmap, const char *description, ...) | 12370 HWND dw_notification_new(const char *title, const char *imagepath, const char *description, ...) |
12371 { | 12371 { |
12372 #if GLIB_CHECK_VERSION(2,40,0) | 12372 #if GLIB_CHECK_VERSION(2,40,0) |
12373 GNotification *notification = g_notification_new(title); | 12373 GNotification *notification = g_notification_new(title); |
12374 | 12374 |
12375 if(notification) | 12375 if(notification) |
12383 vsnprintf(outbuf, 1024, description, args); | 12383 vsnprintf(outbuf, 1024, description, args); |
12384 va_end(args); | 12384 va_end(args); |
12385 | 12385 |
12386 g_notification_set_body(notification, outbuf); | 12386 g_notification_set_body(notification, outbuf); |
12387 } | 12387 } |
12388 if(imagepath) | 12388 /* check if we can read from this file (it exists and read permission) */ |
12389 if(imagepath && access(imagepath, 04 ) != 0) | |
12389 { | 12390 { |
12390 GFile *file = g_file_new_for_path(imagepath); | 12391 GFile *file = g_file_new_for_path(imagepath); |
12391 | 12392 |
12392 if(file) | 12393 if(file) |
12393 { | 12394 { |
12394 GFileIcon *icon = g_file_icon_new(file); | 12395 GIcon *icon = g_file_icon_new(file); |
12395 | 12396 |
12396 if(icon) | 12397 if(icon) |
12397 g_notification_set_icon(notification, G_ICON(icon)); | 12398 g_notification_set_icon(notification, G_ICON(icon)); |
12398 } | 12399 } |
12399 } | 12400 } |